+// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2000-2009
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
/*
#include <common.h>
#include <bootm.h>
#include <command.h>
-#include <environment.h>
+#include <env.h>
#include <errno.h>
#include <image.h>
#include <malloc.h>
#include <linux/ctype.h>
#include <linux/err.h>
#include <u-boot/zlib.h>
+#include <mapmem.h>
DECLARE_GLOBAL_DATA_PTR;
#endif
#if defined(CONFIG_CMD_IMLS) || defined(CONFIG_CMD_IMLS_NAND)
-static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+static int do_imls(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);
#endif
/* we overload the cmd field with our state machine info instead of a
* function pointer */
-static cmd_tbl_t cmd_bootm_sub[] = {
+static struct cmd_tbl cmd_bootm_sub[] = {
U_BOOT_CMD_MKENT(start, 0, 1, (void *)BOOTM_STATE_START, "", ""),
U_BOOT_CMD_MKENT(loados, 0, 1, (void *)BOOTM_STATE_LOADOS, "", ""),
#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
U_BOOT_CMD_MKENT(go, 0, 1, (void *)BOOTM_STATE_OS_GO, "", ""),
};
-static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,
- char * const argv[])
+static int do_bootm_subcommand(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
int ret = 0;
long state;
- cmd_tbl_t *c;
+ struct cmd_tbl *c;
c = find_cmd_tbl(argv[0], &cmd_bootm_sub[0], ARRAY_SIZE(cmd_bootm_sub));
argc--; argv++;
/* bootm - boot application image from image in memory */
/*******************************************************************/
-int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
#ifdef CONFIG_NEEDS_MANUAL_RELOC
static int relocated = 0;
BOOTM_STATE_OS_GO, &images, 1);
}
-int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
+int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd)
{
const char *ep = env_get("autostart");
char *local_args[2];
local_args[0] = (char *)cmd;
local_args[1] = NULL;
- printf("Automatic boot of image at addr 0x%08lX ...\n", load_addr);
+ printf("Automatic boot of image at addr 0x%08lX ...\n",
+ image_load_addr);
return do_bootm(cmdtp, 0, 1, local_args);
}
"\tfdt - relocate flat device tree\n"
#endif
"\tcmdline - OS specific command line processing/setup\n"
- "\tbdt - OS specific bd_t processing\n"
+ "\tbdt - OS specific bd_info processing\n"
"\tprep - OS specific prep before relocation or go\n"
#if defined(CONFIG_TRACE)
"\tfake - OS specific fake start without go\n"
/* bootd - boot default image */
/*******************************************************************/
#if defined(CONFIG_CMD_BOOTD)
-int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
return run_command(env_get("bootcmd"), flag);
}
/* iminfo - print header info for a requested image */
/*******************************************************************/
#if defined(CONFIG_CMD_IMI)
-static int do_iminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
int arg;
ulong addr;
int rcode = 0;
if (argc < 2) {
- return image_info(load_addr);
+ return image_info(image_load_addr);
}
for (arg = 1; arg < argc; ++arg) {
static int image_info(ulong addr)
{
- void *hdr = (void *)addr;
+ void *hdr = (void *)map_sysmem(addr, 0);
printf("\n## Checking Image at %08lx ...\n", addr);
switch (genimg_get_format(hdr)) {
-#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
case IMAGE_FORMAT_LEGACY:
puts(" Legacy image found\n");
if (!image_check_magic(hdr)) {
puts(" Bad Magic Number\n");
+ unmap_sysmem(hdr);
return 1;
}
if (!image_check_hcrc(hdr)) {
puts(" Bad Header Checksum\n");
+ unmap_sysmem(hdr);
return 1;
}
puts(" Verifying Checksum ... ");
if (!image_check_dcrc(hdr)) {
puts(" Bad Data CRC\n");
+ unmap_sysmem(hdr);
return 1;
}
puts("OK\n");
+ unmap_sysmem(hdr);
return 0;
#endif
#if defined(CONFIG_ANDROID_BOOT_IMAGE)
case IMAGE_FORMAT_ANDROID:
puts(" Android image found\n");
android_print_contents(hdr);
+ unmap_sysmem(hdr);
return 0;
#endif
#if defined(CONFIG_FIT)
if (!fit_check_format(hdr)) {
puts("Bad FIT image format!\n");
+ unmap_sysmem(hdr);
return 1;
}
if (!fit_all_image_verify(hdr)) {
puts("Bad hash in FIT image!\n");
+ unmap_sysmem(hdr);
return 1;
}
+ unmap_sysmem(hdr);
return 0;
#endif
default:
break;
}
+ unmap_sysmem(hdr);
return 1;
}
goto next_sector;
switch (genimg_get_format(hdr)) {
-#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
case IMAGE_FORMAT_LEGACY:
if (!image_check_hcrc(hdr))
goto next_sector;
}
switch (genimg_get_format(buffer)) {
-#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
case IMAGE_FORMAT_LEGACY:
header = (const image_header_t *)buffer;
#endif
#if defined(CONFIG_CMD_IMLS) || defined(CONFIG_CMD_IMLS_NAND)
-static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_imls(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
int ret_nor = 0, ret_nand = 0;