Daniel, thank you kindly for your patience. It is much appreciated. Here is a smaller set of patches today, drawn from your feedback. git://github.com/utlemming/lb.git
0001-Adding-Ubuntu-Cloud-Images-package-lists.patch: - Adds Ubuntu Cloud images packages list 0002-Adding-check-for-valid-mtab-during-chrooted-binary-r.patch: - Installs and reverts /etc/mtab if missing 0003-Adding-foreign-bootstrap-via-qemu-for-cross-arch-bui.patch - Adds LB_BOOTSTRAP_QEMU_* The use-case for the foreign bootstrap via qemu is to build ARMEL images on non-ARM hardware. While it is not exactly the fastest thing in the world, it allows for some flexibility (i.e. not having to procure separate hardware for separate builds). My use case is building ARMEL images on a x86_64 cloud instance. In the last email you mentioned trying it out. Should you feel so inclined, here is an example (albeit useless) lb_config command. Tested using lb_config commands of: lb_config --package-lists ubuntu-cloud --mode ubuntu --initramfs none --initsystem none --bootloader none -d oneiric -b rootfs --build-with-chroot true --chroot-filesystem ext3 -a armel --bootstrap-qemu-arch armel --bootstrap-qemu-static /usr/bin/qemu-arm-static Thanks, Ben
>From d484eba8a80a60d6d1479c49ef83bb452a71dc70 Mon Sep 17 00:00:00 2001 From: Ben Howard <ben.how...@canonical.com> Date: Fri, 30 Sep 2011 16:23:00 -0600 Subject: [PATCH 1/3] Adding Ubuntu Cloud images packages lists. --- package-lists/ubuntu-cloud | 10 ++++++++++ package-lists/ubuntu-cloud-desktop | 5 +++++ 2 files changed, 15 insertions(+), 0 deletions(-) create mode 100644 package-lists/ubuntu-cloud create mode 100644 package-lists/ubuntu-cloud-desktop diff --git a/package-lists/ubuntu-cloud b/package-lists/ubuntu-cloud new file mode 100644 index 0000000..43fc756 --- /dev/null +++ b/package-lists/ubuntu-cloud @@ -0,0 +1,10 @@ +# /usr/share/live/build/package-lists/standard - package list for live-build(7) + +#include <minimal> + +# Tasks +standard^ server^ cloud-image^ ubuntu-minimal + +# Packages +landscape-client + diff --git a/package-lists/ubuntu-cloud-desktop b/package-lists/ubuntu-cloud-desktop new file mode 100644 index 0000000..d7b0853 --- /dev/null +++ b/package-lists/ubuntu-cloud-desktop @@ -0,0 +1,5 @@ +# /usr/share/live/build/package-lists/standard - package list for live-build(7) + +#include <ubunut-cloud> + +ubuntu-destkop^ -- 1.7.5.4
>From 1fbb66110bdbf7fd382064ec2735fa7b615a1dda Mon Sep 17 00:00:00 2001 From: Ben Howard <ben.how...@canonical.com> Date: Fri, 30 Sep 2011 16:23:34 -0600 Subject: [PATCH 2/3] Adding check for missing mtab during chrooted binary rootfs stage. --- scripts/build/lb_binary_rootfs | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/scripts/build/lb_binary_rootfs b/scripts/build/lb_binary_rootfs index 280cd1a..96523a8 100755 --- a/scripts/build/lb_binary_rootfs +++ b/scripts/build/lb_binary_rootfs @@ -122,12 +122,24 @@ case "${LB_CHROOT_FILESYSTEM}" in case "${LB_BUILD_WITH_CHROOT}" in true) dd if=/dev/zero of=chroot/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM} + + if ! Chroot chroot "test -s /etc/mtab" + then + Chroot chroot "ln -s /proc/mounts/mtab /etc/mtab" + FAKE_MTAB="true" + fi + Chroot chroot "mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 filesystem.${LB_CHROOT_FILESYSTEM}" mkdir -p filesystem.tmp ${LB_ROOT_COMMAND} mount -o loop chroot/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp cp -a chroot/chroot/* filesystem.tmp + if [ "${FAKE_MTAB}" = "true" ] + then + Chroot chroot "rm -f /etc/mtab" + fi + ${LB_ROOT_COMMAND} umount filesystem.tmp rmdir filesystem.tmp -- 1.7.5.4
>From c54f417cce0dcafb097011b6b523f902ed041c37 Mon Sep 17 00:00:00 2001 From: Ben Howard <ben.how...@canonical.com> Date: Fri, 30 Sep 2011 16:24:08 -0600 Subject: [PATCH 3/3] Adding foreign bootstrap via qemu for cross arch building. --- functions/architectures.sh | 36 ++++++++++++++++++++++++++++++++ functions/defaults.sh | 9 ++++++++ scripts/build/lb_bootstrap_debootstrap | 19 ++++++++++++++++- scripts/build/lb_config | 36 ++++++++++++++++++++++++++++++- 4 files changed, 97 insertions(+), 3 deletions(-) diff --git a/functions/architectures.sh b/functions/architectures.sh index 53d925b..d2c99dd 100755 --- a/functions/architectures.sh +++ b/functions/architectures.sh @@ -22,6 +22,24 @@ Check_architectures () fi done + if [ "${ARCHITECTURES}" = "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" ] + then + VALID="true" + + if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ] + then + Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURES} was not found" + VALID="false" + fi + + if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ] + then + Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable" + VALID="false" + fi + + fi + if [ "${VALID}" = "false" ] then Echo_warning "skipping %s, foreign architecture(s)." "${0}" @@ -52,6 +70,24 @@ Check_crossarchitectures () ;; esac + if [ "${LB_ARCHITECTURES}" = "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" ] + then + + if [ ! -e "${LB_BOOTSTRAP_QEMU_STATIC}" ] + then + Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_ARCHITECTURES} was not found" + exit 0 + fi + + if [ ! -x "${LB_BOOTSTRAP_QEMU_STATIC}" ] + then + Echo_warning "skipping %s, qemu-static binary ${LB_BOOTSTRAP_QEMU_STATIC} is not executable" + exit 0 + fi + return + fi + + Check_architectures "${CROSS}" } diff --git a/functions/defaults.sh b/functions/defaults.sh index 52b7107..a0dfd2b 100755 --- a/functions/defaults.sh +++ b/functions/defaults.sh @@ -1276,4 +1276,13 @@ Check_defaults () fi fi + # Architectures to use foreign bootstrap for + LB_BOOTSTRAP_QEMU_ARCHITECTURES="${LB_BOOTSTRAP_QEMU_ARCHITECTURES:-}" + + # Packages to exclude for the foreign/ports bootstrapping + LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_PORTS_BOOTSTRAP_EXCLUDE:-}" + + # Ports using foreign bootstrap need a working qemu-*-system. This is the location it + LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC:-}" + } diff --git a/scripts/build/lb_bootstrap_debootstrap b/scripts/build/lb_bootstrap_debootstrap index 1b5f5fe..16e478d 100755 --- a/scripts/build/lb_bootstrap_debootstrap +++ b/scripts/build/lb_bootstrap_debootstrap @@ -137,7 +137,24 @@ then fi Echo_breakage "Running debootstrap... " - ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" + + # Run appropriate bootstrap, i.e. foreign or regular bootstrap + if [ "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" = "${LB_ARCHITECTURES}" ]; then + + if [ -n "${LB_BOOTSTRAP_QEMU_EXCLUDE}" ] + then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LB_BOOTSTRAP_QEMU_EXCLUDE} | sed 's| *|,|g')" + fi + + Echo_message "Bootstrap will be foreign" + ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" + + Echo_message "Running debootstrap second stage under QEMU" + cp ${LB_BOOTSTRAP_QEMU_STATIC} chroot/usr/bin + Chroot chroot /debootstrap/debootstrap --second-stage + else + ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" + fi if [ -n "${LB_ROOT_COMMAND}" ] then diff --git a/scripts/build/lb_config b/scripts/build/lb_config index 3f7ab0f..aa4564f 100755 --- a/scripts/build/lb_config +++ b/scripts/build/lb_config @@ -147,7 +147,11 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--exposed-root true|false]\n\ \t [--username NAME]\n\ \t [--verbose]\n\ -\t [--win32-loader true|false]" +\t [--win32-loader true|false]\n\ +\t [--bootstrap-qemu-exclude PACKAGES]\n\ +\t [--bootstrap-qemu-static PATH]\n\ +\t [--bootstrap-qemu-arch ARCH]" + Local_arguments () { @@ -170,7 +174,8 @@ Local_arguments () net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:, net-cow-server:,net-tarball:,swap-file-path:,swap-file-size:,syslinux-theme:, username:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, - help,ignore-system-defaults,quiet,usage,verbose,version" + help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:, + bootstrap-qemu-exclude:" # Remove spaces added by indentation LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')" ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}" --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")" @@ -781,6 +786,21 @@ Local_arguments () shift 2 ;; + --bootstrap-qemu-arch) + LB_BOOTSTRAP_QEMU_ARCHITECTURES="${2}" + shift 2 + ;; + + --bootstrap-qemu-exclude) + LB_BOOTSTRAP_QEMU_EXCLUDE="${2}" + shift 2 + ;; + + --bootstrap-qemu-static) + LB_BOOTSTRAP_QEMU_STATIC="${2}" + shift 2 + ;; + # config/source --source) LB_SOURCE="${2}" @@ -1171,6 +1191,18 @@ LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}" # \$LB_PARENT_ARCHIVE_AREAS: select archive areas to use # (Default: ${LB_PARENT_ARCHIVE_AREAS}) LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS}" + +# \$LB_BOOTSTRAP_QEMU_ARCHITECTURES: architectures to use foreign bootstrap +# (Default: ${LB_BOOTSTRAP_QEMU_ARCHITECTURES}) +LB_BOOTSTRAP_QEMU_ARCHITECTURES="${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" + +# \$LB_BOOTSTRAP_QEMU_EXCLUDE: packages to exclude during foreign bootstrap +# (Default: ${LB_BOOTSTRAP_QEMU_EXCLUDE}) +LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_BOOTSTRAP_QEMU_EXCLUDE}" + +# \$LB_BOOTSTRAP_QEMU_STATIC: static qemu binary for foreign bootstrap +# (Default: ${LB_BOOTSTRAP_QEMU_STATIC}) +LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC}" EOF # Creating lb_chroot_* configuration -- 1.7.5.4