From 2075062139b95f781d8d20a3a33af5d9aa0ce238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Fri, 17 Mar 2023 12:34:42 +0100 Subject: [PATCH] Enable building intel-iot live-server images. --- debian/changelog | 6 ++++++ live-build/auto/config | 21 +++++++++++++------ live-build/lb_binary_layered | 19 ++++++++++------- .../hooks/03-kernel-metapkg.chroot_early | 2 ++ .../ubuntu-server/hooks/04-kernel-bits.binary | 2 ++ 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0c98d282..72e67ad0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.765.20) UNRELEASED; urgency=medium + + * Enable building intel-iot live-server images (LP: #1980067). + + -- Ɓukasz 'sil2100' Zemczak Fri, 17 Mar 2023 12:31:55 +0100 + livecd-rootfs (2.765.19) jammy; urgency=medium * auto/config: Add support for ubuntu core arm64 generic images (LP: #2009067) diff --git a/live-build/auto/config b/live-build/auto/config index dde8e587..c076521a 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -855,12 +855,18 @@ case $PROJECT in # written generically to support both even though a lot of the # time only one kernel is offered. - if [ $ARCH = riscv64 ]; then - # However, for RISC-V we only offer one kernel - variants='ga' - else - variants='ga hwe' - fi + case "$ARCH+${SUBARCH:-}" in + amd64+intel-iot) + variants='intel' + ;; + riscv64*) + # However, for RISC-V we only offer one kernel + variants='ga' + ;; + *) + variants='ga hwe' + ;; + esac for variant in $variants; do if [ "$variant" = "ga" ]; then @@ -869,6 +875,9 @@ case $PROJECT in elif [ "$variant" = "hwe" ]; then kernel_metapkg=linux-generic-hwe-$(lsb_release -sr) flavor=generic-hwe + elif [ "$variant" = "intel" ]; then + kernel_metapkg=linux-intel-iotg + flavor=intel-iotg else echo "bogus variant: $variant" exit 1 diff --git a/live-build/lb_binary_layered b/live-build/lb_binary_layered index 424f7001..f31d5e22 100755 --- a/live-build/lb_binary_layered +++ b/live-build/lb_binary_layered @@ -56,9 +56,12 @@ build_layered_squashfs () { Echo_message "lb_binary_layered: treating pass $pass" + # Per convention, we include the subarch name next to the project + PROJECT_FULL=$PROJECT${SUBARCH:+-$SUBARCH} + # Building squashfs filesystem & manifest local overlay_dir="overlay.${pass}" - base="${PWD}/livecd.${PROJECT}.${pass}" + base="${PWD}/livecd.${PROJECT_FULL}.${pass}" squashfs_f="${base}.squashfs" # We have already treated that pass @@ -113,7 +116,7 @@ build_layered_squashfs () { create_manifest "chroot" "${squashfs_f_manifest}.full" # Delta manifest - diff -NU0 ${PWD}/livecd.${PROJECT}.$(get_parent_pass $pass).manifest.full ${squashfs_f_manifest}.full|grep -v ^@ > $squashfs_f_manifest + diff -NU0 ${PWD}/livecd.${PROJECT_FULL}.$(get_parent_pass $pass).manifest.full ${squashfs_f_manifest}.full|grep -v ^@ > $squashfs_f_manifest squashfs_f_size="${base}.size" du -B 1 -s "overlay.${pass}/" | cut -f1 > "${squashfs_f_size}" @@ -121,7 +124,7 @@ build_layered_squashfs () { # We take first live pass for "global" ISO properties (used by installers and checkers): # Prepare initrd + kernel # Main manifest and size files - prefix="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" + prefix="livecd.$PROJECT_FULL" if [ ! -e "${prefix}.manifest" ] && $(is_live_layer "$pass"); then totalsize=$(cat ${squashfs_f_size}) curpass="$pass" @@ -130,7 +133,7 @@ build_layered_squashfs () { # We climbed up the tree to the root layer, we are done [ -z "$curpass" ] && break - totalsize=$(expr $totalsize + $(cat "${PWD}/livecd.${PROJECT}.${curpass}.size")) + totalsize=$(expr $totalsize + $(cat "${PWD}/livecd.${PROJECT_FULL}.${curpass}.size")) done echo ${totalsize} > "${prefix}.size" @@ -141,7 +144,7 @@ build_layered_squashfs () { if [ -f config/$pass.catalog-in.yaml ]; then echo "Expanding catalog entry template for $pass" - usc_opts="--output livecd.${PROJECT}.install-sources.yaml \ + usc_opts="--output livecd.${PROJECT_FULL}.install-sources.yaml \ --template config/$pass.catalog-in.yaml \ --size $(du -B 1 -s chroot/ | cut -f1) --squashfs ${pass}.squashfs \ --translations config/catalog-translations" @@ -168,9 +171,9 @@ do done # Ubiquity-compatible removal manifest for ISO not using a layered-aware installer -if [ -n "$(ls livecd.${PROJECT}.*install.live.manifest.full 2>/dev/null)" ] && \ - [ -n "$(ls livecd.${PROJECT}.*install.manifest.full 2>/dev/null)" ]; then - echo "$(diff livecd.${PROJECT}.*install.live.manifest.full livecd.${PROJECT}.*install.manifest.full | awk '/^< / { print $2 }')" > livecd.${PROJECT}-manifest-remove +if [ -n "$(ls livecd.${PROJECT_FULL}.*install.live.manifest.full 2>/dev/null)" ] && \ + [ -n "$(ls livecd.${PROJECT_FULL}.*install.manifest.full 2>/dev/null)" ]; then + echo "$(diff livecd.${PROJECT_FULL}.*install.live.manifest.full livecd.${PROJECT_FULL}.*install.manifest.full | awk '/^< / { print $2 }')" > livecd.${PROJECT_FULL}-manifest-remove fi chmod 644 *.squashfs *.manifest* *.size diff --git a/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early b/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early index 864d4c4c..3e0be41b 100755 --- a/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early +++ b/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early @@ -8,6 +8,8 @@ case $PASS in kernel_metapkg=linux-generic elif [ "$flavor" = "generic-hwe" ]; then kernel_metapkg=linux-generic-hwe-$(lsb_release -sr) + elif [ "$flavor" = "intel-iotg" ]; then + kernel_metapkg=linux-intel-iotg else echo "bogus flavor: $flavor" exit 1 diff --git a/live-build/ubuntu-server/hooks/04-kernel-bits.binary b/live-build/ubuntu-server/hooks/04-kernel-bits.binary index c0b2e3d7..51520265 100755 --- a/live-build/ubuntu-server/hooks/04-kernel-bits.binary +++ b/live-build/ubuntu-server/hooks/04-kernel-bits.binary @@ -10,6 +10,8 @@ case $PASS in ;; esac +PROJECT=$PROJECT${SUBARCH:+-$SUBARCH} + # Fish out generated kernel image and initrd mv chroot/boot/initrd.img-* ${PWD}/livecd.${PROJECT}.initrd-$flavor mv chroot/boot/vmlinu?-* ${PWD}/livecd.${PROJECT}.kernel-$flavor