Re: booting from ISO image on HD?




Enrique Perez-Terron wrote:
> On Sat, 14 Jan 2006 13:23:41 +0100, laota <laota.zju@xxxxxxxxx> wrote:
>
> > Nice. Thank you, Peter.
> > But, what should i do after pivot_root? executing what? Can you make it
> > more clear?
>
> After pivot_root, exec /sbin/init.
>
> > 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....).
>
> Stop. Mount has two arguments, a device and a directory.
>
> In English (Unixish) people say they mount the device on the directory.
> Not the "on the device".

oh.. yes. My expression is not accurate.
>
> In the case of a loopback mount, the device is the loopback device.
> Before the actual mounting, the mount program sets up the association
> between the loopback device and the underlying file (the iso image).
>
> > So, the following device-probing code of
> > /linuxrc will believe that some CDROM device does exist and booting
> > happily.
>
> It seems like you are thinking that the "device-probing code" infers
> something from the fact that the link resides in the /dev/directory?
> Or from the fact that the link has a name starting with "hd"?
>
> What "device-probing code" are you referring to?
>
just as you said. The Knoppix /linuxrc enumerates /dev/hd?, /dev/sd?
and so on to find CDROM. So, I just make a 'fack CDROM' by means of
loopback device.

> Also be aware that a hard link is nothing but another file name.
> That is, if /dev/hdd is a hard link to /dev/loop1, then /dev/hdd and
> /dev/loop1 are two equivalent names of the same file. There is no
> way to tell which name is the "right" one.
>
yeah, I know, they are of the same inode.
/dev/hdd is a hard link to /dev/loop1, then all the work is actually
done by loopback. It is ugly. :(
>
> > 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, you
> > know the loop module should be of the same version as the kernel image
> > in the ISO image, so... tedious.
>
> But wait a minute, to run an initrd, you need a kernel! If the kernel is
> on the CD, how can you boot it from an initrd???

The kernel image is extracted from ISO image too. Then, all the kernel
image and modified initrd is provided to the bootloader.

>
> I suppose you are first booting a kernel, and the special initrd, from
> some other device, but you want that kernel to boot another kernel?
>
> In the following, I suppose you have the right kernel running.
>
> What shell runs your linuxrc? You need one that has the capability
> to test the name of the kernel. Are you using nash? From nash's
> manpage, it seems nash cannot do this. Find a statically linked shell,
> or include in the initrd the files required for dynamic linking.
>
> I suggest ash, it is much smaller:
yes, it is ash
>
> $ ldd /bin/ash
> linux-gate.so.1 => (0x00440000)
> libc.so.6 => /lib/libc.so.6 (0x00b7f000)
> /lib/ld-linux.so.2 (0x00b61000)
> $ ldd /bin/bash
> linux-gate.so.1 => (0x00f4c000)
> libtermcap.so.2 => /lib/libtermcap.so.2 (0x003dd000)
> libdl.so.2 => /lib/libdl.so.2 (0x00cd1000)
> libc.so.6 => /lib/libc.so.6 (0x00b7f000)
> /lib/ld-linux.so.2 (0x00b61000)
> $ ls -l /bin/ash
> -rwxr-xr-x 1 root root 98356 Jun 16 2004 /bin/ash
> $ ls -l /bin/bash
> -rwxr-xr-x 1 root root 686520 May 10 2005 /bin/bash
>
> For dynamic linking you also need /lib/ld-linux.so (a symbolic link)
> and whatever that link points to.
>
> > My mentor is also not happy with my
> > proposal, he wants some sort of pervasive support.(Oh My Godness...).
>
> Does he actually know what he wants? It may be your job to help him know
> better what he wants.

Sorry again for my expression skill.... We just want a mechanism that
allows us to boot from bootable Linux ISO image on harddisk. Just
pervasive support of 'boot from ISO on HD'. You can not say, ok,
Knoppix ISO can boot, but Slax ISO will not work. He even mentioned the
Fedora Core 4 ISO(4 disks, the first one bootable, you know). He said
it would be nice to complete a installation work by this 'boot from ISO
on HD' mechanism... I just wonder, how can i change to the second ISO
after the installation work of the first one is done... :(

>
> > So, it seems that the initrd solution is a little bit too high level.
> > (Maybe BIOS solution? I don't know... )
>
> Bios is not a good idea. A bios is very tightly adapted to the specific
> hardware of the computer, and cannot easily be transferred to other computers.
> Also, the bios is stored in a flash ram (it used to be a rom, then a prom
> or eprom, so it is often still referred to as a prom). I suppose this flash
> ram does not usually have much more capacity than required by the bios it
> contains. The special code you need will likely not fit in whatever free
> room remains.

Exactly. BIOS is not a good solution, neither. Low level, lack of
portability and so on..
The Linux kernel always re-enumerates the perpheral devices by himself,
and then no longer make use of BIOS services.

> > So, I feel a little bit depressed now. It is possible on earth to 'boot
> > ISO on HD' theoretically??
>
> Absolutely. You need a specialized boot loader that creates the initrd
> on the fly, extracting the required module from the iso image. If the
> module is not there, assume it is compiled-in into the kernel itself.
>
hmmm.... then the bootloader should know the filesystem of my harddisk
and iso9660, isn't it ? I think these functions should be performed in
the 'stage 2' of this bootloader and leave the 'stage 1' programe
written in ASM(and compiled and install to the boot sector) untouched.
what do you think? maybe I can refer to the GRUB code.

yes, we can create a new initrd, but we still need the functions in the
original initrd on ISO, just extract and call the /linuxrc within the
original initrd?

> English: "Why on earth". "Possible at all".

haha, thanks, Enrique, sorry for my poor English
>
> -Enrique

.



Relevant Pages

  • Re: booting from ISO image on HD?
    ... bootable ISO image should have exactly the same performances as booting ... That is, kernel image, modules, application programs and so ... >> through customized initrd files for each one. ... you can boot the kernel of your ...
    (comp.os.linux.misc)
  • 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?
    ... 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: [FreeBSD] Fix for ServerWorks HT1000 in upcoming 7.1?
    ... I've tried to make a new 7.1-BETA bootable ISO from the ... box to build a 7.x kernel though. ... However I'm unable to umount it! ... I'm now downloading a 7.1-BETA-livefs ISO and I'll try next to boot ...
    (freebsd-stable)