[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#627665: marked as done (option to remove kernel+initrd from compressed filesystem)



Your message dated Mon, 13 Jun 2011 20:21:52 +0200
with message-id <4DF65540.1040700@progress-technologies.net>
and subject line Re: option to remove kernel+initrd from compressed filesystem
has caused the Debian Bug report #627665,
regarding option to remove kernel+initrd from compressed filesystem
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
627665: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627665
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: live-build
Version: 3.0~a17-1
Severity: wishlist
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch oneiric

On the Ubuntu live CDs, we have a hack to save some space: rather than
shipping the kernel and initrd both in the ISO9660 filesystem (for
booting) and in the squashfs (for installing), we remove the duplicate
copies from the squashfs, and our installer is smart enough to copy
those files from the ISO9660 filesystem if it needs to.  This saves us
17MiB or so of CD space at the cost of a small amount of code
complexity.

We'll be able to get rid of this hack once we switch to GRUB as our CD
boot loader, since it can read files out of the squashfs directly; but
even so it seems like something other folks might find useful,
particularly if they're creating a live CD that isn't intended to be
installable.

The attached patch adds 'lb config --binary-remove-linux true'.  Feel
free to rename the option if some other name would fit better, though.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
>From dfaac39fe91755c5cfc7e34b85d52633df5bfd0c Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@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_linux-image |    6 ++++++
 scripts/build/lb_config             |   12 +++++++++++-
 4 files changed, 23 insertions(+), 1 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_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


--- End Message ---
--- Begin Message ---
Adding an own option just for excluding the kernel and initrd seems like
not worth it; rather, the already existing config/chroot_rootfs/excludes
should be used. that solves the task of excluding files in a generic way.

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/


--- End Message ---

Reply to: