On May 17, 10:51 am, "Rod Pemberton" <do_not_h...@notemailnotq.cpm>
wrote:
...
> > [...] I remember
> > complaining about some of the popular ones because the boot
> > process of the whole machine becomes dependent on the
> > partition that contains one OS they are written for.
>
> "I feel exasperated that Syslinux, Grub and Lilo apparently
> load their second stages from fixed locations - often within a
> Linux partition or, if not, from somewhere on the disk that
> has no protection."
>
> James Harris, "Per-OS boot benefits" thread,
> alt.os.development, 4/22/
12news:c280e519-b2d2-4fb3...@e42g2000yqa.googlegroups.com
>
> (I bet you didn't expect that... ;-)
You are right, I didn't! That person talks my language. ;-)
>
> > [...] (a variant of Syslinux) [...]
> >
http://www.syslinux.org
>
> Does SYSLINUX have a new website? I recall seeing SYSLINUX and
> it's numerous other confusing, variant bootloaders, with
> inadequate descriptions a few times over the years. However, I
> don't recall that website. It's more informative than anything
> I've seen on SYSLINUX so far...
I don't think it's new as I found a link to it from a year ago but the
content may have been changed significantly.
> > I came across a comment earlier today about Extlinux (a variant
> > of Syslinux) that it was "well-behaved" because it sits in a
> > single partition.
>
> >
http://www.syslinux.org/wiki/index.php/EXTLINUX
>
> "Note that EXTLINUX installs in the filesystem partition like a
> well-behaved bootloader :) Thus, it needs a master boot record in
> the partition table; the mbr.bin shipped with SYSLINUX should
> work well."
>
> 'mbr.bin' in the quote on the EXTLINUX page links to an MBR page:
http://www.syslinux.org/wiki/index.php/Mbr
>
> Wikipedia has some information:
http://en.wikipedia.org/wiki/SYSLINUX
>
> It mentions "Hardware Detection Tool (HDT)". I don't recall
> seeing that project. That might be worth a look.
http://hdt-project.org/
Interesting. It seems the Syslinux family (which is/are really badly
named!) has a com32 plugin interface which others have hooked in to. I
found there is a presentation about Syslinux at
http://www.youtube.com/watch?v=wZB8KxXdiKg
> > IIUC this means that the MBR simply needs the partition
> > containing Extlinux to be the one flagged as bootable. That
> > allows other partitions' VBRs to be made bootable simply
> > by moving the MBR's boot flag.
>
> Yes, possibly...
>
> Unfortunately, the mbr page above doesn't describe the
> functionality and operation of mbr.bin very well.
I don't think it matters much. AIUI that mbr.bin is just something
generic that can be used to replace an MBR which has been trashed or
overwritten.
> Have you disassembled mbr.bin to confirm what it does?
> It's only 512 bytes.
No. I don't think this MBR is too important. AIUI one could use a
Microsoft MBR just as easily.
> I.e., at this point, I don't know if partition is hardcoded, or if
> it selects the partition marked with the boot flag, or if it uses
> the boot flag or not... Personally, I'm suspicious that mbr.bin
> only selects the first partition. Why? Because, the mbr page
> says: 1) altmbr.bin boots a fixed partition, 2) altmbr.bin is only
> one byte shorter than mbr.bin, 3) there are three variations of
> altmbr.bin, e.g., for the 2nd, 3rd, 4th partitions. The one byte
> difference implies to me that mbr.bin and altmbr.bin are actually
> the same code, with mbr.bin set to boot the 1st partition. Does
> this follow?
I don't know but I doubt it. There is plenty of space in an MBR to
choose a single bootable partition by boot flag.
HPA seems, though, to have made an effort to cope with those BIOSes
that fail to set DL correctly so there are variants of his MBR.
> > So, what do you think of it?
>
> Well, I've never used it, or the others they provide. AIR, you
> seem to prefer VBR code to MBR code, e.g., to allow multiple OS
> support.
When we looked at this before (about a year ago as it happens) I
wondered if there was a way to boot linux from a VBR. It turns out
that Extlinux does it. I have replaced Grub with Extlinux on a test
machine and it is fine.
For anyone else who is interested I followed the notes at
http://shallowsky.com/linux/extlinux.html
http://www.syslinux.org/wiki/index.php/EXTLINUX
Because Grub had set up its own MBR I had to overwrite it. I used the
mbr.bin file you mentioned earlier. The surprising thing is that it
can be simply copied to the disk device with
cat mbr.bin > /dev/XXX
Whenever I have seen dd used for suchlike it has included conv=notrunc
so I assumed that a normal file copy would do something more than just
copy bytes. But the command worked and overwrote just the bytes prior
to the partition table keeping the partition table etc intact.
For some reason apt-get didn't seem to recognise anything called Grub
that it could remove so after replacing it and rebooting on Extlinux I
deleted Grub folders and files manually. I think I kept only those
files with grub in the name were part of the package cache. In
particular /boot/grub was removed and, yes, the system still reboots!
Booting with Extlinux doesn't look much different to Grub. In fact I
wasn't sure it had been replaced at first. But the main thing is it
boots Linux and does so from the Linux partition, not from the MBR.
Cool!
Note to self: must remember to try a removable media boot in case the
hard disk Extlinux system gets trashed.
> > Is it a good scheme or a bad scheme [...]?
>
> Yes, it'd be nice if the bootloader selects the partition marked
> as active, doesn't attempt to boot partitions not marked as
> active, and doesn't hardcode the partition entry the mbr expects
> to boot.
I think the Microsoft MBRs do that.
http://thestarman.pcministry.com/asm/mbr/STDMBR.htm
So do lots of others.
> > [...] would you say it is "well-behaved"?
>
> What would be considered "badly-behaved" in this instance?
Terms are often debatable. I would settle for saying it is better
behaved than Grub's because it doesn't interfere with other boot
mechanisms. Different elements can and should be able to work well
together without treading on each other's toes.
This was the old complaint about Microsoft, that they would do their
own thing and never mind working with anyone else. Grub and possibly
Lilo seem similar. Extlinux, while I don't like that it still seems to
load fixed blocks to get its next stage running, does at least play
nicely with other systems.
> I.e., I'd need to eliminate everything on the "infinite" list of
> bad behaviors to say something is "well-behaved". That doesn't
> mean that some designs aren't better. Some are. Multi-boot with
> it's so-called "a.out kludge" is good for starting compiled C
> code.
>
> E.g., are these bad behaviors? What else?
> 0) doesn't work with values other than CS=0, IP=0x7C00?
> 1) fails to check if the VBR "code" is bootable or executable?
> 2) fails to set A20, enable PM, call E820h?
> (i.e., some missing 'feature' needed by VBR...)
> 3) ignores the boot flag?
> 4) hardcodes the partition to boot?
> 5) hardcoded filesystem support?
> 6) hardcoded tracks and sectors?
> ...
>
> I'm not sure all of these can be solved in a 512 byte bootloader.
> E.g., I'm really not sure how a 512 byte bootloader would satisfy
> #1 above in all circumstances. If EXTLINUX required a header or
> magic value or checksum in the VBR in order to confirm it could
> boot, then it could satisfy #1. However, that would deny the user
> their choice of VBR, only EXTLINUX compatible VBRs with the
> header/checksum/magic value would then work with it. #1 seems to
> be dependent on the skill of the user, i.e., doesn't forget to
> install a VBR.
I would go in a slightly different direction these days. Now that
secure boot is perceived as an issue it seems better for the MBR to be
able to check that a designated boot partition (which we discussed a
year ago) begins with approved secure code. That way, the chain of
security can be maintained. The security of the boot, if desired, can
be carried into the boot partition.
James