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

timezone's place

This commit is contained in:
bzt 2018-06-28 13:10:26 +02:00
parent a7e56635aa
commit cf539a057d
4 changed files with 31 additions and 31 deletions

View file

@ -195,7 +195,7 @@ That cannot be larger than a page size (4096 bytes). Temporary variables will be
UEFI command line). C style single line and multi line comments can be used. BOOTBOOT protocol only uses `screen` and UEFI command line). C style single line and multi line comments can be used. BOOTBOOT protocol only uses `screen` and
`kernel` keys, all the others and their values are up to your kernel (or drivers) to parse. Be creative :-) `kernel` keys, all the others and their values are up to your kernel (or drivers) to parse. Be creative :-)
To modify the environment, one will need to insert the disk into another machine (or boot a simple OS like DOS) and edit To modify the environment when having booting issues, one will need to insert the disk into another machine (or boot a simple OS like DOS) and edit
BOOTBOOT\CONFIG on the boot partition. With UEFI, you can use the `edit` command provided by the EFI Shell or append BOOTBOOT\CONFIG on the boot partition. With UEFI, you can use the `edit` command provided by the EFI Shell or append
"key=value" pairs on the command line (value specified on command line takes precedence over the one in the file). "key=value" pairs on the command line (value specified on command line takes precedence over the one in the file).

View file

@ -450,7 +450,7 @@ int sd_cmd(uint32_t code, uint32_t arg)
uart_puts("EMMC: Sending command ");uart_hex(code,4);uart_puts(" arg ");uart_hex(arg,4);uart_putc('\n'); uart_puts("EMMC: Sending command ");uart_hex(code,4);uart_puts(" arg ");uart_hex(arg,4);uart_putc('\n');
#endif #endif
*EMMC_INTERRUPT=*EMMC_INTERRUPT; *EMMC_ARG1=arg; *EMMC_CMDTM=code; *EMMC_INTERRUPT=*EMMC_INTERRUPT; *EMMC_ARG1=arg; *EMMC_CMDTM=code;
if(code==CMD_SEND_OP_COND) delaym(1000); else if(code==CMD_SEND_OP_COND) delaym(1000); else
if(code==CMD_SEND_IF_COND || code==CMD_APP_CMD) delaym(100); if(code==CMD_SEND_IF_COND || code==CMD_APP_CMD) delaym(100);
if((r=sd_int(INT_CMD_DONE))) {DBG("BOOTBOOT-ERROR: failed to send EMMC command\n");sd_err=r;return 0;} if((r=sd_int(INT_CMD_DONE))) {DBG("BOOTBOOT-ERROR: failed to send EMMC command\n");sd_err=r;return 0;}
r=*EMMC_RESP0; r=*EMMC_RESP0;
@ -565,10 +565,10 @@ int sd_init()
// GPIO_DAT0, GPIO_DAT1, GPIO_DAT2, GPIO_DAT3 // GPIO_DAT0, GPIO_DAT1, GPIO_DAT2, GPIO_DAT3
r=*GPFSEL5; r|=(7<<(0*3)) | (7<<(1*3)) | (7<<(2*3)) | (7<<(3*3)); *GPFSEL5=r; r=*GPFSEL5; r|=(7<<(0*3)) | (7<<(1*3)) | (7<<(2*3)) | (7<<(3*3)); *GPFSEL5=r;
*GPPUD=2; delay(150); *GPPUD=2; delay(150);
*GPPUDCLK1=(1<<18) | (1<<19) | (1<<20) | (1<<21); *GPPUDCLK1=(1<<18) | (1<<19) | (1<<20) | (1<<21);
delay(150); *GPPUD=0; *GPPUDCLK1=0; delay(150); *GPPUD=0; *GPPUDCLK1=0;
sd_hv = (*EMMC_SLOTISR_VER & HOST_SPEC_NUM) >> HOST_SPEC_NUM_SHIFT; sd_hv = (*EMMC_SLOTISR_VER & HOST_SPEC_NUM) >> HOST_SPEC_NUM_SHIFT;
#if SD_DEBUG #if SD_DEBUG
uart_puts("EMMC: GPIO set up\n"); uart_puts("EMMC: GPIO set up\n");
@ -803,13 +803,13 @@ int GetLFB(uint32_t width, uint32_t height)
mbox[9] = 8; mbox[9] = 8;
mbox[10] = width; //FrameBufferInfo.virtual_width mbox[10] = width; //FrameBufferInfo.virtual_width
mbox[11] = height; //FrameBufferInfo.virtual_height mbox[11] = height; //FrameBufferInfo.virtual_height
mbox[12] = 0x48009; //set virt offset mbox[12] = 0x48009; //set virt offset
mbox[13] = 8; mbox[13] = 8;
mbox[14] = 8; mbox[14] = 8;
mbox[15] = 0; //FrameBufferInfo.x_offset mbox[15] = 0; //FrameBufferInfo.x_offset
mbox[16] = 0; //FrameBufferInfo.y.offset mbox[16] = 0; //FrameBufferInfo.y.offset
mbox[17] = 0x48005; //set depth mbox[17] = 0x48005; //set depth
mbox[18] = 4; mbox[18] = 4;
mbox[19] = 4; mbox[19] = 4;
@ -1289,7 +1289,7 @@ gzerr: puts("BOOTBOOT-PANIC: Unable to uncompress\n");
core.size=1; core.size=1;
break; break;
} }
if(((mz_hdr*)(core.ptr))->magic==MZ_MAGIC && pehdr->magic == PE_MAGIC && if(((mz_hdr*)(core.ptr))->magic==MZ_MAGIC && pehdr->magic == PE_MAGIC &&
pehdr->machine == IMAGE_FILE_MACHINE_ARM64 && pehdr->file_type == PE_OPT_MAGIC_PE32PLUS) { pehdr->machine == IMAGE_FILE_MACHINE_ARM64 && pehdr->file_type == PE_OPT_MAGIC_PE32PLUS) {
core.size=1; core.size=1;
break; break;
@ -1322,7 +1322,7 @@ gzerr: puts("BOOTBOOT-PANIC: Unable to uncompress\n");
phdr=(Elf64_Phdr *)((uint8_t *)phdr+ehdr->e_phentsize); phdr=(Elf64_Phdr *)((uint8_t *)phdr+ehdr->e_phentsize);
} }
} else } else
if(((mz_hdr*)(core.ptr))->magic==MZ_MAGIC && pehdr->magic == PE_MAGIC && if(((mz_hdr*)(core.ptr))->magic==MZ_MAGIC && pehdr->magic == PE_MAGIC &&
pehdr->machine == IMAGE_FILE_MACHINE_ARM64 && pehdr->file_type == PE_OPT_MAGIC_PE32PLUS && pehdr->machine == IMAGE_FILE_MACHINE_ARM64 && pehdr->file_type == PE_OPT_MAGIC_PE32PLUS &&
(int64_t)pehdr->code_base>>48==0xffff) { (int64_t)pehdr->code_base>>48==0xffff) {
DBG(" * Parsing PE32+\n"); DBG(" * Parsing PE32+\n");
@ -1365,7 +1365,7 @@ gzerr: puts("BOOTBOOT-PANIC: Unable to uncompress\n");
mmap->ptr=0; mmap->size=(uint64_t)&__bootboot | MMAP_FREE; mmap->ptr=0; mmap->size=(uint64_t)&__bootboot | MMAP_FREE;
mmap++; bootboot->size+=sizeof(MMapEnt); mmap++; bootboot->size+=sizeof(MMapEnt);
// mark bss reserved // mark bss reserved
mmap->ptr=(uint64_t)&__bootboot; mmap->size=((uint64_t)&_end-(uint64_t)&__bootboot) | MMAP_USED; mmap->ptr=(uint64_t)&__bootboot; mmap->size=((uint64_t)&_end-(uint64_t)&__bootboot) | MMAP_USED;
mmap++; bootboot->size+=sizeof(MMapEnt); mmap++; bootboot->size+=sizeof(MMapEnt);

View file

@ -826,7 +826,7 @@ protmode_start:
mov gs, ax mov gs, ax
mov ss, ax mov ss, ax
mov esp, 7C00h mov esp, 7C00h
; ------- Locate initrd -------- ; ------- Locate initrd --------
mov esi, 0C8000h mov esi, 0C8000h
.nextrom: cmp word [esi], 0AA55h .nextrom: cmp word [esi], 0AA55h

View file

@ -162,14 +162,14 @@ typedef struct _EFI_FILE_PROTOCOL {
#define EFI_PCI_OPTION_ROM_TABLE_GUID \ #define EFI_PCI_OPTION_ROM_TABLE_GUID \
{ 0x7462660f, 0x1cbd, 0x48da, {0xad, 0x11, 0x91, 0x71, 0x79, 0x13, 0x83, 0x1c} } { 0x7462660f, 0x1cbd, 0x48da, {0xad, 0x11, 0x91, 0x71, 0x79, 0x13, 0x83, 0x1c} }
typedef struct { typedef struct {
EFI_PHYSICAL_ADDRESS RomAddress; EFI_PHYSICAL_ADDRESS RomAddress;
EFI_MEMORY_TYPE MemoryType; EFI_MEMORY_TYPE MemoryType;
UINT32 RomLength; UINT32 RomLength;
UINT32 Seg; UINT32 Seg;
UINT8 Bus; UINT8 Bus;
UINT8 Dev; UINT8 Dev;
UINT8 Func; UINT8 Func;
BOOLEAN ExecutedLegacyBiosImage; BOOLEAN ExecutedLegacyBiosImage;
BOOLEAN DontLoadEfiRom; BOOLEAN DontLoadEfiRom;
} EFI_PCI_OPTION_ROM_DESCRIPTOR; } EFI_PCI_OPTION_ROM_DESCRIPTOR;
@ -393,7 +393,7 @@ GetLFB()
// there's a bug in TianoCore, it reports bad masks in PixelInformation, so we don't use PixelBitMask // there's a bug in TianoCore, it reports bad masks in PixelInformation, so we don't use PixelBitMask
// || (info->PixelFormat == PixelBitMask) // || (info->PixelFormat == PixelBitMask)
)){ )){
if(info->HorizontalResolution >= (unsigned int)reqwidth && if(info->HorizontalResolution >= (unsigned int)reqwidth &&
info->VerticalResolution >= (unsigned int)reqheight && info->VerticalResolution >= (unsigned int)reqheight &&
(selectedMode==9999||(info->HorizontalResolution<sw && info->VerticalResolution < sh))) { (selectedMode==9999||(info->HorizontalResolution<sw && info->VerticalResolution < sh))) {
selectedMode = i; selectedMode = i;
@ -440,7 +440,7 @@ GetLFB()
)); ));
DBG(L" * Screen %d x %d, scanline %d, fb @%lx %d bytes, type %d %s\n", DBG(L" * Screen %d x %d, scanline %d, fb @%lx %d bytes, type %d %s\n",
bootboot->fb_width, bootboot->fb_height, bootboot->fb_scanline, bootboot->fb_width, bootboot->fb_height, bootboot->fb_scanline,
bootboot->fb_ptr, bootboot->fb_size, gop->Mode->Info->PixelFormat, bootboot->fb_ptr, bootboot->fb_size, gop->Mode->Info->PixelFormat,
bootboot->fb_type==FB_ARGB?L"ARGB":(bootboot->fb_type==FB_ABGR?L"ABGR":( bootboot->fb_type==FB_ARGB?L"ARGB":(bootboot->fb_type==FB_ABGR?L"ABGR":(
bootboot->fb_type==FB_RGBA?L"RGBA":L"BGRA"))); bootboot->fb_type==FB_RGBA?L"RGBA":L"BGRA")));
return EFI_SUCCESS; return EFI_SUCCESS;
@ -463,7 +463,7 @@ LoadFile(IN CHAR16 *FileName, OUT UINT8 **FileData, OUT UINTN *FileDataLength)
return report(EFI_NOT_FOUND,L"Empty Root or FileName\n"); return report(EFI_NOT_FOUND,L"Empty Root or FileName\n");
} }
status = uefi_call_wrapper(RootDir->Open, 5, RootDir, &FileHandle, FileName, status = uefi_call_wrapper(RootDir->Open, 5, RootDir, &FileHandle, FileName,
EFI_FILE_MODE_READ, EFI_FILE_READ_ONLY | EFI_FILE_HIDDEN | EFI_FILE_SYSTEM); EFI_FILE_MODE_READ, EFI_FILE_READ_ONLY | EFI_FILE_HIDDEN | EFI_FILE_SYSTEM);
if (EFI_ERROR(status)) { if (EFI_ERROR(status)) {
return status; return status;
@ -527,7 +527,7 @@ LoadCore()
ehdr->e_phnum>0){ ehdr->e_phnum>0){
break; break;
} }
if(((mz_hdr*)(core.ptr))->magic==MZ_MAGIC && pehdr->magic == PE_MAGIC && if(((mz_hdr*)(core.ptr))->magic==MZ_MAGIC && pehdr->magic == PE_MAGIC &&
pehdr->machine == IMAGE_FILE_MACHINE_AMD64 && pehdr->file_type == PE_OPT_MAGIC_PE32PLUS) { pehdr->machine == IMAGE_FILE_MACHINE_AMD64 && pehdr->file_type == PE_OPT_MAGIC_PE32PLUS) {
break; break;
} }
@ -556,7 +556,7 @@ LoadCore()
} }
phdr=(Elf64_Phdr *)((UINT8 *)phdr+ehdr->e_phentsize); phdr=(Elf64_Phdr *)((UINT8 *)phdr+ehdr->e_phentsize);
} }
} else if(((mz_hdr*)(core.ptr))->magic==MZ_MAGIC && pehdr->magic == PE_MAGIC && } else if(((mz_hdr*)(core.ptr))->magic==MZ_MAGIC && pehdr->magic == PE_MAGIC &&
pehdr->machine == IMAGE_FILE_MACHINE_AMD64 && pehdr->file_type == PE_OPT_MAGIC_PE32PLUS && pehdr->machine == IMAGE_FILE_MACHINE_AMD64 && pehdr->file_type == PE_OPT_MAGIC_PE32PLUS &&
(INT64)pehdr->code_base>>48==0xffff) { (INT64)pehdr->code_base>>48==0xffff) {
//Parse PE32+ //Parse PE32+
@ -575,7 +575,7 @@ LoadCore()
return report(EFI_OUT_OF_RESOURCES,L"AllocatePages"); return report(EFI_OUT_OF_RESOURCES,L"AllocatePages");
CopyMem((void*)core.ptr,ptr,core.size); CopyMem((void*)core.ptr,ptr,core.size);
if(bss>0) if(bss>0)
ZeroMem((void*)core.ptr + core.size, bss); ZeroMem((void*)core.ptr + core.size, bss);
core.size += bss; core.size += bss;
DBG(L" * Entry point @%lx, text @%lx %d bytes\n",entrypoint, core.ptr, core.size); DBG(L" * Entry point @%lx, text @%lx %d bytes\n",entrypoint, core.ptr, core.size);
core.size = ((core.size+PAGESIZE-1)/PAGESIZE)*PAGESIZE; core.size = ((core.size+PAGESIZE-1)/PAGESIZE)*PAGESIZE;
@ -676,8 +676,8 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
return report(EFI_OUT_OF_RESOURCES,L"GetMemoryMap getSize"); return report(EFI_OUT_OF_RESOURCES,L"GetMemoryMap getSize");
} }
memory_map_size+=2*desc_size; memory_map_size+=2*desc_size;
uefi_call_wrapper(BS->AllocatePages, 4, 0, 2, uefi_call_wrapper(BS->AllocatePages, 4, 0, 2,
(memory_map_size+PAGESIZE-1)/PAGESIZE, (memory_map_size+PAGESIZE-1)/PAGESIZE,
(EFI_PHYSICAL_ADDRESS*)&memory_map); (EFI_PHYSICAL_ADDRESS*)&memory_map);
if (memory_map == NULL) { if (memory_map == NULL) {
return report(EFI_OUT_OF_RESOURCES,L"AllocatePages"); return report(EFI_OUT_OF_RESOURCES,L"AllocatePages");
@ -784,7 +784,7 @@ foundinrom:
break; break;
// use the first OS/Z root partition for this architecture // use the first OS/Z root partition for this architecture
if(!CompareMem(&gptEnt->PartitionTypeGUID.Data1,"OS/Z",4) && if(!CompareMem(&gptEnt->PartitionTypeGUID.Data1,"OS/Z",4) &&
gptEnt->PartitionTypeGUID.Data2==0x8664 && gptEnt->PartitionTypeGUID.Data2==0x8664 &&
!CompareMem(&gptEnt->PartitionTypeGUID.Data4[4],"root",4)) { !CompareMem(&gptEnt->PartitionTypeGUID.Data4[4],"root",4)) {
partfound: lba_s=gptEnt->StartingLBA; lba_e=gptEnt->EndingLBA; partfound: lba_s=gptEnt->StartingLBA; lba_e=gptEnt->EndingLBA;
initrd.size = (((lba_e-lba_s)*bio->Media->BlockSize + PAGESIZE-1)/PAGESIZE)*PAGESIZE; initrd.size = (((lba_e-lba_s)*bio->Media->BlockSize + PAGESIZE-1)/PAGESIZE)*PAGESIZE;
@ -801,7 +801,7 @@ partok:
uefi_call_wrapper(BS->AllocatePages, 4, 0, 2, initrd.size/PAGESIZE, (EFI_PHYSICAL_ADDRESS*)&initrd.ptr); uefi_call_wrapper(BS->AllocatePages, 4, 0, 2, initrd.size/PAGESIZE, (EFI_PHYSICAL_ADDRESS*)&initrd.ptr);
if (initrd.ptr == NULL) if (initrd.ptr == NULL)
return report(EFI_OUT_OF_RESOURCES,L"AllocatePages"); return report(EFI_OUT_OF_RESOURCES,L"AllocatePages");
status=bio->ReadBlocks(bio, bio->Media->MediaId, lba_s, initrd.size, initrd.ptr); status=bio->ReadBlocks(bio, bio->Media->MediaId, lba_s, initrd.size, initrd.ptr);
} else } else
status=EFI_LOAD_ERROR; status=EFI_LOAD_ERROR;
} }
@ -955,8 +955,8 @@ gzerr: return report(EFI_COMPROMISED_DATA,L"Unable to uncompress");
// allocate memory for memory descriptors. We assume that one or two new memory // allocate memory for memory descriptors. We assume that one or two new memory
// descriptor may created by our next allocate calls and we round up to page size // descriptor may created by our next allocate calls and we round up to page size
memory_map_size+=2*desc_size; memory_map_size+=2*desc_size;
uefi_call_wrapper(BS->AllocatePages, 4, 0, 2, uefi_call_wrapper(BS->AllocatePages, 4, 0, 2,
(memory_map_size+PAGESIZE-1)/PAGESIZE, (memory_map_size+PAGESIZE-1)/PAGESIZE,
(EFI_PHYSICAL_ADDRESS*)&memory_map); (EFI_PHYSICAL_ADDRESS*)&memory_map);
if (memory_map == NULL) { if (memory_map == NULL) {
return report(EFI_OUT_OF_RESOURCES,L"AllocatePages"); return report(EFI_OUT_OF_RESOURCES,L"AllocatePages");
@ -1011,7 +1011,7 @@ get_memory_map:
mement<memory_map+memory_map_size; mement<memory_map+memory_map_size;
mement=NextMemoryDescriptor(mement,desc_size)) { mement=NextMemoryDescriptor(mement,desc_size)) {
// failsafe // failsafe
if(mement==NULL || bootboot->size>=PAGESIZE-128 || if(mement==NULL || bootboot->size>=PAGESIZE-128 ||
(mement->PhysicalStart==0 && mement->NumberOfPages==0)) (mement->PhysicalStart==0 && mement->NumberOfPages==0))
break; break;
// failsafe, don't report our own structures as free // failsafe, don't report our own structures as free
@ -1037,7 +1037,7 @@ get_memory_map:
(mement->Type==11||mement->Type==12?MMAP_MMIO: (mement->Type==11||mement->Type==12?MMAP_MMIO:
MMAP_USED)))); MMAP_USED))));
// merge continous areas of the same type // merge continous areas of the same type
if(last!=NULL && if(last!=NULL &&
MMapEnt_Type(last) == MMapEnt_Type(mmapent) && MMapEnt_Type(last) == MMapEnt_Type(mmapent) &&
MMapEnt_Ptr(last)+MMapEnt_Size(last) == MMapEnt_Ptr(mmapent)) { MMapEnt_Ptr(last)+MMapEnt_Size(last) == MMapEnt_Ptr(mmapent)) {
last->size+=MMapEnt_Size(mmapent); last->size+=MMapEnt_Size(mmapent);