tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: patch: MFSv3 support (libsa) for boot2 (i386)



Hi,

Izumi, thank you very much for the detailed explanation!

I want to add bootxx_minix3fs. I don't know what scheme would be
appropriate for MINIX, but currently I think about following scheme:

MINIX partition might contain subpartitions (its volume boot sector is
like MBR, so disk driver checks this extra partition table). There
might be a gap between first sector of partition and a first
subpartition.
pbr.S can check for MINIX partition like it does for NetBSD partition
or FAT. Then boot1 can use bootable subpartition as default (similarly
to 'a' partition). I've implemented a quick proto and it seems to work
(boot2 is loaded, but there is some issue I didn't fix yet).

Do you think it can be committed to the NetBSD (with appropriate macro
flags to disable it by default like MinixFS for boot2)?


On Wed, Dec 28, 2011 at 9:10 PM, Izumi Tsutsui 
<tsutsui%ceres.dti.ne.jp@localhost> wrote:
>> Aha, it's a real disklabel, not fictitious one, and 'a' works as a
>> fallback partition, right? With MBR it will not work, will it?
>
> It works with MBR:
> ---
> # fdisk wd0
>  :
>
> Partition table:
> 0: NetBSD (sysid 169)
>    start 32, size 2097120 (1024 MB, Cyls 0/0/33-520/8/8), Active
> 1: <UNUSED>
> 2: <UNUSED>
> 3: <UNUSED>
>  :
> ---
>
> - Kernel and Bootloader search NetBSD partition in MBR.
> - If NetBSD partition is found, kernel checks NetBSD disklabel
>  at LABELSECTOR in the NetBSD partition.
>  (in sys/kern/disk_subr_mbr.c, but this is machine dependent)
> - The first pbr.S in bootxx is loaded by master MBR or BIOS
> - pbr.S loads the first 16 sectors in the NetBSD partition.
> - The rest of bootxx (boot1.c) check NetBSD disklabel at LABELSECTOR
>  and load secondary /boot in partition a:.
>
>
>> Also 'e' is 0 - 0 and 'a' is 0 - 1819, so they overlap. Why 'a' is not
>> overwritten by bootxx then? Sorry, I'm not familiar with disklabels.
>
> They are (calculated) cylinder numbers and they are not
> actually used by bootloaders (if LBA is supported by BIOS).
> Check sector numbers instead:
>
> On usual UFS:
>>> a:   1833552        63     4.2BSD
>>> c:   2097089        63     unused
>>> d:   2097152         0     unused
>
> sector 63:    pbr.S (first 512 bytes bootxx_ffsvN)
> sector 64:    NetBSD disklabel (installboot(8) skips here)
> sector 65-78: rest of bootxx_ffsvN
> sector 79-:   UFS superblock
>  :
>
> In my Ext2fs case:
>>> a:   1833457       128 Linux Ext2
>>> c:   2097120        32     unused
>>> d:   2097152         0     unused
>>> e:        96        32       boot
>
> sector 32:   pbr.S (first 512 bytes bootxx_ext2fs
> sector 33:   NetBSD disklabel
> sector 34-:  rest of bootxx_ext2fs
>  :
> sector 128:  blank (first sector of Ext2fs root partition)
> sector 129:  blank (space for disklabel if a: has no offset)
> sector 130-: Ext2fs superblock
>  :
>
> i.e.
> - Primary MBR loads sector 32 (pbr.S) per MBR settings
> - pbr.S loads sectors 32-47 (bootxx_ext2fs) where MBR_PTYPE_NETBSD in MBR
> - bootxx_ext2fs loads /boot in partition a: at 128- per NetBSD disklabel
>  at LABELSECTOR in MBR_PTYPE_NETBSD partition
> so bootxx_ext2fs magically works with the above MBR and disklabel.
>
> (I could be wrong, but x86/PC gurus will correct me :-)
> ---
> Izumi Tsutsui



-- 
Evgeniy


Home | Main Index | Thread Index | Old Index