LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 05-03-2004, 04:41 PM   #1
Keffin
LQ Newbie
 
Registered: Sep 2003
Location: England
Distribution: VectorLinux 4.0
Posts: 19

Rep: Reputation: 0
Bash script to compile kernel


I can never remember the exact steps and their order to compile a kernel, so I'm just playing around to make a little script that will stop me needing to . This is for a 2.4 kernel btw.

The way the it works is that I su and cd to the directory where the new kernel source has unpacked, then run the script. What happens then is pretty self explanatory. Here's what the script looks like at the moment:

Code:
rm /usr/src/linux
ln -sf ./ /usr/src/linux
make mrproper
cp /home/keffin/Important/config ./.config
make menuconfig
cp ./.config /home/keffin/Important/config-NEW
make dep clean
make bzImage
make modules
make modules_install
cp arch/i386/boot/bzImage /boot/kernel-NEW
cp System.map /boot/System.map-NEW
cd /boot
ls
gedit /boot/grub/grub.conf
The second line (ln -sf ./ /usr/src/linux) is intended to create a symlink /usr/src/linux which points to the current directory, but looking at the output of ls -l /usr/src it shows the symlink literally pointing to "./". Is there a way I can make it replace this with the actual path to the current directory?

Also, if there's an easy way to place the actual version number of the new kernel in the place of "NEW" in kernel-NEW etc. then that would be brilliant. In fact if there's a hard way it would be cool too .

Any help much appreciated.
 
Old 05-03-2004, 04:47 PM   #2
kooch
Member
 
Registered: Mar 2004
Location: Upstate NY
Distribution: Slackware/YDL
Posts: 77

Rep: Reputation: 15
I know a shell scripter so this solution isn't very elegant but it seems that you could use the $PWD environment variable. Or use pwd to get the current working directory and store it into a variable.
 
Old 05-03-2004, 04:52 PM   #3
Keffin
LQ Newbie
 
Registered: Sep 2003
Location: England
Distribution: VectorLinux 4.0
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks kooch, that's perfect for the symlink. I have no real idea what I'm doing but I have to start somewhere right .
 
Old 05-03-2004, 06:10 PM   #4
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,104

Rep: Reputation: Disabled
I didn't examine either closely, but this reminded me there's also this one.

Subsequent discussion is also relevant.
 
Old 05-03-2004, 06:14 PM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,524

Rep: Reputation: 93
Quote:
Originally posted by Keffin
I have no real idea what I'm doing [..snip..]
PWD stands for Print Working Directory, and it is a environment variable that will always contain the full path of the current working directory. BTW "pwd" (lowercase) is a program that prints the working directory.

Try this to see what it does::
echo $PWD

Last edited by Hko; 05-03-2004 at 06:29 PM.
 
Old 05-03-2004, 06:19 PM   #6
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 30
Yep, and here is another of them scripts
 
Old 05-03-2004, 06:31 PM   #7
Keffin
LQ Newbie
 
Registered: Sep 2003
Location: England
Distribution: VectorLinux 4.0
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks guys
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile/Encrypt Bash Script DoubleOTeC Programming 6 10-09-2005 07:33 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
bash script - incrementing a filename in a script tslinux Programming 10 08-05-2003 11:58 PM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 05:34 AM
Bash errors after kernel compile Touchstone Linux - Software 5 02-09-2002 09:18 PM


All times are GMT -5. The time now is 11:14 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration