On Fri, Jan 22, 2010 at 11:11 AM, AlannY <m@xxxxxxxxx> wrote: > On Fri, Jan 22, 2010 at 11:06:08AM -0500, Jim Pryor wrote: >> 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. > > It not helps at all. "Your" hooks runs before mounting root device. > I need to run my script after mount root, but before switch_root. > > At the end of /lib/initcpio/init, there are call to kinit > and it seems kinit mount root partition and do switch_root. > > Is it possible to write "hook" for kinit? As Michael said, look at what archiso or larch do. In effect, the use a custom hook script that does the mounting and kinit step themselves, basically abandoning the rest of the init script. > P.S. Why does Arch uses kinit, raw is not trusted? I have no idea what you're asking here. We use kinit because, when this was created, it was a quick and robust way to do this that didn't require major overhauls or any packages.