On 09/12/12 05:03, Khoa Nguyen wrote:
> Can you tell me more about busybox ?
> What do you mean "busybox in an initramfs" ?
>
> I understand that due to failed boot process because the kernel can't 
> mount the root file system to read /etc/inittab.
> So we use busybox to mount manually . Right ?
>
When the kernel boots, it mounts the root file system and executes 
/sbin/init from there.
/sbin/init becomes process number one, and is responsible for system 
initialization (eg. running rc.d scripts and more).

But the kernel does not understand boot=<uuid>, only 
boot=<path-to-device>, and if for some reason the kernel can not mount 
the root file system, you are stuck.

Initramfs is a compressed archive of files. The initramfs file is read 
from disk by grub and passed to the kernel. The kernel is then mounting 
this (as a ramfs ) as the root filesystem and executes /sbin/init.
See
http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Introducing-initramfs-a-new-model-for-initial-RAM-disks/
http://lugatgt.org/content/booting.inittools/downloads/presentation.pdf
http://kaarpux.kaarposoft.dk/packages/l/linux.html

The /sbin/init in the initramfs can then do whatever is necessary to 
mount the real root filesystem from disk, and finally run /sbin/init on 
the real root file system. Or it can run a whole system directly from 
the initramfs, never touching your disk.

My init file in the initramfs looks like this:
http://sourceforge.net/p/kaarpux/code/ci/HEAD/tree/master/packages/l/linux.files/init?force=True

It basically mounts the /proc /sys and /dev special directories, finds 
the real root file system and mounts it, and finally executes /sbin/init 
on the real root file system.

However, if something goes wrong (or if you specify busybox on the 
command line) it will drop into a /bin/sh shell from busybox.

BusyBox combines tiny versions of many common UNIX utilities into a 
single small executable. It provides replacements for most of the 
utilities you usually find in GNU fileutils, shellutils, etc.
See
http://busybox.net/
http://kaarpux.kaarposoft.dk/packages/b/busybox.html

My way of building the initramfs:
http://kaarpux.kaarposoft.dk/packages/l/linux.html
http://sourceforge.net/p/kaarpux/code/ci/HEAD/tree/master/packages/l/linux.yaml 
(line 128-145)

Good luck...

/Henrik
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to