dokernel script

Discuss Programming

dokernel script

Postby X11 » Tue Oct 26, 2004 8:45 am

Everytime I get a new kernel patch to play around with I usually have to unpack the full 2.6.8 tree that I have, patch it up to 2.6.8, then patch that up to 2.6.9, and in tonights case, i wanted to patch that up to 2.6.10-rc1. Then I would have to rename the folder to the new version name, and other manual work.

I wrote a script to do this for me, thought I would post it since its a pretty good idea, however kind of obvious, it could be of use to people who are new to linux and not very confident in there shell scripting skills.

Code: Select all
#!/bin/sh
                                                                               
#my quick and easy kernel source tree patching/unpacking script
                                                                               
SOURCESPATH=/stuff/software/Unix/Linux/kernel/
                                                                               
SPECPATCH=$1
                                                                               
#unpack 2.6.8 kernel sources
echo "Unpacking 2.6.8 sources"
tar -zxf `echo $SOURCESPATH`linux-2.6.8.tar.gz
cd linux-2.6.8
VERSION=2.6.8
                                                                               
#patch em up to 2.6.9
echo "Patching $VERSION > 2.6.9"
bzip2 -dc `echo $SOURCESPATH`patch-2.6.9.bz2 | patch -p1
cd ..
VERSION=2.6.9
                                                                               
#apply specified patch
if [ $SPECPATCH ]; then
                                                                               
        echo "Patching $VERSION > $SPECPATCH"
        bzip2 -dc 'echo $SOURCESPATH'patch-'echo $SPECPATCH'.bz2 | patch -p1
        VERSION=$SPECPATCH
                                                                               
fi
                                                                               
mv linux-2.6.8 linux-$VERSION
                                                                               
echo "Kernel Sources for $VERSION available in linux-$VERSION"


Of course you will probably need to modify this, like what it does automatically (in this scripts case, unpacking 2.6.8, patching to 2.6.9).

Then I can just do a

Code: Select all
[root@exeleven src]# ./dokernel 2.6.10-rc1
X11
guru
guru
 
Posts: 674
Joined: Sun Jan 19, 2003 11:09 pm
Location: Australia

Postby Void Main » Tue Oct 26, 2004 5:09 pm

Good one X11. Now take it the extra step and have it configure/compile and install the new kernel. :)
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby X11 » Wed Oct 27, 2004 1:21 am

Yea, im thinking of somthing like that.

I was thinking of writing a script that checks your hardware and selects the right modules and other things.
X11
guru
guru
 
Posts: 674
Joined: Sun Jan 19, 2003 11:09 pm
Location: Australia

Postby worker201 » Wed Oct 27, 2004 3:42 pm

I'm thinking it would be easier to make a little list of your hardware, and have it grab all the necessary modules for you. Kinda like a 'kernelmods.conf' or something, you know, just a list of your hardware that you pass as an argument to your script. Then, you can take the guesswork out of the hardware detection. You could also build custom kernels for other people from your computer. Well, whatever works for you, just an idea.
worker201
guru
guru
 
Posts: 668
Joined: Sun Jun 13, 2004 6:38 pm
Location: Hawaii

Postby X11 » Thu Oct 28, 2004 10:41 pm

I was thinking of just using the information from /proc/pci and /proc/cpuinfo, etc.

However things like generalised hardware could be loaded as a module by default. But also manually turned off using the usual .config file/kconfig/etc
X11
guru
guru
 
Posts: 674
Joined: Sun Jan 19, 2003 11:09 pm
Location: Australia


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests