From owner-freebsd-small Thu Jan 24 0:36: 9 2002 Delivered-To: freebsd-small@freebsd.org Received: from oneplusone.ch (oneplusone.ch [212.55.208.170]) by hub.freebsd.org (Postfix) with ESMTP id D54F337B405 for ; Thu, 24 Jan 2002 00:36:04 -0800 (PST) Received: (from uucp@localhost) by oneplusone.ch (8.11.4/8.11.3) with UUCP id g0O8a3j30121; Thu, 24 Jan 2002 09:36:03 +0100 (MET) (envelope-from ast@marabu.ch) Received: from marabu.marabu.ch (marabu.marabu.ch [192.168.21.3]) by marabu.ch (8.9.3/2000102801) with ESMTP id JAA00133; Thu, 24 Jan 2002 09:33:28 +0100 (CET) (envelope-from ast@marabu.ch) Received: by marabu.marabu.ch (8.7.5/20001028-ast-8.3) id JAA20831; Thu, 24 Jan 2002 09:33:26 +0100 (CET) Message-Id: <200201240833.JAA20831@marabu.marabu.ch> MIME-Version: 1.0 (NeXT Mail 3.3 v124.8483.6) Content-Type: text/plain In-Reply-To: <3C4F9B6A.B552F051@www.kuzbass.ru> X-Nextstep-Mailer: Mail 3.3 (Enhance 2.0b6) Received: by NeXT.Mailer (1.124.8483.6) From: Adrian Steinmann Date: Thu, 24 Jan 2002 09:33:25 +0100 To: Eugene Grosbein Subject: Re: bzip2'd kernel Cc: Doug White , small@FreeBSD.ORG References: <20020123130959.E56623-100000@resnet.uoregon.edu> <3C4F9B6A.B552F051@www.kuzbass.ru> X-Organization: Steinmann Consulting, Apollostrasse 21, 8032 Zurich X-Phone-Numbers: Switzerland, Tel +41 1 380 30 83 Fax +41 1 380 30 85 Sender: owner-freebsd-small@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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