Re: booting from ISO image on HD?
- From: "Peter T. Breuer" <ptb@xxxxxxxxxxxxxxx>
- Date: Sat, 14 Jan 2006 14:13:31 +0100
laota <laota.zju@xxxxxxxxx> wrote:
> But, what should i do after pivot_root? executing what?
A new init, I would say. Don't you want to run your init system once
the new root is in place? I'd want to exec /sbin/init 3 or something
like that.
> Can you make it
> more clear?
I'm not going to write the pivot root script, since I recall the last
time I did one it took me days of painful experiment to avoid all the
pitfalls that should have been obvious - but then I was squeezing the
image down as far as I could ... Oh, very well, here's one I did:
# mount proc on ramdisk
mount /proc
depmod -a
while read module options; do
case $module in ""|'#'*) continue ;; esac
modprobe $module $options
done < /etc/modules
raidstart -a || raidstart /dev/md/1
# mount real root on ramdisk
mount /rootfs || exit 1
cd /rootfs || exit 2
mkdir -p initrd || exit 3
mount -ro remount /rootfs
# unmount proc and pivot to real root with ramdisk
# mounted on /initrd
umount /proc
pivot_root . initrd || exit 4
# remount and have a look around
mount /proc
umount /initrd
umount /proc
exec chroot . sbin/init <dev/console >dev/console 2>&1 || sh
#
#umount /initrd
#blockdev --flushbufs /dev/ram0
> Several days ago, I have successfully booted Knoopix and Slax LiveCD
> through customized initrd files for each one. I extract the initrd file
> from the ISO image ,modify the /linuxrc within the inird file, specify
> the customized initrd file in the 'initrd=' kernel parameter, and make
> it! At the beginning of the /linuxrc file, I add some commands which
> mount the ISO file to some place like /dev/hdd(hardlink to a loopback
> device, really ugly....). So, the following device-probing code of
> /linuxrc will believe that some CDROM device does exist and booting
> happily.
OK, whatever.
> But, my initrd mechanism does have many drawbacks. For each ISO, I have
> to provide a modified version of initrd. No common initrd is possible,
> because in most cases, I have to insmod the loop kernel module(e.g.
> loop.ko for 2.6.x kernel) before mounting the loopback device,
Well, you can always do that on spec. It doesn't matter if it fails -
it's either already in kernel or nothing worse can happen since you will
fail elsewhere lower down anyway now.
> you
> know the loop module should be of the same version as the kernel image
> in the ISO image,
Sure, but that goes without saying. One generally matches the initrd to
the kernel, since it is usually used to house some modules. I usually
have a few trees in there ...
% ls lib/modules/
2.2.18pre18-SMP/ 2.4.3-SMP-XFS/ 2.4.6-SMP-XFS/ 2.4.8-SMP-XFS/
> so... tedious. My mentor is also not happy with my
> proposal, he wants some sort of pervasive support.(Oh My Godness...).
> So, it seems that the initrd solution is a liitle bit too high level.
> (Maybe BIOS solution? I don't know... )
I really don't see the problem .. you can boot the kernel of your
choice with the initrd of your choice as target, no? If your kernel does
not support iso9660 then you are stuffed, so I don't see why you should
cmplain about being stuffed if it does not support loop. What's in a
name? The idea is that either you build what you need to boot into your
kernel, or you put it in the initrd, and in the latter case you have to
match the initrd to the kernel.
> So, I feel a little bit depressed now. It is possible on earth to 'boot
> ISO on HD' theoretically??
I believe your boss wants an all-in-one solution, all in a cd image
rather than having a cd image plus a kernel plus a ramdisk image plus a
cd image. As far as I'm concerned, there's no difference, since you can
put all those three things in one file and manage the trick via offsets
or other magic. You still have to boot your kernel or its bootloader,
however, and that needs bios support or other support. For example,
booting freedos and then running loadlin is a good way to start out.
But, no, the bios CANNOT "boot from" an arbitrary place on an arbitrary
hard disk - the best you can do is place some boot record in the boot
sequence of some boot loader that will do it after the bios has booted
IT. If I were you I would place the kernel image bundle on disk, then
generate a boot record file (512B) that will boot it while it is in that
place, then add that boot record file reference to windows boot.ini
file.
> It would be nice if there are some similar
> projects I can ture to.
It's not clear what you want.
Peter
.
- Follow-Ups:
- Re: booting from ISO image on HD?
- From: laota
- Re: booting from ISO image on HD?
- References:
- booting from ISO image on HD?
- From: laota
- Re: booting from ISO image on HD?
- From: Peter T. Breuer
- Re: booting from ISO image on HD?
- From: laota
- booting from ISO image on HD?
- Prev by Date: Re: Read only hard drive !
- Next by Date: Re: Ripping a DRM'd CD and Rootkit?
- Previous by thread: Re: booting from ISO image on HD?
- Next by thread: Re: booting from ISO image on HD?
- Index(es):
Relevant Pages
|