On Mon, May 23, 2011 at 01:19:20PM +0100, Colin Watson wrote: > The attached patch adds 'lb config --binary-remove-linux true'. Feel > free to rename the option if some other name would fit better, though.
I realised that making this work involved moving lb_binary_linux-image before lb_binary_rootfs. This doesn't seem to have any ill effects that I can detect from reading the code, so I've attached an updated patch that does this too. Thanks, -- Colin Watson [cjwat...@ubuntu.com]
>From 2acebebb81869948ca302a9bd5a75a0e13730f4d Mon Sep 17 00:00:00 2001 From: Colin Watson <cjwat...@canonical.com> Date: Mon, 23 May 2011 13:12:01 +0100 Subject: [PATCH] Add an option to remove the kernel and initrd from the compressed filesystem. --- functions/defaults.sh | 2 ++ manpages/en/lb_config.1 | 4 ++++ scripts/build/lb_binary | 2 +- scripts/build/lb_binary_linux-image | 6 ++++++ scripts/build/lb_config | 12 +++++++++++- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/functions/defaults.sh b/functions/defaults.sh index 8526335..a1e5c83 100755 --- a/functions/defaults.sh +++ b/functions/defaults.sh @@ -826,6 +826,8 @@ Set_defaults () ;; esac + LB_BINARY_REMOVE_LINUX="${LB_BINARY_REMOVE_LINUX:-false}" + # Setting apt indices case "${LB_MODE}" in progress) diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1 index 88fcc9b..5e247b4 100644 --- a/manpages/en/lb_config.1 +++ b/manpages/en/lb_config.1 @@ -33,6 +33,8 @@ .br [\fB\-\-binary\-filesystem\fR fat16|fat32|ext2] .br + [\fB\-\-binary\-remove\-linux\fR true|false] +.br [\fB\-\-bootappend\-install\fR \fIPARAMETER\fR|\fI"PARAMETERS"\fR] .br [\fB\-\-bootappend\-live\fR \fIPARAMETER\fR|\fI"PARAMETERS"\fR] @@ -281,6 +283,8 @@ defines the architecture of the to be build image. By default, this is set to th defines the image type to build. By default, for images using syslinux this is set to iso\-hybrid to build CD/DVD images that may also be used like usb\-hdd images, for non\-syslinux images, it defaults to iso. .IP "\fB\-\-binary\-filesystem\fR fat16|fat32|ext2" 4 defines the filesystem to be used in the image type. This only has an effect if the selected binary image type does allow to choose a filesystem. For example, when selection iso the resulting CD/DVD has always the filesystem ISO9660. When building usb\-hdd images for usb sticks, this is active. Note that it defaults to fat16 on all architectures except sparc where it defaults to ext2. Also note that if you choose fat16 and your resulting binary image gets bigger than 2GB, the binary filesystem automatically gets switched to fat32. +.IP "\fB\-\-binary\-remove\-linux\fR true|false" 4 +defines if the Linux kernel and initrd should be removed from the filesystem (they will still be published in the binary output directory). This is useful to reduce image size if the image is not meant to be installable, or if the installer is intelligent enough to copy the kernel and initrd from the top-level image rather than from the compressed filesystem. Default is false. .IP "\fB\-\-bootappend\-install\fR \fIPARAMETER\fR|""\fIPARAMETERS\fR""" 4 sets boot parameters specific to debian\-installer, if included. .IP "\fB\-\-bootappend\-live\fR \fIPARAMETER\fR|""\fIPARAMETERS\fR""" 4 diff --git a/scripts/build/lb_binary b/scripts/build/lb_binary index 738363d..fb10ed0 100755 --- a/scripts/build/lb_binary +++ b/scripts/build/lb_binary @@ -54,12 +54,12 @@ then fi # Building root filesystem +lb binary_linux-image ${*} lb binary_rootfs ${*} lb binary_manifest ${*} # Prepare images lb binary_local-packagelists ${*} -lb binary_linux-image ${*} lb binary_debian-installer ${*} lb binary_memtest ${*} lb binary_grub ${*} diff --git a/scripts/build/lb_binary_linux-image b/scripts/build/lb_binary_linux-image index cac19d8..c5a8cc6 100755 --- a/scripts/build/lb_binary_linux-image +++ b/scripts/build/lb_binary_linux-image @@ -76,6 +76,12 @@ mkdir -p "${DESTDIR}" cp chroot/boot/"${LINUX}"-* "${DESTDIR}" cp chroot/boot/initrd.img-* "${DESTDIR}" +if [ "${LB_BINARY_REMOVE_LINUX}" = true ] +then + rm -f chroot/boot/"${LINUX}"-* + rm -f chroot/boot/initrd.img-* +fi + case "${LB_INITRAMFS}" in live-boot) if [ -e chroot/usr/share/doc/live-boot/parameters.txt ] diff --git a/scripts/build/lb_config b/scripts/build/lb_config index 0e36240..a2f90eb 100755 --- a/scripts/build/lb_config +++ b/scripts/build/lb_config @@ -41,6 +41,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [-a|--architectures ARCHITECTURE]\n\ \t [-b|--binary-images iso|iso-hybrid|net|tar|usb-hdd]\n\ \t [--binary-filesystem fat16|fat32|ext2]\n\ +\t [--binary-remove-linux true|false]\n\ \t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\ \t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\ \t [--bootloader grub|syslinux|yaboot]\n\ @@ -159,7 +160,7 @@ Local_arguments () mirror-binary-security:,mirror-binary-volatile:,mirror-binary-backports:,mirror-debian-installer:, archive-areas:,parent-archive-areas:,chroot-filesystem:,exposed-root:,virtual-root-size:, gzip-options:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:, - packages:,package-lists:,tasks:,security:,volatile:,backports:,binary-filesystem:,binary-images:, + packages:,package-lists:,tasks:,security:,volatile:,backports:,binary-filesystem:,binary-images:,binary-remove-linux:, apt-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,compression:,build-with-chroot:, debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, grub-splash:,hostname:,isohybrid-options:,iso-application:,iso-preparer:,iso-publisher:, @@ -603,6 +604,11 @@ Local_arguments () shift 2 ;; + --binary-remove-linux) + LB_BINARY_REMOVE_LINUX="${2}" + shift 2 + ;; + --bootappend-live) LB_BOOTAPPEND_LIVE="${2}" shift 2 @@ -1248,6 +1254,10 @@ LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM}" # (Default: ${LB_BINARY_IMAGES}) LB_BINARY_IMAGES="${LB_BINARY_IMAGES}" +# \$LB_BINARY_REMOVE_LINUX: set whether to remove kernel from filesystem +# (Default: ${LB_BINARY_REMOVE_LINUX}) +LB_BINARY_REMOVE_LINUX="${LB_BINARY_REMOVE_LINUX}" + # \$LB_APT_INDICES: set apt/aptitude generic indices # (Default: ${LB_APT_INDICES}) LB_APT_INDICES="${LB_APT_INDICES}" -- 1.7.4.1