Support for compressed kernel modules
Luciano Miguel Ferreira Rocha
strange at nsk.no-ip.org
Mon Nov 27 14:41:19 PST 2006
On Mon, Nov 27, 2006 at 02:19:41PM +0100, Rory Vieira wrote:
> Hi,
>
> I'm using BusyBox 1.2.1 (built by buildroot) for my tiny linux env...
>
> I'm running out of rootfs space, and can save roughly 1Mb if I
> compress the kernel modules.
> Does this version of busybox come with modprobe with gzip support?
> And if so, how do I enable this?
If you apply the attached patch to busybox, and use the attached insmod
script instead of busybox's, you can use compressed modules:
* /lib/modules/<kver>/.../module.ko.gz
( find /lib/modules/<kver> -name \*.ko | gzip -9 )
-- or --
* /lib/modules/<kver>/modules.tgz
( cd /lib/modules/<kver> && tar cf - `find */ -name \*.ko` | gzip -9 > modules.tgz )
-- or --
* /lib/modules/<kver>/modules.cgz
( cd /lib/modules/<kver> && find */ -name \*.ko | cpio -oH newc | gzip -9 > modules.cgz )
--
lfr
0/0
-------------- next part --------------
--- busybox-1.2.2.1/libbb/xfuncs.c 2006-07-28 23:53:44.000000000 +0100
+++ busybox-1.2.2.1/libbb/xfuncs.c 2006-11-24 17:09:57.000000000 +0000
@@ -190,14 +190,15 @@
{
static int failed;
pid_t pid;
- void *app = find_applet_by_name(argv[0]);
// Be nice to nommu machines.
failed = 0;
pid = vfork();
if (pid < 0) return pid;
if (!pid) {
- execvp(app ? CONFIG_BUSYBOX_EXEC_PATH : *argv, argv);
+ execvp(*argv, argv);
+ if (find_applet_by_name(argv[0]))
+ execvp(CONFIG_BUSYBOX_EXEC_PATH, argv);
// We're sharing a stack with blocked parent, let parent know we failed
// and then exit to unblock parent (but don't run atexit() stuff, which
-------------- next part --------------
#!/bin/sh
INSMOD="busybox insmod"
MODULE="$1"
[ -e $MODULE ] && exec $INSMOD $MODULE
umask 077
T=`mktemp -d /tmp/mod.XXXXXX`
[ $? -eq 0 -a -n "$T" ] || exit 1
trap "rm -fr $T" EXIT
cd $T || exit 1
FILE="${MODULE##*/}"
KVER=${MODULE#/lib/modules/}
KMOD=${KVER#*/}
KVER=${KVER%%/*}
KDIR=/lib/modules/$KVER
if [ -e "$MODULE.gz" ]; then
zcat < $MODULE.gz > $FILE
$INSMOD $FILE
elif [ -e $KDIR/modules.tgz ]; then
tar xzf $KDIR/modules.tgz ./$KMOD
insmod ./$KMOD
elif [ -e $KDIR/modules.cgz ]; then
zcat < $KDIR/modules.cgz | cpio -id $KMOD > /dev/null
insmod $KMOD
fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20061127/12e7bb03/attachment.pgp
More information about the busybox
mailing list