[arch-general] initramfs: execute own script

Jim Pryor lists+arch-general at jimpryor.net
Fri Jan 22 11:06:08 EST 2010


On Fri, Jan 22, 2010 at 06:39:58PM +0300, AlannY wrote:
> Hi there. I'm newbie in Archlinux's boot process.
> 
> I need to run my own script in early userspace (initramfs).
> It must be after mounting root file system, but before switch root.
> 
> I've opened default initramfs (kernel26.img) and reviewed it's content.
> So, Archlinux uses some kind of tool called 'kinit'. And it seems,
> that this tool mounts root and then switch.
> 
> How to run my own script in kinit? Where can be found documentation of kinit?
> 
> Thanks for patience.

The best way I found to do this was to read the source for the /lib/initcpio/{init,init_functions}
look at some of the pairs /lib/initcpio/{hooks,install}/foo for
different foo. However, you have to realize that you only have a
restricted set of binaries and shell commands available then.

Also, Arch is in the process of moving to a different initcpio system.
It's not in any of the repos yet, but is in the pipeline. I haven't
fully understood what the changes will be. I think they're getting rid
of the use of klibc.

I expect others who do know better will chime in.

-- 
Jim Pryor
profjim at jimpryor.net


More information about the arch-general mailing list