On 31/12/2021 09:37, Rod Pemberton wrote:
> On Fri, 31 Dec 2021 04:22:24 -0500
> Rod Pemberton <
noe...@basdxcqvbe.com> wrote:
>
>> On Mon, 20 Dec 2021 16:17:40 +0000
>> James Harris <
james.h...@gmail.com> wrote:
>
>>> So far I have a VBR which reads through the root dir, finds the
>>> target file, and loads its first sector.
>>
>> Why wouldn't you require that the file always be the first entry in
>> the root dir? ... That conserves space for more code, right? ...
Well, what's best, to make it easy to update the boot files or to make
it difficult? AFAICS it's an open question. I don't know if there is one
right answer.
If I wanted to make it difficult then I could store boot code in special
locations. But the whole point of looking through the root directory is
to treat the OS loader as a normal file so that updates are easier and
the process is more transparent.
>>
>> Most OSes have special utilities which you're probably aware of that
>> place system files and structures into their proper locations on the
>> hard disk. Yes?
I agree that boot steps often use non-standard mechanisms. Whether they
should or not is another matter.
...
>>> with mkfs.fat (or mkfs.vfat)
>>
>> From Linux for FAT16, I had to do something like:
>> (I'm unsure if this is complete ...)
>>
>> ms-sys /dev/sdc
>> mkfs.vfat -v -F 16 /dev/sdc1
>> ms-sys -6 /dev/sdc1
>>
I'd never heard of ms-sys and it's not part of my distribution but it
looks useful.
>>
>
> Oops, that's not complete ...
>
> dd if=/dev/zero of=/dev/sdc count=16470 bs=512
> fdisk /dev/sdc
>
> /* now the stuff above */
I do similar:
dd bs=1024 count=20480 if=/dev/zero of=1-flat.vmdk
sfdisk .... [see below]
sudo losetup --show -Pf 1-flat.vmdk
sudo mkfs.fat -h 2048 /dev/loop???p1 {with ??? replaced}
Then
dd bs=1 count=446 ${DDPARMS} if=mbr of=1-flat.vmdk
dd bs=1 count=2 ${DDPARMS} if=mbr of=1-flat.vmdk skip=510
dd bs=1 count=3 ${DDPARMS} if=vbr of=${PBEG}
dd bs=1 count=450 ${DDPARMS} if=vbr of=${PSTA} skip=62
where
DDPARAMS is conv=notrunc status=none
PBEG is 1-flat.vmdk seek=$(( 2048 * 512 ))
PSTA is 1-flat.vmdk seek=$(( 2048 * 512 + 62 ))
Block 2048 is where the partition begins.
>
> The options used for Linux fdisk were: c n p 1 a t e w
>
> That was for 16470 sectors for 8MB FAT16.
>
> For a floppy, count=1440.
>
> Just an FYI, I'm not sure why I was using fdisk with a floppy
> image/disk, but the Linux fdisk options I used were: n p 2 t 11 w.
>
> If you're not familiar with Linux fdisk, you'll have to work through
> those Linux fdisk options on your own, as I think some of them required
> inputting information, like partition size or starting track number,
> etc.
Rather than controlling fdisk manually one can recreate a partition
table from a text file. For example, I use
sfdisk 1-flat.vmdk <<END
label: dos
label-id: 0xe70bb971
device: 1-flat.vmdk
unit: sectors
1-flat.vmdk1 : start= 2048, size= 79872, type=6, bootable
END
The text file can be created by hand or by
sfdisk --dump
or option O once in fdisk.
--
James Harris