linux-mips-fnet
[Top] [All Lists]

Re: DECstation bootloader

To: linux-mips@fnet.fr
Subject: Re: DECstation bootloader
From: Warner Losh <imp@harmony.village.org>
Date: Mon, 29 Mar 1999 12:10:59 -0700
In-reply-to: Your message of "Mon, 29 Mar 1999 18:00:50 +0200." <XFMail.990329180050.Harald.Koerfgen@home.ivm.de>
References: <XFMail.990329180050.Harald.Koerfgen@home.ivm.de>
In message <XFMail.990329180050.Harald.Koerfgen@home.ivm.de> Harald Koerfgen 
writes:
: AFAIK ext2, unlike ufs and ffs, doesn't reserve space for a bootloader
: except block 0 of a partition. I hope I am wrong here, but I haven't found
: anything in that direction.

Doesn't matter one way or the other.  Given that ext2fs is just ufs
with some hacks (from a file sytstem point of view), I'd be extremely
surprised if it doesn't.

Looking at the FreeBSD implementation I see that it has 1024 bytes
reserved at the front of the file system.  That's two blocks :-).

Even if I'm wrong, this is a simple matter for disklabel.  Just don't
allow a partition to start at 0.  If you do, you can't boot off of it.
Make sure the label is in the first 1024 bytes and you are set.

It looks like ext2fs reserves 1k for all file systems (just like
ufs/ffs (they are the same thing) reserve 8k at the start of the file
system).

Looks like there are some other games that you can play.  You can
reserve the first 9k of those partitions that start at block 0.  Then
you can put the first stage into the first 1k, then you can put the
second stage into 2k-8.5k.  It looks like ext2fs supports
s_first_data_block could be used to reserve this area.  Or maybe the
s_r_blocks_count.  To be honest, I didn't look in more detail to see
if setting these would work.

Also, there are 235*4 ( = 940 bytes) free in the superblock as
well, but that might be pushing your luck...

Hmmm, a little more digging shows that neither of those two fields are
used to offset the group descriptors, which start at super block plus
1.

I still think it would be easier to move the offset of the 'a'
partition from '0' to '16', which would solve this problem.  If the
disk label was in the first 1024 bytes of the sector, then you could
still use the 'c' partition on other disks.  After all, many of the
free oses start their first partition at 16 to avoid boot manager crap
in the PC world.

Warner

<Prev in Thread] Current Thread [Next in Thread>