From b97a2a0a21f279d66de8a9bdbfe21920968bcb1c Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Tue, 8 Jan 2008 18:14:09 +0100 Subject: [new uImage] Define a API for image handling operations - Add inline helper macros for basic header processing - Move common non inline code common/image.c - Replace direct header access with the API routines - Rename IH_CPU_* to IH_ARCH_* Signed-off-by: Marian Balakowicz --- lib_blackfin/bf533_linux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib_blackfin') diff --git a/lib_blackfin/bf533_linux.c b/lib_blackfin/bf533_linux.c index 80a3dc7d6e..26c65340f2 100644 --- a/lib_blackfin/bf533_linux.c +++ b/lib_blackfin/bf533_linux.c @@ -52,12 +52,13 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], { int (*appl) (char *cmdline); char *cmdline; + image_header_t *hdr = &header; #ifdef SHARED_RESOURCES swap_to(FLASH); #endif - appl = (int (*)(char *))ntohl(header.ih_ep); + appl = (int (*)(char *))image_get_ep (hdr); printf("Starting Kernel at = %x\n", appl); cmdline = make_command_line(); if (icache_status()) { -- cgit v1.2.3 From f13e7b2e993c61fed1f607962501e051940d6e80 Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Tue, 8 Jan 2008 18:12:17 +0100 Subject: [new uImage] Cleanup image header pointer use in bootm code - use single image header pointer instead of a set of auxilliary variables. - add multi component image helper routines: get component size/data address Signed-off-by: Marian Balakowicz --- lib_blackfin/bf533_linux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib_blackfin') diff --git a/lib_blackfin/bf533_linux.c b/lib_blackfin/bf533_linux.c index 26c65340f2..6299415b11 100644 --- a/lib_blackfin/bf533_linux.c +++ b/lib_blackfin/bf533_linux.c @@ -42,17 +42,15 @@ extern void swap_to(int device_id); #endif -extern image_header_t header; extern void flush_instruction_cache(void); extern void flush_data_cache(void); static char *make_command_line(void); void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], - ulong addr, ulong * len_ptr, int verify) + image_header_t *hdr, int verify) { int (*appl) (char *cmdline); char *cmdline; - image_header_t *hdr = &header; #ifdef SHARED_RESOURCES swap_to(FLASH); -- cgit v1.2.3 From 4a995edec1ac163d9326d143ffe2b47e7543407f Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Thu, 31 Jan 2008 13:20:06 +0100 Subject: [new uImage] Rename architecture specific bootm code files Implementation of the do_bootm_linux() and other bootm helper routines is architecture specific code. As such it resides in lib_ directories in files named _linux.c This patch renames those files to a more clear and accurate lib_/bootm.c form. List of the renamed files: lib_arm/armlinux.c -> lib_arm/bootm.c lib_avr32/avr32_linux.c -> lib_avr32/bootm.c lib_blackfin/bf533_linux.c -> lib_blackfin/bootm.c lib_i386/i386_linux.c -> lib_i386/bootm.c lib_m68k/m68k_linux.c -> lib_m68k/bootm.c lib_microblaze/microblaze_linux.c -> lib_microblaze/bootm.c lib_mips/mips_linux.c -> lib_mips/bootm.c lib_nios/nios_linux.c -> lib_nios/bootm.c lib_nios2/nios_linux.c -> lib_nios2/bootm.c lib_ppc/ppc_linux.c -> lib_ppc/bootm.c lib_sh/sh_linux.c -> lib_sh/bootm.c Signed-off-by: Marian Balakowicz --- lib_blackfin/Makefile | 2 +- lib_blackfin/bf533_linux.c | 84 ---------------------------------------------- lib_blackfin/bootm.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 85 deletions(-) delete mode 100644 lib_blackfin/bf533_linux.c create mode 100644 lib_blackfin/bootm.c (limited to 'lib_blackfin') diff --git a/lib_blackfin/Makefile b/lib_blackfin/Makefile index a7aaef7a3c..ac3fb28553 100644 --- a/lib_blackfin/Makefile +++ b/lib_blackfin/Makefile @@ -31,7 +31,7 @@ LIB = $(obj)lib$(ARCH).a SOBJS = memcpy.o memcmp.o memset.o memmove.o -COBJS = post.o tests.o board.o bf533_linux.o bf533_string.o cache.o muldi3.o +COBJS = post.o tests.o board.o bootm.o bf533_string.o cache.o muldi3.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/lib_blackfin/bf533_linux.c b/lib_blackfin/bf533_linux.c deleted file mode 100644 index 6299415b11..0000000000 --- a/lib_blackfin/bf533_linux.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * U-boot - bf533_linux.c - * - * Copyright (c) 2005-2007 Analog Devices Inc. - * - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -/* Dummy functions, currently not in Use */ - -#include -#include -#include -#include -#include - -#define LINUX_MAX_ENVS 256 -#define LINUX_MAX_ARGS 256 - -#define CMD_LINE_ADDR 0xFF900000 /* L1 scratchpad */ - -#ifdef SHARED_RESOURCES -extern void swap_to(int device_id); -#endif - -extern void flush_instruction_cache(void); -extern void flush_data_cache(void); -static char *make_command_line(void); - -void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], - image_header_t *hdr, int verify) -{ - int (*appl) (char *cmdline); - char *cmdline; - -#ifdef SHARED_RESOURCES - swap_to(FLASH); -#endif - - appl = (int (*)(char *))image_get_ep (hdr); - printf("Starting Kernel at = %x\n", appl); - cmdline = make_command_line(); - if (icache_status()) { - flush_instruction_cache(); - icache_disable(); - } - if (dcache_status()) { - flush_data_cache(); - dcache_disable(); - } - (*appl) (cmdline); -} - -char *make_command_line(void) -{ - char *dest = (char *)CMD_LINE_ADDR; - char *bootargs; - - if ((bootargs = getenv("bootargs")) == NULL) - return NULL; - - strncpy(dest, bootargs, 0x1000); - dest[0xfff] = 0; - return dest; -} diff --git a/lib_blackfin/bootm.c b/lib_blackfin/bootm.c new file mode 100644 index 0000000000..6299415b11 --- /dev/null +++ b/lib_blackfin/bootm.c @@ -0,0 +1,84 @@ +/* + * U-boot - bf533_linux.c + * + * Copyright (c) 2005-2007 Analog Devices Inc. + * + * (C) Copyright 2000-2004 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +/* Dummy functions, currently not in Use */ + +#include +#include +#include +#include +#include + +#define LINUX_MAX_ENVS 256 +#define LINUX_MAX_ARGS 256 + +#define CMD_LINE_ADDR 0xFF900000 /* L1 scratchpad */ + +#ifdef SHARED_RESOURCES +extern void swap_to(int device_id); +#endif + +extern void flush_instruction_cache(void); +extern void flush_data_cache(void); +static char *make_command_line(void); + +void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], + image_header_t *hdr, int verify) +{ + int (*appl) (char *cmdline); + char *cmdline; + +#ifdef SHARED_RESOURCES + swap_to(FLASH); +#endif + + appl = (int (*)(char *))image_get_ep (hdr); + printf("Starting Kernel at = %x\n", appl); + cmdline = make_command_line(); + if (icache_status()) { + flush_instruction_cache(); + icache_disable(); + } + if (dcache_status()) { + flush_data_cache(); + dcache_disable(); + } + (*appl) (cmdline); +} + +char *make_command_line(void) +{ + char *dest = (char *)CMD_LINE_ADDR; + char *bootargs; + + if ((bootargs = getenv("bootargs")) == NULL) + return NULL; + + strncpy(dest, bootargs, 0x1000); + dest[0xfff] = 0; + return dest; +} -- cgit v1.2.3 From d5934ad7756f038a393a9cfab76a4fe306d9d930 Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Mon, 4 Feb 2008 08:28:09 +0100 Subject: [new uImage] Add dual format uImage support framework This patch adds framework for dual format images. Format detection is added and the bootm controll flow is updated to include cases for new FIT format uImages. When the legacy (image_header based) format is detected appropriate legacy specific handling is invoked. For the new (FIT based) format uImages dual boot framework has a minial support, that will only print out a corresponding debug messages. Implementation of the FIT specific handling will be added in following patches. Signed-off-by: Marian Balakowicz --- lib_blackfin/bootm.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'lib_blackfin') diff --git a/lib_blackfin/bootm.c b/lib_blackfin/bootm.c index 6299415b11..8010e5d64f 100644 --- a/lib_blackfin/bootm.c +++ b/lib_blackfin/bootm.c @@ -47,16 +47,30 @@ extern void flush_data_cache(void); static char *make_command_line(void); void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], - image_header_t *hdr, int verify) + bootm_headers_t *images, int verify) { - int (*appl) (char *cmdline); - char *cmdline; + int (*appl) (char *cmdline); + char *cmdline; + ulong ep = 0; #ifdef SHARED_RESOURCES swap_to(FLASH); #endif - appl = (int (*)(char *))image_get_ep (hdr); + /* 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) { + fit_unsupported_reset ("AVR32 linux bootm"); + do_reset (cmdtp, flag, argc, argv); +#endif + } else { + puts ("Could not find kernel entry point!\n"); + do_reset (cmdtp, flag, argc, argv); + } + appl = (int (*)(char *))ep; + printf("Starting Kernel at = %x\n", appl); cmdline = make_command_line(); if (icache_status()) { -- cgit v1.2.3 From 823afe7cefe00dafefc6696c1cc7aa828c394234 Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Wed, 27 Feb 2008 11:00:47 +0100 Subject: [Makefile] Sort COBJS in lib_ Makefiles Signed-off-by: Marian Balakowicz --- lib_blackfin/Makefile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'lib_blackfin') diff --git a/lib_blackfin/Makefile b/lib_blackfin/Makefile index ac3fb28553..dfaed6d02b 100644 --- a/lib_blackfin/Makefile +++ b/lib_blackfin/Makefile @@ -29,12 +29,21 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(ARCH).a -SOBJS = memcpy.o memcmp.o memset.o memmove.o - -COBJS = post.o tests.o board.o bootm.o bf533_string.o cache.o muldi3.o - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) +SOBJS-y += memcmp.o +SOBJS-y += memcpy.o +SOBJS-y += memmove.o +SOBJS-y += memset.o + +COBJS-y += bf533_string.o +COBJS-y += board.o +COBJS-y += bootm.o +COBJS-y += cache.o +COBJS-y += muldi3.o +COBJS-y += post.o +COBJS-y += tests.o + +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) $(LIB): $(obj).depend $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -- cgit v1.2.3 From 8a5ea3e6168fe6a2780eeaf257a3b19f30dec658 Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Wed, 27 Feb 2008 11:01:04 +0100 Subject: [new uImage] Move image verify flag to bootm_headers structure Do not pass image verification flag directly to related routines. Simplify argument passing and move it to the bootm_header structure which contains curently processed image specific data and is already being passed on the argument list. Signed-off-by: Marian Balakowicz Acked-by: Kumar Gala --- lib_blackfin/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib_blackfin') diff --git a/lib_blackfin/bootm.c b/lib_blackfin/bootm.c index 8010e5d64f..26ac88b267 100644 --- a/lib_blackfin/bootm.c +++ b/lib_blackfin/bootm.c @@ -47,7 +47,7 @@ extern void flush_data_cache(void); static char *make_command_line(void); void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], - bootm_headers_t *images, int verify) + bootm_headers_t *images) { int (*appl) (char *cmdline); char *cmdline; -- cgit v1.2.3 From 75fa002c47171b73fb4c1f2c2fe4d6391c136276 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 27 Feb 2008 21:51:51 -0600 Subject: [new uImage] Respect autostart setting in linux bootm Signed-off-by: Kumar Gala Acked-by: Marian Balakowicz --- lib_blackfin/bootm.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib_blackfin') diff --git a/lib_blackfin/bootm.c b/lib_blackfin/bootm.c index 26ac88b267..33979a9fb2 100644 --- a/lib_blackfin/bootm.c +++ b/lib_blackfin/bootm.c @@ -53,6 +53,9 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], char *cmdline; ulong ep = 0; + if (!images->autostart) + return ; + #ifdef SHARED_RESOURCES swap_to(FLASH); #endif -- cgit v1.2.3 From cd7c596e9f561dbbc17b717277438aee78cde14f Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Wed, 12 Mar 2008 10:33:00 +0100 Subject: [new uImage] Add new uImage format support to arch specific do_bootm_linux() routines This patch updates architecture specific implementations of do_bootm_linux() adding new uImage format handling for operations like get kernel entry point address, get kernel image data start address. Signed-off-by: Marian Balakowicz --- lib_blackfin/bootm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib_blackfin') diff --git a/lib_blackfin/bootm.c b/lib_blackfin/bootm.c index 33979a9fb2..1ea80f4e36 100644 --- a/lib_blackfin/bootm.c +++ b/lib_blackfin/bootm.c @@ -65,12 +65,16 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], ep = image_get_ep (images->legacy_hdr_os); #if defined(CONFIG_FIT) } else if (images->fit_uname_os) { - fit_unsupported_reset ("AVR32 linux bootm"); - do_reset (cmdtp, flag, argc, argv); + 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"); - do_reset (cmdtp, flag, argc, argv); + goto error; } appl = (int (*)(char *))ep; @@ -85,6 +89,13 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], dcache_disable(); } (*appl) (cmdline); + /* does not return */ + return; + +error: + if (images->autostart) + do_reset (cmdtp, flag, argc, argv); + return; } char *make_command_line(void) -- cgit v1.2.3