boot loader that can read from partition? - Linux

This is a discussion on boot loader that can read from partition? - Linux ; phil-news-nospam@ipal.net wrote: > Where would this map file be? One thing I want to avoid is the boot > loader storing anything it needs in any filesystem. I want to be able > to zero-out and reformat every filesystem and ...

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 21 to 25 of 25

Thread: boot loader that can read from partition?

  1. Re: boot loader that can read from partition?

    phil-news-nospam@ipal.net wrote:
    > Where would this map file be? One thing I want to avoid is the boot
    > loader storing anything it needs in any filesystem. I want to be able
    > to zero-out and reformat every filesystem and still have the boot loader
    > be able to bring up a kernel.


    But you obviously can't zero-out and reformat every partition. The boot
    loader and kernel(s) have to live somewhere, right? That somewhere can
    be a small filesystem partition, which has the boot loader there, its
    configuration file, and kernel images. You can mount this under, hmm,
    /boot.

    Hey, wait a minute!

    But you know, if you zero out every filesystem, what is there to boot?
    You can't do anything if you don't have a root filesystem. If you have
    a way to create a root filesystem in a partition, then at the same time
    you can stick a vmlinux kernel image into its root directory. The boot
    loader that understands filesystems can then just find it. If the name
    hasn't changed, that loader doesn't even have to be reconfigured.

    So what you can do is have a dedicated partition which just holds Grub
    and its configuration file. No kernels.

    > Right now I'm playing around with QEMU. It has this option -kernel which
    > loads a kernel from a file it reads instead of depending on a boot loader.
    > This is actually kind of nice for when I am building a new system on a
    > 2nd disk drive. At some point that new drive is almost complete, but has
    > no boot loader. LILO seems to never get it right when trying to make one
    > drive (e.g. /dev/hdc) bootable for when it will be another (e.g. /dev/hda).


    But with grub, you can install the loader without having any kernels
    there, and just boot into Grub. Then with Grub you can probe around for
    the kernel image.

    > At the moment, my kernel resides in a partition that is a smallish (256MB)
    > system, along with lilo and many recovery tools. That partition is not
    > used during normal system operation which uses other full size partitions.
    > I would like to be able to easily rebuild that extra system partition but
    > not clobber the kernel when doing so. Hence the need for another partition.


    Right. A tiny partition with the boot loader, smallish partition with
    recovery tools, then bigger partitions. The tiny one with the
    bootloader can boot into everything using filesystem access to grab the
    respective kernels from there, and passing the right root=... option to
    that kernel.


  2. Re: boot loader that can read from partition?

    Kaz Kylheku wrote:
    > phil-news-nospam@ipal.net wrote:
    >
    >>So if I format the filesystem and put the kernel back in, GRUB will
    >>load it OK?

    >
    >
    > Not if Grub lives on that same filesystem. In that case, Grub has to be
    > reinstalled after the reformatting.
    >
    >
    >>If it understands and reads the filesystem (as opposed
    >>to the collection of a list of sectors that LILO does), I would think
    >>that it should. But where are those 100 kbytes hiding? if they are
    >>in the filessytem, they may be lost.

    >
    >
    > Grub's stage 1 boot loader uses a sector list to get Grub itself. Once
    > that is running, it has the filesystem support. It can read and execute
    > a configuration script file from the filesystem, which tells it how to
    > behave and where to find images. You can reconfigure all that without
    > having to update the Grub image or the boot sector.
    >


    The full GRUB can handle all the configured file systems,
    and as such it may be too large for the MBR to load. To
    solve the dilemma, there's also a stage 1.5 loader which
    understands one filesystem only (that one housing the stage 2
    binary). It this case, the boot sector loads the stage 1.5
    image as a block list, and stage 1.5 reads the file system
    (e.g. ext2/3) to load the full GRUB (stage 2).

    In normal case, the files of stage 1.5, stage 2, the GRUB
    configuration file and the kernel (with initram image) all
    reside on the boot partition file system.

    If you re-build the file system or move the stage loaded
    by the boot sector, you need to re-install GRUB.

    --

    Tauno Voipio
    tauno voipio (at) iki fi

  3. Re: boot loader that can read from partition?

    On 20 Oct 2006 22:24:44 -0700 Kaz Kylheku wrote:
    | phil-news-nospam@ipal.net wrote:
    |> So if I format the filesystem and put the kernel back in, GRUB will
    |> load it OK?
    |
    | Not if Grub lives on that same filesystem. In that case, Grub has to be
    | reinstalled after the reformatting.

    Then GRUB is not what I want. I want a boot loader that is independent
    of the contents of any filesystem.


    |> If it understands and reads the filesystem (as opposed
    |> to the collection of a list of sectors that LILO does), I would think
    |> that it should. But where are those 100 kbytes hiding? if they are
    |> in the filessytem, they may be lost.
    |
    | Grub's stage 1 boot loader uses a sector list to get Grub itself. Once
    | that is running, it has the filesystem support. It can read and execute
    | a configuration script file from the filesystem, which tells it how to
    | behave and where to find images. You can reconfigure all that without
    | having to update the Grub image or the boot sector.

    I think what I want is the kind of boot loader that used to come with the
    kernel that worked on floppies, but updated to understand a hard drive and
    where to find the kernel via the partition selected.

    --
    |---------------------------------------/----------------------------------|
    | Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
    | first name lower case at ipal.net / spamtrap-2006-10-21-1812@ipal.net |
    |------------------------------------/-------------------------------------|

  4. Re: boot loader that can read from partition?

    On Sat, 21 Oct 2006 07:59:04 GMT Tauno Voipio wrote:

    | The full GRUB can handle all the configured file systems,
    | and as such it may be too large for the MBR to load. To
    | solve the dilemma, there's also a stage 1.5 loader which
    | understands one filesystem only (that one housing the stage 2
    | binary). It this case, the boot sector loads the stage 1.5
    | image as a block list, and stage 1.5 reads the file system
    | (e.g. ext2/3) to load the full GRUB (stage 2).

    If all the additional sectors of GRUB were located contiguously and in
    correct sequence, it should not be a problem for MBR resident code to
    load it. But maybe it should just load the kernel, instead.


    | In normal case, the files of stage 1.5, stage 2, the GRUB
    | configuration file and the kernel (with initram image) all
    | reside on the boot partition file system.
    |
    | If you re-build the file system or move the stage loaded
    | by the boot sector, you need to re-install GRUB.

    Actually, I'm going to be re-building the file system _as_ part of the
    process of bringing the system up. So GRUB is not an option for me as
    long as some of it must reside in a filesystem.

    It would be an option to make sure the first partition is more than 63
    sector from the beginning of the drive, to accomodate a large boot
    loader there, if GRUB or some other loader can be made to work there,
    and provided no other programs expect to mess with that space which will
    be outside of any valid partition. How many sectors will GRUB need over
    the next 10 years?

    --
    |---------------------------------------/----------------------------------|
    | Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
    | first name lower case at ipal.net / spamtrap-2006-10-21-1815@ipal.net |
    |------------------------------------/-------------------------------------|

  5. Re: boot loader that can read from partition?

    On 20 Oct 2006 23:02:42 -0700 Kaz Kylheku wrote:
    | phil-news-nospam@ipal.net wrote:
    |> Where would this map file be? One thing I want to avoid is the boot
    |> loader storing anything it needs in any filesystem. I want to be able
    |> to zero-out and reformat every filesystem and still have the boot loader
    |> be able to bring up a kernel.
    |
    | But you obviously can't zero-out and reformat every partition. The boot
    | loader and kernel(s) have to live somewhere, right? That somewhere can
    | be a small filesystem partition, which has the boot loader there, its
    | configuration file, and kernel images. You can mount this under, hmm,
    | /boot.
    |
    | Hey, wait a minute!

    Yes, the kernel must be somewhere. But the program that will put the
    kernel in won't be running under Linux or anything that understand any
    Linux filesystem. When I described that the kernel would be written
    to the partition "as if I did" the "dd" command, I meant that some
    program would be writing the sectors linearly, not that it would be
    running under Linux.


    | But you know, if you zero out every filesystem, what is there to boot?
    | You can't do anything if you don't have a root filesystem. If you have
    | a way to create a root filesystem in a partition, then at the same time
    | you can stick a vmlinux kernel image into its root directory. The boot
    | loader that understands filesystems can then just find it. If the name
    | hasn't changed, that loader doesn't even have to be reconfigured.

    There will be a root filesystem. With the "early user space" feature of
    the kernel, it's approximately like having an initrd built into the kernel
    image itself (not separately loaded) ... though various namespace setups
    normally done by the kernel are now pawned off to the first user space
    program being run (which is not a problem).


    | So what you can do is have a dedicated partition which just holds Grub
    | and its configuration file. No kernels.

    Why not kernels? If you're going to have a filesystem, why not put the
    kernel there, too? That's actually what I do now, though with LILO, not
    GRUB. And it also happens to be a smallish root filesystem, too, for
    rescue purposes. But this next project involves not having any filesystem
    at all.


    |> At the moment, my kernel resides in a partition that is a smallish (256MB)
    |> system, along with lilo and many recovery tools. That partition is not
    |> used during normal system operation which uses other full size partitions.
    |> I would like to be able to easily rebuild that extra system partition but
    |> not clobber the kernel when doing so. Hence the need for another partition.
    |
    | Right. A tiny partition with the boot loader, smallish partition with
    | recovery tools, then bigger partitions. The tiny one with the
    | bootloader can boot into everything using filesystem access to grab the
    | respective kernels from there, and passing the right root=... option to
    | that kernel.

    What I have now is unrelated to this next project, aside from it being a
    learning and illustration example. What I need is a boot loader that can
    load a raw kernel image from a raw partition. I can't explain what this
    is about, but I know that having such a boot loader "leaps the barrier"
    to making these new ideas work.

    I asked for such a boot loader because it seemed appropriate to do that
    before writing my own (which I don't want to do). It seems enough people
    have joined in this thread that I can probably assume no such boot loader
    exists. I would have thought it would be the very first kind of boot
    loader long before anything that deal with filesystems one way (LILO) or
    the other (GRUB). What was around before LILO to load Linux from a hard
    drive?

    --
    |---------------------------------------/----------------------------------|
    | Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
    | first name lower case at ipal.net / spamtrap-2006-10-21-1821@ipal.net |
    |------------------------------------/-------------------------------------|

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2