2
0
Fork 0
mirror of https://github.com/AsahiLinux/u-boot synced 2024-12-17 08:43:07 +00:00
u-boot/arch/sh/lib/zimageboot.c
Simon Glass 7e5f460ec4 global: Convert simple_strtoul() with hex to hextoul()
It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-02 13:32:14 -04:00

69 lines
1.3 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2010
* Renesas Solutions Corp.
* Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
*/
/*
* Linux SuperH zImage loading and boot
*/
#include <common.h>
#include <command.h>
#include <env.h>
#include <irq_func.h>
#include <asm/io.h>
#include <asm/zimage.h>
int do_sh_zimageboot(struct cmd_tbl *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 []))hextoul(s0,
NULL);
/* empty_zero_page */
if (s1)
param = (unsigned char *)hextoul(s1, NULL);
/* Linux kernel command line */
cmdline = (char *)param + COMMAND_LINE;
bootargs = env_get("bootargs");
/* Clear zero page */
/* cppcheck-suppress nullPointer */
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",
""
);