initramfs is too big
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
busybox (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
initramfs-tools (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
A lot of space is wasted in initramfs because busybox is not correctly used.
1) busybox-initramfs is compiled statically but it's useless because libc.so is on the initramfs (that means 1217840 bytes against 270112 if compiled dynamically -- give or take a few, arch: amd64)
2) some tools that are present in the initramfs could be symlinks to busybox
3) all symbolic links are destroyed by cpio --dereference in mkinitramfs
To solve 2) and 3) I propose the attached changes to mkinitramfs (and ntfs-3g hook).
In addition to solve 1) I propose the following 1 line change to busybox-initramfs
(i.e. to busybox_
--- busybox_
+++ busybox_
@@ -4179,7 +4179,7 @@
+#
+# Build Options
+#
-CONFIG_STATIC=y
++# CONFIG_STATIC is not set
+# CONFIG_NOMMU is not set
+# CONFIG_
+# CONFIG_
4) Wishlist: busybox has a lot applets that are currently unused. In particular
cpio dd dmesg eject gzip halt insmod kbd_mode losetup pivot_root pkill rmmod swapon
could replace the ones on the initramfs (those one use 176656 bytes on jaunty-alpha4,
their replacement with busybox increases its size of 28768 bytes (amd64)).
5) If 4) is treated, only
fstype
ipconfig
kinit unused
minips useless (ps in busybox)
nfsmount (mount in busybox ?)
nuke = find $1 -xdev -type f | xargs rm; find $1 -xdev -depth -type d | xargs rmdir
resume
run-init
remain from klibc. Maybe it is possible to dispose of klibc completely.
As far as remember run-init is essentially nuke;chroot /dir;exec /sbin/init "$@"
ipconfig can be emulated,
fstype probably (recompiled ?).
I don't know about resume.
SurJector
I fixed the busybox part of this independently before looking at this bug. I also have an independently- created patch that addresses most of the same issues in initramfs-tools. Note that the symlink vs. cpio issue really doesn't matter all that much, IMO; identical files will get compressed very efficiently anyway. I seem to remember there was a good reason to use cpio --dereference - I think it allowed initramfs *generation* to take much less space - so I'd rather not change that.
busybox (1:1.13.3-1ubuntu2) karmic; urgency=low
* [initramfs] Link dynamically rather than statically. We always have
glibc in the initramfs these days.
-- Colin Watson <email address hidden> Tue, 23 Jun 2009 10:02:27 +0100