Unix Technical Forum

Build kernel script ??

This is a discussion on Build kernel script ?? within the Gentoo Linux Support forums, part of the Unix Operating Systems category; --> Thought I read sometime the last 18 months a script to automate the steps, which are typically performed *manually* ...


Go Back   Unix Technical Forum > Unix Operating Systems > Gentoo Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 10:59 AM
BlackTopBum
 
Posts: n/a
Default Build kernel script ??

Thought I read sometime the last 18 months a script to automate the steps,
which are typically performed *manually* ,during a kernel build that
somebody home cooked and posted herein. If I recall it provided for some
needful - and desirable - input; e.g calling bzImage what you want in /boot
and .config during cp stage. Also, to call up nano -w to edit grub as well.

To explain more of what I mean per "the steps":

cd /usr/src/linux
make menuconfig
make && make modules_install
cp arch/i386/boot/bzImage /boot/kernel-1.13.2006
cp .config /boot/config-1.13.2006
nano -w /boot/grub/grub.conf

Anyway, I'm not knowledgeable of such scripting and couldn't find it
Googling. Anyone have it and/or willing to post such?

Thanks for your time.
--
BlackTopBum
I'm NOT lazy.
Why do the work when Linux can do it for you?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 10:59 AM
KonMan
 
Posts: n/a
Default Re: Build kernel script ??

BlackTopBum generated the following data:

> Thought I read sometime the last 18 months a script to automate the steps,
> which are typically performed *manually* ,during a kernel build that
> somebody home cooked and posted herein.


http://www.gentoo.org/doc/en/genkernel.xml

Cheers,
../KonMan

--
*** www.konrad.mantorski.com ***
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2008, 10:59 AM
BlackTopBum
 
Posts: n/a
Default Re: Build kernel script ??

KonMan said something like a ...

> http://www.gentoo.org/doc/en/genkernel.xml


Thanks but I'm not doing genkernel - manual kernel.
--
BlackTopBum
You're still using MS Windows !?
Free yourself - put the fun back into computing.
Use Linux - visit www.distrowatch.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 10:59 AM
J.O. Aho
 
Posts: n/a
Default Re: Build kernel script ??

BlackTopBum wrote:
> Thought I read sometime the last 18 months a script to automate the steps,
> which are typically performed *manually* ,during a kernel build that
> somebody home cooked and posted herein. If I recall it provided for some
> needful - and desirable - input; e.g calling bzImage what you want in /boot
> and .config during cp stage. Also, to call up nano -w to edit grub as well.
>
> To explain more of what I mean per "the steps":
>
> cd /usr/src/linux
> make menuconfig
> make && make modules_install
> cp arch/i386/boot/bzImage /boot/kernel-1.13.2006
> cp .config /boot/config-1.13.2006
> nano -w /boot/grub/grub.conf
>
> Anyway, I'm not knowledgeable of such scripting and couldn't find it
> Googling. Anyone have it and/or willing to post such?
>
> Thanks for your time.


--- next line is first (don't include this one!!!) ---
#!/bin/sh
DATE=`date +%d%m%Y`
cd /usr/src/linux
make menuconfig
make && make modules_install
cp arch/i386/boot/bzImage /boot/kernel-$DATE
cp .config /boot/config-$DATE
nano -w /boot/grub/grub.conf
--- previous line was last (don't include this one!!!) ---

don't forget to 'chmod 750 scriptname' before you start to use it.


//Aho
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-21-2008, 10:59 AM
BlackTopBum
 
Posts: n/a
Default Re: Build kernel script ??

J.O. Aho said something like a ...

> --- next line is first (don't include this one!!!) ---
> #!/bin/sh
> DATE=`date +%d%m%Y`
> cd /usr/src/linux
> make menuconfig
> make && make modules_install
> cp arch/i386/boot/bzImage /boot/kernel-$DATE
> cp .config /boot/config-$DATE
> nano -w /boot/grub/grub.conf
> --- previous line was last (don't include this one!!!) ---
>
> don't forget to 'chmod 750 scriptname' before you start to use it.


<em> Excellent ! </em>

Called it mknewkernel and put it in /sbin for root's pleasure.

Hey, thanks *big* time - worked like a charm.
--
BlackTopBum
You're still using MS Windows !?
Free yourself - put the fun back into computing.
Use Linux - visit www.distrowatch.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-21-2008, 10:59 AM
Arthur Hagen
 
Posts: n/a
Default Re: Build kernel script ??

J.O. Aho <user@example.net> wrote:
>
> --- next line is first (don't include this one!!!) ---
> #!/bin/sh
> DATE=`date +%d%m%Y`
> cd /usr/src/linux
> make menuconfig
> make && make modules_install
> cp arch/i386/boot/bzImage /boot/kernel-$DATE
> cp .config /boot/config-$DATE
> nano -w /boot/grub/grub.conf
> --- previous line was last (don't include this one!!!) ---
>
> don't forget to 'chmod 750 scriptname' before you start to use it.


Personally, I prefer to edit grub.conf once and for all, to reference
/vmlinuz and /vmlinuz.old. One of my machines look like:

title Gentoo Linux
root (hd1,0)
kernel /vmlinuz root=/dev/hdb3 vga=791

title Gentoo Linux (previous kernel)
root (hd1,0)
kernel /vmlinuz.old root=/dev/hdb3 vga=791

After doing that, I won't have to edit grub.conf again nor run any
scripts to rename files, all I normally do is:

make install && make modules_install


Explanation:

The "make install" will install the new kernel as
/boot/vmlinuz-2.N.NN-gentoo-rN
and create a symlink from /boot/vmlinuz that points to the new kernel,
meaning that your grub script can always use /vmlinuz to get the latest
kernel, no matter which version it is.
It will also create a symlink from vmlinuz.old that points to the old
kernel, so you can boot the last known good kernel.
Finally, it will also maintain links to /boot/config and
/boot/System.map the same way as for /boot/vmlinuz.

Thus no need to edit grub.conf nor write and maintain scripts, as long
as you're content with having just the two latest versions of the kernel
available from the grub menu - the "make install" will do it all for
you.


From one of my boxes:

System.map -> System.map-2.6.14-gentoo-r5
System.map-2.6.14-gentoo-r4
System.map-2.6.14-gentoo-r5
System.map.old -> System.map-2.6.14-gentoo-r4
boot -> .
config -> config-2.6.14-gentoo-r5
config-2.6.14-gentoo-r4
config-2.6.14-gentoo-r5
config.old -> config-2.6.14-gentoo-r4
grub/
vmlinuz -> vmlinuz-2.6.14-gentoo-r5
vmlinuz-2.6.14-gentoo-r4
vmlinuz-2.6.14-gentoo-r5
vmlinuz.old -> vmlinuz-2.6.14-gentoo-r4

If I install gentoo-sources-2.6.15-r1, the make install will cause this
to change to:

System.map -> System.map-2.6.15-gentoo-r1
System.map-2.6.14-gentoo-r4
System.map-2.6.14-gentoo-r5
System.map-2.6.15-gentoo-r1
System.map.old -> System.map-2.6.14-gentoo-r5
boot -> .
config -> config-2.6.15-gentoo-r1
config-2.6.14-gentoo-r4
config-2.6.14-gentoo-r5
config-2.6.15-gentoo-r1
config.old -> config-2.6.14-gentoo-r5
grub/
vmlinuz -> vmlinuz-2.6.15-gentoo-r1
vmlinuz-2.6.14-gentoo-r4
vmlinuz-2.6.14-gentoo-r5
vmlinuz-2.6.15-gentoo-r1
vmlinuz.old -> vmlinuz-2.6.14-gentoo-r5

Thus, no need to edit grub.conf or do any renaming myself, as /vmlinuz
and /vmlinuz.old automatically points to the last and next-to-last
versions. All I may want to do every now and then is clean up old
versions from /boot, /lib/modules and /usr/src to reclaim space.

Regards,
--
*Art

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-21-2008, 10:59 AM
BlackTopBum
 
Posts: n/a
Default Re: Build kernel script ??

Arthur Hagen said something like a ...

> Personally, I prefer to edit grub.conf once and for all, to reference
> /vmlinuz and /vmlinuz.old. One of my machines look like: [...]


Interesting. Will think on your approach.
--
BlackTopBum
You're still using MS Windows !?
Free yourself - put the fun back into computing.
Use Linux - visit www.distrowatch.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-21-2008, 10:59 AM
Alunduil
 
Posts: n/a
Default Re: Build kernel script ??

J.O. Aho wrote:

> --- next line is first (don't include this one!!!) ---
> #!/bin/sh
> DATE=`date +%d%m%Y`
> cd /usr/src/linux
> make menuconfig
> make && make modules_install
> cp arch/i386/boot/bzImage /boot/kernel-$DATE
> cp .config /boot/config-$DATE
> nano -w /boot/grub/grub.conf
> --- previous line was last (don't include this one!!!) ---
>
> don't forget to 'chmod 750 scriptname' before you start to use it.
>
>
> //Aho


I have taken the time recently to write up a more "robust" kernel script, but
remember it is still under development for features. One can try it by
downloading it from ftp://alunduilhosting.com/upkern.sh. Let me know via e-mail
what you think, or suggest.

Regards,

Alunduil

--
Student of Physics at MSUM
www.alunduil.com
(Site is under construction)

Love makes fools, marriage cuckolds, and patriotism malevolent imbeciles.
-- Paul Leautaud, "Passe-temps"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:11 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com