[Merge] ~itrue/livecd-rootfs:add-nemos-support into livecd-rootfs:ubuntu/master
Loïc Minier
mp+440173 at code.launchpad.net
Fri Mar 31 17:05:31 UTC 2023
Review: Needs Fixing
Hey, there was a generic kiwi codepath hardcoding nemos; this might also require a Main Inclusion Request, unless there's a way to dynamically install kiwi; I've also suggested a simplification – see review
Diff comments:
> diff --git a/debian/control b/debian/control
> index 438239e..30fad70 100644
> --- a/debian/control
> +++ b/debian/control
> @@ -23,10 +23,13 @@ Depends: ${misc:Depends},
> gnupg,
> grep-dctrl,
> kpartx,
> + kiwi,
Probably have to plan a MIR on kiwi as a result
> live-build (>= 3.0~a57-1ubuntu31~),
> lsb-release,
> lzma,
> make,
> + nemos-images-embedded-lunar,
> + nemos-images-reference-lunar,
> parted,
> procps,
> python3,
> diff --git a/live-build/auto/build b/live-build/auto/build
> index ddbb733..95b9aae 100755
> --- a/live-build/auto/build
> +++ b/live-build/auto/build
> @@ -117,6 +117,64 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
> fi
>
> exit 0
> +elif [ "${IMAGEFORMAT:-}" = "kiwi" ]; then
> + # Kiwi refers to target build configurations as "descriptions". These
> + # descriptions are XML files (generally called either "appliance.kiwi"
> + # or "config.xml" and reside in a folder alongside any additional
> + # scripts and files that are needed by the target system. This can
> + # include any arbitrary script that will be executed inside a chroot
> + # environment. The caller must specify the folder the description
> + # resides in, rather than the file itself, due to the way Kiwi works.
> +
> + if [ -z "${KIWI_ROOT:-}" ]; then
> + KIWI_ROOT="/usr/share/kiwi/nemos"
This hardcodes nemos in a generic codepath
> + fi
> +
> + # Combine all of the parameters derived in the config script to
> + # get the full path to the Kiwi description.
> + KIWI_PROJECT_PATH="${KIWI_ROOT}/${KIWI_PROJECT}"
> + KIWI_DESCRIPTION="${KIWI_PROJECT_PATH}/${KIWI_PLATFORM}"
> +
> + if [ ! -e "${KIWI_DESCRIPTION}/appliance.kiwi" ] &&
> + [ ! -e "${KIWI_DESCRIPTION}/config.xml" ]; then
> + echo "Kiwi error: appliance description not found in path " \
> + "\"${KIWI_DESCRIPTION}\""
> + exit 1
> + fi
> +
> + # Kiwi provides a variety of configuration options for the build
> + # system that are not a part of the image configuration itself, and
> + # instead need to be managed using a YAML file.
> + # Check if the platform provides a specific configuration file.
> + # Otherwise, check if the project provides one.
> + if [ -e "${KIWI_DESCRIPTION}/kiwi.yaml" ]; then
> + KIWI_CONFIG="--config ${KIWI_DESCRIPTION}/kiwi.yaml"
> + elif [ -e "${KIWI_PROJECT_PATH}/kiwi.yaml" ]; then
> + KIWI_CONFIG="--config ${KIWI_PROJECT_PATH}/kiwi.yaml"
> + fi
> +
> + # Kiwi allows the use of different profiles inside the description
> + # file. This allows different configuration blocks to be disabled or
> + # enabled at build-time. This is derived from the SUBPROJECT in the
> + # config script.
> + if [ -n "${KIWI_PROFILE:-}" ]; then
> + KIWI_PROFILE="--profile ${KIWI_PROFILE}"
> + fi
> +
> + # Run the Kiwi build. Not that the output directory must not exist
> + # before this runs, otherwise Kiwi will complain and exit
> + kiwi-ng --debug ${KIWI_CONFIG:-} ${KIWI_PROFILE:-} \
> + system build --description "${KIWI_DESCRIPTION}" \
> + --target-dir output
> +
> + # Move the files around so that we have the same output as ubuntu-image
> + mv output/*.raw "${PREFIX}".img
> + xz -0 -T4 "${PREFIX}".img
> +
> + # Also link the output image to a filename that cdimage expects
> + ln "${PREFIX}".img.xz "livecd.${PROJECT}.disk1.img.xz"
> +
> + exit 0
> fi
>
> # Setup cleanup function
> diff --git a/live-build/auto/config b/live-build/auto/config
> index 1f81218..3e27ce1 100755
> --- a/live-build/auto/config
> +++ b/live-build/auto/config
> @@ -541,6 +544,72 @@ case $IMAGEFORMAT in
> exit 0
> ;;
>
> + kiwi)
> + case ${ARCH:-} in
> + amd64)
> + if [ -n "${SUBARCH:-}" ]; then
> + echo "SUBARCH not supported with IMAGEFORMAT=kiwi and ARCH=amd64"
> + exit 1
> + fi
> + echo "KIWI_PLATFORM=\"x86\"" >> config/common
> + ;;
> + arm64)
> + case ${SUBARCH:-aarch64} in
> + nxp-s32g2)
> + echo "KIWI_PLATFORM=\"nxp-s32g2\"" >> config/common
> + ;;
> + aarch64)
optional nitpick, but this seems to allow arm64+aarch64 which doesn't seem useful
I'd recommend to make KIWI_PLATFORM default to SUBARCH, and then let the outer case statement route on $ARCH+$SUBARCH to test for valid combos/set for x86
> + echo "KIWI_PLATFORM=\"aarch64\"" >> config/common
> + ;;
> + *)
> + echo "Unsupported subarchitecture for IMAGEFORMAT=kiwi and ARCH=${ARCH}: ${SUBARCH}"
> + exit 1
> + ;;
> + esac
> + ;;
> + *)
> + echo "Unsupported architecture for IMAGEFORMAT=kiwi: ${ARCH}"
> + exit 1
> + ;;
> + esac
> +
> + case ${SUBPROJECT:-reference} in
I have no idea what these means for kiwi in practice, but this looks good :)
> + # Barebones image using a prebuilt base rootfs
> + minimal-bootstrapped)
> + KIWI_PROJECT="nemos-images-minimal"
> + KIWI_PROFILE="bootstrapped"
> + ;;
> + # Barebones image built using debootstrap
> + minimal)
> + KIWI_PROJECT="nemos-images-minimal"
> + ;;
> + # Feature-rich image using a prebuilt base rootfs
> + reference-bootstrapped)
> + KIWI_PROJECT="nemos-images-reference"
> + KIWI_PROFILE="bootstrapped"
> + ;;
> + # Feature-rich image using a prebuilt base rootfs and development tools
> + reference-development)
> + KIWI_PROJECT="nemos-images-reference"
> + KIWI_PROFILE="development"
> + ;;
> + # Feature-rich image built using debootstrap
> + reference)
> + KIWI_PROJECT="nemos-images-reference"
> + ;;
> + *)
> + echo "Unsupported subproject for PROJECT=kiwi: ${SUBPROJECT}"
> + exit 1
> + ;;
> + esac
> + echo "KIWI_PROFILE=\"${KIWI_PROFILE:-}\"" >> config/common
> + echo "KIWI_PROJECT=\"${KIWI_PROJECT}-${SUITE}\"" >> config/common
> + echo "IMAGEFORMAT=\"${IMAGEFORMAT}\"" >> config/common
> +
> + # No further configuration needed
> + exit 0
> + ;;
> +
> none)
> # Currently the IMAGEFORMAT none format is used only for ubuntu-image
> # targeted image builds which, currently, only target physical devices.
--
https://code.launchpad.net/~itrue/livecd-rootfs/+git/livecd-rootfs/+merge/440173
Your team Ubuntu Core Development Team is subscribed to branch livecd-rootfs:ubuntu/master.
More information about the Ubuntu-reviews
mailing list