diff --git a/live-build/auto/build b/live-build/auto/build index 4a0dd317..1466615b 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -89,6 +89,10 @@ PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then # Use ubuntu-image instead of live-build + # TODO: eventually, this should be handled by a single ubuntu-image + # call without having to do a conditional on ubuntu-core/classic. + # We could already do that, but then we'd still have to do the + # compressing for the core images. if [ "$PROJECT" = "ubuntu-core" ]; then env SNAPPY_STORE_NO_CDN=1 \ ubuntu-image snap $UBUNTU_IMAGE_ARGS \ @@ -100,20 +104,18 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then xz -0 -T4 "$PREFIX".img mv output/seed.manifest "$PREFIX".manifest else - # First we need to build the gadget tree - make -C "config/$PREFIX-gadget" \ - ARCH=$ARCH SERIES=$SUITE $GADGET_TARGET + env SNAPPY_STORE_NO_CDN=1 \ ubuntu-image classic $UBUNTU_IMAGE_ARGS \ - -s $SUITE -p $PROJECT -a $ARCH --subarch $SUBARCH \ - -O output config/$PREFIX-gadget/install - # XXX: currently we only have one image generated, but really - # we should be supporting more than one for models that - # define those. - mv output/*.img "$PREFIX".img - xz -0 -T4 "$PREFIX".img - # Also link the output image to a filename that cdimage expects - ln "$PREFIX".img.xz livecd.ubuntu-cpc.disk1.img.xz - mv output/filesystem.manifest "$PREFIX".manifest + -O output "$PREFIX".yaml + # Since the output of the ubuntu-image call can vary based on what + # kind of an image we build, the safest bet is to 'export' all the + # artifacts from the output directory. The image definition file + # should be what defines what is expected, so that we don't have + # to tweak livecd-rootfs everytime a different type of artifact + # is needed. + for artifact in output/*; do + mv $artifact $PREFIX.$(basename $artifact) + done fi exit 0 diff --git a/live-build/auto/config b/live-build/auto/config index 1722e98b..7401b946 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -333,8 +333,10 @@ _get_live_passes () if [ -z "${IMAGEFORMAT:-}" ]; then case $PROJECT:${SUBPROJECT:-} in ubuntu-cpc:*|ubuntu:desktop-preinstalled|ubuntu-wsl:*) - case $SUBARCH in - raspi|intel-iot) + case $ARCH+${SUBARCH:-} in + *+raspi|riscv64+?*) + # All raspi and RISC-V images that *have* a SUBARCH will now + # use ubuntu-image. IMAGEFORMAT=ubuntu-image ;; *) @@ -342,25 +344,15 @@ if [ -z "${IMAGEFORMAT:-}" ]; then ;; esac ;; + ubuntu-base:*) + IMAGEFORMAT=ubuntu-image + ;; ubuntu-server:live) IMAGEFORMAT=plain ;; esac fi -# Configure preinstalled ubuntu-cpc images with included password -# one also must request disk1-img-xz image format -if [ "$IMAGEFORMAT" = "ext4" ] && [ "$PROJECT" = "ubuntu-cpc" ]; then - case $ARCH:$SUBARCH in - armhf:raspi2|riscv64:sifive_*|riscv64:nezha|riscv64:visionfive|riscv64:licheerv|riscv64:icicle|*:generic) - IMAGE_HAS_HARDCODED_PASSWORD=1 - if [ -z "${IMAGE_TARGETS:-}" ]; then - export IMAGE_TARGETS="disk1-img-xz" - fi - ;; - esac -fi - skip_lb_stage() { STAGE="$1" mkdir -p .build @@ -496,37 +488,13 @@ case $IMAGEFORMAT in else # classic images - # Certain models have different names but are built from the same source gadget tree - case $MODEL in - pi-arm64|pi3-arm64) - MODEL=pi - ;; - intel-iot) - MODEL=pc - ;; - esac + DEFINITION="$PROJECT-$MODEL.yaml" - GADGET_TARGET="server" - if [ "$SUBPROJECT" = "desktop-preinstalled" ]; then - GADGET_TARGET="desktop" - fi - - UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${SUBPROJECT:+ --subproject \"$SUBPROJECT\"}" - UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${PROPOSED:+ --with-proposed}" - UBUNTU_IMAGE_ARGS="$UBUNTU_IMAGE_ARGS${EXTRA_PPAS:+ --extra-ppas \"$EXTRA_PPAS\"}" - - # We need to look in two places for the gadget tree: - # - Launchpad hosted gadgets will be in the snap-gadget repo - # - Github hosted gadgets are mirrored into a github-mirror repo - BRANCH="classic" - git clone git://git.launchpad.net/~canonical-foundations/snap-$MODEL/+git/snap-$MODEL -b $BRANCH config/$PREFIX-gadget || git clone git://git.launchpad.net/~canonical-foundations/snap-$MODEL/+git/github-mirror -b $BRANCH config/$PREFIX-gadget || git clone git://git.launchpad.net/~canonical-foundations/snap-$MODEL/+git/github-mirror-$ARCH -b $BRANCH config/$PREFIX-gadget - - echo "IMAGEFORMAT=$IMAGEFORMAT" >> config/common - echo "SUITE=$SUITE" >> config/common - echo "GADGET_TARGET=$GADGET_TARGET" >> config/common - echo "UBUNTU_IMAGE_ARGS=\"$UBUNTU_IMAGE_ARGS\"" >> config/common - - echo "Configured ubuntu-image for the following gadget model: $MODEL" + git clone git://git.launchpad.net/ubuntu-images -b $SERIES image-definitions + cp image-definitions/$DEFINITION "$PREFIX".yaml + echo "Configured ubuntu-image for the following image-definition:" + cat "$PREFIX".yaml + echo "----------------------------------------------------------" fi # Save the model name used for building, mostly for any model-specific hook execution