Hopefully this is my last commit of major infrasture changes for a while.
Highlights: - elfboot.c Now can load images to the ram location where linuxBIOS is running - Added the standalone directory for bootloaders built from the linuxBIOS source Other things: - Correctly maode fallback_boot.c conditional - Added entry32.lds to do the math for segment descriptor table entries - Merged ldscript.cacheram and ldscript.base - Moved assembly code to the sections .rom.text and .rom.data - Modified linuxBIOS so C code completely runs from RAM as the SiS630 case does - Updated and commented example config files for the supermicro p4dc6 - Bumped the elfboot loader version to 1.0 - Removed extra carriage returns in dump_northbridge.inc (DOS->UNIX) - General cleanups to the config of the supermicro p4dc6
This commit is contained in:
parent
5346fd33f9
commit
0f7f76fb40
56 changed files with 1191 additions and 375 deletions
2
src/standalone/Config
Normal file
2
src/standalone/Config
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
nooption _ROMBASE
|
||||
option CRT0=$(TOP)/src/arch/$(ARCH)/standalone/crt0.S
|
||||
8
src/standalone/lbbl/Config
Normal file
8
src/standalone/lbbl/Config
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Load the default standalone application options
|
||||
dir ..
|
||||
|
||||
option _RAMBASE=0x00004000
|
||||
object lbbl.o
|
||||
payload /dev/null
|
||||
|
||||
option USE_ELF_BOOT=1
|
||||
18
src/standalone/lbbl/example.config
Normal file
18
src/standalone/lbbl/example.config
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# This will make a target directory of ./lbbl
|
||||
target ./lbbl
|
||||
arch i386
|
||||
dir src/standalone/lbbl
|
||||
|
||||
# Generate debugging output
|
||||
option DEFAULT_CONSOLE_LOGLEVEL=9
|
||||
option MAXIMUM_CONSOLE_LOGLEVEL=8
|
||||
#option DEFAULT_CONSOLE_LOGLEVEL=5
|
||||
|
||||
option SERIAL_CONSOLE=1
|
||||
option TTYS0_BAUD=115200
|
||||
|
||||
option BOOT_IDE=0
|
||||
option BOOT_FLOPPY=1
|
||||
option USE_SERIAL_FILL_INBUF=0
|
||||
#option USE_GENERIC_ROM=0
|
||||
|
||||
100
src/standalone/lbbl/lbbl.c
Normal file
100
src/standalone/lbbl/lbbl.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
#include <printk.h>
|
||||
#include <subr.h>
|
||||
#include <boot/elf.h>
|
||||
#include <rom/read_bytes.h>
|
||||
#include <boot/linuxbios_tables.h>
|
||||
#include <ip_checksum.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static unsigned long count_lb_records(void *start, unsigned long length)
|
||||
{
|
||||
struct lb_record *rec;
|
||||
void *end;
|
||||
unsigned long count;
|
||||
count = 0;
|
||||
end = ((char *)start) + length;
|
||||
for(rec = start; ((void *)rec < end) &&
|
||||
((signed long)rec->size <= (end - (void *)rec));
|
||||
rec = (void *)(((char *)rec) + rec->size)) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static int find_lb_table(struct lb_header **result, void *start, void *end)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
/* For now be stupid.... */
|
||||
for(ptr = start; (void *)ptr < end; ptr += 16) {
|
||||
struct lb_header *head = (void *)ptr;
|
||||
if ((head->signature[0] == 'L') &&
|
||||
(head->signature[1] == 'B') &&
|
||||
(head->signature[2] == 'I') &&
|
||||
(head->signature[3] == 'O') &&
|
||||
(head->header_bytes == sizeof(*head)) &&
|
||||
(compute_ip_checksum(head, sizeof(*head)) == 0) &&
|
||||
(compute_ip_checksum(ptr + sizeof(*head), head->table_bytes) ==
|
||||
head->table_checksum) &&
|
||||
(count_lb_records(ptr + sizeof(*head), head->table_bytes) ==
|
||||
head->table_entries)
|
||||
) {
|
||||
*result = (struct lb_header *)ptr;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct lb_memory *lookup_meminfo(void)
|
||||
{
|
||||
struct lb_header *head;
|
||||
struct lb_record *rec;
|
||||
void *start, *end;
|
||||
|
||||
if (!find_lb_table(&head, (void *)0x00000, (void *)0x1000)) {
|
||||
if (!find_lb_table(&head, (void *)0xf0000, (void*)0x100000)) {
|
||||
printk_err("Cannot find linuxbios table...\n");
|
||||
while(1);
|
||||
}
|
||||
}
|
||||
start = ((unsigned char *)head) + sizeof(*head);
|
||||
end = ((char *)start) + head->table_bytes;
|
||||
for(rec = start; ((void *)rec < end) &&
|
||||
((long)rec->size <= (end - (void *)rec));
|
||||
rec = (void *)(((char *)rec) + rec->size)) {
|
||||
switch(rec->tag) {
|
||||
case LB_TAG_MEMORY:
|
||||
return (struct lb_memory *)rec;
|
||||
}
|
||||
}
|
||||
printk_err("Cannot find memory range table\n");
|
||||
while(1);
|
||||
|
||||
}
|
||||
void standalonemain(void)
|
||||
{
|
||||
int i;
|
||||
int max;
|
||||
malloc_mark_t place;
|
||||
struct lb_memory *mem;
|
||||
|
||||
/* displayinit MUST PRECEDE ALL PRINTK! */
|
||||
displayinit();
|
||||
|
||||
printk_info("LBBL\n");
|
||||
max = estreams - streams;
|
||||
mem = lookup_meminfo();
|
||||
printk_info("%d boot devices present\n", max);
|
||||
for(i = 0; i < max; i++) {
|
||||
int result = 1;
|
||||
malloc_mark(&place);
|
||||
printk_info("Trying to boot from %d\n", i);
|
||||
result = elfboot(&streams[i], mem);
|
||||
malloc_release(&place);
|
||||
if (result) {
|
||||
/* displayinit MUST PRECEDE ALL PRINTK! */
|
||||
displayinit();
|
||||
}
|
||||
}
|
||||
printk_err("All boot devices failed\n");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue