From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- roms/openbios/arch/unix/boot.c | 107 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 roms/openbios/arch/unix/boot.c (limited to 'roms/openbios/arch/unix/boot.c') diff --git a/roms/openbios/arch/unix/boot.c b/roms/openbios/arch/unix/boot.c new file mode 100644 index 000000000..8480ad82f --- /dev/null +++ b/roms/openbios/arch/unix/boot.c @@ -0,0 +1,107 @@ +/* + * + */ +#undef BOOTSTRAP +#include "config.h" +#include "libopenbios/bindings.h" +#include "libopenbios/elf_load.h" +#include "libopenbios/initprogram.h" +#include "arch/common/nvram.h" +#include "libc/diskio.h" + +void boot(void); +void *load_elf(char *spec); + +void +*load_elf(char *spec) +{ +#if 0 + int fd; + void *entry=NULL; + int i, lszz_offs, elf_offs; + char buf[128]; // , *addr; + Elf_ehdr ehdr; + Elf_phdr *phdr; + size_t s; + + if( (fd=open_io(spec)) == -1 ) + return NULL; + + if( (elf_offs=find_elf(fd)) < 0 ) { + printk("----> %s is not an ELF image\n", buf ); + return NULL; + } + + if( !(phdr=elf_readhdrs(fd, 0, &ehdr)) ) { + printk("elf32_readhdrs failed\n"); + return NULL; + } + + (unsigned long long *)entry = ehdr.e_entry; + + lszz_offs = elf_offs; + for( i=0; i