Support for compressed kernel modules

Luciano Miguel Ferreira Rocha strange at nsk.no-ip.org
Tue Nov 28 23:24:03 UTC 2006


On Tue, Nov 28, 2006 at 11:41:39PM +0100, Yann E. MORIN wrote:
> Rory, Luciano,
> All,

Hello,

<snip of very insightful stuff about compressed filesystems>

I don't have a very good experience with unionfs, so I can't use
squashfs+unionfs for my projects. But I do agree that, for most, that's
the best solution.

Now, some comments about your comments (thanks for those, btw):

> > If you apply the attached patch to busybox, and use the attached insmod
> > script instead of busybox's, you can use compressed modules:
> [--SNIP--]
> 
> That's a rather good idea, but I'd go a bit further:
>   - apply the suggested path, but please note that by doing so you bypasses
>     (is that correct phrasing?) an optimisation;

("you bypass")

Well, currently bb_spawn is only used by modprobe.c (and my logger for
cgis). In svn, the function is renamed and is only called by modprobe
and find, and it checks if the feature ENABLE_FEATURE_SH_STANDALONE_SHELL is
set, so the patch isn't needed in that case.

<snip>
> # Please note that calling mktemp is not safe, as it introduces
> # a race. But you should be quite safe if untrusted users don't
> # have shell access to the machine (embedded stuff), or you trust
> # your users enough (which you should not ;-]) with shell access:

mktemp uses the libc's mkdtemp, and that's quite safe.

<snip>

> # I'm not quite sure these would work with anything else
> # but bash and ash (lash and hush might have problems):
> FILE="${MODULE##*/}"
> KVER=${MODULE#/lib/modules/}
> KMOD=${KVER#*/}
> KVER=${KVER%%/*}

sed or IFS tricks are other options, but I only use bash or ash, so I
don't care. :)

<snip>

> 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
>         # Hmmm. Should that be $KMOD or ./$KMOD ? I don't know cpio,
>         # so you'll have to check:
>         $INSMOD $KMOD

The form to use on tar depends on how the archive is created. cpio (in
my tests) always remove a leading ./, so $KMOD is the correct argument.

But for tar, depends on how you call it. If you use the command I sent
on my email (cd /lib/modules/<kver> && tar cf - `find */ -name \*.ko` \
 | gzip -9 > modules.tgz), then the correct argument is $KMOD. If you use
"find ." instead of "find */", then ./$KMOD is the correct argument.

Regards,
Luciano Rocha

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20061128/14dc50f6/attachment-0002.pgp 


More information about the busybox mailing list