mirror of
https://gitlab.com/bztsrc/bootboot.git
synced 2023-02-13 20:54:32 -05:00
Dynamically query CDROM drive on BIOS
This commit is contained in:
parent
934b90f2f9
commit
7c6a8ee72e
10 changed files with 60 additions and 35 deletions
|
@ -354,13 +354,13 @@ Hibakeresés
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
```
|
```
|
||||||
BOOTBOOT-PANIC: LBA support not found
|
BOOTBOOT-PANIC: no LBA support
|
||||||
```
|
```
|
||||||
|
|
||||||
Nagyon régi hardver. A BIOSod nem támogatja az LBA-t. Ezt az üzenetet az első betöltő szektor (boot.bin) írja ki.
|
Nagyon régi hardver. A BIOSod nem támogatja az LBA-t. Ezt az üzenetet az első betöltő szektor (boot.bin) írja ki.
|
||||||
|
|
||||||
```
|
```
|
||||||
BOOTBOOT-PANIC: FS0:\BOOTBOOT.BIN not found
|
BOOTBOOT-PANIC: no FS0:\BOOTBOOT.BIN
|
||||||
```
|
```
|
||||||
|
|
||||||
A fő betöltő nem található a lemezen, vagy az induló szektorcíme nincs jól rögzítve az indítószektor 32 bites
|
A fő betöltő nem található a lemezen, vagy az induló szektorcíme nincs jól rögzítve az indítószektor 32 bites
|
||||||
|
|
|
@ -355,13 +355,13 @@ Troubleshooting
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
```
|
```
|
||||||
BOOTBOOT-PANIC: LBA support not found
|
BOOTBOOT-PANIC: no LBA support
|
||||||
```
|
```
|
||||||
|
|
||||||
Really old hardware. Your BIOS does not support LBA. This message is generated by 1st stage loader (boot.bin).
|
Really old hardware. Your BIOS does not support LBA. This message is generated by 1st stage loader (boot.bin).
|
||||||
|
|
||||||
```
|
```
|
||||||
BOOTBOOT-PANIC: FS0:\BOOTBOOT.BIN not found
|
BOOTBOOT-PANIC: no FS0:\BOOTBOOT.BIN
|
||||||
```
|
```
|
||||||
|
|
||||||
The loader is not on the disk or it's starting LBA address is not recorded in the boot sector at dword [0x1B0]
|
The loader is not on the disk or it's starting LBA address is not recorded in the boot sector at dword [0x1B0]
|
||||||
|
|
Binary file not shown.
Binary file not shown.
BIN
dist/boot.bin
vendored
BIN
dist/boot.bin
vendored
Binary file not shown.
BIN
dist/bootboot.bin
vendored
BIN
dist/bootboot.bin
vendored
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
||||||
extern unsigned char binary_boot_bin[512];
|
extern unsigned char binary_boot_bin[512];
|
||||||
extern unsigned char binary_bootboot_bin[12288];
|
extern unsigned char binary_bootboot_bin[12288];
|
||||||
extern unsigned char binary_bootboot_efi[101490];
|
extern unsigned char binary_bootboot_efi[101490];
|
||||||
extern unsigned char binary_bootboot_img[34712];
|
extern unsigned char binary_bootboot_img[35032];
|
||||||
extern unsigned char binary_bootboot_rv64[8192];
|
extern unsigned char binary_bootboot_rv64[8192];
|
||||||
extern unsigned char binary_LICENCE_broadcom[1594];
|
extern unsigned char binary_LICENCE_broadcom[1594];
|
||||||
extern unsigned char binary_bootcode_bin[52456];
|
extern unsigned char binary_bootcode_bin[52456];
|
||||||
|
|
|
@ -111,7 +111,6 @@ bootboot_record:
|
||||||
jl .nolba
|
jl .nolba
|
||||||
.notfloppy: mov ah, byte 41h
|
.notfloppy: mov ah, byte 41h
|
||||||
mov bx, word 55AAh
|
mov bx, word 55AAh
|
||||||
clc
|
|
||||||
int 13h
|
int 13h
|
||||||
jc .nolba
|
jc .nolba
|
||||||
cmp bx, word 0AA55h
|
cmp bx, word 0AA55h
|
||||||
|
@ -120,25 +119,41 @@ bootboot_record:
|
||||||
jnz .lbaok
|
jnz .lbaok
|
||||||
.nolba: mov si, lbanotf
|
.nolba: mov si, lbanotf
|
||||||
jmp diefunc
|
jmp diefunc
|
||||||
.lbaok: ;try to load stage2 - it's a continous area on disk
|
.lbaok: ;get CDROM drive code
|
||||||
|
mov ax, word 4B01h
|
||||||
|
mov si, lba_packet
|
||||||
|
mov byte [si + 2], 0E0h
|
||||||
|
push si
|
||||||
|
int 13h
|
||||||
|
pop si
|
||||||
|
jc .read2stg
|
||||||
|
mov al, byte [si + 2]
|
||||||
|
mov byte [cdrom], al
|
||||||
|
;try to load stage2 - it's a continous area on disk
|
||||||
;started at given sector with maximum size of 7000h bytes
|
;started at given sector with maximum size of 7000h bytes
|
||||||
mov di, lba_packet
|
.read2stg: mov di, lba_packet
|
||||||
mov cx, 8
|
|
||||||
xor ax, ax
|
|
||||||
repnz stosw
|
|
||||||
mov si, stage2_addr
|
mov si, stage2_addr
|
||||||
mov di, lbapacket.sect0
|
|
||||||
;set up for hard-drive
|
;set up for hard-drive
|
||||||
movsw
|
xor ah, ah
|
||||||
movsw
|
mov al, 16 ; size
|
||||||
mov byte [lbapacket.size], 16
|
stosw
|
||||||
mov byte [lbapacket.addr0+1], 08h ;to address 800h
|
mov al, 56 ; count
|
||||||
mov byte [lbapacket.count], 56
|
stosw
|
||||||
|
xor al, al
|
||||||
|
mov ah, 8 ; addr0 to address 800h
|
||||||
|
stosw
|
||||||
|
xor ax, ax ; addr1
|
||||||
|
stosw
|
||||||
|
movsw ; sect0
|
||||||
|
movsw ; sect1
|
||||||
|
xor ax, ax
|
||||||
|
stosw ; sect2
|
||||||
|
stosw ; sect3
|
||||||
mov dl, byte [drive]
|
mov dl, byte [drive]
|
||||||
;if it's a CDROM with 2048 byte sectors
|
;if it's a CDROM with 2048 byte sectors
|
||||||
cmp dl, 0E0h
|
cmp dl, byte [cdrom]
|
||||||
jl @f
|
jl @f
|
||||||
sub di, 4
|
sub di, 8
|
||||||
;lba=lba/4
|
;lba=lba/4
|
||||||
clc
|
clc
|
||||||
rcr word [di+2], 1
|
rcr word [di+2], 1
|
||||||
|
@ -146,6 +161,7 @@ bootboot_record:
|
||||||
clc
|
clc
|
||||||
rcr word [di+2], 1
|
rcr word [di+2], 1
|
||||||
rcr word [di], 1
|
rcr word [di], 1
|
||||||
|
;count=count/4
|
||||||
shr word [lbapacket.count], 2
|
shr word [lbapacket.count], 2
|
||||||
;load sectors
|
;load sectors
|
||||||
@@: mov ah, byte 42h
|
@@: mov ah, byte 42h
|
||||||
|
@ -172,7 +188,7 @@ bootboot_record:
|
||||||
@@: mov byte [drive], al
|
@@: mov byte [drive], al
|
||||||
inc byte [cnt]
|
inc byte [cnt]
|
||||||
cmp byte [cnt], 8
|
cmp byte [cnt], 8
|
||||||
jl .lbaok
|
jl .read2stg
|
||||||
.nostage2err:
|
.nostage2err:
|
||||||
mov si, stage2notf
|
mov si, stage2notf
|
||||||
;fall into the diefunc code
|
;fall into the diefunc code
|
||||||
|
@ -184,8 +200,6 @@ bootboot_record:
|
||||||
diefunc:
|
diefunc:
|
||||||
print panic
|
print panic
|
||||||
call printfunc
|
call printfunc
|
||||||
mov si, found
|
|
||||||
call printfunc
|
|
||||||
sti
|
sti
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
int 16h
|
int 16h
|
||||||
|
@ -208,17 +222,18 @@ printfunc:
|
||||||
;* data area *
|
;* data area *
|
||||||
;*********************************************************************
|
;*********************************************************************
|
||||||
|
|
||||||
panic: db "BOOTBOOT-PANIC: ",0
|
panic: db "BOOTBOOT-PANIC: no ",0
|
||||||
lbanotf: db "LBA support",0
|
lbanotf: db "LBA support",0
|
||||||
stage2notf: db "FS0:\BOOTBOOT.BIN",0
|
stage2notf: db "FS0:\BOOTBOOT.BIN",0
|
||||||
found: db " not found",0
|
|
||||||
cnt: db 0
|
|
||||||
drive: db 0
|
|
||||||
db 01B0h-($-$$) dup 0
|
db 01B0h-($-$$) dup 0
|
||||||
|
|
||||||
;right before the partition table some data
|
;right before the partition table some data
|
||||||
stage2_addr:dd 0FFFFFFFFh,0 ;1B0h 2nd stage loader address
|
stage2_addr:dd 0FFFFFFFFh ;1B0h 2nd stage loader address
|
||||||
;this should be set by mkfs
|
;this should be set by mkfs
|
||||||
|
cnt: db 0
|
||||||
|
drive: db 0
|
||||||
|
cdrom: db 0
|
||||||
|
db 0
|
||||||
|
|
||||||
diskid: dd 0 ;1B8h WinNT expects it here
|
diskid: dd 0 ;1B8h WinNT expects it here
|
||||||
dw 0
|
dw 0
|
||||||
|
|
|
@ -284,7 +284,17 @@ realmode_start:
|
||||||
jnz @f
|
jnz @f
|
||||||
.clrdl: mov dl, 80h
|
.clrdl: mov dl, 80h
|
||||||
@@: mov byte [bootdev], dl
|
@@: mov byte [bootdev], dl
|
||||||
|
;get CDROM drive code
|
||||||
|
mov ax, word 4B01h
|
||||||
|
mov si, entrypoint ; bss area
|
||||||
|
mov byte [si + 2], 0E0h
|
||||||
|
push si
|
||||||
|
int 13h
|
||||||
|
pop si
|
||||||
|
jc @f
|
||||||
|
mov al, byte [si + 2]
|
||||||
|
mov byte [cdromdev], al
|
||||||
|
@@:
|
||||||
;-----initialize serial port COM1,115200,8N1------
|
;-----initialize serial port COM1,115200,8N1------
|
||||||
mov ax, 0401h
|
mov ax, 0401h
|
||||||
xor bx, bx
|
xor bx, bx
|
||||||
|
@ -948,8 +958,7 @@ prot_readsectorfunc:
|
||||||
.again: mov ax, word [lbapacket.count]
|
.again: mov ax, word [lbapacket.count]
|
||||||
mov word [origcount], ax
|
mov word [origcount], ax
|
||||||
mov dl, byte [readdev]
|
mov dl, byte [readdev]
|
||||||
;don't use INT 13h / AX=4B01h, that's buggy on many BIOSes
|
cmp dl, byte [cdromdev]
|
||||||
cmp dl, 0E0h
|
|
||||||
jl @f
|
jl @f
|
||||||
;use 2048 byte sectors instead of 512 if it's a cdrom
|
;use 2048 byte sectors instead of 512 if it's a cdrom
|
||||||
mov al, byte [lbapacket.sect0]
|
mov al, byte [lbapacket.sect0]
|
||||||
|
@ -2697,11 +2706,12 @@ root_sec: dd 0 ;root directory's first sector
|
||||||
data_sec: dd 0 ;first data sector
|
data_sec: dd 0 ;first data sector
|
||||||
clu_sec: dd 0 ;sector per cluster
|
clu_sec: dd 0 ;sector per cluster
|
||||||
origcount: dw 0
|
origcount: dw 0
|
||||||
|
cdromdev: db 0
|
||||||
bootdev: db 0
|
bootdev: db 0
|
||||||
readdev: db 0
|
readdev: db 0
|
||||||
cntdev: db 0
|
cntdev: db 0
|
||||||
hasinitrd: db 0
|
hasinitrd: db 0
|
||||||
hasconfig: db 0
|
hasconfig: db 0
|
||||||
iscdrom: db 0
|
iscdrom: db 0
|
||||||
nosmp: db 0
|
nosmp: db 0
|
||||||
bsp_done: ;flag to indicate APs can run
|
bsp_done: ;flag to indicate APs can run
|
||||||
|
|
Loading…
Reference in a new issue