Skip to content

Commit

Permalink
[Buildsystem] build rootfs in loopback to work around qemu bug (#121)
Browse files Browse the repository at this point in the history
[Buildsystem] build rootfs in loopback to work around qemu bug
  • Loading branch information
anuejn authored Nov 2, 2019
1 parent c214041 commit 2ca2463
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
1 change: 1 addition & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ docker_builder:
env:
TOKEN: ENCRYPTED[4e4d80e944992ff037ce22e89b29a5151ef75bf44b133db67fb3cfb5ff1f3aaf7722bf86028957fc99a07edecfbe0962]
UPLOAD_KEY: ENCRYPTED[218507b6609fd0eb0cd00663c48a10082930967672efe5655b56118e4f515561f0bbc893dbb6a5a943d55f384ec1285c]
SSH_PRIVATE_KEY: ENCRYPTED[f2f0f5401824d85c731ff5e6663a2388663a776deef6ccbbaee0bb0f968718131a87bbbfebb8960b3ad686cfa8b3debe]
matrix:
DEVICE: beta
DEVICE: micro
Expand Down
7 changes: 4 additions & 3 deletions makefiles/docker-make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ docker run --privileged \
-v $(pwd):/root/axiom-firmware/ \
-w /root/axiom-firmware/ \
-l axiom-build \
$([ -z "$CI" ] && echo "-it" ) \
vupvupvup/axiom_build:latest \
/bin/bash -c "stty cols $COLUMNS rows $LINES; make -f makefiles/host/main.mk -I makefiles/host -j $(nproc) $*" \
--env COLUMNS=$COLUMNS --env LINES=$LINES --env CI \
$([ -z "$CI" ] && echo "-i" ) \
apertushq/axiom_build:latest \
./makefiles/host/docker_entry.sh $* \
| tee -a build/build.log
24 changes: 24 additions & 0 deletions makefiles/host/docker_entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# this script is called from the docker-make.sh script and sets up everything in the
# docker container & executes make

stty cols $COLUMNS rows $LINES;

# this is a stupid hack to work around this bug: https://bugs.launchpad.net/qemu/+bug/1805913
mkdir -p build/root.fs
if [ ! -z $CI ]; then
mount -t tmpfs tmpfs build/root.fs
echo "WARNING: building rootfs in ramdisk; incremental builds suffer"
else
if [ ! -f build/root.fs.loopback.img ]; then
truncate -s 4G build/root.fs.loopback.img
mkfs.btrfs build/root.fs.loopback.img
fi
losetup -d /dev/loop0
losetup /dev/loop0 build/root.fs.loopback.img
mount /dev/loop0 build/root.fs
fi

make -f makefiles/host/main.mk -I makefiles/host -j $(nproc) $*
umount build/root.fs
losetup -d /dev/loop0
15 changes: 9 additions & 6 deletions makefiles/in_chroot/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ pacman --noconfirm --needed -Syu
pacman --noconfirm -R linux-zedboard || true

# install dependencies
# pacman -R pkgconf --noconfirm || true
pacman --noconfirm --needed -S $(grep -vE "^\s*#" makefiles/in_chroot/requirements_pacman.txt | tr "\n" " ")

# evil hack because archlinux-arm has fucked up packages
cat /etc/ca-certificates/extracted/cadir/* > /etc/ca-certificates/extracted/tls-ca-bundle.pem

pip install -r makefiles/in_chroot/requirements_pip.txt

# setup users
Expand Down Expand Up @@ -70,7 +65,15 @@ echo 'PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/axiom/bin:/usr/axiom/script' >> /e
(cd software/axiom-control-daemon/
[ -d build ] || mkdir -p build
cd build
cmake -G Ninja ..
cmake --version
gcc --version
cc --version
c++ --version
command -v g++
command -v c++
find ..
echo $PATH
cmake -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..
ninja
./install_daemon.sh
)
Expand Down

0 comments on commit 2ca2463

Please sign in to comment.