Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / amd64 / boot.c
1 /*
2  *
3  */
4 #undef BOOTSTRAP
5 #include "config.h"
6 #include "libopenbios/bindings.h"
7 #include "libopenbios/elfload.h"
8 #include "arch/common/nvram.h"
9 #include "libc/diskio.h"
10 #include "libopenbios/sys_info.h"
11
12 int elf_load(struct sys_info *, const char *filename, const char *cmdline);
13 int linux_load(struct sys_info *, const char *filename, const char *cmdline);
14
15 void boot(void);
16
17 void boot(void)
18 {
19         char *path=pop_fstr_copy(), *param;
20
21         // char *param="root=/dev/hda2 console=ttyS0,115200n8 console=tty0";
22
23         if(!path) {
24                 printk("[x86] Booting default not supported.\n");
25                 return;
26         }
27
28         param = strchr(path, ' ');
29         if(param) {
30                 *param = '\0';
31                 param++;
32         }
33
34         printk("[x86] Booting file '%s' with parameters '%s'\n",path, param);
35
36         if (elf_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
37                 if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
38                         printk("Unsupported image format\n");
39
40         free(path);
41 }