I want to modify linux kernel so that it can mount vhd files and starts from it...please give me some idea!!! As we know that linux kernel mount hardisk partitions after the initrd.gz is loaded...i want that instead of mounting the linux partiton it should mount a vhd file located some where in the harddisk which containes ubuntu installed and start the system from it. Windows 7 support this feature of booting from vhd but ubuntu does not..so that y i was asking that how we can modify the kernel for this purpose. Thank You
This will not be easy at all.
To start loading Linux a bootloader is used. This program locates the vmlinux or vmlinuz file and the initrd file and loads them into RAM.
I assume your VHD file is stored on a NTFS filesystem. Inside the VHD file are the vmlinuz and initrd files.
So first, the bootloader will need to understand NTFS. Next, the bootloader will need to understand VHD.
Only after that can Linux even begin to load.
At that point, things become easier because Linux has NTFS filesystem drivers that you can use. Probably the NTFS-3G user-space driver combined with FUSE. I am not sure of the VHD formats but you could use vdfuse from VirtualBox to mount it.
The NTFS and VHD mount programs would have to go inside the initrd. Then the initrd can mount the root partition from the VHD and proceed into normal Linux user-space.