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 (48 lines) | stat: -rw-r--r-- 1,003 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
44
45
46
47
48
/* tag: openbios boot command for x86
 *
 * Copyright (C) 2003-2004 Stefan Reinauer
 *
 * See the file "COPYING" for further information about
 * the copyright and warranty status of this work.
 */

#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"
#include "boot.h"

struct sys_info sys_info;

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

	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)
		goto loaded;
	if (linux_load(&sys_info, path, param) != LOADER_NOT_SUPPORT)
		goto loaded;
	if (forth_load(&sys_info, path, param) != LOADER_NOT_SUPPORT)
		goto loaded;

	printk("Unsupported image format\n");

loaded:
	free(path);
}