summaryrefslogtreecommitdiff
path: root/lib_nios2
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-03-26 10:41:48 +0100
committerWolfgang Denk <wd@denx.de>2008-03-26 10:41:48 +0100
commitb951f8d31711f3f10ad119ddcf5a3d0afe14d561 (patch)
tree950ca2e675ec92ea7b5610a3a2ea2b739f0aaab5 /lib_nios2
parent218ca724c08ca8a649f0917cf201cf23d4b33f39 (diff)
parent27f33e9f45ef7f9685cbdc65066a1828e85dde4f (diff)
downloadu-boot-imx-b951f8d31711f3f10ad119ddcf5a3d0afe14d561.zip
u-boot-imx-b951f8d31711f3f10ad119ddcf5a3d0afe14d561.tar.gz
u-boot-imx-b951f8d31711f3f10ad119ddcf5a3d0afe14d561.tar.bz2
Merge branch 'master_merge_new-image' of /home/tur/git/u-boot
Diffstat (limited to 'lib_nios2')
-rw-r--r--lib_nios2/Makefile12
-rw-r--r--lib_nios2/bootm.c (renamed from lib_nios2/nios_linux.c)35
2 files changed, 39 insertions, 8 deletions
diff --git a/lib_nios2/Makefile b/lib_nios2/Makefile
index 1ff2f29..717aa9b 100644
--- a/lib_nios2/Makefile
+++ b/lib_nios2/Makefile
@@ -25,12 +25,16 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(ARCH).a
-SOBJS = cache.o
+SOBJS-y += cache.o
-COBJS = board.o divmod.o nios_linux.o mult.o time.o
+COBJS-y += board.o
+COBJS-y += bootm.o
+COBJS-y += divmod.o
+COBJS-y += mult.o
+COBJS-y += time.o
-SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
+SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
$(LIB): $(obj).depend $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
diff --git a/lib_nios2/nios_linux.c b/lib_nios2/bootm.c
index 9eb3426..0c89e96 100644
--- a/lib_nios2/nios_linux.c
+++ b/lib_nios2/bootm.c
@@ -25,16 +25,43 @@
#include <command.h>
#include <asm/byteorder.h>
-extern image_header_t header; /* common/cmd_bootm.c */
+extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
- ulong addr, ulong *len_ptr, int verify)
+ bootm_headers_t *images)
{
- image_header_t *hdr = &header;
- void (*kernel)(void) = (void (*)(void))ntohl (hdr->ih_ep);
+ ulong ep = 0;
+
+ /* find kernel entry point */
+ if (images->legacy_hdr_valid) {
+ ep = image_get_ep (images->legacy_hdr_os);
+#if defined(CONFIG_FIT)
+ } else if (images->fit_uname_os) {
+ int ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
+#endif
+ } else {
+ puts ("Could not find kernel entry point!\n");
+ goto error;
+ }
+ void (*kernel)(void) = (void (*)(void))ep;
+
+ if (!images->autostart)
+ return ;
/* For now we assume the Microtronix linux ... which only
* needs to be called ;-)
*/
kernel ();
+ /* does not return */
+ return;
+
+error:
+ if (images->autostart)
+ do_reset (cmdtp, flag, argc, argv);
+ return;
}