WDe and GPT, booting DOS (Users)
> > * Full file must be loaded, implying that the boot sector loader needs
> to
> > relocate itself away from linear 07C00h
>
> Interesting! So I assume - for FAT12/16 - it has to follow the FAT chain
> for a full read of kernel.sys. And does this code - including the
> relocation stuff - still fit in one sector ( as the boot loader of the
> MS-DOS 6.2 kernel, for example ) ?
Yes, it is necessary to follow the FAT chain to read the full file. (Though it would be required for the MS-DOS v6/v7 load protocols as well if the first 1536/2048 bytes of IO.SYS happen to be fragmented.)
You can read the source for the current boot sector loader in https://github.com/FDOS/kernel/blob/bb1bbbb1cb74525bb943725fc83027f634e4eae7/boot/boot.asm
It does fit in one sector, it does LBA or CHS reads, it is 8086-clean. However, it comes in two builds, either for FAT12 or FAT16, not both. It relocates itself to 1FE0h:7C00h (linear 27A00h), without checking that there is that much memory available. This position (plus the position of some more buffers above linear 1FE00h) also limits the maximum kernel size to "134k", according to the memory map comment at the top. Because the loader reads full clusters it also limits the maximum cluster size.
The loaders read in the whole FAT (should be maximum 6 KiB for FAT12, maximum 128 KiB for FAT16) then create a cluster list for the entire kernel. This means that the FAT buffer can be discarded as soon as the cluster list is complete. Then the list is used to read the kernel file data.
Their boot32.asm is a FAT32 boot sector loader: https://github.com/FDOS/kernel/blob/bb1bbbb1cb74525bb943725fc83027f634e4eae7/boot/boot32.asm It also appears to be 8086-clean. It is CHS only. It does fit in a single sector, too. Unlike the FAT12/FAT16 loader it does not build a cluster list. It instead buffers a single FAT sector and uses shared routines to walk the FAT for loading the root directory and the kernel.
The boot32lb.asm is here: https://github.com/FDOS/kernel/blob/bb1bbbb1cb74525bb943725fc83027f634e4eae7/boot/boot32lb.asm It is similar to the boot32.asm except it is LBA-only and uses 386-level instructions. It also fits in a single sector.
I can add some comments about my boot.asm and boot32.asm (in ldosboot repo) later.
---
l
Complete thread:
- WDe and GPT, booting DOS - Japheth, 24.10.2022, 10:56 (Users)
- WDe and GPT, booting DOS - tom, 24.10.2022, 17:31
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 05:24
- WDe and GPT, booting DOS - tom, 25.10.2022, 13:40
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 17:29
- WDe and GPT, booting DOS - Zyzzle, 27.10.2022, 16:08
- WDe and GPT, booting DOS - Japheth, 27.10.2022, 16:41
- WDe and GPT, booting DOS - Japheth, 28.10.2022, 20:13
- WDe and GPT, booting DOS - Zyzzle, 29.10.2022, 02:39
- WDe and GPT, booting DOS - Richard, 02.11.2022, 03:39
- WDe and GPT, booting DOS - Zyzzle, 02.11.2022, 06:43
- WDe and GPT, booting DOS - Japheth, 02.11.2022, 07:55
- WDe and GPT, booting DOS - ecm, 02.11.2022, 09:55
- WDe and GPT, booting DOS - ecm, 02.11.2022, 11:21
- WDe and GPT, booting DOS - Japheth, 04.11.2022, 08:06
- WDe and GPT, booting DOS - ecm, 04.11.2022, 10:14
- WDe and GPT, booting DOS - ecm, 04.11.2022, 11:30
- WDe and GPT, booting DOS - Richard, 03.01.2023, 16:37
- WDe and GPT, booting DOS - ecm, 04.01.2023, 13:42
- Booting FreeDOS from an MS-DOS v7 compatible IO.SYS - ecm, 04.01.2023, 14:11
- WDe and GPT, booting DOS - ecm, 04.01.2023, 13:42
- WDe and GPT, booting DOS - Richard, 03.01.2023, 16:37
- WDe and GPT, booting DOS - ecm, 04.11.2022, 11:30
- WDe and GPT, booting DOS - ecm, 04.11.2022, 10:14
- WDe and GPT, booting DOS - Richard, 10.11.2022, 13:11
- WDe and GPT, booting DOS - Japheth, 10.11.2022, 17:55
- WDe and GPT, booting DOS - Richard, 22.11.2022, 07:10
- WDe and GPT, booting DOS - Rugxulo, 22.11.2022, 09:00
- WDe and GPT, booting DOS - Japheth, 22.11.2022, 09:52
- WDe and GPT, booting DOS - Richard, 22.11.2022, 12:29
- WDe and GPT, booting DOS - Japheth, 22.11.2022, 15:26
- WDe and GPT, booting DOS - Richard, 28.11.2022, 13:18
- WDe and GPT, booting DOS - Japheth, 28.11.2022, 16:57
- WDe and GPT, booting DOS - Richard, 08.12.2022, 17:21
- WDe and GPT, booting DOS - Japheth, 09.12.2022, 05:10
- WDe and GPT, booting DOS - Richard, 11.12.2022, 03:08
- WDe and GPT, booting DOS - Japheth, 11.12.2022, 10:39
- WDe and GPT, booting DOS - Richard, 11.12.2022, 14:53
- WDe and GPT, booting DOS - Japheth, 12.12.2022, 10:34
- WDe and GPT, booting DOS - Richard, 21.12.2022, 17:30
- WDe and GPT, booting DOS - glennmcc, 21.12.2022, 19:07
- WDe and GPT, booting DOS - Japheth, 22.12.2022, 14:52
- WDe and GPT, booting DOS - glennmcc, 22.12.2022, 18:41
- WDe and GPT, booting DOS - Richard, 23.12.2022, 01:49
- WDe and GPT, booting DOS - glennmcc, 23.12.2022, 05:06
- WDe and GPT, booting DOS - Richard, 23.12.2022, 06:46
- WDe and GPT, booting DOS - glennmcc, 23.12.2022, 05:06
- WDe and GPT, booting DOS - Richard, 23.12.2022, 01:49
- WDe and GPT, booting DOS - Richard, 26.12.2022, 12:16
- WDe and GPT, booting DOS - Richard, 28.12.2022, 09:34
- WDe and GPT, booting DOS - Japheth, 28.12.2022, 12:05
- WDe and GPT, booting DOS - Richard, 28.12.2022, 17:27
- WDe and GPT, booting DOS - Japheth, 29.12.2022, 19:32
- WDe and GPT, booting DOS - Richard, 30.12.2022, 07:52
- WDe and GPT, booting DOS - Zyzzle, 31.12.2022, 08:23
- WDe and GPT, booting DOS - Japheth, 02.01.2023, 13:04
- WDe and GPT, booting DOS - Richard, 03.01.2023, 03:51
- WDe and GPT, booting DOS - glennmcc, 03.01.2023, 04:05
- WDe and GPT, booting DOS - Richard, 03.01.2023, 04:37
- WDe and GPT, booting DOS - Richard, 03.01.2023, 05:17
- WDe and GPT, booting DOS - jadoxa, 04.01.2023, 01:02
- WDe and GPT, booting DOS - Richard, 03.01.2023, 05:17
- WDe and GPT, booting DOS - Richard, 03.01.2023, 04:37
- WDe and GPT, booting DOS - Japheth, 03.01.2023, 09:14
- WDe and GPT, booting DOS - Richard, 16.01.2023, 02:50
- WDe and GPT, booting DOS - glennmcc, 03.01.2023, 04:05
- WDe and GPT, booting DOS - Japheth, 29.12.2022, 19:32
- WDe and GPT, booting DOS - Richard, 28.12.2022, 17:27
- WDe and GPT, booting DOS - Japheth, 28.12.2022, 12:05
- WDe and GPT, booting DOS - glennmcc, 22.12.2022, 18:41
- WDe and GPT, booting DOS - Richard, 21.12.2022, 17:30
- WDe and GPT, booting DOS - Japheth, 12.12.2022, 10:34
- WDe and GPT, booting DOS - Richard, 11.12.2022, 14:53
- WDe and GPT, booting DOS - Japheth, 11.12.2022, 10:39
- WDe and GPT, booting DOS - Richard, 11.12.2022, 03:08
- WDe and GPT, booting DOS - Japheth, 09.12.2022, 05:10
- WDe and GPT, booting DOS - Richard, 08.12.2022, 17:22
- WDe and GPT, booting DOS - Richard, 08.12.2022, 17:24
- WDe and GPT, booting DOS - Richard, 08.12.2022, 17:21
- WDe and GPT, booting DOS - Japheth, 28.11.2022, 16:57
- WDe and GPT, booting DOS - Richard, 28.11.2022, 13:18
- WDe and GPT, booting DOS - Japheth, 22.11.2022, 15:26
- WDe and GPT, booting DOS - Richard, 22.11.2022, 12:29
- WDe and GPT, booting DOS - Richard, 22.11.2022, 07:10
- WDe and GPT, booting DOS - Japheth, 10.11.2022, 17:55
- WDe and GPT, booting DOS - ecm, 02.11.2022, 09:55
- WDe and GPT, booting DOS - Japheth, 28.10.2022, 20:13
- WDe and GPT, booting DOS - Japheth, 27.10.2022, 16:41
- WDe and GPT, booting DOS - Zyzzle, 27.10.2022, 16:08
- WDe and GPT, booting DOS - RayeR, 15.12.2022, 19:49
- WDe and GPT, booting DOS - tom, 15.12.2022, 20:14
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 17:29
- WDe and GPT, booting DOS - tom, 25.10.2022, 13:40
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 05:24
- WDe and GPT, booting DOS - tom, 24.10.2022, 18:15
- WDe and GPT, booting DOS - Zyzzle, 25.10.2022, 02:55
- WDe and GPT, booting DOS - tom, 25.10.2022, 13:39
- WDe and GPT, booting DOS - tom, 03.01.2023, 17:14
- WDe and GPT, booting DOS - Richard, 03.01.2023, 17:44
- WDe and GPT, booting DOS - fritz.mueller, 03.01.2023, 18:17
- WDe and GPT, booting DOS - Richard, 03.01.2023, 18:28
- WDe and GPT, booting DOS - glennmcc, 03.01.2023, 22:10
- WDe and GPT, booting DOS - Richard, 03.01.2023, 18:28
- WDe and GPT, booting DOS - fritz.mueller, 03.01.2023, 18:17
- WDe and GPT, booting DOS - Richard, 03.01.2023, 17:44
- WDe and GPT, booting DOS - Zyzzle, 25.10.2022, 02:55
- WDe and GPT, booting DOS - glennmcc, 24.10.2022, 19:09
- WDe and GPT, booting DOS - rr, 24.10.2022, 20:19
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 05:14
- WDe v1.0 - Japheth, 14.11.2022, 10:35
- WDe and GPT, booting DOS - tom, 24.10.2022, 17:31