Discussion:
how do I get EFI BIOS to accept my bootable partition?
(too old to reply)
bilsch01
2020-12-15 17:57:50 UTC
Permalink
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which has
EFI BIOS. The pc is ASUS VivoBook F512JA-OH36 and has an SSD with Win10
and Ubuntu installed on it. The EFI BIOS is American Megatrends version
302. I have "secure boot" turned off in the BIOS. I have previously
booted other thumb drives on the newer pc (Knoppix and Ubuntu Live) so I
am familiar with booting from a thumb drive on the newer pc.

The OS I want to boot is on partition #1 of a thumb drive. The system
type indicated in the partition table is FAT16 LBA (0x0e) and the boot
flag is set. The boot sector of partition #1 is definitely not a
standard FAT16 LBA boot sector (see listing at the end of this post). It
simply loads the 16 sector OS from partition #1 to 0:0x1000 and performs
a long jump to the code. The boot sector has the standard 55AA signature
at the end. Partition #1 has a lot of space on it besides the boot
sector and the 16 sector OS - it is 32.5 MB. The OS isn't much of an OS,
but rather aspires to be a text editor which operates on files in
partition #2 and #3 of the thumb drive. Partition #2 and #3 are standard
FAT16 LBA partitions - but they are not bootable.

The boot options listed by the EFI BIOS upon initial start up are:

OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #2
OPTION #4 UEFI: USB DIDK PARTITION #3

You can select one of the USB DISK PARTITIONS to boot by moving and
saving its line to the OPTION #1 position in the EFI BIOS. If the
selected partition is bootable it will be booted when you exit from the
EFI BIOS. The problem is that the system I want to boot is on USB DISK
PARTITION #1, which isn't even listed. For some reason the BIOS does not
include partition #1 as an option for booting.

QUESTION 1: does anyone know why it might not accept partition #1 as a
boot option?

QUESTION 2: can I avoid the problem if I "enroll" a "hash" of something
to the EFI system? If so, I don't know how to do that.

Below is a listing of partition #1 boot sector. Note: the bytes between
the executable code and the 55AA signature are filled with ASCII 0x6B.


00000000 B80000 mov ax,0x0
00000003 8ED0 mov ss,ax
00000005 BCFF7A mov sp,0x7aff
00000008 8ED8 mov ds,ax
0000000A BE007B mov si,0x7b00
0000000D C7041000 mov word [si],0x10
00000011 C744021000 mov word [si+0x2],0x10
00000016 C744040000 mov word [si+0x4],0x0
0000001B C744060010 mov word [si+0x6],0x1000
00000020 C744086002 mov word [si+0x8],0x260
00000025 C7440A0000 mov word [si+0xa],0x0
0000002A C7440C0000 mov word [si+0xc],0x0
0000002F C7440E0000 mov word [si+0xe],0x0
00000034 B442 mov ah,0x42
00000036 B280 mov dl,0x80
00000038 CD13 int 0x13
0000003A 720A jc 0x46
0000003C B8310E mov ax,0xe31
0000003F CD10 int 0x10
00000041 EA00000010 jmp 0x1000:0x0
00000046 B90200 mov cx,0x2
00000049 C1C004 rol ax,byte 0x4
0000004C 50 push ax
0000004D 240F and al,0xf
0000004F 0430 add al,0x30
00000051 3C39 cmp al,0x39
00000053 7602 jna 0x57
00000055 0407 add al,0x7
00000057 B40E mov ah,0xe
00000059 CD10 int 0x10
0000005B 58 pop ax
0000005C 49 dec cx
0000005D 75EA jnz 0x49
0000005F EBFE jmp short 0x5f

00000061 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000065 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000069 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b

000001FC 6B6B55AA imul bp,[bp+di+0x55],byte -0x56

Thank you for your suggestions. Bill S.
bilsch01
2020-12-15 18:41:27 UTC
Permalink
OOPS. i JUST REALIZED MAYBE I CAN'T USE INT 0X13.

How do I load and jomp to my 16 sectors of code without int 0x13?

Your suggestions will be appreciated.

TIA. Bill S.
bilsch01
2020-12-15 19:31:48 UTC
Permalink
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which has
EFI BIOS. The pc is ASUS VivoBook F512JA-OH36 and has an SSD with Win10
and Ubuntu installed on it. The EFI BIOS is American Megatrends version
302. I have "secure boot" turned off in the BIOS. I have previously
booted other thumb drives on the newer pc (Knoppix and Ubuntu Live) so I
am familiar with booting from a thumb drive on the newer pc.
The OS I want to boot is on partition #1 of a thumb drive. The system
type indicated in the partition table is FAT16 LBA (0x0e) and the boot
flag is set. The boot sector of partition #1 is definitely not a
standard FAT16 LBA boot sector (see listing at the end of this post). It
simply loads the 16 sector OS from partition #1 to 0:0x1000 and performs
a long jump to the code. The boot sector has the standard 55AA signature
at the end. Partition #1 has a lot of space on it besides the boot
sector and the 16 sector OS - it is 32.5 MB. The OS isn't much of an OS,
but rather aspires to be a text editor which operates on files in
partition #2 and #3 of the thumb drive. Partition #2 and #3 are standard
FAT16 LBA partitions - but they are not bootable.
OPTION #1 UBUNTU  WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #2
OPTION #4 UEFI: USB DIDK PARTITION #3
You can select one of the USB DISK PARTITIONS to boot by moving and
saving its line to the OPTION #1 position in the EFI BIOS. If the
selected partition is bootable it will be booted when you exit from the
EFI BIOS. The problem is that the system I want to boot is on USB DISK
PARTITION #1, which isn't even listed. For some reason the BIOS does not
include partition #1 as an option for booting.
QUESTION 1: does anyone know why it might not accept partition #1 as a
boot option?
QUESTION 2: can I avoid the problem if I "enroll" a "hash" of something
to the EFI system? If so, I don't know how to do that.
Below is a listing of partition #1 boot sector. Note: the bytes between
the executable code and the 55AA signature are filled with ASCII 0x6B.
00000000  B80000            mov ax,0x0
00000003  8ED0              mov ss,ax
00000005  BCFF7A            mov sp,0x7aff
00000008  8ED8              mov ds,ax
0000000A  BE007B            mov si,0x7b00
0000000D  C7041000          mov word [si],0x10
00000011  C744021000        mov word [si+0x2],0x10
00000016  C744040000        mov word [si+0x4],0x0
0000001B  C744060010        mov word [si+0x6],0x1000
00000020  C744086002        mov word [si+0x8],0x260
00000025  C7440A0000        mov word [si+0xa],0x0
0000002A  C7440C0000        mov word [si+0xc],0x0
0000002F  C7440E0000        mov word [si+0xe],0x0
00000034  B442              mov ah,0x42
00000036  B280              mov dl,0x80
00000038  CD13              int 0x13
0000003A  720A              jc 0x46
0000003C  B8310E            mov ax,0xe31
0000003F  CD10              int 0x10
00000041  EA00000010        jmp 0x1000:0x0
00000046  B90200            mov cx,0x2
00000049  C1C004            rol ax,byte 0x4
0000004C  50                push ax
0000004D  240F              and al,0xf
0000004F  0430              add al,0x30
00000051  3C39              cmp al,0x39
00000053  7602              jna 0x57
00000055  0407              add al,0x7
00000057  B40E              mov ah,0xe
00000059  CD10              int 0x10
0000005B  58                pop ax
0000005C  49                dec cx
0000005D  75EA              jnz 0x49
0000005F  EBFE              jmp short 0x5f
00000061  6B6B6B6B          imul bp,[bp+di+0x6b],byte +0x6b
00000065  6B6B6B6B          imul bp,[bp+di+0x6b],byte +0x6b
00000069  6B6B6B6B          imul bp,[bp+di+0x6b],byte +0x6b
000001FC  6B6B55AA          imul bp,[bp+di+0x55],byte -0x56
Thank you for your suggestions.   Bill S.
OPS. i JUST REALIZED MAYBE I CAN'T USE INT 0X13.

How do I load and jomp to my 16 sectors of code without int 0x13?

Your suggestions will be appreciated.

TIA. Bill S.
Kerr-Mudd,John
2020-12-16 17:51:36 UTC
Permalink
Post by bilsch01
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which
has EFI BIOS. The pc is ASUS VivoBook F512JA-OH36 and has an SSD with
Win10 and Ubuntu installed on it. The EFI BIOS is American Megatrends
version 302. I have "secure boot" turned off in the BIOS. I have
previously booted other thumb drives on the newer pc (Knoppix and
Ubuntu Live) so I am familiar with booting from a thumb drive on the
newer pc.
The OS I want to boot is on partition #1 of a thumb drive. The system
type indicated in the partition table is FAT16 LBA (0x0e) and the
boot flag is set. The boot sector of partition #1 is definitely not a
standard FAT16 LBA boot sector (see listing at the end of this post).
It simply loads the 16 sector OS from partition #1 to 0:0x1000 and
performs a long jump to the code. The boot sector has the standard
55AA signature at the end. Partition #1 has a lot of space on it
besides the boot sector and the 16 sector OS - it is 32.5 MB. The OS
isn't much of an OS, but rather aspires to be a text editor which
operates on files in partition #2 and #3 of the thumb drive.
Partition #2 and #3 are standard FAT16 LBA partitions - but they are
not bootable.
OPTION #1 UBUNTU  WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #2
OPTION #4 UEFI: USB DIDK PARTITION #3
You can select one of the USB DISK PARTITIONS to boot by moving and
saving its line to the OPTION #1 position in the EFI BIOS. If the
selected partition is bootable it will be booted when you exit from
the EFI BIOS. The problem is that the system I want to boot is on USB
DISK PARTITION #1, which isn't even listed. For some reason the BIOS
does not include partition #1 as an option for booting.
QUESTION 1: does anyone know why it might not accept partition #1 as
a boot option?
No. sorry
Post by bilsch01
Post by bilsch01
QUESTION 2: can I avoid the problem if I "enroll" a "hash" of
something to the EFI system? If so, I don't know how to do that.
Neither do I
Post by bilsch01
Post by bilsch01
Below is a listing of partition #1 boot sector. Note: the bytes
between the executable code and the 55AA signature are filled with
ASCII 0x6B.
00000000  B80000            mov ax,0x0
00000003  8ED0              mov ss,ax
00000005  BCFF7A            mov sp,0x7aff
00000008  8ED8              mov ds,ax
0000000A  BE007B            mov si,0x7b00
0000000D  C7041000          mov word [si],0x10
00000011  C744021000        mov word [si+0x2],0x10
00000016  C744040000        mov word [si+0x4],0x0
0000001B  C744060010        mov word [si+0x6],0x1000
00000020  C744086002        mov word [si+0x8],0x260
00000025  C7440A0000        mov word [si+0xa],0x0
0000002A  C7440C0000        mov word [si+0xc],0x0
0000002F  C7440E0000        mov word [si+0xe],0x0
00000034  B442              mov ah,0x42
00000036  B280              mov dl,0x80
00000038  CD13              int 0x13
0000003A  720A              jc 0x46
0000003C  B8310E            mov ax,0xe31
0000003F  CD10              int 0x10
00000041  EA00000010        jmp 0x1000:0x0
00000046  B90200            mov cx,0x2
00000049  C1C004            rol ax,byte 0x4
0000004C  50                push ax
0000004D  240F              and al,0xf
0000004F  0430              add al,0x30
00000051  3C39              cmp al,0x39
00000053  7602              jna 0x57
00000055  0407              add al,0x7
00000057  B40E              mov ah,0xe
00000059  CD10              int 0x10
0000005B  58                pop ax
0000005C  49                dec cx
0000005D  75EA              jnz 0x49
0000005F  EBFE              jmp short 0x5f
00000061  6B6B6B6B          imul bp,[bp+di+0x6b],byte +0x6b
00000065  6B6B6B6B          imul bp,[bp+di+0x6b],byte +0x6b
00000069  6B6B6B6B          imul bp,[bp+di+0x6b],byte +0x6b
000001FC  6B6B55AA          imul bp,[bp+di+0x55],byte -0x56
Thank you for your suggestions.   Bill S.
OPS. i JUST REALIZED MAYBE I CAN'T USE INT 0X13.
How do I load and jomp to my 16 sectors of code without int 0x13?
Your suggestions will be appreciated.
TIA. Bill S.
You can't, IMO; i.e. you need int 0x13; it should be present in old mode.
It looks to me that your Bios isn't recogising your USB as valid.

Should you not have a (set of) valid ptn info prior to 55AA? I don't
know.
--
Bah, and indeed, Humbug.
wolfgang kern
2020-12-17 05:37:14 UTC
Permalink
On 16.12.2020 18:51, Kerr-Mudd,John wrote:
...
[code .. unfortunately garbled in reply]
Post by Kerr-Mudd,John
You can't, IMO; i.e. you need int 0x13; it should be present in old mode.
It looks to me that your Bios isn't recognising your USB as valid.
me too would think so.
Post by Kerr-Mudd,John
Should you not have a (set of) valid ptn info prior to 55AA? I don't
know.
yeah, partition entries are missing or just not shown.

For exercise You could shrink his posted code down to less than half :)

b8 00 00 -> 31 c0 and so on ...
c7 .... make all params data instead
__
wolfgang
Kerr-Mudd,John
2020-12-17 11:12:38 UTC
Permalink
Post by wolfgang kern
...
[code .. unfortunately garbled in reply]
Post by Kerr-Mudd,John
You can't, IMO; i.e. you need int 0x13; it should be present in old
mode. It looks to me that your Bios isn't recognising your USB as
valid.
me too would think so.
Post by Kerr-Mudd,John
Should you not have a (set of) valid ptn info prior to 55AA? I don't
know.
yeah, partition entries are missing or just not shown.
For exercise You could shrink his posted code down to less than half :)
Well I might if it a) worked and b) did something I wanted!

My calendar program is still over in clax!
Post by wolfgang kern
b8 00 00 -> 31 c0 and so on ...
c7 .... make all params data instead
__
wolfgang
--
Bah, and indeed, Humbug.
s***@yahoo.com
2020-12-17 19:02:32 UTC
Permalink
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which has
EFI BIOS. The pc is ASUS VivoBook F512JA-OH36 and has an SSD with Win10
and Ubuntu installed on it. The EFI BIOS is American Megatrends version
302. I have "secure boot" turned off in the BIOS. I have previously
booted other thumb drives on the newer pc (Knoppix and Ubuntu Live) so I
am familiar with booting from a thumb drive on the newer pc.
The OS I want to boot is on partition #1 of a thumb drive. The system
type indicated in the partition table is FAT16 LBA (0x0e) and the boot
flag is set. The boot sector of partition #1 is definitely not a
standard FAT16 LBA boot sector (see listing at the end of this post). It
simply loads the 16 sector OS from partition #1 to 0:0x1000 and performs
a long jump to the code. The boot sector has the standard 55AA signature
at the end. Partition #1 has a lot of space on it besides the boot
sector and the 16 sector OS - it is 32.5 MB. The OS isn't much of an OS,
but rather aspires to be a text editor which operates on files in
partition #2 and #3 of the thumb drive. Partition #2 and #3 are standard
FAT16 LBA partitions - but they are not bootable.
The EFI BIOS seems to say that they are bootable.

Can you provide both the MBR source code and the binary dump of the MBR image on the thumb drive?

It seems like the problem may be in there, in the partition table entries, not in the boot sector (vbr).

You might want to try swapping the partition table entries #1, with #2, and then see how the EFI BIOS
reports your boot options.

Steve
Post by bilsch01
OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #2
OPTION #4 UEFI: USB DIDK PARTITION #3
You can select one of the USB DISK PARTITIONS to boot by moving and
saving its line to the OPTION #1 position in the EFI BIOS. If the
selected partition is bootable it will be booted when you exit from the
EFI BIOS. The problem is that the system I want to boot is on USB DISK
PARTITION #1, which isn't even listed. For some reason the BIOS does not
include partition #1 as an option for booting.
QUESTION 1: does anyone know why it might not accept partition #1 as a
boot option?
QUESTION 2: can I avoid the problem if I "enroll" a "hash" of something
to the EFI system? If so, I don't know how to do that.
Below is a listing of partition #1 boot sector. Note: the bytes between
the executable code and the 55AA signature are filled with ASCII 0x6B.
00000000 B80000 mov ax,0x0
00000003 8ED0 mov ss,ax
00000005 BCFF7A mov sp,0x7aff
00000008 8ED8 mov ds,ax
0000000A BE007B mov si,0x7b00
0000000D C7041000 mov word [si],0x10
00000011 C744021000 mov word [si+0x2],0x10
00000016 C744040000 mov word [si+0x4],0x0
0000001B C744060010 mov word [si+0x6],0x1000
00000020 C744086002 mov word [si+0x8],0x260
00000025 C7440A0000 mov word [si+0xa],0x0
0000002A C7440C0000 mov word [si+0xc],0x0
0000002F C7440E0000 mov word [si+0xe],0x0
00000034 B442 mov ah,0x42
00000036 B280 mov dl,0x80
00000038 CD13 int 0x13
0000003A 720A jc 0x46
0000003C B8310E mov ax,0xe31
0000003F CD10 int 0x10
00000041 EA00000010 jmp 0x1000:0x0
00000046 B90200 mov cx,0x2
00000049 C1C004 rol ax,byte 0x4
0000004C 50 push ax
0000004D 240F and al,0xf
0000004F 0430 add al,0x30
00000051 3C39 cmp al,0x39
00000053 7602 jna 0x57
00000055 0407 add al,0x7
00000057 B40E mov ah,0xe
00000059 CD10 int 0x10
0000005B 58 pop ax
0000005C 49 dec cx
0000005D 75EA jnz 0x49
0000005F EBFE jmp short 0x5f
00000061 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000065 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000069 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
000001FC 6B6B55AA imul bp,[bp+di+0x55],byte -0x56
Thank you for your suggestions. Bill S.
bilsch01
2020-12-22 09:42:35 UTC
Permalink
Post by s***@yahoo.com
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which has
EFI BIOS. The pc is ASUS VivoBook F512JA-OH36 and has an SSD with Win10
and Ubuntu installed on it. The EFI BIOS is American Megatrends version
302. I have "secure boot" turned off in the BIOS. I have previously
booted other thumb drives on the newer pc (Knoppix and Ubuntu Live) so I
am familiar with booting from a thumb drive on the newer pc.
The OS I want to boot is on partition #1 of a thumb drive. The system
type indicated in the partition table is FAT16 LBA (0x0e) and the boot
flag is set. The boot sector of partition #1 is definitely not a
standard FAT16 LBA boot sector (see listing at the end of this post). It
simply loads the 16 sector OS from partition #1 to 0:0x1000 and performs
a long jump to the code. The boot sector has the standard 55AA signature
at the end. Partition #1 has a lot of space on it besides the boot
sector and the 16 sector OS - it is 32.5 MB. The OS isn't much of an OS,
but rather aspires to be a text editor which operates on files in
partition #2 and #3 of the thumb drive. Partition #2 and #3 are standard
FAT16 LBA partitions - but they are not bootable.
The EFI BIOS seems to say that they are bootable.
Can you provide both the MBR source code and the binary dump of the MBR image on the thumb drive?
It seems like the problem may be in there, in the partition table entries, not in the boot sector (vbr).
You might want to try swapping the partition table entries #1, with #2, and then see how the EFI BIOS
reports your boot options.
Steve
Hi Steve. I'm going to work on this some more before I make a good
response to your post. I'm going to do some more thinking and tinkering.
Talk to you soon. Happy holidays.

Bill S.
Post by s***@yahoo.com
Post by bilsch01
OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #2
OPTION #4 UEFI: USB DIDK PARTITION #3
You can select one of the USB DISK PARTITIONS to boot by moving and
saving its line to the OPTION #1 position in the EFI BIOS. If the
selected partition is bootable it will be booted when you exit from the
EFI BIOS. The problem is that the system I want to boot is on USB DISK
PARTITION #1, which isn't even listed. For some reason the BIOS does not
include partition #1 as an option for booting.
QUESTION 1: does anyone know why it might not accept partition #1 as a
boot option?
QUESTION 2: can I avoid the problem if I "enroll" a "hash" of something
to the EFI system? If so, I don't know how to do that.
Below is a listing of partition #1 boot sector. Note: the bytes between
the executable code and the 55AA signature are filled with ASCII 0x6B.
00000000 B80000 mov ax,0x0
00000003 8ED0 mov ss,ax
00000005 BCFF7A mov sp,0x7aff
00000008 8ED8 mov ds,ax
0000000A BE007B mov si,0x7b00
0000000D C7041000 mov word [si],0x10
00000011 C744021000 mov word [si+0x2],0x10
00000016 C744040000 mov word [si+0x4],0x0
0000001B C744060010 mov word [si+0x6],0x1000
00000020 C744086002 mov word [si+0x8],0x260
00000025 C7440A0000 mov word [si+0xa],0x0
0000002A C7440C0000 mov word [si+0xc],0x0
0000002F C7440E0000 mov word [si+0xe],0x0
00000034 B442 mov ah,0x42
00000036 B280 mov dl,0x80
00000038 CD13 int 0x13
0000003A 720A jc 0x46
0000003C B8310E mov ax,0xe31
0000003F CD10 int 0x10
00000041 EA00000010 jmp 0x1000:0x0
00000046 B90200 mov cx,0x2
00000049 C1C004 rol ax,byte 0x4
0000004C 50 push ax
0000004D 240F and al,0xf
0000004F 0430 add al,0x30
00000051 3C39 cmp al,0x39
00000053 7602 jna 0x57
00000055 0407 add al,0x7
00000057 B40E mov ah,0xe
00000059 CD10 int 0x10
0000005B 58 pop ax
0000005C 49 dec cx
0000005D 75EA jnz 0x49
0000005F EBFE jmp short 0x5f
00000061 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000065 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000069 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
000001FC 6B6B55AA imul bp,[bp+di+0x55],byte -0x56
Thank you for your suggestions. Bill S.
bilsch01
2021-01-04 09:48:29 UTC
Permalink
Post by s***@yahoo.com
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which has
EFI BIOS. The pc is ASUS VivoBook F512JA-OH36 and has an SSD with Win10
and Ubuntu installed on it. The EFI BIOS is American Megatrends version
302. I have "secure boot" turned off in the BIOS. I have previously
booted other thumb drives on the newer pc (Knoppix and Ubuntu Live) so I
am familiar with booting from a thumb drive on the newer pc.
The OS I want to boot is on partition #1 of a thumb drive. The system
type indicated in the partition table is FAT16 LBA (0x0e) and the boot
flag is set. The boot sector of partition #1 is definitely not a
standard FAT16 LBA boot sector (see listing at the end of this post). It
simply loads the 16 sector OS from partition #1 to 0:0x1000 and performs
a long jump to the code. The boot sector has the standard 55AA signature
at the end. Partition #1 has a lot of space on it besides the boot
sector and the 16 sector OS - it is 32.5 MB. The OS isn't much of an OS,
but rather aspires to be a text editor which operates on files in
partition #2 and #3 of the thumb drive. Partition #2 and #3 are standard
FAT16 LBA partitions - but they are not bootable.
The EFI BIOS seems to say that they are bootable.
Can you provide both the MBR source code and the binary dump of the MBR image on the thumb drive?
It seems like the problem may be in there, in the partition table entries, not in the boot sector (vbr).
You might want to try swapping the partition table entries #1, with #2, and then see how the EFI BIOS
reports your boot options.
Steve
Post by bilsch01
OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #2
OPTION #4 UEFI: USB DIDK PARTITION #3
You can select one of the USB DISK PARTITIONS to boot by moving and
saving its line to the OPTION #1 position in the EFI BIOS. If the
selected partition is bootable it will be booted when you exit from the
EFI BIOS. The problem is that the system I want to boot is on USB DISK
PARTITION #1, which isn't even listed. For some reason the BIOS does not
include partition #1 as an option for booting.
QUESTION 1: does anyone know why it might not accept partition #1 as a
boot option?
QUESTION 2: can I avoid the problem if I "enroll" a "hash" of something
to the EFI system? If so, I don't know how to do that.
Below is a listing of partition #1 boot sector. Note: the bytes between
the executable code and the 55AA signature are filled with ASCII 0x6B.
00000000 B80000 mov ax,0x0
00000003 8ED0 mov ss,ax
00000005 BCFF7A mov sp,0x7aff
00000008 8ED8 mov ds,ax
0000000A BE007B mov si,0x7b00
0000000D C7041000 mov word [si],0x10
00000011 C744021000 mov word [si+0x2],0x10
00000016 C744040000 mov word [si+0x4],0x0
0000001B C744060010 mov word [si+0x6],0x1000
00000020 C744086002 mov word [si+0x8],0x260
00000025 C7440A0000 mov word [si+0xa],0x0
0000002A C7440C0000 mov word [si+0xc],0x0
0000002F C7440E0000 mov word [si+0xe],0x0
00000034 B442 mov ah,0x42
00000036 B280 mov dl,0x80
00000038 CD13 int 0x13
0000003A 720A jc 0x46
0000003C B8310E mov ax,0xe31
0000003F CD10 int 0x10
00000041 EA00000010 jmp 0x1000:0x0
00000046 B90200 mov cx,0x2
00000049 C1C004 rol ax,byte 0x4
0000004C 50 push ax
0000004D 240F and al,0xf
0000004F 0430 add al,0x30
00000051 3C39 cmp al,0x39
00000053 7602 jna 0x57
00000055 0407 add al,0x7
00000057 B40E mov ah,0xe
00000059 CD10 int 0x10
0000005B 58 pop ax
0000005C 49 dec cx
0000005D 75EA jnz 0x49
0000005F EBFE jmp short 0x5f
00000061 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000065 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000069 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
000001FC 6B6B55AA imul bp,[bp+di+0x55],byte -0x56
Thank you for your suggestions. Bill S.
Steve, As you suggested I swapped the partition table (partab) position
of the 16 byte partab records of partition#1 and partition#3. Here are
the boot options now offered by the EFI BIOS:

OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #1
OPTION #4 UEFI: USB DIDK PARTITION #2

The fact that there is no boot option listed for partition#3 indicates
that EFI doesn't like the partition record I swapped in to position #3
of the partab. That is the same result as in the original post (above)
where no boot option was listed for the record in partab position #1. So
we know that EFI doesn't like the 16 byte record that belongs to actual
partition#1. As you requested a listing of MBR code is included below.

Here is a hand typed hex dump of the partab record for partition#1:

80 01 01 00 0e 1f 3f 20 3f 00 00 00 a1 03 01 00

Here is the decoded info in the record that belongs to partition#1:

start head: 0x01 = 1
start sector: 000010 = 2
start cyl: 0000000000 = 0
file system: 0x0e = FAT16 LBA
end head: 0x1f = 31
end sector: 011111 = 31
end cyl: 1101000000 = 832
relative sectors: 0x0000003f = 63 (agrees with fdisk)
total sectors: 0x000103a1 = 66465 (agrees with fdisk)

Here is the MBR code:

00000000 cli
00000001 xor ax,ax
00000003 mov ss,ax
00000005 mov sp,0x7c00
00000008 mov si,sp
0000000A push ax
0000000B pop es
0000000C push ax
0000000D pop ds
0000000E sti
0000000F cld
00000010 mov di,0x600
00000013 mov cx,0x100
00000016 repne movsw
00000018 jmp 0x0:0x61d
0000001D mov si,0x7be
00000020 mov bl,0x4
00000022 cmp byte [si],0x80
00000025 jz 0x35
00000027 cmp byte [si],0x0
0000002A jnz 0x48
0000002C add si,byte +0x10
0000002F dec bl
00000031 jnz 0x22
00000033 int 0x18
00000035 mov dx,[si]
00000037 mov cx,[si+0x2]
0000003A mov bp,si
0000003C add si,byte +0x10
0000003F dec bl
00000041 jz 0x5d
00000043 cmp byte [si],0x0
00000046 jz 0x3c
00000048 mov si,0x68b
0000004B lodsb
0000004C cmp al,0x0
0000004E jz 0x5b
00000050 push si
00000051 mov bx,0x7
00000054 mov ah,0xe
00000056 int 0x10
00000058 pop si
00000059 jmp short 0x4b
0000005B jmp short 0x5b
0000005D mov di,0x5
00000060 mov bx,0x7c00
00000063 mov ax,0x201
00000066 push di
00000067 int 0x13
00000069 pop di
0000006A jnc 0x78
0000006C xor ax,ax
0000006E int 0x13
00000070 dec di
00000071 jnz 0x60
00000073 mov si,0x6a3
00000076 jmp short 0x4b
00000078 mov si,0x6c2
0000007B mov di,0x7dfe
0000007E cmp word [di],0xaa55
00000082 jnz 0x4b
00000084 mov si,bp
00000086 jmp 0x0:0x7c00

Here are the partab values

800101
000E1F3F
203F
0000
00A10301
0000
0001
210E1F3F
3CE0
0301
0080DC00
0000
0001
3D0E1F
3F
55
60
E001
00E0
C400
0000
0000
0000
0000
0000
0000
0000
0000
55AA
wolfgang kern
2021-01-04 12:50:26 UTC
Permalink
On 04.01.2021 10:48, bilsch01 posted:

[an attempt to boot a classic DOS MBR on EFI...]

the BIOS may not even see your MBR, I'd check if it's read at all by
inserting any int0x10 text print before "your code and not the BIOS"
selects a partition.
__
wolfgang
bilsch01
2021-01-04 19:30:05 UTC
Permalink
Post by wolfgang kern
[an attempt to boot a classic DOS MBR on EFI...]
the BIOS may not even see your MBR, I'd check if it's read at all by
inserting any int0x10 text print before "your code and not the BIOS"
selects a partition.
__
wolfgang
I think the test (recommended by Steve) that I performed by swapping
partition table records #1 and #3 shows that EFI is looking at the
partition table and offering boot options based on what it sees there.
s***@yahoo.com
2021-01-04 19:34:09 UTC
Permalink
Post by bilsch01
Post by wolfgang kern
[an attempt to boot a classic DOS MBR on EFI...]
the BIOS may not even see your MBR, I'd check if it's read at all by
inserting any int0x10 text print before "your code and not the BIOS"
selects a partition.
__
wolfgang
I think the test (recommended by Steve) that I performed by swapping
partition table records #1 and #3 shows that EFI is looking at the
partition table and offering boot options based on what it sees there.
bilsch01's profile photo
bilsch01
unread,
3:48 AM (4 hours ago)
to
On 12/17/20 11:02 AM, ***@yahoo.com wrote:
Steve, As you suggested I swapped the partition table (partab) position
of the 16 byte partab records of partition#1 and partition#3. Here are
the boot options now offered by the EFI BIOS:

OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #1
OPTION #4 UEFI: USB DIDK PARTITION #2

The fact that there is no boot option listed for partition#3 indicates
that EFI doesn't like the partition record I swapped in to position #3
of the partab. That is the same result as in the original post (above)
where no boot option was listed for the record in partab position #1. So
we know that EFI doesn't like the 16 byte record that belongs to actual
partition#1. As you requested a listing of MBR code is included below.

Here is a hand typed hex dump of the partab record for partition#1:

80 01 01 00 0e 1f 3f 20 3f 00 00 00 a1 03 01 00

Here is the decoded info in the record that belongs to partition#1:

start head: 0x01 = 1
start sector: 000010 = 2
start cyl: 0000000000 = 0
file system: 0x0e = FAT16 LBA
end head: 0x1f = 31
end sector: 011111 = 31
end cyl: 1101000000 = 832
relative sectors: 0x0000003f = 63 (agrees with fdisk)
total sectors: 0x000103a1 = 66465 (agrees with fdisk)

Here is the MBR code:

00000000 cli
00000001 xor ax,ax
00000003 mov ss,ax
00000005 mov sp,0x7c00
00000008 mov si,sp
0000000A push ax
0000000B pop es
0000000C push ax
0000000D pop ds
0000000E sti
0000000F cld
00000010 mov di,0x600
00000013 mov cx,0x100
00000016 repne movsw
00000018 jmp 0x0:0x61d

0000001D mov si,0x7be
00000020 mov bl,0x4
00000022 cmp byte [si],0x80
00000025 jz 0x35

00000027 cmp byte [si],0x0
0000002A jnz 0x48
0000002C add si,byte +0x10
0000002F dec bl
00000031 jnz 0x22

00000033 int 0x18
00000035 mov dx,[si]
00000037 mov cx,[si+0x2]
0000003A mov bp,si
0000003C add si,byte +0x10
0000003F dec bl
00000041 jz 0x5d

00000043 cmp byte [si],0x0
00000046 jz 0x3c

00000048 mov si,0x68b
0000004B lodsb
0000004C cmp al,0x0
0000004E jz 0x5b

00000050 push si
00000051 mov bx,0x7
00000054 mov ah,0xe
00000056 int 0x10
00000058 pop si
00000059 jmp short 0x4b

0000005B jmp short 0x5b

;; Passed the checking of the partition tbl entries..
;; So read the VBR to 0000:7C00h

0000005D mov di,0x5 ; total tries
.loop ; retry loop
00000060 mov bx,0x7c00
00000063 mov ax,0x201
00000066 push di
00000067 int 0x13

00000069 pop di
0000006A jnc 0x78 .ok

0000006C xor ax,ax .err -- reset
0000006E int 0x13

00000070 dec di .retry count down
00000071 jnz 0x60 .loop

00000073 mov si,0x6a3
00000076 jmp short 0x4b

.ok
00000078 mov si,0x6c2
0000007B mov di,0x7dfe
0000007E cmp word [di],0xaa55
00000082 jnz 0x4b ; four partitions to ck

00000084 mov si,bp
00000086 jmp 0x0:0x7c00

{{ code looks ok }}
{{ missing strings, data, 008C..00BD }}

Here are the partab values

{07BE}
80|01 01 00|0E|1F 3F 20|3F 00 00 00|A1 03 01 00

bootflg
|head
|sector
|cyl
|type
| last HSC
|start LB
|ending LB


00 00 01 21 0E 1F 3F 3C E0 03 01 00 80 DC 00 00
00 00 01 3D 0E 1F 3F 55 60 E0 01 00 E0 C4 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{07DE}
55 AA

{~~~}
The mbr code you show is what I use, but my partition table has one entry:

;; **First Partition Table Entry**

L07BE: db 80h, 01, 01h, 00, 04h, 01h, 0e0h, 0e0h, 20h, 00, 00, 00, 5fh, 0f8h, 00, 00
L07CE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07DE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07EE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07FE: db 55h, 0aah ;; AA55h Boot Signature

In the partition I use,
o the partition type is 04h
o the starting VBR LB is shown as 20h, this is also indicating that a 'track' is 32
(20h) LBs. -Yours indicates 3Fh. Historically, track 0 holds the MBR, and the whole
of that track is gifted to the MBR even though only the first sector is the MBR code.
o the partition table I use works, type 4 is appropriate to fat16. -type 0Eh ??

;; Init: Sun, Aug 6 2017 11:00:17
;;
;; mbr boot from Imation (IBM) 33mb Flash Drive s/n 3525-415C Fat16 Bootable,
;; type 4 partition.
;; Partition Entries = 1
;; Partition Size per description of 0000'F85Fh LB's; <32mb

o I now suggest taking a virgin usb and placing the mbr code you show, with the single
entry partition that I show. Fill the other 3 entries with nulls. The VBR is at
LB 20h, so write some test code and place it there, and it should work. Mine has
been working, and my system is a 64-bit desktop, Dell. The VBR also needs the
AA55h Boot Signature at the end of the LB as the MBR will check that.

o Back in the day, multiple partitions made some sense, nowadays not so much. You
don't want your Hobby OS to accidently stab something in another OS's partition.

hth, keep us posted..

Steve
bilsch01
2021-01-06 03:49:37 UTC
Permalink
Post by s***@yahoo.com
Post by bilsch01
Post by wolfgang kern
[an attempt to boot a classic DOS MBR on EFI...]
the BIOS may not even see your MBR, I'd check if it's read at all by
inserting any int0x10 text print before "your code and not the BIOS"
selects a partition.
__
wolfgang
I think the test (recommended by Steve) that I performed by swapping
partition table records #1 and #3 shows that EFI is looking at the
partition table and offering boot options based on what it sees there.
bilsch01's profile photo
bilsch01
unread,
3:48 AM (4 hours ago)
to
Steve, As you suggested I swapped the partition table (partab) position
of the 16 byte partab records of partition#1 and partition#3. Here are
OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #1
OPTION #4 UEFI: USB DIDK PARTITION #2
The fact that there is no boot option listed for partition#3 indicates
that EFI doesn't like the partition record I swapped in to position #3
of the partab. That is the same result as in the original post (above)
where no boot option was listed for the record in partab position #1. So
we know that EFI doesn't like the 16 byte record that belongs to actual
partition#1. As you requested a listing of MBR code is included below.
80 01 01 00 0e 1f 3f 20 3f 00 00 00 a1 03 01 00
start head: 0x01 = 1
start sector: 000010 = 2
start cyl: 0000000000 = 0
file system: 0x0e = FAT16 LBA
end head: 0x1f = 31
end sector: 011111 = 31
end cyl: 1101000000 = 832
relative sectors: 0x0000003f = 63 (agrees with fdisk)
total sectors: 0x000103a1 = 66465 (agrees with fdisk)
00000000 cli
00000001 xor ax,ax
00000003 mov ss,ax
00000005 mov sp,0x7c00
00000008 mov si,sp
0000000A push ax
0000000B pop es
0000000C push ax
0000000D pop ds
0000000E sti
0000000F cld
00000010 mov di,0x600
00000013 mov cx,0x100
00000016 repne movsw
00000018 jmp 0x0:0x61d
0000001D mov si,0x7be
00000020 mov bl,0x4
00000022 cmp byte [si],0x80
00000025 jz 0x35
00000027 cmp byte [si],0x0
0000002A jnz 0x48
0000002C add si,byte +0x10
0000002F dec bl
00000031 jnz 0x22
00000033 int 0x18
00000035 mov dx,[si]
00000037 mov cx,[si+0x2]
0000003A mov bp,si
0000003C add si,byte +0x10
0000003F dec bl
00000041 jz 0x5d
00000043 cmp byte [si],0x0
00000046 jz 0x3c
00000048 mov si,0x68b
0000004B lodsb
0000004C cmp al,0x0
0000004E jz 0x5b
00000050 push si
00000051 mov bx,0x7
00000054 mov ah,0xe
00000056 int 0x10
00000058 pop si
00000059 jmp short 0x4b
0000005B jmp short 0x5b
;; Passed the checking of the partition tbl entries..
;; So read the VBR to 0000:7C00h
0000005D mov di,0x5 ; total tries
.loop ; retry loop
00000060 mov bx,0x7c00
00000063 mov ax,0x201
00000066 push di
00000067 int 0x13
00000069 pop di
0000006A jnc 0x78 .ok
0000006C xor ax,ax .err -- reset
0000006E int 0x13
00000070 dec di .retry count down
00000071 jnz 0x60 .loop
00000073 mov si,0x6a3
00000076 jmp short 0x4b
.ok
00000078 mov si,0x6c2
0000007B mov di,0x7dfe
0000007E cmp word [di],0xaa55
00000082 jnz 0x4b ; four partitions to ck
00000084 mov si,bp
00000086 jmp 0x0:0x7c00
{{ code looks ok }}
{{ missing strings, data, 008C..00BD }}
Here are the partab values
{07BE}
80|01 01 00|0E|1F 3F 20|3F 00 00 00|A1 03 01 00
bootflg
|head
|sector
|cyl
|type
| last HSC
|start LB
|ending LB
00 00 01 21 0E 1F 3F 3C E0 03 01 00 80 DC 00 00
00 00 01 3D 0E 1F 3F 55 60 E0 01 00 E0 C4 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{07DE}
55 AA
{~~~}
;; **First Partition Table Entry**
L07BE: db 80h, 01, 01h, 00, 04h, 01h, 0e0h, 0e0h, 20h, 00, 00, 00, 5fh, 0f8h, 00, 00
L07CE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07DE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07EE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07FE: db 55h, 0aah ;; AA55h Boot Signature
In the partition I use,
o the partition type is 04h
o the starting VBR LB is shown as 20h, this is also indicating that a 'track' is 32
(20h) LBs. -Yours indicates 3Fh. Historically, track 0 holds the MBR, and the whole
of that track is gifted to the MBR even though only the first sector is the MBR code.
o the partition table I use works, type 4 is appropriate to fat16. -type 0Eh ??
;; Init: Sun, Aug 6 2017 11:00:17
;;
;; mbr boot from Imation (IBM) 33mb Flash Drive s/n 3525-415C Fat16 Bootable,
;; type 4 partition.
;; Partition Entries = 1
;; Partition Size per description of 0000'F85Fh LB's; <32mb
o I now suggest taking a virgin usb and placing the mbr code you show, with the single
entry partition that I show. Fill the other 3 entries with nulls. The VBR is at
LB 20h, so write some test code and place it there, and it should work. Mine has
been working, and my system is a 64-bit desktop, Dell. The VBR also needs the
AA55h Boot Signature at the end of the LB as the MBR will check that.
o Back in the day, multiple partitions made some sense, nowadays not so much. You
don't want your Hobby OS to accidently stab something in another OS's partition.
hth, keep us posted..
Steve
I reformatted partition#1 as FAT16 and set the LBA flag and boot flag,
all using gparted utility. Then I made a copy of the actual boot sector
that gparted just made on partition#1. It starts with an instruction
that jumps to offset 0x3e (byte 62) of the sector, which is standard in
a FAT16 bs. Then I reassembled my simple "boot sector" code so that
there are 61 zeros at the beginning of the resulting 512 byte file, with
my code starting at byte 62. Then I dd copied the first 61 bytes of the
FAT16 bs over the first 61 bytes of that 512 byte file containing my
code. I dd copied that 512 bytes over the FAT16 bs in partition#1.
Following the bs there are 544 empty sectors which is space for 2 FATs
and a 32 sector root directory. I dd copied my 16 sector OS to the flash
drive beginning at absolute sector 608 of the drive which is where the
int 0x13/ah=42 of my code will find it. This flash drive boots my simple
OS on the two non-EFI pcs I have. My EFI pc now shows a boot option for
all 3 partitions on the flash drive:

OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #1
OPTION #4 UEFI: USB DIDK PARTITION #2
OPTION #5 UEFI: USB DIDK PARTITION #3

This is an improvement because EFI had been refusing to list a boot
option for actual partition#1. But when I change partition#1 to the
option #1 position of the EFI boot menu it still does not boot.

What is EFI looking for? Maybe it is looking for some file names like
MSDOS.SYS and IO.SYS to be written at the end of the FAT16 bs, and for
corresponding file names to be in the root directory. However the bs
that gparted utility wrote doesn't contain any such file names. The only
thing I can think to do is to supply some phoney file names in the bs
and in the root directory.

TIA. Bill S.
bilsch01
2021-01-07 10:47:04 UTC
Permalink
Post by bilsch01
Post by s***@yahoo.com
Post by bilsch01
Post by wolfgang kern
[an attempt to boot a classic DOS MBR on EFI...]
the BIOS may not even see your MBR, I'd check if it's read at all by
inserting any int0x10 text print before "your code and not the BIOS"
selects a partition.
__
wolfgang
I think the test (recommended by Steve) that I performed by swapping
partition table records #1 and #3 shows that EFI is looking at the
partition table and offering boot options based on what it sees there.
bilsch01's profile photo
bilsch01
unread,
3:48 AM (4 hours ago)
to
Steve, As you suggested I swapped the partition table (partab) position
of the 16 byte partab records of partition#1 and partition#3. Here are
OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #1
OPTION #4 UEFI: USB DIDK PARTITION #2
The fact that there is no boot option listed for partition#3 indicates
that EFI doesn't like the partition record I swapped in to position #3
of the partab. That is the same result as in the original post (above)
where no boot option was listed for the record in partab position #1. So
we know that EFI doesn't like the 16 byte record that belongs to actual
partition#1. As you requested a listing of MBR code is included below.
80 01 01 00 0e 1f 3f 20 3f 00 00 00 a1 03 01 00
start head: 0x01 = 1
start sector: 000010 = 2
start cyl: 0000000000 = 0
file system: 0x0e = FAT16 LBA
end head: 0x1f = 31
end sector: 011111 = 31
end cyl: 1101000000 = 832
relative sectors: 0x0000003f = 63 (agrees with fdisk)
total sectors: 0x000103a1 = 66465 (agrees with fdisk)
00000000 cli
00000001 xor ax,ax
00000003 mov ss,ax
00000005 mov sp,0x7c00
00000008 mov si,sp
0000000A push ax
0000000B pop es
0000000C push ax
0000000D pop ds
0000000E sti
0000000F cld
00000010 mov di,0x600
00000013 mov cx,0x100
00000016 repne movsw
00000018 jmp 0x0:0x61d
0000001D mov si,0x7be
00000020 mov bl,0x4
00000022 cmp byte [si],0x80
00000025 jz 0x35
00000027 cmp byte [si],0x0
0000002A jnz 0x48
0000002C add si,byte +0x10
0000002F dec bl
00000031 jnz 0x22
00000033 int 0x18
00000035 mov dx,[si]
00000037 mov cx,[si+0x2]
0000003A mov bp,si
0000003C add si,byte +0x10
0000003F dec bl
00000041 jz 0x5d
00000043 cmp byte [si],0x0
00000046 jz 0x3c
00000048 mov si,0x68b
0000004B lodsb
0000004C cmp al,0x0
0000004E jz 0x5b
00000050 push si
00000051 mov bx,0x7
00000054 mov ah,0xe
00000056 int 0x10
00000058 pop si
00000059 jmp short 0x4b
0000005B jmp short 0x5b
;; Passed the checking of the partition tbl entries..
;; So read the VBR to 0000:7C00h
0000005D mov di,0x5    ; total tries
.loop                   ; retry loop
00000060 mov bx,0x7c00
00000063 mov ax,0x201
00000066 push di
00000067 int 0x13
00000069 pop di
0000006A jnc 0x78    .ok
0000006C xor ax,ax    .err -- reset
0000006E int 0x13
00000070 dec di        .retry count down
00000071 jnz 0x60    .loop
00000073 mov si,0x6a3
00000076 jmp short 0x4b
.ok
00000078 mov si,0x6c2
0000007B mov di,0x7dfe
0000007E cmp word [di],0xaa55
00000082 jnz 0x4b    ; four partitions to ck
00000084 mov si,bp
00000086 jmp 0x0:0x7c00
{{ code looks ok }}
{{ missing strings, data, 008C..00BD }}
Here are the partab values
{07BE}
80|01 01 00|0E|1F 3F 20|3F 00 00 00|A1 03 01 00
bootflg
   |head
      |sector
         |cyl
            |type
               | last HSC
                        |start LB
                                    |ending LB
00 00 01 21 0E 1F 3F 3C E0 03 01 00 80 DC 00 00
00 00 01 3D 0E 1F 3F 55 60 E0 01 00 E0 C4 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{07DE}
55 AA
{~~~}
;; **First Partition Table Entry**
L07BE: db 80h, 01, 01h, 00, 04h, 01h, 0e0h, 0e0h, 20h, 00, 00, 00, 5fh, 0f8h, 00, 00
L07CE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07DE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07EE: db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
L07FE: db 55h, 0aah    ;; AA55h Boot Signature
In the partition I use,
o  the partition type is 04h
o  the starting VBR LB is shown as 20h, this is also indicating that a
'track' is 32
    (20h) LBs. -Yours indicates 3Fh.  Historically, track 0 holds the
MBR, and the whole
    of that track is gifted to the MBR even though only the first
sector is the MBR code.
o  the partition table I use works, type 4 is appropriate to fat16.
-type 0Eh ??
;; Init: Sun, Aug  6 2017 11:00:17
;;
;; mbr boot from Imation (IBM) 33mb Flash Drive s/n 3525-415C Fat16 Bootable,
;;  type 4 partition.
;; Partition Entries = 1
;; Partition Size per description of 0000'F85Fh LB's; <32mb
o  I now suggest taking a virgin usb and placing the mbr code you
show, with the single
    entry partition that I show.  Fill the other 3 entries with
nulls.  The VBR is at
    LB 20h, so write some test code and place it there, and it should
work.  Mine has
    been working, and my system is a 64-bit desktop, Dell.  The VBR
also needs the
    AA55h Boot Signature at the end of the LB as the MBR will check that.
o  Back in the day, multiple partitions made some sense, nowadays not
so much.  You
    don't want your Hobby OS to accidently stab something in another
OS's partition.
hth, keep us posted..
Steve
I reformatted partition#1 as FAT16 and set the LBA flag and boot flag,
all using gparted utility.  Then I made a copy of the actual boot sector
that gparted just made on partition#1. It starts with an instruction
that jumps to offset 0x3e (byte 62) of the sector, which is standard in
a FAT16 bs. Then I reassembled my simple "boot sector" code so that
there are 61 zeros at the beginning of the resulting 512 byte file, with
my code starting at byte 62. Then I dd copied the first 61 bytes of the
FAT16 bs over the first 61 bytes of that 512 byte file containing my
code. I dd copied that 512 bytes over the FAT16 bs in partition#1.
Following the bs there are 544 empty sectors which is space for 2 FATs
and a 32 sector root directory. I dd copied my 16 sector OS to the flash
drive beginning at absolute sector 608 of the drive which is where the
int 0x13/ah=42 of my code will find it. This flash drive boots my simple
OS on the two non-EFI pcs I have. My EFI pc now shows a boot option for
OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #1
OPTION #4 UEFI: USB DIDK PARTITION #2
OPTION #5 UEFI: USB DIDK PARTITION #3
This is an improvement because EFI had been refusing to list a boot
option for actual partition#1. But when I change partition#1 to the
option #1 position of the EFI boot menu it still does not boot.
What is EFI looking for? Maybe it is looking for some file names like
MSDOS.SYS and IO.SYS to be written at the end of the FAT16 bs, and for
corresponding file names to be in the root directory. However the bs
that gparted utility wrote doesn't contain any such file names. The only
thing I can think to do is to supply some phoney file names in the bs
and in the root directory.
TIA.   Bill S.
My approach outlined in my previous post is not very good. I've just
about worked my way through a FAT 16 LBA boot sector created by Ranish
Partition Manager (RPM). I've also got a FAT 16 bs created by MSDOS
6.22. I'll modify one of those to load my simple OS to memory at boot
time. I'll abandon my goofy "boot sector". I'll use gparted to format
the partition, that will get me the right numbers in the BPB - of the bs
created by gparted. The gparted bs has hardly any bootstrap code. I will
use the BPB with the bootstrap code from RPM or DOS. I'll copy my OS
binary to the partition as the very first file, using Ubuntu or
something. Then copy the BPB into the first 61 bytes of my modified RPM
bootsector and copy that over the bs written to the partition by
gparted. It will read the file name near the end of the bs and access it
using FAT and root directory entries written by Ubuntu. It will load it
and jump to it.

SO, HOW DOES THAT SOLVE THE EFI PROBLEM?

It doesn't. I will have to seriously modify my OS to use it with EFI and
to use it without BIOS interrupts. That is a later project. Besides, I'm
going to convert to 32-bit assembly code first.

TIA. Bill S.
James Harris
2021-01-07 15:59:54 UTC
Permalink
On 07/01/2021 10:47, bilsch01 wrote:

...
Post by bilsch01
SO, HOW DOES THAT SOLVE THE EFI PROBLEM?
It doesn't. I will have to seriously modify my OS to use it with EFI and
to use it without BIOS interrupts. That is a later project. Besides, I'm
going to convert to 32-bit assembly code first.
I've not been following this thread but in case it's of any use:

MBR and EFI boot are different animals so it makes sense to plan for
your OS image to be booted by either mechanism, even if you write the
code for only one now.

You would need to divide your boot process up into multiple parts. Then
you could have different code to work with each approach. We discussed
this at


https://groups.google.com/g/alt.os.development/c/QlNu6s4cMaY/m/cad1kE3mBwAJ

Maybe there are some useful comments there or in the surrounding posts.
--
James Harris
bilsch01
2021-01-07 21:33:44 UTC
Permalink
Post by James Harris
...
Post by bilsch01
SO, HOW DOES THAT SOLVE THE EFI PROBLEM?
It doesn't. I will have to seriously modify my OS to use it with EFI
and to use it without BIOS interrupts. That is a later project.
Besides, I'm going to convert to 32-bit assembly code first.
MBR and EFI boot are different animals so it makes sense to plan for
your OS image to be booted by either mechanism, even if you write the
code for only one now.
You would need to divide your boot process up into multiple parts. Then
you could have different code to work with each approach. We discussed
this at
https://groups.google.com/g/alt.os.development/c/QlNu6s4cMaY/m/cad1kE3mBwAJ
Maybe there are some useful comments there or in the surrounding posts.
Thanks for the tip. Does the google group have all of the conversations
from the usenet alt.os.development group plus a whole lot more
conversations?
James Harris
2021-01-08 10:13:12 UTC
Permalink
On 07/01/2021 21:33, bilsch01 wrote:

...
Post by bilsch01
Thanks for the tip. Does the google group have all of the conversations
from the usenet alt.os.development group plus a whole lot more
conversations?
Google Groups has (or includes) a web front end to Usenet so, yes, it's
certainly a way of getting to alt.os.development.
--
James Harris
bilsch01
2021-01-04 19:21:06 UTC
Permalink
Post by bilsch01
Post by s***@yahoo.com
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which has
EFI BIOS. The pc is ASUS VivoBook F512JA-OH36 and has an SSD with Win10
and Ubuntu installed on it. The EFI BIOS is American Megatrends version
302. I have "secure boot" turned off in the BIOS. I have previously
booted other thumb drives on the newer pc (Knoppix and Ubuntu Live) so I
am familiar with booting from a thumb drive on the newer pc.
The OS I want to boot is on partition #1 of a thumb drive. The system
type indicated in the partition table is FAT16 LBA (0x0e) and the boot
flag is set. The boot sector of partition #1 is definitely not a
standard FAT16 LBA boot sector (see listing at the end of this post). It
simply loads the 16 sector OS from partition #1 to 0:0x1000 and performs
a long jump to the code. The boot sector has the standard 55AA signature
at the end. Partition #1 has a lot of space on it besides the boot
sector and the 16 sector OS - it is 32.5 MB. The OS isn't much of an OS,
but rather aspires to be a text editor which operates on files in
partition #2 and #3 of the thumb drive. Partition #2 and #3 are standard
FAT16 LBA partitions - but they are not bootable.
The EFI BIOS seems to say that they are bootable.
Can you provide both the MBR source code and the binary dump of the
MBR image on the thumb drive?
It seems like the problem may be in there, in the partition table
entries, not in the boot sector (vbr).
You might want to try swapping the partition table entries #1, with
#2, and then see how the EFI BIOS
reports your boot options.
Steve
Post by bilsch01
OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #2
OPTION #4 UEFI: USB DIDK PARTITION #3
You can select one of the USB DISK PARTITIONS to boot by moving and
saving its line to the OPTION #1 position in the EFI BIOS. If the
selected partition is bootable it will be booted when you exit from the
EFI BIOS. The problem is that the system I want to boot is on USB DISK
PARTITION #1, which isn't even listed. For some reason the BIOS does not
include partition #1 as an option for booting.
QUESTION 1: does anyone know why it might not accept partition #1 as a
boot option?
QUESTION 2: can I avoid the problem if I "enroll" a "hash" of something
to the EFI system? If so, I don't know how to do that.
Below is a listing of partition #1 boot sector. Note: the bytes between
the executable code and the 55AA signature are filled with ASCII 0x6B.
00000000 B80000 mov ax,0x0
00000003 8ED0 mov ss,ax
00000005 BCFF7A mov sp,0x7aff
00000008 8ED8 mov ds,ax
0000000A BE007B mov si,0x7b00
0000000D C7041000 mov word [si],0x10
00000011 C744021000 mov word [si+0x2],0x10
00000016 C744040000 mov word [si+0x4],0x0
0000001B C744060010 mov word [si+0x6],0x1000
00000020 C744086002 mov word [si+0x8],0x260
00000025 C7440A0000 mov word [si+0xa],0x0
0000002A C7440C0000 mov word [si+0xc],0x0
0000002F C7440E0000 mov word [si+0xe],0x0
00000034 B442 mov ah,0x42
00000036 B280 mov dl,0x80
00000038 CD13 int 0x13
0000003A 720A jc 0x46
0000003C B8310E mov ax,0xe31
0000003F CD10 int 0x10
00000041 EA00000010 jmp 0x1000:0x0
00000046 B90200 mov cx,0x2
00000049 C1C004 rol ax,byte 0x4
0000004C 50 push ax
0000004D 240F and al,0xf
0000004F 0430 add al,0x30
00000051 3C39 cmp al,0x39
00000053 7602 jna 0x57
00000055 0407 add al,0x7
00000057 B40E mov ah,0xe
00000059 CD10 int 0x10
0000005B 58 pop ax
0000005C 49 dec cx
0000005D 75EA jnz 0x49
0000005F EBFE jmp short 0x5f
00000061 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000065 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
00000069 6B6B6B6B imul bp,[bp+di+0x6b],byte +0x6b
000001FC 6B6B55AA imul bp,[bp+di+0x55],byte -0x56
Thank you for your suggestions. Bill S.
Steve, As you suggested I swapped the partition table (partab) position
of the 16 byte partab records of partition#1 and partition#3. Here are
OPTION #1 UBUNTU WDC PC SN520
OPTION #2 WINDOWS WDC PC SN520
OPTION #3 UEFI: USB DISK PARTITION #1
OPTION #4 UEFI: USB DIDK PARTITION #2
The fact that there is no boot option listed for partition#3 indicates
that EFI doesn't like the partition record I swapped in to position #3
of the partab. That is the same result as in the original post (above)
where no boot option was listed for the record in partab position #1. So
we know that EFI doesn't like the 16 byte record that belongs to actual
partition#1. As you requested a listing of MBR code is included below.
80 01 01 00 0e 1f 3f 20 3f 00 00 00 a1 03 01 00
start head: 0x01 = 1
start sector: 000010 = 2
start cyl: 0000000000 = 0
file system: 0x0e = FAT16 LBA
end head: 0x1f = 31
end sector: 011111 = 31
end cyl: 1101000000 = 832
relative sectors: 0x0000003f = 63 (agrees with fdisk)
total sectors: 0x000103a1 = 66465 (agrees with fdisk)
00000000  cli
00000001  xor ax,ax
00000003  mov ss,ax
00000005  mov sp,0x7c00
00000008  mov si,sp
0000000A  push ax
0000000B  pop es
0000000C  push ax
0000000D  pop ds
0000000E  sti
0000000F  cld
00000010  mov di,0x600
00000013  mov cx,0x100
00000016  repne movsw
00000018  jmp 0x0:0x61d
0000001D  mov si,0x7be
00000020  mov bl,0x4
00000022  cmp byte [si],0x80
00000025  jz 0x35
00000027  cmp byte [si],0x0
0000002A  jnz 0x48
0000002C  add si,byte +0x10
0000002F  dec bl
00000031  jnz 0x22
00000033  int 0x18
00000035  mov dx,[si]
00000037  mov cx,[si+0x2]
0000003A  mov bp,si
0000003C  add si,byte +0x10
0000003F  dec bl
00000041  jz 0x5d
00000043  cmp byte [si],0x0
00000046  jz 0x3c
00000048  mov si,0x68b
0000004B  lodsb
0000004C  cmp al,0x0
0000004E  jz 0x5b
00000050  push si
00000051  mov bx,0x7
00000054  mov ah,0xe
00000056  int 0x10
00000058  pop si
00000059  jmp short 0x4b
0000005B  jmp short 0x5b
0000005D  mov di,0x5
00000060  mov bx,0x7c00
00000063  mov ax,0x201
00000066  push di
00000067  int 0x13
00000069  pop di
0000006A  jnc 0x78
0000006C  xor ax,ax
0000006E  int 0x13
00000070  dec di
00000071  jnz 0x60
00000073  mov si,0x6a3
00000076  jmp short 0x4b
00000078  mov si,0x6c2
0000007B  mov di,0x7dfe
0000007E  cmp word [di],0xaa55
00000082  jnz 0x4b
00000084  mov si,bp
00000086  jmp 0x0:0x7c00
Here are the partab values
800101
000E1F3F
203F
0000
00A10301
0000
0001
210E1F3F
3CE0
0301
0080DC00
0000
0001
3D0E1F
3F
55
60
E001
00E0
C400
0000
0000
0000
0000
0000
0000
0000
0000
     55AA
One possible difference between the way EFI is treating the acceptable
partitions (#2 & #3) and the unacceptable one (#1) is that #1 boot
sector lacks any information about the structure of the partition - the
BIOS Parameter Block. EFI might be using some of those numbers for a
reality comparison with partition table numbers. That would fail on
partition #1 but not on #2 and #3. The BPB numbers are in a standard
location that EFI could check. Two numbers that would be the same in the
partition table and in BPB are:

1) hidden sectors at BPB offset 0x1c should be same as partition table
value for relative sectors
2) total sectors at BPB offset 0x20 should be the same as partition
table value for total sectors.

I can't restore the entire BPB in partition #1 because I wiped it out,
but I can put those correct numbers in their required locations - there
is enough space to do that and also put in my "boot sector" code.
Rod Pemberton
2021-01-08 08:31:18 UTC
Permalink
On Tue, 15 Dec 2020 09:57:50 -0800
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which
has EFI BIOS.
Is this a UEFI-only motherboard?

Articles on UEFI say you should be able to enable "non-UEFI" boot or
"Legacy Mode" boot options in the BIOS to disable UEFI booting.
--
When Antifa and BLM burn down cities, it's a "peaceful" protest.
When pro-Trumpers riot in the capital, it's an "insurrection".
Melzzzzz
2021-01-08 08:46:18 UTC
Permalink
Post by Rod Pemberton
On Tue, 15 Dec 2020 09:57:50 -0800
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which
has EFI BIOS.
Actually he should enable CSM, compatibility support modul, in order to
boot non UEFI.
--
current job title: senior software engineer
skills: c++,c,rust,go,nim,haskell...

press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi
bili naoruzani. -- Mladen Gogala
bilsch01
2021-01-09 05:25:06 UTC
Permalink
Post by Rod Pemberton
On Tue, 15 Dec 2020 09:57:50 -0800
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which
has EFI BIOS.
Is this a UEFI-only motherboard?
Articles on UEFI say you should be able to enable "non-UEFI" boot or
"Legacy Mode" boot options in the BIOS to disable UEFI booting.
I think this laptop must be UEFI-only. I checked all the options in
BIOS setup and don't see any thing about legacy, CSM, or non-UEFI boot.
This laptop is:
ASUS VivoBook F512JA-OH36. AMI BIOS version 302.

Just as well. I'd like to learn how to rig my "OS" to work on a UEFI
machine.

Thanks. Bill S.
Melzzzzz
2021-01-09 22:11:14 UTC
Permalink
Post by bilsch01
Post by Rod Pemberton
On Tue, 15 Dec 2020 09:57:50 -0800
Post by bilsch01
I am trying to boot a simple 16-bit real mode OS on a thumb drive. It
boots fine on my older pcs but I can't boot it on my newer pc, which
has EFI BIOS.
Is this a UEFI-only motherboard?
Articles on UEFI say you should be able to enable "non-UEFI" boot or
"Legacy Mode" boot options in the BIOS to disable UEFI booting.
I think this laptop must be UEFI-only. I checked all the options in
BIOS setup and don't see any thing about legacy, CSM, or non-UEFI boot.
ASUS VivoBook F512JA-OH36. AMI BIOS version 302.
Just as well. I'd like to learn how to rig my "OS" to work on a UEFI
machine.
UEFI starts Windows PE (I think 64 bit) from fat32 partition.
Post by bilsch01
Thanks. Bill S.
--
current job title: senior software engineer
skills: c++,c,rust,go,nim,haskell...

press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi
bili naoruzani. -- Mladen Gogala
Loading...