Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel install script, gentoo style
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Tue Oct 11, 2005 7:05 am    Post subject: Kernel install script, gentoo style Reply with quote

hello.. i created a nice script to install kernels to /boot, and edit my grub entry.. this script gives gentoo style output, and is quite simple.

you can configure how it should edit your grub.conf

output looks like:
Code:

 * Initiating Install of "2.6.13.4-redeehardened(1)" ...
 *  Installing kernel to /boot ...
 *   Copying kernel image
 *   Copying System.map                                                                  [ ok ]
 *  Grub template found, Editing kernel entry in GRUB ...                                [ ok ]


http://wiki.kaspersandberg.com/doku.php?id=projects:scripts:installkernel

there you can download it :D

i hope you like it


edit: btw, it also installs modules, if you have module support built into your kernel, but i do not have it here, since this is my server.
Back to top
View user's profile Send private message
tHATdUD3
n00b
n00b


Joined: 22 Sep 2005
Posts: 9
Location: New York

PostPosted: Tue Oct 11, 2005 8:01 am    Post subject: Reply with quote

Awesome, I always build these scripts for new gentoo installs of mine. Makes it easier to be lazy :). I like the formatting of yours, i'll convert now hehe.
Back to top
View user's profile Send private message
blue.sca
l33t
l33t


Joined: 28 Aug 2003
Posts: 680
Location: Mainz, Germany

PostPosted: Tue Oct 11, 2005 11:15 am    Post subject: Reply with quote

you know there is
Code:
make install
for at least x86? it also makes a backup of your current kernel.
_________________
geek by nature, linux by choice
i want my avatar back... thank you
:wq
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Tue Oct 11, 2005 11:47 am    Post subject: Reply with quote

i know all about it - it is a debian script, which doesent modify grub the way i like it (atleast i believe so), and it doesent look as nice..

i just made so that it also detects if kernel is uptodate, and compiles if not.. output looks like this:
Code:

 * Initiating Install of "2.6.14(1)" ...
 *  Kernel not uptodate, compiling ...
 *   Module support in kernel detected, building modules                   [ ok ]
 *  Installing kernel to /boot ...
 *   Copying kernel image
 *   Copying System.map
 *   Installing modules                                                    [ ok ]
 *  Grub template found, Editing kernel entry in GRUB ...                  [ ok ]


should i publish this as the stuff on my site, or do you prefere to build the kernel yourself?

note: you should want to build yourself, it will not recompile, cause it will be up2date then.


edit: and about backup of your old kernel.. well.. this doesent remove any old kernel
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Thu Oct 13, 2005 12:05 am    Post subject: Reply with quote

okay, now i updated on my wiki..

the latest version, now also has the ability to detect externally installed kernel modules, and rebuild them.

its really quite nice :)


if anyone should be interrested in using this script on another dist than gentoo - inform me, and i will make it independent of /sbin/functions.sh.
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Thu Oct 13, 2005 3:44 am    Post subject: Reply with quote

Nice script!

Here is my modification that will default to /usr/src/linux, offers to use the running kernel's config, nices compilation, is fully verbose in addition to the logging, prefixes the bzimage filenames with "linux-", archives a copy of .config to /boot/config-*... but most importantly does rolling grub.conf updates based on the topmost grub.conf entry (which is the least trivial part, at the end of the script)

If you use the "root (hd0,0)" grub syntax (as opposed to including it on the kernel line, i.e. kernel (hd0,0)/foo ) then you will have to customize the NEW_GRUB line.

Currently it only checks if the topmost entry in grub.conf is identical to the one it would otherwise add (it should probably be extended to check them all)

This satisfies my needs for now, but I'm more than happy to make improvements if people are interested and have suggestions...
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Thu Oct 13, 2005 5:01 am    Post subject: Reply with quote

Dlareh wrote:
Nice script!

Here is my modification that will default to /usr/src/linux, offers to use the running kernel's config, nices compilation, is fully verbose in addition to the logging, prefixes the bzimage filenames with "linux-", archives a copy of .config to /boot/config-*... but most importantly does rolling grub.conf updates based on the topmost grub.conf entry (which is the least trivial part, at the end of the script)

If you use the "root (hd0,0)" grub syntax (as opposed to including it on the kernel line, i.e. kernel (hd0,0)/foo ) then you will have to customize the NEW_GRUB line.

Currently it only checks if the topmost entry in grub.conf is identical to the one it would otherwise add (it should probably be extended to check them all)

This satisfies my needs for now, but I'm more than happy to make improvements if people are interested and have suggestions...


well.. when i created it i did it with a few things on my mind:
1: only show messages of the script (which is why i choose logging, so the user still could analyze in case of error).
2: simplicity in grub.conf editing, i hate when scripts edits more than i would want to, and my script only copies my grub.conf, and replaces one string inside it.

actually, i have already planned to add support for it to check if .config exists, and if not, copy from /proc/config.gz, and run menuconfig, but that havent been my prioity untill now.

its great to get feedback :) and im glad my script works for you!.
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Thu Oct 13, 2005 5:10 am    Post subject: Reply with quote

Redeeman wrote:
well.. when i created it i did it with a few things on my mind:
1: only show messages of the script (which is why i choose logging, so the user still could analyze in case of error).

I suppose this is a matter of taste, but I consider full verbosity to be "gentoo style output". Portage doesn't just log everything silently and break with a [ !! ].
Quote:
2: simplicity in grub.conf editing, i hate when scripts edits more than i would want to, and my script only copies my grub.conf, and replaces one string inside it.

And I hate it when scripts overwrite my grub.conf based on some pesky template. They should add to grub.conf, because I want a full list of previously compiled kernels to choose from.

The final diff should set anyone's mind at ease about the script editing "more than they would want it to." ... it is there so the modification can be checked for sanity.
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Thu Oct 13, 2005 8:55 am    Post subject: Reply with quote

mind you, the template you create yourself.
Back to top
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Thu Oct 13, 2005 10:08 am    Post subject: Reply with quote

Dlareh: Could you have it automatically mount and unmount /boot if needed?
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Thu Oct 13, 2005 10:44 am    Post subject: Reply with quote

Monkeh wrote:
Dlareh: Could you have it automatically mount and unmount /boot if needed?

Both already mount /boot if needed.
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?


Last edited by Dlareh on Thu Oct 13, 2005 10:50 am; edited 1 time in total
Back to top
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Thu Oct 13, 2005 10:46 am    Post subject: Reply with quote

Dlareh wrote:
Monkeh wrote:
Dlareh: Could you have it automatically mount and unmount /boot if needed?

Both already mount /boot if needed.


Do they? I must be blind.. Looked both over and didn't see anything... Yes, I am blind. I see it now. Thanks. I'll be giving it a try in a few minutes when python is done.
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Thu Oct 13, 2005 10:52 am    Post subject: Reply with quote

Monkeh wrote:
Dlareh wrote:
Monkeh wrote:
Dlareh: Could you have it automatically mount and unmount /boot if needed?

Both already mount /boot if needed.


Do they? I must be blind.. Looked both over and didn't see anything... Yes, I am blind. I see it now.

It would seem someone has yet to master CTRL+F ;)
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Thu Oct 13, 2005 11:05 am    Post subject: Reply with quote

Dlareh wrote:
Monkeh wrote:
Dlareh wrote:
Monkeh wrote:
Dlareh: Could you have it automatically mount and unmount /boot if needed?

Both already mount /boot if needed.


Do they? I must be blind.. Looked both over and didn't see anything... Yes, I am blind. I see it now.

It would seem someone has yet to master CTRL+F ;)


I'm lazy ;) Plus I prefer to look stuff over by myself.
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Thu Oct 13, 2005 11:16 am    Post subject: Reply with quote

i have the stuff with config too now.. if you wanna test before i put on my wiki.. its availiable here:

http://kaspersandberg.com/~redeeman/dokernel

the only thing i need to figure out, is how to make it hide the compile messages of make menuconfig, it should work fine.

output like this(with removed menuconfig messages):
Code:
 * Beginning installation procedure for "2.6.14-rc4-git1" ...
 *  No kernel config found, searching for best availiable config ...
 *   Foung config from running kernel, updating to match target kernel      [ ok ]
*  Menuconfig requested, invoking ...                                       [ ok ]
*  Kernel build not uptodate, compiling ...
 *   Module support in kernel detected, building modules                    [ ok ]
 *  Merging kernel to system (Buildnumber: 1) ...
 *   Copying bzImage to "/boot/2.6.14-rc4-git1-1"
 *   Copying System.map to "/boot/System.map-2.6.14-rc4-git1"
 *   Installing modules to "/lib/modules/2.6.14-rc4-git1/"                  [ ok ]
 *  Looking for external kernel modules that need rebuilding ...
 *   Recompiling outdated module "app-laptop/acerhk-0.5.27" ...             [ ok ]
 *   Recompiling outdated module "media-video/ati-drivers-8.18.6" ...       [ ok ]
 *  Grub template found, Editing kernel entry in GRUB ...                   [ ok ]


to make menuconfig come - use --menuconfig
Back to top
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Thu Oct 13, 2005 12:15 pm    Post subject: Reply with quote

That (Dlareh's version) worked rather nicely, missed two things however: initrd and root lines in grub.conf.
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Thu Oct 13, 2005 12:34 pm    Post subject: Reply with quote

Monkeh wrote:
That (Dlareh's version) worked rather nicely, missed two things however: initrd and root lines in grub.conf.

did mine not work?

edit:btw, if you use grub.conf editing as i do in my versions of the script, root= will be preserved to your liking.

about initrd.. what do you need it for? just for the sake of it, or to do stuff like lvm? describe the process you do to create an initrd.
Back to top
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Thu Oct 13, 2005 12:43 pm    Post subject: Reply with quote

I haven't tried yours, if I had I would've commented on it also.

root=/dev/hda6 was preserved, root (hd0,1) was not. As for the initrd, it's for fbsplash. I can reuse the same one over and over, it just didn't re-use the line when editing grub.conf.
Back to top
View user's profile Send private message
Redeeman
l33t
l33t


Joined: 25 Sep 2003
Posts: 958
Location: Portugal

PostPosted: Thu Oct 13, 2005 12:45 pm    Post subject: Reply with quote

oh well..
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Thu Oct 13, 2005 2:12 pm    Post subject: Reply with quote

Monkeh wrote:
That (Dlareh's version) worked rather nicely, missed two things however: initrd and root lines in grub.conf.

I explained that you need to customize the NEW_GRUB line if you wish to use the root= syntax. For example:
Code:
NEW_GRUB="title=Linux ${FULLVER}-${BUILDNO} $(date)\nroot=(hd0,1)\n$NEW_LINE"

I don't know much about initrd, but of course you can just do that part manually.
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Thu Oct 13, 2005 2:21 pm    Post subject: Reply with quote

Dlareh wrote:
Monkeh wrote:
That (Dlareh's version) worked rather nicely, missed two things however: initrd and root lines in grub.conf.

I explained that you need to customize the NEW_GRUB line if you wish to use the root= syntax. For example:
Code:
NEW_GRUB="title=Linux ${FULLVER}-${BUILDNO} $(date)\nroot=(hd0,1)\n$NEW_LINE"

I don't know much about initrd, but of course you can just do that part manually.


Once again, I miss things by skimming. I apologise.

As for the initrd, it wouldn't be hard to check for an initrd line containing fbsplash and copy that, would it? (I'm not overly good at scripts)
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Fri Oct 14, 2005 4:57 am    Post subject: Reply with quote

Monkeh wrote:
Dlareh wrote:
Monkeh wrote:
That (Dlareh's version) worked rather nicely, missed two things however: initrd and root lines in grub.conf.

I explained that you need to customize the NEW_GRUB line if you wish to use the root= syntax. For example:
Code:
NEW_GRUB="title=Linux ${FULLVER}-${BUILDNO} $(date)\nroot=(hd0,1)\n$NEW_LINE"

I don't know much about initrd, but of course you can just do that part manually.


Once again, I miss things by skimming. I apologise.

As for the initrd, it wouldn't be hard to check for an initrd line containing fbsplash and copy that, would it? (I'm not overly good at scripts)

If you usually re-use the same initrd for new kernels (again, I don't know much about initrd) then you can simply add it to the NEW_GRUB line. I can show you an example if you show me your grub.conf.
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
Monkeh
Veteran
Veteran


Joined: 06 Aug 2005
Posts: 1656
Location: England

PostPosted: Fri Oct 14, 2005 8:39 am    Post subject: Reply with quote

I think I can handle it.. Just \n and the initrd line after $NEW_LINE, right?
Back to top
View user's profile Send private message
Dlareh
Advocate
Advocate


Joined: 06 Aug 2005
Posts: 2102

PostPosted: Fri Oct 14, 2005 8:57 am    Post subject: Reply with quote

Monkeh wrote:
I think I can handle it.. Just \n and the initrd line after $NEW_LINE, right?

I guess so.
_________________
"Mr Thomas Edison has been up on the two previous nights discovering 'a bug' in his phonograph." --Pall Mall Gazette (1889)
Are we THERE yet?
Back to top
View user's profile Send private message
SteakTheMooCow
Tux's lil' helper
Tux's lil' helper


Joined: 02 Sep 2005
Posts: 99
Location: /dev/urandom

PostPosted: Fri Oct 14, 2005 10:21 pm    Post subject: Reply with quote

When I glanced at this in my 2% consciousness last night I thought "hell what a great idea." But what I was looking at was making a script myself to copy the bzImage, .config and System.map to /boot, renaming them to kernel-(ver), config-(ver) and System.map-(ver). The whole compile thing is OTT IMHO. Maybe its because I like compiling things :)

Anyway, I'm looking through both of your scripts now and I'll probably end up using a modified version. Thanks guys :)
_________________
Gentoo HP ProBook 6540b
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum