File: boot.c

package info (click to toggle)
openbios-sparc 1.0%2Bsvn640-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,412 kB
  • ctags: 12,091
  • sloc: ansic: 57,249; asm: 2,680; xml: 1,335; cpp: 414; makefile: 224; sh: 190
file content (43 lines) | stat: -rw-r--r-- 926 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 *
 */
#undef BOOTSTRAP
#include "openbios/config.h"
#include "openbios/bindings.h"
#include "openbios/elfload.h"
#include "openbios/nvram.h"
#include "libc/diskio.h"
#include "sys_info.h"

int elf_load(struct sys_info *, const char *filename, const char *cmdline);
int linux_load(struct sys_info *, const char *filename, const char *cmdline);

void boot(void);

struct sys_info sys_info;

void boot(void)
{
	char *path=pop_fstr_copy(), *param;

	// char *param="root=/dev/hda2 console=ttyS0,115200n8 console=tty0";

	if(!path) {
		printk("[x86] Booting default not supported.\n");
		return;
	}

	param = strchr(path, ' ');
	if(param) {
		*param = '\0';
		param++;
	}

	printk("[x86] Booting file '%s' with parameters '%s'\n",path, param);

	if (elf_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
		if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
			printk("Unsupported image format\n");

	free(path);
}