Re: Kernel and modules for another machine.

Brian K. White (linut@squonk.net)
Tue, 28 Jul 1998 10:06:59 -0400


> Subject: Re: Kernel and modules for another machine.
>
> Iusty Pop wrote:
> > As for modules, (...) you could save your current directory
> > of modules ...
>
> Actually, I now came up with a slicker solution. I modified the
> Makefile in /usr/src/linux by copying the rule for modules_install,
> renaming it to modules_alt and changing MODLIB from /lib/modules/...
> to /usr/src/linux/alter/... It seams to have warked like charm.
>
> Perhaps this is a modification that is worth taking up in upcoming
> versions of kernel releases?

How about this:

--- Makefile.orig Tue Jul 28 08:57:27 1998
+++ Makefile Tue Jul 28 08:49:22 1998
@@ -1,6 +1,7 @@
VERSION = 2
PATCHLEVEL = 1
SUBLEVEL = 112
+BUILDLABEL =

ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e
s/arm.*/arm/ -e s/sa110/arm/)

@@ -294,7 +295,7 @@

modules_install:
@( \
- MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
+ MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(BUILDLABEL); \
cd modules; \
MODULES=""; \
inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \

What you do is optionally add a short string to BUILDLABEL= and then the modules
will get installed to /lib/modules/$(uname -r)$BUILDLABEL so if you leave it
blank, the end result is the same operation as always, so the masses will not
be affected. or you can add a little
tags like -ac4 or -2 or -2+vesafb and so on to get /lib/modules/2.1.112-2 etc...
and that way make modules_install never overwrites /lib/modules/2.1.112

Been using it a while, and in concert with these lines in rc.d scripts
it makes a groovy setup. no reason why it can't be fully automated, but even
this much is a big timesaver.

rc.kdeps called from within rc.sysinit immediately after /proc and / get
mounted
rw (after fsck) but before any modules get loaded.

export $(awk "BEGIN { RS = \" \" } /BOOT_IMAGE/ { print \$1 }" /proc/cmdline)
export K_VERSION=`uname -r`
echo "Setting up shop for kernel $BOOT_IMAGE ."
rm -f /usr/src/linux
ln -s /usr/src/linux-$K_VERSION /usr/src/linux
rm -f /lib/modules/$K_VERSION
ln -s /lib/modules/$BOOT_IMAGE /lib/modules/$K_VERSION

# Generic 2.1.* vs 2.0.* stuff
if [ `echo $K_VERSION | grep 2.1. ` ]; then
#set up shop for 2.1.*
rm -f /dev/lp
ln -s /dev/lp0 /dev/lp
# copy in alternate versions of certain files, ifup that uses dhcpcd 1.3.3
# don't need tunelp, etc...
else
#set up shop for 2.0.*
rm -f /dev/lp
ln -s /dev/lp1 /dev/lp
tunelp /dev/lp1 -i 7
# copy ifup that uses dhcpcd 0.70-karn, maybe need setserial, etc...
done

maybe a better way is to just have a whole seperate rc.kdeps.$BOOT_IMAGE
for each build and call that instead

then you still have to edit lilo.conf by hand, and the lilo label has to
match $(uname -r)$BUILDLABEL used in /lib/modules/*

ho hum... it looks a lot more half-baked when I describe it than when I use it
:)
todo: make install option that copies (b)zImage, System.map & .config to
/boot/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(BUILDLABEL) and then adds a
stanza to lilo.conf. possibly scanning /boot/* to remove dead stanzas and
/lib/modules subdirs too. stick a string input in config.in for entering a
build-label and accompanying entry in Configure.help

-- 

Brian~

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html