MIPS: bootm: add "MIPS barebox" handler
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
2a9d94a81e
commit
87b302f4e2
|
@ -6,3 +6,4 @@ obj-y += ashrdi3.o
|
||||||
obj-y += memory.o
|
obj-y += memory.o
|
||||||
|
|
||||||
obj-$(CONFIG_CMD_MIPS_CPUINFO) += cpuinfo.o
|
obj-$(CONFIG_CMD_MIPS_CPUINFO) += cpuinfo.o
|
||||||
|
obj-$(CONFIG_CMD_BOOTM) += bootm.o
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#include <boot.h>
|
||||||
|
#include <common.h>
|
||||||
|
#include <init.h>
|
||||||
|
#include <fs.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <binfmt.h>
|
||||||
|
|
||||||
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
|
static int do_bootm_barebox(struct image_data *data)
|
||||||
|
{
|
||||||
|
void (*barebox)(void);
|
||||||
|
|
||||||
|
barebox = read_file(data->os_file, NULL);
|
||||||
|
if (!barebox)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
shutdown_barebox();
|
||||||
|
|
||||||
|
barebox();
|
||||||
|
|
||||||
|
reset_cpu(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct image_handler barebox_handler = {
|
||||||
|
.name = "MIPS barebox",
|
||||||
|
.bootm = do_bootm_barebox,
|
||||||
|
.filetype = filetype_mips_barebox,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct binfmt_hook binfmt_barebox_hook = {
|
||||||
|
.type = filetype_mips_barebox,
|
||||||
|
.exec = "bootm",
|
||||||
|
};
|
||||||
|
|
||||||
|
static int mips_register_image_handler(void)
|
||||||
|
{
|
||||||
|
register_image_handler(&barebox_handler);
|
||||||
|
binfmt_register(&binfmt_barebox_hook);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
late_initcall(mips_register_image_handler);
|
|
@ -78,6 +78,8 @@ enum filetype file_detect_type(void *_buf)
|
||||||
return filetype_oftree;
|
return filetype_oftree;
|
||||||
if (strncmp(buf8, "ANDROID!", 8) == 0)
|
if (strncmp(buf8, "ANDROID!", 8) == 0)
|
||||||
return filetype_aimage;
|
return filetype_aimage;
|
||||||
|
if (strncmp(buf8 + 0x10, "barebox", 7) == 0)
|
||||||
|
return filetype_mips_barebox;
|
||||||
|
|
||||||
return filetype_unknown;
|
return filetype_unknown;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ enum filetype {
|
||||||
filetype_oftree,
|
filetype_oftree,
|
||||||
filetype_aimage,
|
filetype_aimage,
|
||||||
filetype_sh,
|
filetype_sh,
|
||||||
|
filetype_mips_barebox,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *file_type_to_string(enum filetype f);
|
const char *file_type_to_string(enum filetype f);
|
||||||
|
|
Loading…
Reference in New Issue