Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 3 files changed
  • 0 comments
  • 1 contributor

Showing 3 changed files with 60 additions and 4 deletions. Show diff stats Hide diff stats

  1. +3 4 BootDuet.S
  2. +34 0 INSTALL
  3. +23 0 Makefile
7 BootDuet.S
@@ -207,9 +207,11 @@ main:
207 207
208 208 movw %sp,%bp # yes, we use a frame pointer
209 209
  210 +#if !defined(WITH_HARDCODED_DRIVE)
210 211 movb %dl,main_bDrive(%bp) # store drive number, which the
211 212 # MBR should have passed us on
212 213 # DL, to the EBPB.
  214 +#endif
213 215
214 216 #if defined(WITH_VALIDATION) && !defined(DEBUG)
215 217
@@ -870,8 +872,6 @@ fread.6:
870 872 */
871 873 read:
872 874 pushw %si
873   - pushw %bp
874   - movw %sp,%bp
875 875
876 876 /*
877 877 * Fill in Disk Address Packet (DAP) structure. This is filled on the
@@ -889,7 +889,7 @@ read:
889 889 */
890 890 movb $0x42,%ah
891 891 movb bDrive,%dl
892   - leaw -16(%bp),%si # SI = BP - 16 (&DAP)
  892 + movw %sp,%si # SI = SP (base of DAP)
893 893 int $0x13
894 894
895 895 /*
@@ -897,7 +897,6 @@ read:
897 897 * already been written on the screen).
898 898 */
899 899 read.h: jc read.h # Halt if carry
900   - leave
901 900 popw %si
902 901 ret
903 902
34 INSTALL
@@ -21,6 +21,17 @@ We can think of the following present limitations for BootDuet.
21 21 sectors field in the BPB. This is the number of sectors before the boot
22 22 sector of the partition, and is exactly the start LBA of the partition.
23 23
  24 +- BootDuet doesn't want to guess the BIOS drive number where it should find
  25 + its own partition. Normally, MBR boot programs always pass the boot BIOS
  26 + drive number in the DL register to the partition boot program.
  27 + And that's how BootDuet normally knows the drive number of its partition.
  28 + However, one important MBR boot program does not do that, which is the
  29 + Gpt.com program in EFI DUET.
  30 + For that case, there is the option of compiling BootDuet with the
  31 + WITH_HARDCODED_DRIVE option (see Makefile), and in that case, BootDuet
  32 + will use the BIOS drive number which is hard coded on the Boot Parameter
  33 + Block of its own partition.
  34 +
24 35 - BootDuet can't handle a root directory with more than 32 KiB whether in
25 36 FAT12, FAT16 or FAT32. It won't do anything useful or even reasonable in
26 37 that case.
@@ -66,6 +77,23 @@ would be practical to use the following command:
66 77 Where xxd is a tool for hexdumps that comes with vim and 00 10 40 17 is a
67 78 little endian dump for the hex number 17401000 which is 390074368.
68 79
  80 +The versions of BootDuet compiled with WITH_HARDCODED_DRIVE, the "hd" versions,
  81 +also require that the BIOS drive number field of the Boot Parameter Block of
  82 +its own partition to be set to the correct drive number.
  83 +Many format tools, specifically dosfstools, don't set that.
  84 +Note that you only need to do this if you plan to use EFI DUET's Gpt.com for
  85 +the MBR boot program.
  86 +That field may be set with a command such as:
  87 +
  88 +For FAT12 or FAT16:
  89 + # echo 00: 80 | xxd -r | dd of=/dev/sda20 bs=1 seek=36
  90 +For FAT32:
  91 + # echo 00: 80 | xxd -r | dd of=/dev/sda20 bs=1 seek=64
  92 +
  93 +Where 80 would be the BIOS drive number in hex. The convention for BIOS drive
  94 +numbers is 00 for the first floppy drive (A: in MS-DOS), 01 for the second
  95 +(B:), 80 for the first hard drive (C:), 81 for the second hard drive (D:).
  96 +
69 97 If you absolutely must use 64-bit LBA (remember, it does no validation of the
70 98 boot sector), then you would have to fill in the high 32-bit part of your
71 99 start LBA for the partition, because the Hidden Sectors field only is 32 bit.
@@ -89,6 +117,12 @@ If additionally you want to build the 64-bit LBA binaries, then use:
89 117
90 118 # make lba64
91 119
  120 +If you want to build BootDuet versions that use the hard-coded BIOS drive
  121 +number (such as if your planning to use EFI DUET's Gpt.com for the MBR), then
  122 +use:
  123 +
  124 + # make hardcoded-drive
  125 +
92 126
93 127 4. Install BootDuet on the boot sector
94 128
23 Makefile
@@ -9,11 +9,16 @@ all : bd16.bin bd32.bin bd12.bin
9 9
10 10 lba64 : bd16_64.bin bd32_64.bin # bd12_64.bin
11 11
  12 +hardcoded-drive : bd16hd.bin bd32hd.bin bd12hd.bin
  13 +
12 14
13 15 clean :
14 16 @rm -f bd16.bin bd32.bin bd12.bin \
15 17 bd16.lst bd32.lst bd12.lst \
16 18 bd16.map bd32.map bd12.map \
  19 + bd16hd.bin bd32hd.bin bd12hd.bin \
  20 + bd16hd.lst bd32hd.lst bd12hd.lst \
  21 + bd16hd.map bd32hd.map bd12hd.map \
17 22 bd16_64.bin bd32_64.bin bd12_64.bin \
18 23 bd16_64.lst bd32_64.lst bd12_64.lst \
19 24 bd16_64.map bd32_64.map bd12_64.map
@@ -37,6 +42,15 @@ bd16_64.bin : BootDuet.S
37 42 bd32_64.bin : BootDuet.S
38 43 gcc -DFAT=32 -DWITH_LBA_64BIT $(CFLAGS) -o $@ $< -Wa,-a=$(@:.bin=.lst) -Wl,-Map=$(@:.bin=.map)
39 44
  45 +bd12hd.bin : BootDuet.S
  46 + gcc -DFAT=12 -DWITH_HARDCODED_DRIVE $(CFLAGS) -o $@ $< -Wa,-a=$(@:.bin=.lst) -Wl,-Map=$(@:.bin=.map)
  47 +
  48 +bd16hd.bin : BootDuet.S
  49 + gcc -DFAT=16 -DWITH_HARDCODED_DRIVE $(CFLAGS) -o $@ $< -Wa,-a=$(@:.bin=.lst) -Wl,-Map=$(@:.bin=.map)
  50 +
  51 +bd32hd.bin : BootDuet.S
  52 + gcc -DFAT=32 -DWITH_HARDCODED_DRIVE $(CFLAGS) -o $@ $< -Wa,-a=$(@:.bin=.lst) -Wl,-Map=$(@:.bin=.map)
  53 +
40 54
41 55 install-bd12 : bd12.bin
42 56 dd if=$< of=$(DEVICE) bs=1 skip=62 seek=62 count=448
@@ -55,3 +69,12 @@ install-bd16_64 : bd16_64.bin
55 69
56 70 install-bd32_64 : bd32_64.bin
57 71 dd if=$< of=$(DEVICE) bs=1 skip=90 seek=90 count=416
  72 +
  73 +install-bd12hd : bd12hd.bin
  74 + dd if=$< of=$(DEVICE) bs=1 skip=62 seek=62 count=448
  75 +
  76 +install-bd16hd : bd16hd.bin
  77 + dd if=$< of=$(DEVICE) bs=1 skip=62 seek=62 count=448
  78 +
  79 +install-bd32hd : bd32hd.bin
  80 + dd if=$< of=$(DEVICE) bs=1 skip=90 seek=90 count=420

No commit comments for this range

Something went wrong with that request. Please try again.