2006-04-26 15:08:19 +00:00
|
|
|
/* 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
|
2010-03-14 17:19:58 +00:00
|
|
|
#include "config.h"
|
2010-03-14 15:05:53 +00:00
|
|
|
#include "libopenbios/bindings.h"
|
|
|
|
|
#include "libopenbios/elfload.h"
|
2010-03-14 20:34:01 +00:00
|
|
|
#include "arch/common/nvram.h"
|
2006-04-26 15:08:19 +00:00
|
|
|
#include "libc/diskio.h"
|
2010-03-14 16:09:44 +00:00
|
|
|
#include "libopenbios/sys_info.h"
|
2006-04-26 15:08:19 +00:00
|
|
|
#include "boot.h"
|
|
|
|
|
|
2008-12-11 20:30:53 +00:00
|
|
|
struct sys_info sys_info;
|
2006-04-26 15:08:19 +00:00
|
|
|
|
|
|
|
|
void boot(void)
|
|
|
|
|
{
|
|
|
|
|
char *path=pop_fstr_copy(), *param;
|
2008-12-11 20:30:53 +00:00
|
|
|
|
2006-04-26 15:08:19 +00:00
|
|
|
if(!path) {
|
|
|
|
|
printk("[x86] Booting default not supported.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
param = strchr(path, ' ');
|
|
|
|
|
if(param) {
|
|
|
|
|
*param = '\0';
|
|
|
|
|
param++;
|
|
|
|
|
}
|
2008-12-11 20:30:53 +00:00
|
|
|
|
2006-04-26 15:08:19 +00:00
|
|
|
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;
|
2008-12-11 20:30:53 +00:00
|
|
|
|
2006-04-26 15:08:19 +00:00
|
|
|
printk("Unsupported image format\n");
|
|
|
|
|
|
|
|
|
|
loaded:
|
|
|
|
|
free(path);
|
|
|
|
|
}
|