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

More precise error messages

This commit is contained in:
bzt 2019-12-13 14:15:55 +01:00
parent 84415afd2f
commit 09ceab095f
8 changed files with 29 additions and 16 deletions

View file

@ -364,12 +364,18 @@ BOOTBOOT-PANIC: Unable to initialize SDHC card
The loader was unable to initialize EMMC for SDHC card access, probably hardware error or old card.
```
BOOTBOOT-PANIC: No GPT found
```
The loader was unable to load the GUID Partitioning Table.
```
BOOTBOOT-PANIC: No boot partition
```
Either the disk does not have a GPT, or there's no EFI System Partition nor any other bootable
partition on it. Or the FAT file system is found but inconsistent, or doesn't have a BOOTBOOT directory.
There's no EFI System Partition nor any other bootable partition in the GPT. Or the FAT file system is found but corrupt
(contains inconsistent BPB data), or doesn't have a BOOTBOOT directory (with 8+3 MSDOS entry, not LFN).
```
BOOTBOOT-PANIC: Not 2048 sector aligned

View file

@ -1218,8 +1218,8 @@ int bootboot_main(uint64_t hcl)
/* read and parse GPT table */
r=sd_readblock(1,(unsigned char*)&__diskbuf,1);
if(r==0 || memcmp((void*)&__diskbuf, "EFI PART", 8)) {
diskerr:
puts("BOOTBOOT-PANIC: No boot partition\n");
gpterr:
puts("BOOTBOOT-PANIC: No GPT found\n");
goto error;
}
// get number of partitions and size of partition entry
@ -1227,7 +1227,7 @@ diskerr:
if(np>127) np=127;
// read GPT entries
r=sd_readblock(*((uint32_t*)((char*)&__diskbuf+72)),(unsigned char*)&__diskbuf,(np*sp+511)/512);
if(r==0) goto diskerr;
if(r==0) goto gpterr;
part=NULL;
// first, look for a partition with bootable flag
for(r=0;r<np;r++) {
@ -1254,7 +1254,11 @@ diskerr:
break;
}
}
if(part==NULL || r>=np) goto diskerr;
if(part==NULL || r>=np) {
diskerr:
puts("BOOTBOOT-PANIC: No boot partition\n");
goto error;
}
r=sd_readblock(part->start,(unsigned char*)&_end,1);
if(r==0) goto diskerr;
initrd.ptr=NULL; initrd.size=0;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1040,7 +1040,7 @@ end if
mov esi, 0A000h+512
cmp dword [esi], 'EFI '
je @f
.nogpt: mov si, nogpt
.nogpt: mov esi, nogpt
jmp prot_diefunc
@@: mov edi, 0B000h
mov ebx, edi
@ -1084,8 +1084,8 @@ end if
.noto: add esi, ebx
dec ecx
jnz @b
.noinitrd: mov esi, nord
jz prot_diefunc
.nopart: mov esi, nopar
jmp prot_diefunc
; load ESP at free memory hole found
.loadesp: mov dword [gpt_ptr], esi
@ -1112,9 +1112,9 @@ end if
je .isfat
;no, then it's an initrd on the entire partition
or eax, eax
jz .noinitrd
jz .nopart
or ecx, ecx
jz .noinitrd
jz .nopart
sub ecx, eax
shl ecx, 9
mov dword [bootboot.initrd_size], ecx
@ -1325,6 +1325,8 @@ end if
jz .loadinitrd
dec ecx
jnz .nextdir
.noinitrd: mov esi, nord
jmp prot_diefunc
;load cluster chain, eax=cluster, ecx=size
.loadinitrd:
@ -2571,7 +2573,8 @@ memerr: db "E820 memory map not found",0
nogzmem: db "Inflating: "
noenmem: db "Not enough memory",0
noacpi: db "ACPI not found",0
nogpt: db "No boot partition",0
nogpt: db "No GPT found",0
nopar: db "No boot partition",0
nord: db "Initrd not found",0
nolib: db "/sys not found in initrd",0
nocore: db "Kernel not found in initrd",0

View file

@ -1256,7 +1256,7 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
EFI_PROCESSOR_INFORMATION *pibuf=(EFI_PROCESSOR_INFORMATION*)pibuffer;
UINTN bsp_num=0, i, j=0, handle_size=0,memory_map_size=0, map_key=0, desc_size=0;
UINT32 desc_version=0;
UINT64 lba_s=0,lba_e=0;
UINT64 lba_s=0,lba_e=0,sysptr;
MMapEnt *mmapent, *last=NULL;
file_t ret={NULL,0};
CHAR16 **argv, *initrdfile, *configfile, *help=
@ -1550,9 +1550,9 @@ gzerr: return report(EFI_COMPROMISED_DATA,L"Unable to uncompress");
// System tables and structures
DBG(L" * System tables%s\n",L"");
LibGetSystemConfigurationTable(&AcpiTableGuid,(void *)&(bootboot->arch.x86_64.acpi_ptr));
LibGetSystemConfigurationTable(&SMBIOSTableGuid,(void *)&(bootboot->arch.x86_64.smbi_ptr));
LibGetSystemConfigurationTable(&MpsTableGuid,(void *)&(bootboot->arch.x86_64.mp_ptr));
sysptr = 0; LibGetSystemConfigurationTable(&AcpiTableGuid,(void *)&sysptr); bootboot->arch.x86_64.acpi_ptr = sysptr;
sysptr = 0; LibGetSystemConfigurationTable(&SMBIOSTableGuid,(void *)&sysptr); bootboot->arch.x86_64.smbi_ptr = sysptr;
sysptr = 0; LibGetSystemConfigurationTable(&MpsTableGuid,(void *)&sysptr); bootboot->arch.x86_64.mp_ptr = sysptr;
// FIX ACPI table pointer on TianoCore...
ret.ptr = (UINT8*)(bootboot->arch.x86_64.acpi_ptr);