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

Re: Sparc netboot image is too large to boot (again)



On Sun, Feb 05, 2012 at 03:11:48PM +0100, Samuel Thibault wrote:
> Bastian Blank, le Sun 05 Feb 2012 14:55:49 +0100, a écrit :
> > On Sun, Feb 05, 2012 at 02:09:11PM +0100, Samuel Thibault wrote:
> > > AIUI, linux can now have support for uncompressing bzip2, lzma and lzo.
> > 
> > CONFIG_RD_GZIP=y
> > CONFIG_RD_BZIP2=y
> > CONFIG_RD_LZMA=y
> > CONFIG_RD_XZ=y
> > CONFIG_RD_LZO=y
> > 
> > The amd64 image have support for gzip, bzip2, lzma and the xz variant.
> 
> Ah, right, it's not explicitly set in the linux-2.6 configs, but
> automatically enabled by Kconfig.
> 
> So, anything against using xz compression instead? (except that there
> might be quite a few scripts to update from initrd.gz to initrd.xz...)

Samuel, thanks a lot for all ideas. Using xz on the sparc's netboot 
initrd image reduces its size dramatically:

-rw-r--r--  1 jurij jurij 4341553 Feb 17 18:50 initrd.gz
-rw-r--r--  1 jurij jurij 3083408 Feb 17 18:51 initrd.xz

Attached patch implements the switch. It's not particularly elegant, 
but minimally intrusive, only affecting the building ot sparc's 
netboot image. I would like to commit it some time next week, unless 
anyone objects.

Best regards,
-- 
Jurij Smakov                                           jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
>From 821362eaaba0982132ad2ed54c9aff4be01eee38 Mon Sep 17 00:00:00 2001
From: Jurij Smakov <jurij@wooyd.org>
Date: Fri, 17 Feb 2012 19:07:45 +0000
Subject: [PATCH] Switch sparc netboot image to xz-compressed initrd to get
 its size under the magic limit of 10MB (otherwise it does
 not boot).

---
 build/config/sparc/netboot.cfg |   10 ++++++++--
 debian/control                 |    4 +++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/build/config/sparc/netboot.cfg b/build/config/sparc/netboot.cfg
index 23b3b46..828ce73 100644
--- a/build/config/sparc/netboot.cfg
+++ b/build/config/sparc/netboot.cfg
@@ -7,7 +7,13 @@ EXTRANAME = $(MEDIUM)/
 
 MANIFEST-BOOT = "tftp boot image for sparc64"
 
+TEMP_INITRD_XZ = $(TEMP)/initrd.xz
+
+$(TEMP_INITRD_XZ): $(TEMP_INITRD)
+	# xz options ensure that kernel's decoder can handle the image.
+	zcat $(TEMP_INITRD) | xz --check=crc32 --lzma2=dict=512KiB > $(TEMP_INITRD_XZ)
+
 .PHONY: arch_boot
-arch_boot:
+arch_boot: $(TEMP_INITRD_XZ)
 	gzip -c $(TEMP)/System.map-$(KERNELIMAGEVERSION) >$(TEMP)/System.map.gz
-	tftpboot.sh $(TEMP_KERNEL) $(TEMP)/System.map.gz $(TEMP_INITRD) $(TEMP_BOOT)
+	tftpboot.sh $(TEMP_KERNEL) $(TEMP)/System.map.gz $(TEMP_INITRD_XZ) $(TEMP_BOOT)
diff --git a/debian/control b/debian/control
index 5eef76a..949e14b 100644
--- a/debian/control
+++ b/debian/control
@@ -1,4 +1,4 @@
-Source: debian-installer
+source: debian-installer
 Section: devel
 Priority: optional
 Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
@@ -78,6 +78,8 @@ Build-Depends:
 #		m68k uses it for atari floppies
 	cpio,
 #		For creating initramfs images.
+	xz-utils,
+#		For compressing initramfs images.
 	devio [armeb armel],
 #		Tool to read and write from block devices, used to byteswap
 #		kernels and add nslu2 boot magic.
-- 
1.7.9


Reply to: