mirror of
https://git.launchpad.net/livecd-rootfs
synced 2026-03-18 13:37:42 +00:00
Add PROJECT=ubuntu-test-iso for fast end-to-end ISO testing
Builds a real Ubuntu ISO in ~2-3 minutes (vs 30-60 for production)
by keeping the package set minimal (casper + linux-generic only) and
using lz4 squashfs compression.
Design:
- Two-pass layered build (PASSES_TO_LAYERS=true):
- base: installs casper
- base.generic (LIVE_PASSES): installs linux-generic, triggers
update-initramfs with CASPER_GENERATE_UUID=1 to embed UUID
- No package pool (POOL_SEED_NAME=), no universe, amd64 only
- SQUASHFS_COMP=lz4 (~10x faster than xz); create_squashfs() now
respects ${SQUASHFS_COMP:-xz} so all other projects are unaffected
- Germinate is skipped (only add_package is used, no add_task/pool)
New files:
- live-build/ubuntu-test-iso/hooks/01-test-iso.chroot_early
- live-build/ubuntu-test-iso/hooks/02-test-iso-kernel.binary
Modified:
- live-build/functions: honour $SQUASHFS_COMP in create_squashfs()
- live-build/gen-iso-ids: add ubuntu-test-iso -> Ubuntu-Test-ISO
- live-build/auto/config: IMAGEFORMAT, fs, COMPONENTS, germinate
skip, SQUASHFS_COMP default + per-project override, project block,
write SQUASHFS_COMP to config/common, lxd exclusion, hook copying
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9861d393aa
commit
04e2aea648
@ -390,7 +390,7 @@ if [ -z "${IMAGEFORMAT:-}" ]; then
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
ubuntu-server:live|ubuntu-mini-iso:|ubuntu-core-installer:*)
|
||||
ubuntu-server:live|ubuntu-mini-iso:|ubuntu-test-iso:|ubuntu-core-installer:*)
|
||||
IMAGEFORMAT=plain
|
||||
;;
|
||||
esac
|
||||
@ -426,7 +426,7 @@ case $IMAGEFORMAT in
|
||||
ubuntu-server:live|ubuntu-core-installer:*)
|
||||
touch config/universe-enabled
|
||||
;;
|
||||
ubuntu-mini-iso:)
|
||||
ubuntu-mini-iso:|ubuntu-test-iso:)
|
||||
fs=none
|
||||
;;
|
||||
*)
|
||||
@ -636,7 +636,7 @@ case $PROJECT in
|
||||
esac
|
||||
|
||||
case $PROJECT in
|
||||
ubuntu-mini-iso)
|
||||
ubuntu-mini-iso|ubuntu-test-iso)
|
||||
COMPONENTS='main'
|
||||
;;
|
||||
edubuntu|ubuntu-budgie|ubuntucinnamon|ubuntukylin)
|
||||
@ -653,15 +653,24 @@ case $SUBPROJECT in
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [ -e config/germinate-output/structure ]; then
|
||||
echo "Running germinate..."
|
||||
if [ -n "$COMPONENTS" ]; then
|
||||
GERMINATE_ARG="-c $(echo $COMPONENTS | sed -e's/ \+/,/g')"
|
||||
fi
|
||||
(cd config/germinate-output && germinate --no-rdepends --no-installer \
|
||||
-S $SEEDMIRROR -m $MIRROR -d $SUITE,$SUITE-updates \
|
||||
-s $FLAVOUR.$SUITE $GERMINATE_ARG -a ${ARCH_VARIANT:-$ARCH})
|
||||
fi
|
||||
case $PROJECT in
|
||||
ubuntu-test-iso)
|
||||
# ubuntu-test-iso uses only add_package (not add_task) and has no
|
||||
# pool, so germinate output is never needed.
|
||||
touch config/germinate-output/structure
|
||||
;;
|
||||
*)
|
||||
if ! [ -e config/germinate-output/structure ]; then
|
||||
echo "Running germinate..."
|
||||
if [ -n "$COMPONENTS" ]; then
|
||||
GERMINATE_ARG="-c $(echo $COMPONENTS | sed -e's/ \+/,/g')"
|
||||
fi
|
||||
(cd config/germinate-output && germinate --no-rdepends --no-installer \
|
||||
-S $SEEDMIRROR -m $MIRROR -d $SUITE,$SUITE-updates \
|
||||
-s $FLAVOUR.$SUITE $GERMINATE_ARG -a ${ARCH_VARIANT:-$ARCH})
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# ISO build configuration. These defaults are overridden per-project below.
|
||||
#
|
||||
@ -674,6 +683,9 @@ MAKE_ISO=no
|
||||
# - "server-ship-live" for Ubuntu Server (includes server-specific packages)
|
||||
# - "" (empty) for images without a pool, like Ubuntu Core Installer
|
||||
POOL_SEED_NAME=ship-live
|
||||
# SQUASHFS_COMP: compression algorithm for squashfs images. lz4 is ~10x
|
||||
# faster than xz and useful for test builds that don't need small images.
|
||||
SQUASHFS_COMP=xz
|
||||
|
||||
# Common functionality for layered desktop images
|
||||
common_layered_desktop_image() {
|
||||
@ -1179,6 +1191,24 @@ case $PROJECT in
|
||||
esac
|
||||
;;
|
||||
|
||||
ubuntu-test-iso)
|
||||
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal"
|
||||
OPTS="${OPTS:+$OPTS }--linux-packages=none --initramfs=none"
|
||||
KERNEL_FLAVOURS=none
|
||||
BINARY_REMOVE_LINUX=false
|
||||
MAKE_ISO=yes
|
||||
POOL_SEED_NAME=
|
||||
SQUASHFS_COMP=lz4
|
||||
PASSES_TO_LAYERS=true
|
||||
add_package base casper
|
||||
add_package base.generic linux-virtual
|
||||
LIVE_PASSES="base.generic"
|
||||
case $ARCH in
|
||||
amd64) ;;
|
||||
*) echo "ubuntu-test-iso only supports amd64"; exit 1 ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
ubuntu-base|ubuntu-oci)
|
||||
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal"
|
||||
;;
|
||||
@ -1408,6 +1438,7 @@ if [ -n "$PASSES" ]; then
|
||||
fi
|
||||
echo "MAKE_ISO=\"$MAKE_ISO\"" >> config/common
|
||||
echo "POOL_SEED_NAME=\"$POOL_SEED_NAME\"" >> config/common
|
||||
echo "SQUASHFS_COMP=\"$SQUASHFS_COMP\"" >> config/common
|
||||
if [ -n "$NO_SQUASHFS_PASSES" ]; then
|
||||
echo "NO_SQUASHFS_PASSES=\"$NO_SQUASHFS_PASSES\"" >> config/common
|
||||
fi
|
||||
@ -1443,7 +1474,7 @@ rm -fv /etc/ssl/private/ssl-cert-snakeoil.key \
|
||||
EOF
|
||||
|
||||
case $PROJECT in
|
||||
ubuntu-cpc|ubuntu-core|ubuntu-base|ubuntu-oci|ubuntu-wsl|ubuntu-mini-iso)
|
||||
ubuntu-cpc|ubuntu-core|ubuntu-base|ubuntu-oci|ubuntu-wsl|ubuntu-mini-iso|ubuntu-test-iso)
|
||||
# ubuntu-cpc gets this added in 025-create-groups.chroot, and we do
|
||||
# not want this group in projects that are effectively just chroots
|
||||
;;
|
||||
@ -1531,7 +1562,7 @@ fi
|
||||
|
||||
case $PROJECT:${SUBPROJECT:-} in
|
||||
ubuntu-cpc:*|ubuntu-server:live|ubuntu:desktop-preinstalled| \
|
||||
ubuntu-wsl:*|ubuntu-mini-iso:*|ubuntu:|ubuntu:dangerous|ubuntu-oem:*| \
|
||||
ubuntu-wsl:*|ubuntu-mini-iso:*|ubuntu-test-iso:*|ubuntu:|ubuntu:dangerous|ubuntu-oem:*| \
|
||||
ubuntustudio:*|edubuntu:*|ubuntu-budgie:*|ubuntucinnamon:*|xubuntu:*| \
|
||||
ubuntukylin:*|ubuntu-mate:*|ubuntu-core-installer:*|lubuntu:*)
|
||||
# Ensure that most things e.g. includes.chroot are copied as is
|
||||
|
||||
@ -408,7 +408,7 @@ create_squashfs() {
|
||||
squashfs_file="$2"
|
||||
config_dir="$PWD/config"
|
||||
(cd $rootfs_dir &&
|
||||
mksquashfs . $squashfs_file -no-progress -xattrs -comp xz \
|
||||
mksquashfs . $squashfs_file -no-progress -xattrs -comp "${SQUASHFS_COMP:-xz}" \
|
||||
-ef "$config_dir/squashfs-exclude-files")
|
||||
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ project_to_capproject_map = {
|
||||
"ubuntu-core-installer": "Ubuntu-Core-Installer",
|
||||
"ubuntu-mate": "Ubuntu-MATE",
|
||||
"ubuntu-mini-iso": "Ubuntu-Mini-ISO",
|
||||
"ubuntu-test-iso": "Ubuntu-Test-ISO",
|
||||
"ubuntu-oem": "Ubuntu OEM",
|
||||
"ubuntu-server": "Ubuntu-Server",
|
||||
"ubuntu-unity": "Ubuntu-Unity",
|
||||
|
||||
8
live-build/ubuntu-test-iso/hooks/01-test-iso.chroot_early
Executable file
8
live-build/ubuntu-test-iso/hooks/01-test-iso.chroot_early
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
mkdir -p "etc/initramfs-tools/conf.d"
|
||||
cat > etc/initramfs-tools/conf.d/casperize.conf <<EOF
|
||||
export CASPER_GENERATE_UUID=1
|
||||
EOF
|
||||
15
live-build/ubuntu-test-iso/hooks/02-test-iso-kernel.binary
Executable file
15
live-build/ubuntu-test-iso/hooks/02-test-iso-kernel.binary
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Copy kernel/initrd artifacts for isobuilder to consume.
|
||||
# The MAKE_ISO flow in auto/build expects ${PREFIX}.kernel-* and
|
||||
# ${PREFIX}.initrd-* files. With --linux-packages=none live-build won't
|
||||
# create them, so we do it here (mirroring ubuntu-mini-iso's approach).
|
||||
# This hook runs for every pass; exit early when the kernel isn't present.
|
||||
|
||||
set -eu
|
||||
|
||||
[ -e chroot/boot/vmlinuz ] || exit 0
|
||||
[ -e chroot/boot/initrd.img ] || exit 0
|
||||
|
||||
PREFIX="livecd.${PROJECT}"
|
||||
cp chroot/boot/vmlinuz "${PREFIX}.kernel-generic"
|
||||
cp chroot/boot/initrd.img "${PREFIX}.initrd-generic"
|
||||
Loading…
x
Reference in New Issue
Block a user