On Wed, Oct 09, 2024 at 05:56:54PM +0200, Christian Weisgerber wrote: > Thomas: > > > - the 2nd stage bootloader in the softraid volume, the man page says > > "in the storage area oft he softraid volume". > > The start of /usr/src/sys/dev/softraidvar.h holds a number of defines > that relate this. It might be worth looking into the installboot(8) > source how this is actually used. > > > If I wanted to check the integrity of the bootloaders against what is in > > /usr/mdec, how would I go about it? > > Figure out the relevant offsets and extract the corresponding sectors > with dd(1) from the raw disk device. > > At least that's how I would approach this. > > -- > Christian "naddy" Weisgerber na...@mips.inka.de >
In the the 2nd stage bootloader gets stored in a kind special way: a rudimentary filesystem image consisting of - no superblock, - 1 file (the actual 2nd stage boostrap code) of a few data blocks and - 1 block containing a single inode is constructed. The inode blocklist points to the data blocks. This image is stored in a special area next to the softraid meta-data. For BIOS boot the 1st stage bootloader is patched to contain the right filesystem parameters to find the inode. The BIOS 1st stage is a very small assembly program, it has no room to do any real filesystem operations, like scanning for a superblock or interpreting a superblock. The code constructing the filesystem image can be found in /usr/src/usr.sbin/installboot/i386_softraid.c (also used for amd64). I am still very fond of the idea and my implementation of this mechanism. A side note: the 1st stage bootloader code can be found in /usr/src/sys/arch/amd64/stand/biosboot/biosboot.S -Otto