Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 95335 - genkernel - add feature to run script before initrd packed
Summary: genkernel - add feature to run script before initrd packed
Status: VERIFIED WONTFIX
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-07 04:57 UTC by Alon Bar-Lev (RETIRED)
Modified: 2005-06-23 05:45 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alon Bar-Lev (RETIRED) gentoo-dev 2005-06-07 04:57:11 UTC
First of all I enjoy using genkernel!

I recommend adding a initrd_prepack script to genkernel.conf so that genkernel
will execute this script with the mounted location of the initrd image just
before it shrink and comporess it.

I also recommend adding argument that forces genkernel to re-create its cache
(Or check time stamp of cached files and compare them to source and config)



Reproducible: Always
Steps to Reproduce:



Expected Results:  
If you will add prepack script to genkernel.conf users will be able to add files
modify linkes to initrd in a simple way, as part of the kernel generate procedure.

This without the need to remount the initrd copy its content, create a larger
initrd, copy original initrd contents, modify contents and pack it again.

I had needed it when I tried to create my custom initrd.

I needed to use "stty -echo" in my initrd and add my own module to initrd and
some file.

genkernel default configuration for busybox does not have stty enabled... So
I've enabled this (this was simple enough), but then discovered that the
/bin/XXX linkes to busybox are hardcoded in genkernel scripts.

I've also needed to copy a module and some files to the initrd and couldn't.

All these issues can be solved using a script that can be configured to run
before genkernel pack the initrd.
Comment 1 Tim Yamin (RETIRED) gentoo-dev 2005-06-15 12:12:31 UTC
Look into genkernel-3.2.0_pre5 and --initramfs_overlay=<...> -- if that doesn't
do what you need it to, please reopen this bug. Thanks!
Comment 2 Alon Bar-Lev (RETIRED) gentoo-dev 2005-06-15 13:19:49 UTC
Thank you for your reply.

As I understand this replaces genkernel's initrd.

I like the initrd that genkernel creates! 
It has all the basics... It saves me a lot of work.
I just need to modify it (a little)...

So if there was a script (callback or something) that allows me to add files,
devices, links before it being packed it would be super!

I guess the right place is to add parameter like --initrd-callback=xxx that runs
a specific command before initrd is packed, it should get the file system where
initrd files exists.
Comment 3 Tim Yamin (RETIRED) gentoo-dev 2005-06-21 10:13:14 UTC
No, it doesn't replace, it concatenates onto the one genkernel builds :)
Comment 4 Alon Bar-Lev (RETIRED) gentoo-dev 2005-06-22 03:09:38 UTC
Hi!

I've installed version 3.2.0_pre9, found that it always compiles initramfs... So
it took me a while to convert my stuff to initramfs, and it working fine! I
loved the new splash behavior.

The new initramfs_overlay allows me to add new devices and files as you suggested.

A few comments:

1. [Maybe it is silly question] I added a stty applet to busybox... How can I
use initramfs_overlay in order to create hard link of busybox to stty?

2. Can you consider adding stty to default configuration of busybox? (It is
handy when prompting the user for password).

3. There is newer busybox ebuild available, why do you use the old one in
genkernel? (The new one support mount bind)

4. I see you added %%ARCH%% to kernel image name... I think you may consider
adding it to initramfs image too, so both will have the same prefix.

5. Is it safe to remove /lib/modules/* from initramfs while modules that where
loaded from there run? (This happens just before the end of the linuxrc script).

Thanks!
Comment 5 Eric Edgar (RETIRED) gentoo-dev 2005-06-22 09:10:04 UTC
Hi!

I've installed version 3.2.0_pre9, found that it always compiles initramfs... So
it took me a while to convert my stuff to initramfs, and it working fine! I
loved the new splash behavior.

The new initramfs_overlay allows me to add new devices and files as you 
suggested.

A few comments:

1. [Maybe it is silly question] I added a stty applet to busybox... How can I
use initramfs_overlay in order to create hard link of busybox to stty?

This should link automatically.  The new linuxrc should have taken care of it 
since your using an initramfs.

2. Can you consider adding stty to default configuration of busybox? (It is
handy when prompting the user for password).
We are trying to keep the size down for livecd's and machines with less ram. 
and you can override the busybox config so this probably wont change.

3. There is newer busybox ebuild available, why do you use the old one in
genkernel? (The new one support mount bind)
We have to test it.  and there are a few patches that we need to make sure work 
with the new busybox or are fixed already.  Basically we havent had time.  if 
you want to try it go ahead and let us know how it worked.


4. I see you added %%ARCH%% to kernel image name... I think you may consider
adding it to initramfs image too, so both will have the same prefix.
It should be naming the initramfs image with arch as well.


5. Is it safe to remove /lib/modules/* from initramfs while modules that where
loaded from there run? (This happens just before the end of the linuxrc script).
Yes since these are loaded into memory and this is what other distros do as 
well.  This reclaims some of the ramdisk used for the initramfs otherwise it 
would keep the ram in use and your machine would look like it had less.
Thanks!
Comment 6 Alon Bar-Lev (RETIRED) gentoo-dev 2005-06-23 05:43:11 UTC
Thanks you for your comments!
I am closing this request.
Comment 7 Alon Bar-Lev (RETIRED) gentoo-dev 2005-06-23 05:45:18 UTC
Closed.