[arch-general] initramfs: execute own script

Ray Kohler ataraxia937 at gmail.com
Fri Jan 22 10:56:40 EST 2010


On Fri, Jan 22, 2010 at 10:39 AM, AlannY <m at alanny.ru> 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?

It sounds like you should be able to put your script in
/lib/initcpio/hooks and maybe a detection script for it in
/lib/initcpio/install. Then add it to HOOKS in /etc/mkinitcpio.conf
and rebuild the initramfs with "mkinitcpio -p kernel26". This is
provided by the mkinitcpio package.

I've never actually done this myself, so hopefully someone more
knowledgeable will come by.


More information about the arch-general mailing list