here is the assembly code used to generate the "special" MBR which
includes
the boot strap warning and
the active protective partition :
; nasm bioswarn.asm -f bin -o bioswarn.mbr
; qemu-system-x86_64 bioswarn.mbr
bits 16
org 0x7C00
cli
cld
; <
https://stackoverflow.com/questions/32508919/how-to-produce-a-minimal-bios-hello-world
;xor ax, ax
;mov ax, ds
; end >
; < https://www.apriorit.com/dev-blog/66-develop-boot-loader
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov bp,0x7C00
mov sp,0x7C00
; end >
; < https://jbwyatt.com/253/emu/8086_bios_and_dos_interrupts.html#int10h_01h
mov ch, 0x20
mov ah, 0x01
int 10h
; end >
mov si, warn
mov ah, 0x0E
loop: lodsb
or al, al
jz halt
int 0x10
jmp loop
halt: hlt
warn: db 0x0A, 0x0A, "BIOS/CSM/LEGACY boot no longer supported : switch to
UEFI boot !", 0
; padding
times 0x01BE - ($ - $$) db 0
; partition #1
db 0x80 ; active
db 0x00 ; Head
db 0x00 ; Sector
db 0x00 ; Cylinder
db 0xEE ; type GPT
db 0xFF ; H
db 0xFF ; S
db 0xFF ; C
dd 0x00000000 ; LBA start
dd 0xFFFFFFFF ; sectors
; partitions #2, #3 & #4
times 0x30 db 0 ; 16 bytes x 3
# boot signature
dw 0xAA55
it works under qemu : I just have to test it in real life... ;-)
your comments and feedback will be greatly appreciated !
regards, lacsaP.
Le mer. 3 ao?t 2022 ? 18:55, Pascal <patatetom at gmail.com> a ?crit :
> here is what I plan to test :
> leave the protective partition in place (1), mark it as active (2) and
> change its first sector to zero (3).
>
> 1) its absence seems to be a problem (at least with qemu/ovmf),
> 2) gdisk does not activate it by default,
> 3) the MBR and the first sector of the active partition will be confused
> and will both have the boot strap code (BSC eg. the code) to display the
> warning.
>
>
>
> *if the BIOS needs nothing but the 0x55AA signature, it loads MBR and runs
> BSC.if the BIOS needs a (table of) partition before loading MBR and handing
> over to BSC, it has it.if the BIOS needs an active partition, it has it and
> if it loads its PBR instead of MBR, it has it too.*
>
> the only point that seems contentious to me is whether a partition can
> have its first sector set to zero ?
> does the BIOS check this kind of thing ?
>
> regards, lacsaP.
>
> Le mar. 2 ao?t 2022 ? 11:55, Pascal <patatetom at gmail.com> a ?crit
:
>
>> I use gdisk which adds protective MBR which could be problematic in
this
>> case.
>> this false partition is not marked as active but its presence could be
>> annoying.
>> thanks for this return.
>>
>> Le mar. 2 ao?t 2022 ? 08:40, Gregory Bartholomew <
>> gregory.lee.bartholomew at gmail.com> a ?crit :
>>
>>> Well, I'm still just guessing, but some BIOS systems might
execute a PBR
>>> (partition boot record) instead of the MBR if one exists and the
partition
>>> is marked active. You might need to make sure that there is no DOS
>>> partition table on the system (or at least that none of the
partitions are
>>> marked active).
>>>
>>> On Tue, Aug 2, 2022 at 1:25 AM Pascal <patatetom at
gmail.com> wrote:
>>>
>>>> yes, my live (Linux USB) system is UEFI-only, but this tiny MBR
boot
>>>> code is intended to be run/executed on a pc that boots under
BIOS and not
>>>> under UEFI :
>>>> *"hey, your pc boots in BIOS : if you want to play with
me, boot in
>>>> UEFI ;-)"*
>>>> it works well under some BIOS and not under others where it
displays
>>>> nothing or just a character that looks like a smiley.
>>>>
>>>> Le lun. 1 ao?t 2022 ? 23:35, Gregory Bartholomew <
>>>> gregory.lee.bartholomew at gmail.com> a ?crit :
>>>>
>>>>> On Mon, Aug 1, 2022 at 2:54 AM Pascal via Syslinux <
>>>>> syslinux at syslinux.org> wrote:
>>>>>
>>>>>> hi,
>>>>>>
>>>>>> I have a live system with only UEFI boot supported.
>>>>>>
>>>>>> to indicate this to users who have not yet switched to
UEFI, I have
>>>>>> below
>>>>>> this simple little piece of code (partly found on the
internet) that I
>>>>>> compile with nasm and I push onto the MBR.
>>>>>>
>>>>>> it runs perfectly on some PCs and in virtual machine
with Qemu, but
>>>>>> refuses
>>>>>> to run on other PCs by displaying either a kind of
smiley logo or a
>>>>>> simple
>>>>>> blinking cursor.
>>>>>>
>>>>>> does anyone have any idea or clue about this?
>>>>>>
>>>>>>
>>>>> I guess a truly UEFI-only system won't execute a MBR
first-stage
>>>>> bootloader. You'd probably have to compile your program
as an EFI
>>>>> executable and put it on the ESP on such systems. :)
>>>>>
>>>>