diff --git a/util/baremetal/bootselect/Makefile b/util/baremetal/bootselect/Makefile index 55e084eaa0..56db22646a 100644 --- a/util/baremetal/bootselect/Makefile +++ b/util/baremetal/bootselect/Makefile @@ -5,7 +5,7 @@ CC = gcc CFLAGS = -I ../include -I ../include/$(ARCH) -O2 -DZKERNEL_START=0xfff00000 -DEPS = bootselect.o rom_fill_inbuf.o chooser.o ../lib/baremetal.a +DEPS = ../lib/_main.o bootselect.o rom_fill_inbuf.o chooser.o ../lib/baremetal.a bootselect.elf: $(DEPS) ld -defsym HEAPSIZE=0x8000 -T elfImage.lds $(DEPS) -o bootselect.elf diff --git a/util/baremetal/bootselect/bootselect.c b/util/baremetal/bootselect/bootselect.c index 07396535b0..14d7af271d 100644 --- a/util/baremetal/bootselect/bootselect.c +++ b/util/baremetal/bootselect/bootselect.c @@ -15,13 +15,12 @@ #include #include #include +#include #define DPRINTF( x... ) //#define DPRINTF printk -extern struct lb_memory *get_lbmem(void); - char buffer[16]; extern struct stream rom_stream; @@ -34,14 +33,12 @@ int main(void) { while(1) { printk("Welcome to the LinuxLabs boot chooser!\n"); - lbmem = get_lbmem(); - DPRINTF("Got lbmem struct: %08x\n", (unsigned int) lbmem); if(choose_stream(&rom_stream) <0) return(-1); - elfboot(&rom_stream, lbmem); + elfboot(&rom_stream, preboot_param); } outb(0x0e, 0x3f9); diff --git a/util/baremetal/bootselect/elfImage.lds b/util/baremetal/bootselect/elfImage.lds index 6a24d34b44..5a550ade75 100644 --- a/util/baremetal/bootselect/elfImage.lds +++ b/util/baremetal/bootselect/elfImage.lds @@ -8,11 +8,12 @@ OUTPUT_ARCH(i386) HEAPSIZE = DEFINED(HEAPSIZE) ? HEAPSIZE : 0x8000; -ENTRY(main) +ENTRY(_main) SECTIONS { /* . = 0x10000 - (elf_note - elf_header); */ - . = 0x1000; +/* . = 0x20000000; */ + . = 0x20000; _text = .; /* Text and read-only data */ .text . : { *(.text) diff --git a/util/baremetal/include/preboot.h b/util/baremetal/include/preboot.h index 4f5811db0b..8d97bafcde 100644 --- a/util/baremetal/include/preboot.h +++ b/util/baremetal/include/preboot.h @@ -10,4 +10,13 @@ typedef struct pre_boot_param { struct lb_memory *lbmem; } __attribute__ ((packed)) pre_boot_param_t; + +extern struct lb_memory *lbmem; +extern struct lb_memory *get_lbmem(void); + +extern unsigned long int preboot_ramtop; +extern pre_boot_param_t *preboot_param; + +extern int main(); + #endif diff --git a/util/baremetal/lib/Makefile b/util/baremetal/lib/Makefile index a7962daa1f..c679f9b16a 100644 --- a/util/baremetal/lib/Makefile +++ b/util/baremetal/lib/Makefile @@ -8,6 +8,8 @@ LB_SOURCE=../../../src DEPS = printk.o serial_subr.o subr.o vsprintf.o memcpy.o malloc.o memset.o compute_ip_checksum.o elfboot.o boot.o ide.o linuxbios.o delay_tsc.o +all: baremetal.a _main.o + baremetal.a : $(DEPS) ar -cr baremetal.a $(DEPS)