From: stig@hackvan.com
Date: 6 Dec 1997 23:52:23 -0000
To: ncm@cantrip.org (Nathan Myers)
Cc: balug-talk@balug.org, mstone@mkp.com
Subject: Re: kernel compiling

Nathan Myers wrote:
>
> > This leaves me with a binary named vmlinux in the source directory, which
> > is 976206 in size. Now, this is obviously too large, as Lilo will
> > obligingly inform me if I attempt to install it. The existing kernel
> > image is 611832, by comparison. It looks suspiciously like I have an
> > uncompressed kernel image. But I thought that's what the "z" in "zImage"
> > was for. I get the same results if I say "make bzImage," by the way.
>
> You need to look at zImage in the arch/i386/boot directory.
> vmlinux is just used in creating the zImage. Copy zImage
> to /linuz or something, configure lilo so it knows about it,
> and run.

I have a little script that I use to add the new kernel to lilo.conf and
save the configuration and symbol map along with it. I put all this stuff
in /boot instead of / so that I don't have to see all the clutter.

Usage is generally 'newkernel 2032' for kernel 2.0.32 and then 2032 is an
option at boot time. (Note that I set lilo to prompt me so that I have a
choice of kernels in case one is flaky.)

Stig


#!/bin/sh
#
# newkernel <tag> <where>

case "$1" in
-f )
shift
make clean
make dep
;;
esac

v=20`sed -n '/^SUBLEVEL/s/.* //p' ./Makefile`
tag=${1-$v} # suffix for /linuz
label=${1-linux} # what to put in $where/etc/lilo.conf as the label
where=${2-/} # root directory of boot drive

rootfs=/dev/sda3 # use this as the boot device when adding new
# lilo.conf entries

image=/boot/linuz$tag
instk=$where$image
newk=./arch/i386/boot/zImage

#
# build kernel if necessary
#
if [ ! -f $newk -o .config -nt $newk ]; then
for x in zImage modules modules_install; do make $x; done
fi

if [ ! -f $instk -o $newk -nt $instk ]; then
if grep -s "image = $image" $where/etc/lilo.conf; then
: # okay so far...
else
echo NOTE: adding new entry to $where/etc/lilo.conf
echo "image = $image" >> $where/etc/lilo.conf
echo " root = $rootfs" >> $where/etc/lilo.conf
echo " label = $label" >> $where/etc/lilo.conf
fi

set -x
cp $newk $instk
( echo -e '#\n# LOCAL PATCHES TO THIS KERNEL:\n#\n'
sed 's/^/# /' < .message
echo -e '#\n################'
cat .config
) > $instk.config
gzip -9c < System.map > $instk.map.gz
lilo -r $where
fi