From a274206e1af72097dcbb318125cf9b757edd5555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 Oct 2018 11:17:01 +0100 Subject: [PATCH 1/2] Don't overcomplicate bash conditionals. --- live-build/auto/build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 2e9a4259..ba06b072 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -849,13 +849,13 @@ done NUMFLAVOURS="$(set -- $LB_LINUX_FLAVOURS; echo $#)" if [ "$NUMFLAVOURS" = 1 ] && [ "$LB_LINUX_FLAVOURS" != "none" ]; then # only one kernel flavour - if [ -e "binary/$INITFS/vmlinuz" -a ! -h "binary/$INITFS/vmlinuz" ]; then + if [ -f "binary/$INITFS/vmlinuz" ]; then ln "binary/$INITFS/vmlinuz" "$PREFIX.kernel" chmod 644 "$PREFIX.kernel" else ln -sf "$PREFIX.kernel-$LB_LINUX_FLAVOURS" "$PREFIX.kernel" fi - if [ -e "binary/$INITFS/initrd.lz" -a ! -h "binary/$INITFS/initrd.lz" ]; then + if [ -f "binary/$INITFS/initrd.lz" ]; then ln "binary/$INITFS/initrd.lz" "$PREFIX.initrd" chmod 644 "$PREFIX.initrd" else From 2e3c7d050cfb881a48ac061bcf7dbf75cbae1d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Wed, 31 Oct 2018 12:46:57 +0100 Subject: [PATCH 2/2] Remove unneeded code and code duplication, add comments. --- live-build/auto/build | 12 ++++++++---- live-build/auto/config | 8 +------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 682f7901..b39e91ac 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -573,7 +573,7 @@ case $PROJECT:${SUBPROJECT:-} in if [ "$PROJECT:$SUBPROJECT" = "ubuntu-core:system-image" ]; then case $ARCH in armhf) - subarches="generic raspi2 raspi3" + subarches="generic raspi2" ;; arm64) subarches="generic dragonboard" @@ -609,9 +609,7 @@ case $PROJECT:${SUBPROJECT:-} in fi ;; armhf) - if [ "$devarch" = "raspi2" ]; then - linux_package="linux-image-raspi2" - elif [ "$devarch" = "raspi3" ]; then + if [ "$devarch" = "raspi2" ] || [ "$devarch" = "raspi3" ]; then linux_package="linux-image-raspi2" fi ;; @@ -903,6 +901,12 @@ case $SUBARCH in ;; raspi2|raspi3) + # copy the kernel and initrd to a predictable directory for + # ubuntu-image consumption. In some cases, like in pi2/3 + # u-boot, the bootloader needs to contain the kernel and initrd, + # so during rootfs build we copy it over to a directory that + # ubuntu-image looks for and shoves into the bootloader + # partition. UBOOT_BOOT="image/boot/uboot" mkdir -p $UBOOT_BOOT diff --git a/live-build/auto/config b/live-build/auto/config index a4f8a6a7..703df61a 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -801,17 +801,11 @@ case $ARCH in add_package live ac100-tarball-installer BINARY_REMOVE_LINUX=false ;; - raspi2) + raspi2|raspi3) COMPONENTS='main restricted universe multiverse' add_package install linux-firmware-raspi2 u-boot-rpi flash-kernel u-boot-tools BINARY_REMOVE_LINUX=false ;; - raspi3) - COMPONENTS='main restricted universe multiverse' - KERNEL_FLAVOURS=raspi2 - add_package install linux-firmware-raspi2 u-boot-rpi flash-kernel u-boot-tools - BINARY_REMOVE_LINUX=false - ;; esac ;; esac