1
0
Fork 0
mirror of https://gitlab.com/bztsrc/bootboot.git synced 2023-02-13 20:54:32 -05:00

Support for initrd over serial in BIOS/Multiboot variant

This commit is contained in:
bzt 2020-09-19 23:24:41 +02:00
parent b73f0d5b2a
commit e80c8cc9ab
6 changed files with 70 additions and 3 deletions

BIN
dist/bootboot.bin vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
/* generated by bin2h, do not edit */
extern unsigned char binary_boot_bin[512];
extern unsigned char binary_bootboot_bin[11776];
extern unsigned char binary_bootboot_bin[12288];
extern unsigned char binary_bootboot_efi[99396];
extern unsigned char binary_bootboot_img[34672];
extern unsigned char binary_LICENCE_broadcom[1594];

View file

@ -1006,6 +1006,29 @@ prot_oct2bin:
pop ebx
ret
; IN: al, character to send
uart_send: mov ah, al
mov dx, 3fdh
@@: pause
in al, dx
and al, 20h
jz @b
sub dl, 5
mov al, ah
out dx, al
ret
; IN: edi pointer to store the received char
uart_getc: mov dx, 03fdh
@@: pause
in al, dx
and al, 1
jz @b
sub dl, 5
in al, dx
stosb
ret
protmode_start:
mov ax, DATA_PROT
mov ds, ax
@ -1038,7 +1061,51 @@ protmode_start:
cmp esi, 0F4000h
jb .nextrom
; read GPT
;---- notify raspbootcom / USBImager to send the initrd over serial line ----
mov al, 3
call uart_send
call uart_send
call uart_send
; wait for response with timeout
mov ah, al
mov cx, 10000
mov dx, 3fdh
@@: dec cx
jz .getgpt
pause
in al, dx
and al, 1
jz @b
; read the initrd's size
mov edi, bootboot.initrd_size
call uart_getc
call uart_getc
call uart_getc
call uart_getc
mov ecx, dword [bootboot.initrd_size]
; send negative or positive acknowledge
cmp ecx, 32
jb .se
cmp ecx, INITRD_MAXSIZE*1024*1024
jb .ok
.se: mov al, 'S'
call uart_send
mov al, 'E'
call uart_send
jmp .getgpt
.ok: mov al, 'O'
call uart_send
mov al, 'K'
call uart_send
mov edi, dword [bootboot.initrd_ptr]
; read in the image
@@: call uart_getc
dec ecx
jnz @b
jmp .initrdloaded
;---- read GPT -----
.getgpt: xor eax, eax
xor edi, edi
prot_readsector