Skip to content

Commit 92ae538

Browse files
ecm-pushbxPerditionC
authored andcommitted
boot: allow instsect to match the filesystem ID string
Reference: https://hg.ulukai.org/ecm/instsect/file/33218c729b43/instsect.asm#l1257 lDOS's instsect recently started to default to checking the filesystem ID string in order to validate that the boot sector loader to write matches the detected FS. Using the /S=filename option or building instsect to include the FreeDOS kernel's loaders would require use of the /SN switch without this commit. In addition, boot.asm and oemboot.asm are made to check that exactly one of the ISFAT12 and ISFAT16 defs is defined so as to select the FS. Prior to this commit using both or neither def would silently result in a broken loader.
1 parent 6e42bb6 commit 92ae538

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

boot/boot.asm

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,20 @@ Entry: jmp short real_start
100100

101101
;-----------------------------------------------------------------------
102102

103-
times 0x3E-$+$$ db 0
103+
times 36h - ($ - $$) db 0
104+
; The filesystem ID is used by lDOS's instsect (by ecm)
105+
; by default to validate that the filesystem matches.
106+
%ifdef ISFAT12
107+
db "FAT12"
108+
%ifdef ISFAT16
109+
%error Must select one FS
110+
%endif
111+
%elifdef ISFAT16
112+
db "FAT16"
113+
%else
114+
%error Must select one FS
115+
%endif
116+
times 3Eh - ($ - $$) db 32
104117

105118
; using bp-Entry+loadseg_xxx generates smaller code than using just
106119
; loadseg_xxx, where bp is initialized to Entry, so bp-Entry equals 0

boot/boot32.asm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,16 @@ Entry: jmp short real_start
5757
%define xrootClst bp+0x2c ; Starting cluster of root directory
5858
%define drive bp+0x40 ; Drive number
5959

60-
times 0x5a-$+$$ db 0
60+
times 52h - ($ - $$) db 0
61+
; The filesystem ID is used by lDOS's instsect (by ecm)
62+
; by default to validate that the filesystem matches.
63+
db "FAT32"
64+
times 5Ah - ($ - $$) db 32
65+
6166

6267
%define LOADSEG 0x0060
6368

64-
%define FATSEG 0x2000
69+
%define FATSEG 0x2000
6570

6671
%define fat_sector bp+0x48 ; last accessed sector of the FAT
6772

boot/boot32lb.asm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ Entry: jmp short real_start
9696
%define data_start bp+0x4c ; first data sector (dd)
9797
; (overwriting unused bytes)
9898

99-
times 0x5a-$+$$ db 0
99+
times 52h - ($ - $$) db 0
100+
; The filesystem ID is used by lDOS's instsect (by ecm)
101+
; by default to validate that the filesystem matches.
102+
db "FAT32"
103+
times 5Ah - ($ - $$) db 32
100104
; not used: [0x42] = byte 0x29 (ext boot param flag)
101105
; [0x43] = dword serial
102106
; [0x47] = label (padded with 00, 11 bytes)

boot/oemboot.asm

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,20 @@ Entry: jmp short real_start
223223
db 0x29 ; extended boot record id
224224
dd 0x12345678 ; volume serial number
225225
db 'NO NAME '; volume label
226-
db 'FAT12 ' ; filesystem id
226+
times 36h - ($ - $$) db 0
227+
; The filesystem ID is used by lDOS's instsect (by ecm)
228+
; by default to validate that the filesystem matches.
229+
%ifdef ISFAT12
230+
db "FAT12" ; filesystem id
231+
%ifdef ISFAT16
232+
%error Must select one FS
233+
%endif
234+
%elifdef ISFAT16
235+
db "FAT16"
236+
%else
237+
%error Must select one FS
238+
%endif
239+
times 3Eh - ($ - $$) db 32
227240

228241
;-----------------------------------------------------------------------
229242
; ENTRY

0 commit comments

Comments
 (0)