lkml.org 
[lkml]   [1996]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux and not version dirs
On Thu, 20 Jun 1996, Jauder Ho wrote:

|
| this is what I do usually
|
|
| I have a directory with lets say linux-1.3.57
| I have a soft link to it called linux
|
| I download the patch to 1.3.58
| I do the following things
|
| % mv linux-1.3.57 linux-1.3.58
| % ln -sf linux-1.3.58 linux
| % gzip -cd | patch -p0
|
| I guess I could write a script to do it but I am too lazy

I already did, it does all the above, and a lot more. You probably won't
need a lot of stuff, but I boot Linux using LOADLIN:

---begin: updkernel---
#!/bin/bash
#
# updkernel:
#
# * Patches kernel with any patches found in /root/incoming
# * Compiles kernel and modules
# * If compilation suceeds, installs kernel and modules

get_kversion()
{
eval `sed -n 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' $sourcedir/Makefile`
}

kerneldir=/boot/kernel # kernels will be installed to this dir
srcdir=/usr/src # base directory for sources
moddir=/lib/modules # base directory for compiled modules
sourcedir=$srcdir/linux # source directory for linux
patchdir=/root/incoming # directory where patches are found

help=0
config=0
proper=0
clean=0
depend=1
force=0

helpmsg="\
updkernel 0.1 by Nuno Serrenho (adrenlin@ki.net) \n\
\n\
-a --all same as updkernel -c -n -f \n\
-p --proper run 'make mrproper' \n\
-c --config run 'make config' \n\
-n --clean run 'make clean' \n\
-D --nodep don't run 'make depend' \n\
-f --force force make even if no new patches are found \n\
--help help (you're reading it) \n"


if [ $UID != 0 ]; then
echo $0: must be root >&2

exit 1
else

for arg in $*
do
case $arg in
-a | --all) config=1 ; clean=1 ; force=1 ;;
-p | --proper) proper=1 ;;
-c | --config) config=1 ;;
-n | --clean) clean=1 ;;
-D | --nodep) depend=0 ;;
-f | --force) force=1 ;;
*) echo -e "$helpmsg" ; exit 1 ;;
esac
done

get_kversion ; oldkernel=$VERSION.$PATCHLEVEL.$SUBLEVEL

echo -n "`/bin/date` " >&2
logger -s -t kernel "Kernel Compile Started."

echo "Checking for new patches..." >&2

$sourcedir/scripts/patch-kernel $sourcedir $patchdir

get_kversion ; newkernel=$VERSION.$PATCHLEVEL.$SUBLEVEL

if [ "$oldkernel" != "$newkernel" ] || [ $force = 1 ]; then

echo "Updating symbolic links in /usr/include..." >&2
cd /usr/include
rm -rf linux asm
ln -s $sourcedir/include/linux linux
ln -s $sourcedir/include/asm-i386 asm

echo "Updating symbolic links in /usr/src..." >&2
if [ -L $sourcedir ]; then
if [ -d $srcdir/linux-$oldkernel ] &&
[ ! -d $srcdir/linux-$newkernel ]; then
mv $srcdir/linux-$oldkernel $srcdir/linux-$newkernel &&
cd $srcdir && ln -sf linux-$newkernel $sourcedir
fi
else
echo "Problem with symbolic links in /usr/src..." >&2 && exit 1
fi

cd $sourcedir

if [ $proper = 1 ]; then
echo "Cleaning up source tree ('make mrproper')..." >&2
make mrproper >/dev/null
fi

if [ $config = 1 ]; then
echo "Running kernel configuration ('make config')..." >&2
make config
fi

if [ $depend = 1 ]; then
echo "Updating dependencies ('make dep')..." >&2
make dep >/dev/null
fi

if [ $clean = 1 ]; then
echo "Cleaning up stale object files ('make clean')..." >&2
make clean >/dev/null
fi

if [ $? = 0 ]; then
echo "Compiling basic kernel ($newkernel)..." >&2 &&
make zImage >>/boot/log/kernel.Make.$newkernel &&
echo "Installing basic kernel..." >&2 &&
cp arch/i386/boot/zImage $kerneldir/$VERSION-$PATCHLEVEL-$SUBLEVEL &&
echo "Copying System.map and .config to /boot..." >&2 &&
cp $sourcedir/System.map /boot/System-$newkernel.map &&
( cd /boot && ln -sf System-$newkernel.map System.map ) &&
cp $sourcedir/.config /boot/Config-$newkernel &&
( cd /boot && ln -sf Config-$newkernel Config )
fi

if [ $? = 0 ]; then
echo "Compiling modules..." >&2 &&
make modules >>/boot/log/kernel.Make.$newkernel &&
echo "Installing modules..." >&2 &&
make modules_install &&
echo "Updating module dependencies..." >&2 &&
depmod -a $newkernel
fi

fi

echo -n "`/bin/date` " >&2
logger -s -t kernel "Kernel ($newkernel) Compile Ended."
fi
---end---

+---------------------_|_-----------------------------------------+
| Nuno Serrenho (@ @) Whiskey Bar: The Complete Doors Page: |
| <adrenlin@ki.net> |\o/| http://www.ki.net/~adrenlin/thedoors/ |
+-------------------ooO-Ooo---------------------------------------+



\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.081 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site