Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jan 2002 09:33:25 +0100
From:      Adrian Steinmann <ast@marabu.ch>
To:        Eugene Grosbein <eugen@www.kuzbass.ru>
Cc:        Doug White <dwhite@resnet.uoregon.edu>, small@FreeBSD.ORG
Subject:   Re: bzip2'd kernel
Message-ID:  <200201240833.JAA20831@marabu.marabu.ch>
In-Reply-To: <3C4F9B6A.B552F051@www.kuzbass.ru>
References:  <20020123130959.E56623-100000@resnet.uoregon.edu> <3C4F9B6A.B552F051@www.kuzbass.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Eugene

All the hooks are there, you don't need to "hack" anything! As
someone else already mentioned, you simply need to bzip2 the kernel
and use a loader that is bzip2-enabled.

To build a minimal loader *without* gzip support but bzip2 support
(and also without Forth support) use these compile flags:

    cd /usr/src/sys/boot/i386
    make -f /usr/src/sys/boot/i386/Makefile \
	NOFORTH=YES NOMAN=YES \
	LOADER_BZIP2_SUPPORT=YES \
	LOADER_NO_GZIP_SUPPORT=YES

you can then further kgzip the loader and strip it:

    kgzip loader
    mv loader.kgz loader_mini
    strip --remove-section=.note --remove-section=.comment loader_mini

You'll end up with a loader about this 90k in size.

When you bzip2 the kernel (and md images) make sure you use the -1
option to allow for the restricted memory environment in which the
loader runs:

    bzip2 -1v GENERIC

My GENERIC.bz2 kernel is 1320680 bytes, however my custom kernels
are only about half that size so I have ample space for a bzip2
mfsroot on one floppy.

When you boot, interrupt the normal loader:
    Hit [Enter] to boot immediately, or any other key for command prompt.
    <*** HIT SPACE HERE ***>

then:
    ok unload
    ok boot /boot/loader_mini
    /boot/loader_mini text=0x1760 data=0xceae+0x10516 \

interuppt agian:
    Hit [Enter] to boot immediately, or any other key for command prompt.
    Booting [kernel] in 9 seconds...
    <*** HIT SPACE HERE ***>

    ok load GENERIC
    /GENERIC text=0x13c80f data=0x3204c+0x18088 -
    ok load -t md_image mfsroot
    bzf_read: unexpected EOF
    ok set vfs.root.mountfrom=ufs:/dev/md0c
    ok boot -v

Note that you say "load GENERIC" and not "load GENERIC.bz2" just
like in the gzip case.

Open questions:

    - Why can't one boot bzip2 kernels with forth-enable loaders?
      I think this has something to do with a comment I saw soemwhere:
      "forth changes the functionality of the boot command"

    - I'm not sure why I see the message "bzf_read: unexpected EOF"
      but it seems that it can be safely ignored. An unpadded buffer
      maybe?

    - I also don't understand why I must
	"set vfs.root.mountfrom=ufs:/dev/md0c"
      otherwise the loaded mfsroot is ignored and the kernel mounts
      the harddisks' rootfs.

In the past, I have always been squeezing out these last bytes to
fit as much kernel and mfsroot on one floppy. Since we regularly
blowup our boot floppies due to kernel bloat, I have sent in PRs
suggesting some of these changes, see:

    http://www.freebsd.org/cgi/query-pr.cgi?pr=29272
    http://www.freebsd.org/cgi/query-pr.cgi?pr=33089
	
Hope this helps!
Adrian

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-small" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201240833.JAA20831>