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 à 16:11, Pascal <[email protected]> a écrit : > *this is python biting its tail ;-)* > > 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 loader (BSL eg. the code) to display the > warning. > > > > *if the BIOS needs nothing but the 0x55AA signature, it loads MBR and runs > BSL.if the BIOS needs a (table of) partition before loading MBR and handing > over to BSL, 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 ? > > will give feedback... > > regards, lacsaP. > > Le mar. 2 août 2022 à 23:55, Pascal Hambourg <[email protected]> a > écrit : > >> Le 02/08/2022 à 12:56, Pascal wrote : >> > >> > Gregory(@syslinux) highlights the PBR : >> > *"""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. >> >> That sounds horribly broken. Conversely, some BIOS won't boot if no >> partition is marked active in the MBR. Granted, that's equally broken. >> >>
