Re: Kernel setup() and initrd problems

From: Kevin P. Fleming (kpfleming@cox.net)
Date: Thu Mar 13 2003 - 13:05:43 EST


Kai Germaschewski wrote:
> I think whoever came up with that just got the idea of pivot_root wrong.
> The idea was to get rid of the initrd special case. It should be possible
> to do the following, though I didn't work out the details:
>
> Tell the kernel that our root dev is /dev/ram and give it an initrd which
> isn't really a classical initrd (with /linuxrc on it), but instead has a
> /sbin/init which is similar to the linuxrc above.
>
> Then, the kernel will load the image into /dev/ram, mount that as root and
> exec /sbin/init, skipping the special initrd code.
>
> Now, we have to take care of all the remaining business in /sbin/init
> ourselves, i.e.
>
> - load modules
> - mount real root
> - pivot root to real root
> - execve /sbin/init on real root, pointing stdin/out/err to /dev/console
> on the new root
> - umount and free our first (ramdisk) root

I have used exactly this process, and it works as you expect. In this
situation you're not really using the initrd as a "classic" initrd, it's
just a temporary root filesystem. The kernel has no idea what the real
root is going to be, and that determination isn't made until the
initrd's scripts decide what to mount and then pivot_root to it.

Much cleaner than the old way.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:36 EST