Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: migle/BootDuet
base: 2cd349e7ca
...
head fork: migle/BootDuet
compare: f0cd5ac9d5
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 60 additions and 4 deletions.
  1. +3 −4 BootDuet.S
  2. +34 −0 INSTALL
  3. +23 −0 Makefile
7 BootDuet.S
View
@@ -207,9 +207,11 @@ main:
movw %sp,%bp # yes, we use a frame pointer
+#if !defined(WITH_HARDCODED_DRIVE)
movb %dl,main_bDrive(%bp) # store drive number, which the
# MBR should have passed us on
# DL, to the EBPB.
+#endif
#if defined(WITH_VALIDATION) && !defined(DEBUG)
@@ -870,8 +872,6 @@ fread.6:
*/
read:
pushw %si
- pushw %bp
- movw %sp,%bp
/*
* Fill in Disk Address Packet (DAP) structure. This is filled on the
@@ -889,7 +889,7 @@ read:
*/
movb $0x42,%ah
movb bDrive,%dl
- leaw -16(%bp),%si # SI = BP - 16 (&DAP)
+ movw %sp,%si # SI = SP (base of DAP)
int $0x13
/*
@@ -897,7 +897,6 @@ read:
* already been written on the screen).
*/
read.h: jc read.h # Halt if carry
- leave
popw %si
ret
34 INSTALL
View
@@ -21,6 +21,17 @@ We can think of the following present limitations for BootDuet.
sectors field in the BPB. This is the number of sectors before the boot
sector of the partition, and is exactly the start LBA of the partition.
+- BootDuet doesn't want to guess the BIOS drive number where it should find
+ its own partition. Normally, MBR boot programs always pass the boot BIOS
+ drive number in the DL register to the partition boot program.
+ And that's how BootDuet normally knows the drive number of its partition.
+ However, one important MBR boot program does not do that, which is the
+ Gpt.com program in EFI DUET.
+ For that case, there is the option of compiling BootDuet with the
+ WITH_HARDCODED_DRIVE option (see Makefile), and in that case, BootDuet
+ will use the BIOS drive number which is hard coded on the Boot Parameter
+ Block of its own partition.
+
- BootDuet can't handle a root directory with more than 32 KiB whether in
FAT12, FAT16 or FAT32. It won't do anything useful or even reasonable in
that case.
@@ -66,6 +77,23 @@ would be practical to use the following command:
Where xxd is a tool for hexdumps that comes with vim and 00 10 40 17 is a
little endian dump for the hex number 17401000 which is 390074368.
+The versions of BootDuet compiled with WITH_HARDCODED_DRIVE, the "hd" versions,
+also require that the BIOS drive number field of the Boot Parameter Block of
+its own partition to be set to the correct drive number.
+Many format tools, specifically dosfstools, don't set that.
+Note that you only need to do this if you plan to use EFI DUET's Gpt.com for
+the MBR boot program.
+That field may be set with a command such as:
+
+For FAT12 or FAT16:
+ # echo 00: 80 | xxd -r | dd of=/dev/sda20 bs=1 seek=36
+For FAT32:
+ # echo 00: 80 | xxd -r | dd of=/dev/sda20 bs=1 seek=64
+
+Where 80 would be the BIOS drive number in hex. The convention for BIOS drive
+numbers is 00 for the first floppy drive (A: in MS-DOS), 01 for the second
+(B:), 80 for the first hard drive (C:), 81 for the second hard drive (D:).
+
If you absolutely must use 64-bit LBA (remember, it does no validation of the
boot sector), then you would have to fill in the high 32-bit part of your
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:
# make lba64
+If you want to build BootDuet versions that use the hard-coded BIOS drive
+number (such as if your planning to use EFI DUET's Gpt.com for the MBR), then
+use:
+
+ # make hardcoded-drive
+
4. Install BootDuet on the boot sector
23 Makefile
View
@@ -9,11 +9,16 @@ all : bd16.bin bd32.bin bd12.bin
lba64 : bd16_64.bin bd32_64.bin # bd12_64.bin
+hardcoded-drive : bd16hd.bin bd32hd.bin bd12hd.bin
+
clean :
@rm -f bd16.bin bd32.bin bd12.bin \
bd16.lst bd32.lst bd12.lst \
bd16.map bd32.map bd12.map \
+ bd16hd.bin bd32hd.bin bd12hd.bin \
+ bd16hd.lst bd32hd.lst bd12hd.lst \
+ bd16hd.map bd32hd.map bd12hd.map \
bd16_64.bin bd32_64.bin bd12_64.bin \
bd16_64.lst bd32_64.lst bd12_64.lst \
bd16_64.map bd32_64.map bd12_64.map
@@ -37,6 +42,15 @@ bd16_64.bin : BootDuet.S
bd32_64.bin : BootDuet.S
gcc -DFAT=32 -DWITH_LBA_64BIT $(CFLAGS) -o $@ $< -Wa,-a=$(@:.bin=.lst) -Wl,-Map=$(@:.bin=.map)
+bd12hd.bin : BootDuet.S
+ gcc -DFAT=12 -DWITH_HARDCODED_DRIVE $(CFLAGS) -o $@ $< -Wa,-a=$(@:.bin=.lst) -Wl,-Map=$(@:.bin=.map)
+
+bd16hd.bin : BootDuet.S
+ gcc -DFAT=16 -DWITH_HARDCODED_DRIVE $(CFLAGS) -o $@ $< -Wa,-a=$(@:.bin=.lst) -Wl,-Map=$(@:.bin=.map)
+
+bd32hd.bin : BootDuet.S
+ gcc -DFAT=32 -DWITH_HARDCODED_DRIVE $(CFLAGS) -o $@ $< -Wa,-a=$(@:.bin=.lst) -Wl,-Map=$(@:.bin=.map)
+
install-bd12 : bd12.bin
dd if=$< of=$(DEVICE) bs=1 skip=62 seek=62 count=448
@@ -55,3 +69,12 @@ install-bd16_64 : bd16_64.bin
install-bd32_64 : bd32_64.bin
dd if=$< of=$(DEVICE) bs=1 skip=90 seek=90 count=416
+
+install-bd12hd : bd12hd.bin
+ dd if=$< of=$(DEVICE) bs=1 skip=62 seek=62 count=448
+
+install-bd16hd : bd16hd.bin
+ dd if=$< of=$(DEVICE) bs=1 skip=62 seek=62 count=448
+
+install-bd32hd : bd32hd.bin
+ 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.