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_sh/bootm.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lib_sh/bootm.c (limited to 'lib_sh/bootm.c') diff --git a/lib_sh/bootm.c b/lib_sh/bootm.c new file mode 100644 index 0000000..14b6815 --- /dev/null +++ b/lib_sh/bootm.c @@ -0,0 +1,74 @@ +/* + * (C) Copyright 2003 + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include + +extern image_header_t header; /* common/cmd_bootm.c */ + +/* The SH kernel reads arguments from the empty zero page at location + * 0 at the start of SDRAM. The following are copied from + * arch/sh/kernel/setup.c and may require tweaking if the kernel sources + * change. + */ +#define PARAM ((unsigned char *)CFG_SDRAM_BASE + 0x1000) + +#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) +#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) +#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008)) +#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c)) +#define INITRD_START (*(unsigned long *) (PARAM+0x010)) +#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014)) +/* ... */ +#define COMMAND_LINE ((char *) (PARAM+0x100)) + +#define RAMDISK_IMAGE_START_MASK 0x07FF + +#ifdef CFG_DEBUG +static void hexdump (unsigned char *buf, int len) +{ + int i; + + for (i = 0; i < len; i++) { + if ((i % 16) == 0) + printf ("%s%08x: ", i ? "\n" : "", (unsigned int) &buf[i]); + printf ("%02x ", buf[i]); + } + printf ("\n"); +} +#endif + +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 = &header; + char *bootargs = getenv("bootargs"); + void (*kernel) (void) = (void (*)(void)) ntohl (hdr->ih_ep); + + /* Setup parameters */ + memset(PARAM, 0, 0x1000); /* Clear zero page */ + strcpy(COMMAND_LINE, bootargs); + + kernel(); +} -- cgit v1.1 From 82850f3d32a2661868ec6876bed7a22c55cef718 Mon Sep 17 00:00:00 2001 From: Marian Balakowicz Date: Thu, 31 Jan 2008 13:20:06 +0100 Subject: [new uImage] Use image API in SH do_bootm_linux() routine Introduce image handling API for lately added Hitachi SH architecture. Signed-off-by: Marian Balakowicz --- lib_sh/bootm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib_sh/bootm.c') diff --git a/lib_sh/bootm.c b/lib_sh/bootm.c index 14b6815..4e5fe77 100644 --- a/lib_sh/bootm.c +++ b/lib_sh/bootm.c @@ -25,8 +25,6 @@ #include #include -extern image_header_t header; /* common/cmd_bootm.c */ - /* The SH kernel reads arguments from the empty zero page at location * 0 at the start of SDRAM. The following are copied from * arch/sh/kernel/setup.c and may require tweaking if the kernel sources @@ -60,11 +58,10 @@ static void hexdump (unsigned char *buf, int len) #endif 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) { - image_header_t *hdr = &header; char *bootargs = getenv("bootargs"); - void (*kernel) (void) = (void (*)(void)) ntohl (hdr->ih_ep); + void (*kernel) (void) = (void (*)(void))image_get_ep (hdr); /* Setup parameters */ memset(PARAM, 0, 0x1000); /* Clear zero page */ -- cgit v1.1 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_sh/bootm.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'lib_sh/bootm.c') diff --git a/lib_sh/bootm.c b/lib_sh/bootm.c index 4e5fe77..55e64f5 100644 --- a/lib_sh/bootm.c +++ b/lib_sh/bootm.c @@ -43,6 +43,8 @@ #define RAMDISK_IMAGE_START_MASK 0x07FF +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + #ifdef CFG_DEBUG static void hexdump (unsigned char *buf, int len) { @@ -58,10 +60,24 @@ static void hexdump (unsigned char *buf, int len) #endif 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) { - char *bootargs = getenv("bootargs"); - void (*kernel) (void) = (void (*)(void))image_get_ep (hdr); + ulong ep = 0; + char *bootargs = getenv("bootargs"); + + /* 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 ("SH linux bootm"); + do_reset (cmdtp, flag, argc, argv); +#endif + } else { + puts ("Could not find kernel entry point!\n"); + do_reset (cmdtp, flag, argc, argv); + } + void (*kernel) (void) = (void (*)(void))ep; /* Setup parameters */ memset(PARAM, 0, 0x1000); /* Clear zero page */ -- cgit v1.1 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_sh/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib_sh/bootm.c') diff --git a/lib_sh/bootm.c b/lib_sh/bootm.c index 55e64f5..de5c9ea 100644 --- a/lib_sh/bootm.c +++ b/lib_sh/bootm.c @@ -60,7 +60,7 @@ static void hexdump (unsigned char *buf, int len) #endif void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], - bootm_headers_t *images, int verify) + bootm_headers_t *images) { ulong ep = 0; char *bootargs = getenv("bootargs"); -- cgit v1.1 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_sh/bootm.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib_sh/bootm.c') diff --git a/lib_sh/bootm.c b/lib_sh/bootm.c index de5c9ea..8055841 100644 --- a/lib_sh/bootm.c +++ b/lib_sh/bootm.c @@ -79,6 +79,9 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], } void (*kernel) (void) = (void (*)(void))ep; + if (!images->autostart) + return ; + /* Setup parameters */ memset(PARAM, 0, 0x1000); /* Clear zero page */ strcpy(COMMAND_LINE, bootargs); -- cgit v1.1 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_sh/bootm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib_sh/bootm.c') diff --git a/lib_sh/bootm.c b/lib_sh/bootm.c index 8055841..49462c8 100644 --- a/lib_sh/bootm.c +++ b/lib_sh/bootm.c @@ -70,12 +70,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 ("SH 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; } void (*kernel) (void) = (void (*)(void))ep; @@ -87,4 +91,11 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], strcpy(COMMAND_LINE, bootargs); kernel(); + /* does not return */ + return; + +error: + if (images->autostart) + do_reset (cmdtp, flag, argc, argv); + return; } -- cgit v1.1