开发者_如何学JAVA
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionPlease tell me the working if wubi installer.If we install ubuntu inside windows,in boot.ini file there is an entry for ubuntu loader.But how the kernel starts?How the root.disk file mount before loading kernel?
The Windows bootloader is capable of starting operating systems other than just Windows. I can't speak to Wubi specifically as I haven't looked at their code but I developed a similar solution a couple years ago that worked equivalently. Basically, you do the following:
Booting
- Put a copy of the kernel and a custom initrd in a file on the C:\ drive
- Place a file containing contents of the root file system (probably a SquashFS image file) on the C:\ drive as well
- Configure the windows bootloader to load the linux kernel as one of items on the boot menu using your custom initrd and passing in the location of the file system image file as a boot parameter (how this is done depends on the version of windows being used... big differences between XP and Vista)
Early Userspace in the Initrd
- Mount the windows C:\ drive using ntfs-3g
- Parse the command line arguments to determine where your root filesystem image is
- Loopback mount the image file to a subdirectory such as
/read_only_root
- Configure a UnionFS or AUFS mount to provide a writeable overlay to the read-only root file system. You can use the posixovl filesystem to use a native windows directory or create a fixed-size ext3 filesystem inside a file on the windows C: drive
- Once all the mounting magic is completed and you have a directory that looks like a writeable root filesystem, use
pivot_root
to convert it into the new root directory - exec
/sbin/init
精彩评论