summaryrefslogtreecommitdiffstats
path: root/arch/nios2/lib
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-06 08:53:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-15 11:07:11 +0100
commitd4e5c6b8a03d31c00084d38e40d9811267f00289 (patch)
tree501db64efe6c21d7e8a254eb4e478838ff8c9446 /arch/nios2/lib
parent390249968c4eeaceddd26a1cdeca5728f5b87b18 (diff)
downloadbarebox-d4e5c6b8a03d31c00084d38e40d9811267f00289.tar.gz
barebox-d4e5c6b8a03d31c00084d38e40d9811267f00289.tar.xz
bootm: use new uimage code
This switches the bootm code to the new uimage code. Also bootm can now handle other types of images than uImages. Currently the only architecture making use of this is arm which allows to boot zImages, raw images and barebox images. I intended to make a more bisectable series from this but I failed becuase there are many dependencies and no matter how I tried the patches grew bigger and and bigger. So I decided to put this all in a single patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/nios2/lib')
-rw-r--r--arch/nios2/lib/bootm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index b5b344f499..1cd43c81af 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -31,17 +31,20 @@
#include <environment.h>
#include <init.h>
#include <boot.h>
+#include <errno.h>
#include <asm/cache.h>
#define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
static int do_bootm_linux(struct image_data *idata)
{
- image_header_t *os_header = &idata->os->header;
void (*kernel)(int, int, int, const char *);
const char *commandline = getenv ("bootargs");
- kernel = (void (*)(int, int, int, const char *))ntohl(os_header->ih_ep);
+ if (!idata->os_res)
+ return -EINVAL;
+
+ kernel = (void *)(idata->os_address + idata->os_entry);
/* kernel parameters passing
* r4 : NIOS magic
@@ -63,8 +66,10 @@ static int do_bootm_linux(struct image_data *idata)
}
static struct image_handler handler = {
+ .name = "NIOS2 Linux",
.bootm = do_bootm_linux,
- .image_type = IH_OS_LINUX,
+ .filetype = filetype_uimage,
+ .ih_os = IH_OS_LINUX,
};
int nios2_register_image_handler(void)