[U-Boot] [PATCH 1/5] sh: Delete the function that was not necessary

From: Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
Signed-off-by: Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com --- arch/sh/lib/bootm.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c index 19b3a94..fe23b58 100644 --- a/arch/sh/lib/bootm.c +++ b/arch/sh/lib/bootm.c @@ -100,7 +100,6 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima /* Set commandline */ strcpy(cmdline, bootargs);
- sh_check_cmd_arg(bootargs, CMD_ARG_RD_DOLOAD, 10); /* Initrd */ if (images->rd_start || images->rd_end) { unsigned long ramdisk_flags = 0;

From: Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
Signed-off-by: Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com --- arch/sh/include/asm/zimage.h | 41 +++++++++++++++++++++++++++++++++++++++++ arch/sh/lib/bootm.c | 20 ++++---------------- 2 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 arch/sh/include/asm/zimage.h
diff --git a/arch/sh/include/asm/zimage.h b/arch/sh/include/asm/zimage.h new file mode 100644 index 0000000..33a680b --- /dev/null +++ b/arch/sh/include/asm/zimage.h @@ -0,0 +1,41 @@ +/* + * (C) Copyright 2010 + * Renesas Solutions Corp. + * Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com + * + * 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 + */ + +#ifndef _ASM_ZIMAGE_H_ +#define _ASM_ZIMAGE_H_ + +#define MOUNT_ROOT_RDONLY 0x000 +#define RAMDISK_FLAGS 0x004 +#define ORIG_ROOT_DEV 0x008 +#define LOADER_TYPE 0x00c +#define INITRD_START 0x010 +#define INITRD_SIZE 0x014 +#define COMMAND_LINE 0x100 + +#define RD_PROMPT (1<<15) +#define RD_DOLOAD (1<<14) +#define CMD_ARG_RD_PROMPT "prompt_ramdisk=" +#define CMD_ARG_RD_DOLOAD "load_ramdisk=" + +#endif diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c index fe23b58..57273fa 100644 --- a/arch/sh/lib/bootm.c +++ b/arch/sh/lib/bootm.c @@ -27,6 +27,7 @@ #include <common.h> #include <command.h> #include <asm/byteorder.h> +#include <asm/zimage.h>
#ifdef CONFIG_SYS_DEBUG static void hexdump(unsigned char *buf, int len) @@ -43,19 +44,6 @@ static void hexdump(unsigned char *buf, int len) } #endif
-#define MOUNT_ROOT_RDONLY 0x000 -#define RAMDISK_FLAGS 0x004 -#define ORIG_ROOT_DEV 0x008 -#define LOADER_TYPE 0x00c -#define INITRD_START 0x010 -#define INITRD_SIZE 0x014 -#define COMMAND_LINE 0x100 - -#define RD_PROMPT (1<<15) -#define RD_DOLOAD (1<<14) -#define CMD_ARG_RD_PROMPT "prompt_ramdisk=" -#define CMD_ARG_RD_DOLOAD "load_ramdisk=" - #ifdef CONFIG_SH_SDRAM_OFFSET #define GET_INITRD_START(initrd, linux) (initrd - linux + CONFIG_SH_SDRAM_OFFSET) #else @@ -94,8 +82,8 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) return 1;
- /* Setup parameters */ - memset(param, 0, size); /* Clear zero page */ + /* Clear zero page */ + memset(param, 0, size);
/* Set commandline */ strcpy(cmdline, bootargs); @@ -127,7 +115,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
/* Boot kernel */ kernel(); - /* does not return */
+ /* does not return */ return 1; }

From: Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
Curent U-Boot can boot zImage by use the "go" command. But this is not right method. And this method can not set command-line to linux kernel. zimageboot sets command-line in environment of u-boot in linux kernel, and provides function to boot it.
Signed-off-by: Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com --- arch/sh/lib/Makefile | 3 ++ arch/sh/lib/zimageboot.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 0 deletions(-) create mode 100644 arch/sh/lib/zimageboot.c
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile index 7f60396..c0670cb 100644 --- a/arch/sh/lib/Makefile +++ b/arch/sh/lib/Makefile @@ -31,6 +31,9 @@ COBJS-y += time_sh2.o else COBJS-y += time.o endif +ifeq ($(CONFIG_CMD_SH_ZIMAGEBOOT),y) +COBJS-y += zimageboot.o +endif
SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) diff --git a/arch/sh/lib/zimageboot.c b/arch/sh/lib/zimageboot.c new file mode 100644 index 0000000..dd413c0 --- /dev/null +++ b/arch/sh/lib/zimageboot.c @@ -0,0 +1,80 @@ +/* + * (C) Copyright 2010 + * Renesas Solutions Corp. + * Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com + * + * 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 + */ + +/* + * Linux SuperH zImage loading and boot + */ + +#include <common.h> +#include <asm/io.h> +#include <asm/zimage.h> + +int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + ulong (*zboot_entry)(int, char * const []) = NULL; + char *s0, *s1; + unsigned char *param = NULL; + char *cmdline; + char *bootargs; + + disable_interrupts(); + + if (argc >= 3) { + /* argv[1] holds the address of the zImage */ + s0 = argv[1]; + /* argv[2] holds the address of zero page */ + s1 = argv[2]; + } else { + goto exit; + } + + if (s0) + zboot_entry = (ulong (*)(int, char * const []))simple_strtoul(s0, NULL, 16); + + /* empty_zero_page */ + if (s1) + param = (unsigned char*)simple_strtoul(s1, NULL, 16); + + /* Linux kernel command line */ + cmdline = (char *)param + COMMAND_LINE; + bootargs = getenv("bootargs"); + + /* Clear zero page */ + memset(param, 0, 0x1000); + + /* Set commandline */ + strcpy(cmdline, bootargs); + + /* Boot */ + zboot_entry(0, NULL); + +exit: + return -1; +} + +U_BOOT_CMD( + zimageboot, 3, 0, do_sh_zimageboot, + "Boot zImage for Renesas SH", + "" +);

From: Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org --- include/configs/sh7785lcr.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/sh7785lcr.h b/include/configs/sh7785lcr.h index 591fb5c..a95a759 100644 --- a/include/configs/sh7785lcr.h +++ b/include/configs/sh7785lcr.h @@ -41,6 +41,7 @@ #define CONFIG_CMD_SDRAM #define CONFIG_CMD_RUN #define CONFIG_CMD_SAVEENV +#define CONFIG_CMD_SH_ZIMAGEBOOT
#define CONFIG_CMD_USB #define CONFIG_USB_STORAGE

From: Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org --- include/configs/r2dplus.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h index ade6f7c..8689513 100644 --- a/include/configs/r2dplus.h +++ b/include/configs/r2dplus.h @@ -24,6 +24,7 @@ #define CONFIG_CMD_IDE #define CONFIG_CMD_EXT2 #define CONFIG_DOS_PARTITION +#define CONFIG_CMD_SH_ZIMAGEBOOT
/* SCIF */ #define CONFIG_SCIF_CONSOLE 1
participants (1)
-
nobuhiro.iwamatsu.yj@renesas.com