Skip to content
Snippets Groups Projects
  • Tom Rini's avatar
    5db28905
    cmd: Split 'bootz' and 'booti' out from 'bootm' · 5db28905
    Tom Rini authored
    
    The bootz and booti commands rely on common functionality that is found
    in common/bootm.c and common/bootm_os.c.  They do not however rely on
    the rest of cmd/bootm.c to be implemented so split them into their own
    files.  Have various Makefiles include the required infrastructure for
    CONFIG_CMD_BOOT[IZ] as well as CONFIG_CMD_BOOTM.  Move the declaration
    of 'images' over to common/bootm.c.
    
    Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: default avatarTom Rini <trini@konsulko.com>
    5db28905
    History
    cmd: Split 'bootz' and 'booti' out from 'bootm'
    Tom Rini authored
    
    The bootz and booti commands rely on common functionality that is found
    in common/bootm.c and common/bootm_os.c.  They do not however rely on
    the rest of cmd/bootm.c to be implemented so split them into their own
    files.  Have various Makefiles include the required infrastructure for
    CONFIG_CMD_BOOT[IZ] as well as CONFIG_CMD_BOOTM.  Move the declaration
    of 'images' over to common/bootm.c.
    
    Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: default avatarTom Rini <trini@konsulko.com>
bootz.c 2.60 KiB
/*
 * (C) Copyright 2000-2009
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#include <common.h>
#include <bootm.h>
#include <command.h>
#include <lmb.h>
#include <linux/compiler.h>

int __weak bootz_setup(ulong image, ulong *start, ulong *end)
{
	/* Please define bootz_setup() for your platform */

	puts("Your platform's zImage format isn't supported yet!\n");
	return -1;
}

/*
 * zImage booting support
 */
static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
			char * const argv[], bootm_headers_t *images)
{
	int ret;
	ulong zi_start, zi_end;

	ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
			      images, 1);

	/* Setup Linux kernel zImage entry point */
	if (!argc) {
		images->ep = load_addr;
		debug("*  kernel: default image load address = 0x%08lx\n",
				load_addr);
	} else {
		images->ep = simple_strtoul(argv[0], NULL, 16);
		debug("*  kernel: cmdline image address = 0x%08lx\n",
			images->ep);
	}

	ret = bootz_setup(images->ep, &zi_start, &zi_end);
	if (ret != 0)
		return 1;

	lmb_reserve(&images->lmb, images->ep, zi_end - zi_start);

	/*
	 * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
	 * have a header that provide this informaiton.
	 */
	if (bootm_find_images(flag, argc, argv))
		return 1;

	return 0;
}

int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	int ret;

	/* Consume 'bootz' */
	argc--; argv++;

	if (bootz_start(cmdtp, flag, argc, argv, &images))
		return 1;