Re: issue in init/main.c - prepare_namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "john" == John Tyner <jtyner@cs.ucr.edu> writes:

Hi

john> I'm working on a pet project in my spare time in which the root device is
john> not known at kernel compile time. So, I load the ramdisk and linuxrc does
john> the work of finding the root device and mounting it and so on. When my
john> linuxrc exits; however, the code above tries to mount what it thinks
john> should be the root device (and usually panics). Am I doing something wrong
john> here?

john> Second, the inner if doesn't seem necessary to me. Since the outer if
john> determines that ROOT_DEV is a ramdisk and that real_root_dev is not the
john> same as ROOT_DEV, the inner if will always succeed.

Read mkinitrd from RH or Mandrake (I think that others also use it,
but I don't know), and you will see that they do the change_root
(calling pivot_root()) themselves, for instance that is what a
Mandrake initrd does (RH does basically the same module devfs issues).


<load misc modules here>
echo Mounting /proc filesystem
mount -t proc /proc /proc
echo Creating root device
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
umount /proc
echo Mounting root filesystem 
mount --ro -t ext3 /dev/root /sysroot 
pivot_root /sysroot /sysroot/initrd
echo Remounting devfs at correct place if necessary
handledevfs


Notice the mkrootdev call, it clereates /dev/root
in real_root_dev, you change the value of real_root_dev that you see
in the previous code to the value that you want, then mount the root
filesystem.

Notice that here, the system get a lot of trouble to be sure that / is
mounted from /dev/root, you possible don't need that, the important
part is the real_root_dev and the pivot_root calls.

This is nasm shell script, you can download it from the mkinitrd, it
only have  a couple of commands (you can see almost all that it can do
in that script).

Yes, linux boot sequence is a mesh, but it appears that in 2.5 it will
be much nicer.

Hope this helps.

Later, Juan.


-- 
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux