From 2ca24639d5603cf3ec14a49eb5e48ace55ab3827 Mon Sep 17 00:00:00 2001 From: anuejn Date: Sat, 2 Nov 2019 10:14:23 +0100 Subject: [PATCH] [Buildsystem] build rootfs in loopback to work around qemu bug (#121) [Buildsystem] build rootfs in loopback to work around qemu bug --- .cirrus.yml | 1 + makefiles/docker-make.sh | 7 ++++--- makefiles/host/docker_entry.sh | 24 ++++++++++++++++++++++++ makefiles/in_chroot/install.sh | 15 +++++++++------ 4 files changed, 38 insertions(+), 9 deletions(-) create mode 100755 makefiles/host/docker_entry.sh diff --git a/.cirrus.yml b/.cirrus.yml index ee60efb3..89ac4400 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -3,6 +3,7 @@ docker_builder: env: TOKEN: ENCRYPTED[4e4d80e944992ff037ce22e89b29a5151ef75bf44b133db67fb3cfb5ff1f3aaf7722bf86028957fc99a07edecfbe0962] UPLOAD_KEY: ENCRYPTED[218507b6609fd0eb0cd00663c48a10082930967672efe5655b56118e4f515561f0bbc893dbb6a5a943d55f384ec1285c] + SSH_PRIVATE_KEY: ENCRYPTED[f2f0f5401824d85c731ff5e6663a2388663a776deef6ccbbaee0bb0f968718131a87bbbfebb8960b3ad686cfa8b3debe] matrix: DEVICE: beta DEVICE: micro diff --git a/makefiles/docker-make.sh b/makefiles/docker-make.sh index 8ea3551f..22d9511d 100755 --- a/makefiles/docker-make.sh +++ b/makefiles/docker-make.sh @@ -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 diff --git a/makefiles/host/docker_entry.sh b/makefiles/host/docker_entry.sh new file mode 100755 index 00000000..7d618714 --- /dev/null +++ b/makefiles/host/docker_entry.sh @@ -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 \ No newline at end of file diff --git a/makefiles/in_chroot/install.sh b/makefiles/in_chroot/install.sh index ec0bf969..1f9c257f 100755 --- a/makefiles/in_chroot/install.sh +++ b/makefiles/in_chroot/install.sh @@ -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 @@ -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 )