Re: booting from ISO image on HD?



Thanks very much, Peter. It is really nice of you for providing me so
many valuable adivces.

Yes, my boss did require an all-in-one solution. Booting from a
bootable ISO image should have exactly the same performances as booting
from CDROM. That is, kernel image, modules, application programs and so
on, shoule be of no differences. So, I have no right to boot a
customized kernel image and only regard the bootable ISO image as a
normal data ISO image. Sorry for my poor English. I hope you can
understand the case.

Peter T. Breuer wrote:
> 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.

definitely true!

> 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,
~~~~~~~~~~~~~~~the one on ISO image?

> however, and that needs bios support or other support. For example,

oh... BIOS......

> booting freedos and then running loadlin is a good way to start out.

nice! a new idea! Using LOADIN to chain-load the isolinux(for example)
on the ISO image? Are there any tools similar to LOADIN under
Linux?(or, only freedos can do)
Is it possible not bringing up an OS and booting from the ISO on HD
directly?(I know, it is not easy...)

> 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.

retrieve the boot record file from ISO or create a new one? it is
chain-load, isn't it?

>
>
> > It would be nice if there are some similar
> > projects I can ture to.
>
> It's not clear what you want.
>
> Peter

.



Relevant Pages

  • Re: booting from ISO image on HD?
    ... I'm not going to write the pivot root script, ... > through customized initrd files for each one. ... I have to insmod the loop kernel module(e.g. ... The idea is that either you build what you need to boot into your ...
    (comp.os.linux.misc)
  • Re: booting from ISO image on HD?
    ... >> through customized initrd files for each one. ... > between the loopback device and the underlying file (the iso image). ... I have to insmod the loop kernel module(e.g. ... how can you boot it from an initrd??? ...
    (comp.os.linux.misc)
  • Re: booting from ISO image on HD?
    ... I don't think you can predict every concievably thing a distro initrd can do. ... the only purpose of the initrd is to 1) find out what kernel modules are ... there is a hard disk where that iso image resides. ... The normal boot mechanism starts with the bios loading a boot loader ...
    (comp.os.linux.misc)
  • Re: [SOLVED] incredible solution Re: install of fedora FC4 with ASUS mobo
    ... after it tells u it cant find an image just press enter to boot normally ... The message you told about is the initrd that is being loaded. ... that, the kernel has been loaded, but not yet started. ... The CD too has a boot loader, ...
    (comp.os.linux.setup)
  • Re: After YUM update New Kernel not recognized
    ... >> other way to complete the recognition process of the updated kernel. ... create an ISO image for a bootable CD. ... the iso image file created. ... computer to see if the newly created Boot CD w/ kernel is good. ...
    (Fedora)