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

[debian-knoppix] Kernel & ramdisk compression - was: Re: Some thoughts&questions about knoppix...



On Sat, 25 May 2002 00:59:09 +0200, Klaus Knopper <knopper@linuxtag.org>
wrote:
> > Even the gzip algorithm can be better than with gzip -9 (see the
> > Windows utility 7-zip).
> > 
> > I made a measurement:
> > KNOPPIX' miniroot vs. mine
> > Same filesystem: loop ext2, 3000 blocks, 8k inodes
> > Same directories, /linuxrc script not include
> > 
> > KNOPPIX: 475585 bytes
> > compressed with gzip -9
> > 
> > mine: 439882 bytes
> 
> That looks good. But do you have insmod?

yes (hacked busybox, has less error-checking but works fine)

> > some /dev nodes deleted as mentioned above, removed most files in
> > /etc,
> 
> Which ones did you remove? There are not so many files in /etc, and
> usually those compress well.

I only have mtab in /etc

passwd, group, shadow aren't needed as you don't login
filesystems isn't needed (Kernel just has vfat, ext2 and iso9660 and
this is set in /linuxrc)
resolv.conf, exports are empty anyway
auto.mnt, fstab - you just mount the cdrom
ld.so.conf - you have only static binaries
 
> > /linuxrc:
> >    # copy library cache
> >    cat /KNOPPIX/etc/ld.so.cache > /etc/ld.so.cache
> > Is this necessary? I don't think so.
> 
> Yes it is!
> It's way faster than running ldconfig from CD-Rom, and you need
> /etc/ld.so.cache for the dynamic loader.

ok, but ld.so.cache can be a symlink and you make it a normal file in
knoppix-autoconfig.

> > 7-Zip could also be used for the Kernel bzImage (see
> > /usr/src/linux/arch/i386/boot/compressed/Makefile). Or maybe we
> > could tweak gzip?
> 
> Are you sure that 7-zip is compatible with the Kernel uncompressor?
> How would you create a 7-zipped kernel?

7-zip uses the standard gzip algorithm and works fine with the kernel
loader. Vanilla-gzip compresses data in one go without knowing how big
it is, but the compression is not that good. The trick with 7-zip is
that it runs more than one pass.

7-zip is released with VisualC++ sources
(http://sourceforge.net/projects/sevenzip/) but I don't understand a
single bit of it... so I hacked a shell script (see attached file
rezip-kernel). Run it, boot into Win or use Wine to compress the file
kernel-temp to kernel-temp.gz using 7-zip and re-run the script. You get
the kernel in the file kernel-new. Before you can use this, you have to
normally compile the kernel once (in /usr/src/linux).
I know that rebooting two times is not very comfortable. I read on the
SF page that the developer is planning a linux version "for the next
release".

Another possibility is to use the attached bzip2-Patch so you can use
bzip2 to compress kernel + initrd. But bzip2 is not as good as 7-gzip:

           vanilla gzip    vanilla bzip2     7-gzip      7-bzip2

kernel           773674           754590     749568       754590

initrd           595524           588378     577922       588378
----------------------------------------------------------------
kernel+initrd   1369198          1342968    1327490      1342968
                                            ^^^^^^^

(of course you'll have to round up to 1024 bytes)

You see that vanilla-bzip2 and the 7zip-bzip2 algorithm are the same.
Anyway, using bzip2 means that you'll have to patch the kernel which is
not good. Using the gzip with 7-zip seems to be the best solution (see
^^^^).

> > This is my sort file (numbers are automagically inserted with awk):
[snippety snip]
> Looks good, my list is about 2000 lines. Just make sure the order of
> the proirity numberin is from top to bottom, not vice versa, otherwise
> you will get a LOT of head movements on CD. ;-)

sed /^$/d sortfile.template | sed "/^#/d" | \
awk 'BEGIN {x=10000}; {print $1, x--}' > sortfile

> Well, for creating the sort list, I boot into KDE and start openoffice
> and some often used applications. This should get access times right
> (in some cases).

last used = first on the cd ?
causes a slow boot-up

last used = last on the cd ?
boot-up fast, but everything else quite slow

???

MfG
Stephan

Attachment: rezip-kernel
Description: Binary data

Attachment: linux-2.4.18-bzip2.diff.bz2
Description: Binary data


Reply to: