From e75a28e486d39708d5836752b9a0d587afae922a Mon Sep 17 00:00:00 2001 From: Min Xu Date: Mon, 28 Sep 2020 15:40:58 -0700 Subject: [PATCH 1/8] remove downloading Ubuntu Base using debootstrap to fetch Ubuntu focal --- rootfs.sh | 15 ++------------- settings.inc.sh | 4 ---- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/rootfs.sh b/rootfs.sh index 8645e97..442211a 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -49,17 +49,6 @@ unset LC_ALL unset LC_TIME export LC_ALL=C -if ! [ -e ${ubuntu_tarball} ]; then - echo Downloading Ubuntu Base tarball - wget ${UBUNTU_URL} -O ${ubuntu_tarball} -fi - -echo Checking md5sums -if ! md5sum -c md5sum.txt; then - echo md5sum fail - exit 1 -fi - echo Removing old rootfs image rm -rf ${root_image} ${root_image}.gz @@ -78,8 +67,8 @@ echo Mounting root filesystem mkdir -p ${root_mnt} mount ${root_dev} ${root_mnt} -echo Unpacking Ubuntu tarball -tar xfzp ${ubuntu_tarball} -C ${root_mnt} --strip-components 0 +echo fetching Ubuntu focal +sudo debootstrap --arch=armhf focal ${root_mnt} echo Applying overlays #TODO: Use tarballs (for owner/group)? diff --git a/settings.inc.sh b/settings.inc.sh index a08cb44..5fe8692 100644 --- a/settings.inc.sh +++ b/settings.inc.sh @@ -5,14 +5,10 @@ set -u mkdir -p ${top}/out -UBUNTU_URL="http://cdimage.ubuntu.com/ubuntu-base/releases/bionic/release/ubuntu-base-18.04.2-base-armhf.tar.gz" -UBUNTU_TARBALL_NAME=ubuntu_base.tgz - root_mnt=${top}/mnt/rootfs boot_mnt=${top}/mnt/boot root_image=${top}/out/root.image boot_image=${top}/out/boot.image -ubuntu_tarball=${top}/${UBUNTU_TARBALL_NAME} image_file=${top}/out/image # Offsets and sizes hardcoded. See sfdisk-script.txt image_size=7200 From 29768e13f6ea433b74734516c60a0eccf2e62888 Mon Sep 17 00:00:00 2001 From: Min Xu Date: Mon, 28 Sep 2020 15:41:58 -0700 Subject: [PATCH 2/8] fix /bin /lib symlinks for Ubuntu 20.04 --- rootfs.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rootfs.sh b/rootfs.sh index 442211a..38e4c08 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -157,6 +157,22 @@ cp -r tests ${root_mnt}/home/parallella/ echo Copying debian packages cp -rv ${top}/deb-pkgs ${root_mnt}/tmp/ +# Ubuntu 20.04 uses symlinks to /usr for /bin, /sbin and /lib +# after applying overlays, it change bin lib to a regular folder +fixSymbLink () { + if [[ -e "${root_mnt}/$1" && ! -L "${root_mnt}/$1" ]] + then + echo Fixing symbolic link $1 + pushd ${root_mnt} + rsync -ap --no-owner --no-group $1/ usr/$1 + rm -rf $1 + ln -sf usr/$1 + popd + fi +} +fixSymbLink bin +fixSymbLink lib + echo Starting ARM chroot chroot ${root_mnt} ./tmp/rootfs-arm.sh #chroot ${root_mnt} From b1ae3279d393edf63732374c7dabf76a86f73cfb Mon Sep 17 00:00:00 2001 From: Min Xu Date: Mon, 28 Sep 2020 15:44:02 -0700 Subject: [PATCH 3/8] add 'universe' to sources.list update packages --- rootfs-arm.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rootfs-arm.sh b/rootfs-arm.sh index 8f5d3cd..19c4343 100755 --- a/rootfs-arm.sh +++ b/rootfs-arm.sh @@ -17,6 +17,13 @@ cd $top export LC_ALL=C export DEBIAN_FRONTEND=noninteractive +echo add 'universe' to sources.list +#add-apt-repository "deb http://deb.torproject.org/torproject.org $(lsb_release -s -c) universe" +echo "deb http://ports.ubuntu.com/ubuntu-ports $(lsb_release -s -c) universe" >> /etc/apt/sources.list + +echo Updating packages +apt-get update -yy || true + echo Installing local deb packages apt-get install -yy multiarch-support dpkg -i /tmp/deb-pkgs/*.deb @@ -25,8 +32,6 @@ echo fixing libelf symlink for coprthr #HACK HACK HACK (cd /usr/lib/arm-linux-gnueabihf/ && ln -sf libelf.so.0.8.13 libelf.so) -echo Updating packages -apt-get update -yy || true echo Fixing zoneinfo # Set Zonedata so the interactive prompt won't pop up while installing packages From 35185643805f1cc748402cf41a1c4b44ed8861b5 Mon Sep 17 00:00:00 2001 From: Min Xu Date: Mon, 28 Sep 2020 15:46:43 -0700 Subject: [PATCH 4/8] multiarch-support is not available for Ubuntu 20.04. Download and install it from debian.org --- rootfs-arm.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rootfs-arm.sh b/rootfs-arm.sh index 19c4343..c9b4704 100755 --- a/rootfs-arm.sh +++ b/rootfs-arm.sh @@ -25,7 +25,10 @@ echo Updating packages apt-get update -yy || true echo Installing local deb packages -apt-get install -yy multiarch-support +apt-get install -yy wget +wget -P /tmp/ http://ftp.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.28-10_armhf.deb +#apt-get install -yy multiarch-support +dpkg -i /tmp/multiarch-support*.deb dpkg -i /tmp/deb-pkgs/*.deb echo fixing libelf symlink for coprthr From e1f0da31220ffe6e2e757787ad179c6569ae86a6 Mon Sep 17 00:00:00 2001 From: Min Xu Date: Mon, 28 Sep 2020 15:47:34 -0700 Subject: [PATCH 5/8] fix the libelf.so link --- rootfs-arm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootfs-arm.sh b/rootfs-arm.sh index c9b4704..76ff612 100755 --- a/rootfs-arm.sh +++ b/rootfs-arm.sh @@ -33,7 +33,7 @@ dpkg -i /tmp/deb-pkgs/*.deb echo fixing libelf symlink for coprthr #HACK HACK HACK -(cd /usr/lib/arm-linux-gnueabihf/ && ln -sf libelf.so.0.8.13 libelf.so) +(cd /usr/lib/arm-linux-gnueabihf/ && ln -sf libelf.so.1 libelf.so) echo Fixing zoneinfo From fb767488f915236aa12c540ce25643cd402984c4 Mon Sep 17 00:00:00 2001 From: Min Xu Date: Mon, 28 Sep 2020 15:49:14 -0700 Subject: [PATCH 6/8] upgrade packages available on Ubuntu 20.04 --- packages.basic.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages.basic.txt b/packages.basic.txt index c875af9..e137da4 100644 --- a/packages.basic.txt +++ b/packages.basic.txt @@ -78,7 +78,8 @@ opencl-headers libelf1 #libelf-dev -- conflict 'libconfig++9v5' 'libconfig++-dev' libconfig-dev libconfig9 -libevent-2.1.6 libevent-dev +#libevent-2.1.* will be installed by libevent-dev depends. +libevent-dev # Needed for parallella-utils xtemp libx11-6 @@ -87,6 +88,6 @@ i2c-tools # OpenMPI libopenmpi-dev -libopenmpi2 +libopenmpi3 openmpi-bin openmpi-common From eae029921b51b5e432c5f4cb768d3fef5acfa032 Mon Sep 17 00:00:00 2001 From: Min Xu Date: Mon, 28 Sep 2020 16:27:20 -0700 Subject: [PATCH 7/8] update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ca387ea..dcac55e 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,14 @@ ## Requirements -The scripts require qemu-arm-static and binfmt being set up properly. +- The scripts require qemu-arm-static and binfmt being set up properly. +- Only works on Ubuntu 20.04(tested) and Ubuntu based Linux distribution ```sh sudo apt-get update sudo apt-get install qemu binfmt-support qemu binfmt-support qemu-user-static sudo apt-get install flex bison zerofree u-boot-tools +sudo apt install debootstrap ``` ## Flow From f8087a69923f4bd2b2ce20b06b355e50259b6ca4 Mon Sep 17 00:00:00 2001 From: Min Xu Date: Mon, 28 Sep 2020 16:34:09 -0700 Subject: [PATCH 8/8] remove unnecessary unminimize cmd --- rootfs-arm.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/rootfs-arm.sh b/rootfs-arm.sh index 76ff612..e7b5027 100755 --- a/rootfs-arm.sh +++ b/rootfs-arm.sh @@ -48,8 +48,6 @@ touch /etc/dhcp/dhclient.conf apt-get install -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" --force-yes -yy \ isc-dhcp-client isc-dhcp-common -echo Unminimize Ubuntu install -yes | unminimize || true # Will fail in restart hook echo Upgrading packages apt-get dist-upgrade -yy