2002-09-20 10:59:08 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2001 William L. Pitts
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are freely
|
|
|
|
* permitted provided that the above copyright notice and this
|
|
|
|
* paragraph and the following disclaimer are duplicated in all
|
|
|
|
* such forms.
|
|
|
|
*
|
|
|
|
* This software is provided "AS IS" and without any express or
|
|
|
|
* implied warranties, including, without limitation, the implied
|
|
|
|
* warranties of merchantability and fitness for a particular
|
|
|
|
* purpose.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2014-10-08 20:57:51 +00:00
|
|
|
#include <bootm.h>
|
2002-09-20 10:59:08 +00:00
|
|
|
#include <command.h>
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <net.h>
|
|
|
|
#include <elf.h>
|
2008-11-03 21:15:34 +00:00
|
|
|
#include <vxworks.h>
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2008-10-16 13:01:15 +00:00
|
|
|
#if defined(CONFIG_WALNUT) || defined(CONFIG_SYS_VXWORKS_MAC_PTR)
|
2006-03-31 16:32:53 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
#endif
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2010-10-02 19:44:53 +00:00
|
|
|
static unsigned long load_elf_image_phdr(unsigned long addr);
|
|
|
|
static unsigned long load_elf_image_shdr(unsigned long addr);
|
2008-04-13 23:42:18 +00:00
|
|
|
|
|
|
|
/* Allow ports to override the default behavior */
|
2014-10-08 20:57:31 +00:00
|
|
|
static unsigned long do_bootelf_exec(ulong (*entry)(int, char * const[]),
|
2010-06-28 20:00:46 +00:00
|
|
|
int argc, char * const argv[])
|
2008-01-29 23:21:05 +00:00
|
|
|
{
|
2008-04-13 23:42:18 +00:00
|
|
|
unsigned long ret;
|
|
|
|
|
2008-01-29 23:21:05 +00:00
|
|
|
/*
|
|
|
|
* QNX images require the data cache is disabled.
|
|
|
|
* Data cache is already flushed, so just turn it off.
|
|
|
|
*/
|
2012-09-16 06:55:05 +00:00
|
|
|
int dcache = dcache_status();
|
2008-04-13 23:42:18 +00:00
|
|
|
if (dcache)
|
2012-09-16 06:55:05 +00:00
|
|
|
dcache_disable();
|
2008-01-29 23:21:05 +00:00
|
|
|
|
2008-04-13 23:42:18 +00:00
|
|
|
/*
|
|
|
|
* pass address parameter as argv[0] (aka command name),
|
|
|
|
* and all remaining args
|
|
|
|
*/
|
2012-09-16 06:55:05 +00:00
|
|
|
ret = entry(argc, argv);
|
2008-01-29 23:21:05 +00:00
|
|
|
|
2008-04-13 23:42:18 +00:00
|
|
|
if (dcache)
|
2012-09-16 06:55:05 +00:00
|
|
|
dcache_enable();
|
2008-04-13 23:42:18 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
/* ======================================================================
|
|
|
|
* Determine if a valid ELF image exists at the given memory location.
|
|
|
|
* First looks at the ELF header magic field, the makes sure that it is
|
|
|
|
* executable and makes sure that it is for a PowerPC.
|
|
|
|
* ====================================================================== */
|
|
|
|
int valid_elf_image(unsigned long addr)
|
|
|
|
{
|
|
|
|
Elf32_Ehdr *ehdr; /* Elf header structure pointer */
|
|
|
|
|
|
|
|
/* -------------------------------------------------- */
|
|
|
|
|
|
|
|
ehdr = (Elf32_Ehdr *) addr;
|
|
|
|
|
|
|
|
if (!IS_ELF(*ehdr)) {
|
|
|
|
printf("## No elf image at address 0x%08lx\n", addr);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ehdr->e_type != ET_EXEC) {
|
|
|
|
printf("## Not a 32-bit elf image at address 0x%08lx\n", addr);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if (ehdr->e_machine != EM_PPC) {
|
|
|
|
printf("## Not a PowerPC elf image at address 0x%08lx\n", addr);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2002-09-20 10:59:08 +00:00
|
|
|
/* ======================================================================
|
|
|
|
* Interpreter command to boot an arbitrary ELF image from memory.
|
|
|
|
* ====================================================================== */
|
2012-09-16 06:55:05 +00:00
|
|
|
int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
2002-09-20 10:59:08 +00:00
|
|
|
{
|
|
|
|
unsigned long addr; /* Address of the ELF image */
|
|
|
|
unsigned long rc; /* Return value from user code */
|
2010-10-02 19:44:53 +00:00
|
|
|
char *sload, *saddr;
|
2002-09-20 10:59:08 +00:00
|
|
|
|
|
|
|
/* -------------------------------------------------- */
|
|
|
|
int rcode = 0;
|
|
|
|
|
2010-10-02 19:44:53 +00:00
|
|
|
sload = saddr = NULL;
|
|
|
|
if (argc == 3) {
|
|
|
|
sload = argv[1];
|
|
|
|
saddr = argv[2];
|
|
|
|
} else if (argc == 2) {
|
|
|
|
if (argv[1][0] == '-')
|
|
|
|
sload = argv[1];
|
|
|
|
else
|
|
|
|
saddr = argv[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (saddr)
|
|
|
|
addr = simple_strtoul(saddr, NULL, 16);
|
2002-09-20 10:59:08 +00:00
|
|
|
else
|
2010-10-02 19:44:53 +00:00
|
|
|
addr = load_addr;
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
if (!valid_elf_image(addr))
|
2002-09-20 10:59:08 +00:00
|
|
|
return 1;
|
|
|
|
|
2010-10-02 19:44:53 +00:00
|
|
|
if (sload && sload[1] == 'p')
|
|
|
|
addr = load_elf_image_phdr(addr);
|
|
|
|
else
|
|
|
|
addr = load_elf_image_shdr(addr);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
printf("## Starting application at 0x%08lx ...\n", addr);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* pass address parameter as argv[0] (aka command name),
|
|
|
|
* and all remaining args
|
|
|
|
*/
|
2012-09-16 06:55:05 +00:00
|
|
|
rc = do_bootelf_exec((void *)addr, argc - 1, argv + 1);
|
2002-09-20 10:59:08 +00:00
|
|
|
if (rc != 0)
|
|
|
|
rcode = 1;
|
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
printf("## Application terminated, rc = 0x%lx\n", rc);
|
2002-09-20 10:59:08 +00:00
|
|
|
return rcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
* Interpreter command to boot VxWorks from a memory image. The image can
|
|
|
|
* be either an ELF image or a raw binary. Will attempt to setup the
|
|
|
|
* bootline and other parameters correctly.
|
|
|
|
* ====================================================================== */
|
2012-09-16 06:55:05 +00:00
|
|
|
int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
2002-09-20 10:59:08 +00:00
|
|
|
{
|
|
|
|
unsigned long addr; /* Address of image */
|
2012-09-16 06:55:05 +00:00
|
|
|
unsigned long bootaddr; /* Address to put the bootline */
|
2002-09-20 10:59:08 +00:00
|
|
|
char *bootline; /* Text of the bootline */
|
|
|
|
char *tmp; /* Temporary char pointer */
|
2008-11-03 21:15:34 +00:00
|
|
|
char build_buf[128]; /* Buffer for building the bootline */
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2008-11-03 21:15:34 +00:00
|
|
|
/* ---------------------------------------------------
|
|
|
|
*
|
2002-09-20 10:59:08 +00:00
|
|
|
* Check the loadaddr variable.
|
|
|
|
* If we don't know where the image is then we're done.
|
|
|
|
*/
|
|
|
|
|
2013-11-27 13:48:43 +00:00
|
|
|
if (argc < 2)
|
2006-11-29 11:53:15 +00:00
|
|
|
addr = load_addr;
|
|
|
|
else
|
2013-11-27 13:48:43 +00:00
|
|
|
addr = simple_strtoul(argv[1], NULL, 16);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2007-07-08 22:51:39 +00:00
|
|
|
#if defined(CONFIG_CMD_NET)
|
2012-09-16 06:55:05 +00:00
|
|
|
/*
|
|
|
|
* Check to see if we need to tftp the image ourselves before starting
|
|
|
|
*/
|
2013-11-27 13:48:43 +00:00
|
|
|
if ((argc == 2) && (strcmp(argv[1], "tftp") == 0)) {
|
2011-10-24 18:00:02 +00:00
|
|
|
if (NetLoop(TFTPGET) <= 0)
|
2002-09-20 10:59:08 +00:00
|
|
|
return 1;
|
2012-09-16 06:55:05 +00:00
|
|
|
printf("Automatic boot of VxWorks image at address 0x%08lx ...\n",
|
|
|
|
addr);
|
2002-09-20 10:59:08 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* This should equate
|
|
|
|
* to NV_RAM_ADRS + NV_BOOT_OFFSET + NV_ENET_OFFSET
|
|
|
|
* from the VxWorks BSP header files.
|
|
|
|
* This will vary from board to board
|
|
|
|
*/
|
|
|
|
|
2005-08-01 14:41:48 +00:00
|
|
|
#if defined(CONFIG_WALNUT)
|
2008-10-16 13:01:15 +00:00
|
|
|
tmp = (char *) CONFIG_SYS_NVRAM_BASE_ADDR + 0x500;
|
2009-03-26 06:33:59 +00:00
|
|
|
eth_getenv_enetaddr("ethaddr", (uchar *)build_buf);
|
2009-02-11 23:51:43 +00:00
|
|
|
memcpy(tmp, &build_buf[3], 3);
|
2008-10-16 13:01:15 +00:00
|
|
|
#elif defined(CONFIG_SYS_VXWORKS_MAC_PTR)
|
|
|
|
tmp = (char *) CONFIG_SYS_VXWORKS_MAC_PTR;
|
2009-03-26 06:33:59 +00:00
|
|
|
eth_getenv_enetaddr("ethaddr", (uchar *)build_buf);
|
2009-02-11 23:51:43 +00:00
|
|
|
memcpy(tmp, build_buf, 6);
|
2002-09-20 10:59:08 +00:00
|
|
|
#else
|
2012-09-16 06:55:05 +00:00
|
|
|
puts("## Ethernet MAC address not copied to NV RAM\n");
|
2002-09-20 10:59:08 +00:00
|
|
|
#endif
|
|
|
|
|
2003-06-27 21:31:46 +00:00
|
|
|
/*
|
|
|
|
* Use bootaddr to find the location in memory that VxWorks
|
|
|
|
* will look for the bootline string. The default value for
|
|
|
|
* PowerPC is LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET which
|
|
|
|
* defaults to 0x4200
|
2002-09-20 10:59:08 +00:00
|
|
|
*/
|
2012-09-16 06:55:05 +00:00
|
|
|
tmp = getenv("bootaddr");
|
2013-02-04 09:37:11 +00:00
|
|
|
if (!tmp)
|
2008-11-03 21:15:34 +00:00
|
|
|
bootaddr = CONFIG_SYS_VXWORKS_BOOT_ADDR;
|
2002-09-20 10:59:08 +00:00
|
|
|
else
|
2012-09-16 06:55:05 +00:00
|
|
|
bootaddr = simple_strtoul(tmp, NULL, 16);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2003-06-27 21:31:46 +00:00
|
|
|
/*
|
|
|
|
* Check to see if the bootline is defined in the 'bootargs'
|
|
|
|
* parameter. If it is not defined, we may be able to
|
|
|
|
* construct the info
|
2002-09-20 10:59:08 +00:00
|
|
|
*/
|
2012-09-16 06:55:05 +00:00
|
|
|
bootline = getenv("bootargs");
|
|
|
|
if (bootline) {
|
linux/kernel.h: sync min, max, min3, max3 macros with Linux
U-Boot has never cared about the type when we get max/min of two
values, but Linux Kernel does. This commit gets min, max, min3, max3
macros synced with the kernel introducing type checks.
Many of references of those macros must be fixed to suppress warnings.
We have two options:
- Use min, max, min3, max3 only when the arguments have the same type
(or add casts to the arguments)
- Use min_t/max_t instead with the appropriate type for the first
argument
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Pavel Machek <pavel@denx.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
[trini: Fixup arch/blackfin/lib/string.c]
Signed-off-by: Tom Rini <trini@ti.com>
2014-11-06 18:03:31 +00:00
|
|
|
memcpy((void *)bootaddr, bootline,
|
|
|
|
max(strlen(bootline), (size_t)255));
|
|
|
|
flush_cache(bootaddr, max(strlen(bootline), (size_t)255));
|
2002-09-20 10:59:08 +00:00
|
|
|
} else {
|
2012-09-16 06:55:05 +00:00
|
|
|
sprintf(build_buf, CONFIG_SYS_VXWORKS_BOOT_DEVICE);
|
|
|
|
tmp = getenv("bootfile");
|
|
|
|
if (tmp)
|
|
|
|
sprintf(&build_buf[strlen(build_buf)],
|
2008-11-03 21:15:34 +00:00
|
|
|
"%s:%s ", CONFIG_SYS_VXWORKS_SERVERNAME, tmp);
|
2012-09-16 06:55:05 +00:00
|
|
|
else
|
|
|
|
sprintf(&build_buf[strlen(build_buf)],
|
2008-11-03 21:15:34 +00:00
|
|
|
"%s:file ", CONFIG_SYS_VXWORKS_SERVERNAME);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
tmp = getenv("ipaddr");
|
|
|
|
if (tmp)
|
|
|
|
sprintf(&build_buf[strlen(build_buf)], "e=%s ", tmp);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
tmp = getenv("serverip");
|
|
|
|
if (tmp)
|
|
|
|
sprintf(&build_buf[strlen(build_buf)], "h=%s ", tmp);
|
|
|
|
|
|
|
|
tmp = getenv("hostname");
|
|
|
|
if (tmp)
|
|
|
|
sprintf(&build_buf[strlen(build_buf)], "tn=%s ", tmp);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2008-11-03 21:15:34 +00:00
|
|
|
#ifdef CONFIG_SYS_VXWORKS_ADD_PARAMS
|
2012-09-16 06:55:05 +00:00
|
|
|
sprintf(&build_buf[strlen(build_buf)],
|
2008-11-03 21:15:34 +00:00
|
|
|
CONFIG_SYS_VXWORKS_ADD_PARAMS);
|
2002-09-20 10:59:08 +00:00
|
|
|
#endif
|
2008-11-03 21:15:34 +00:00
|
|
|
|
linux/kernel.h: sync min, max, min3, max3 macros with Linux
U-Boot has never cared about the type when we get max/min of two
values, but Linux Kernel does. This commit gets min, max, min3, max3
macros synced with the kernel introducing type checks.
Many of references of those macros must be fixed to suppress warnings.
We have two options:
- Use min, max, min3, max3 only when the arguments have the same type
(or add casts to the arguments)
- Use min_t/max_t instead with the appropriate type for the first
argument
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Pavel Machek <pavel@denx.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
[trini: Fixup arch/blackfin/lib/string.c]
Signed-off-by: Tom Rini <trini@ti.com>
2014-11-06 18:03:31 +00:00
|
|
|
memcpy((void *)bootaddr, build_buf,
|
|
|
|
max(strlen(build_buf), (size_t)255));
|
|
|
|
flush_cache(bootaddr, max(strlen(build_buf), (size_t)255));
|
2002-09-20 10:59:08 +00:00
|
|
|
}
|
|
|
|
|
2003-06-27 21:31:46 +00:00
|
|
|
/*
|
|
|
|
* If the data at the load address is an elf image, then
|
|
|
|
* treat it like an elf image. Otherwise, assume that it is a
|
|
|
|
* binary image
|
2002-09-20 10:59:08 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
if (valid_elf_image(addr)) {
|
|
|
|
addr = load_elf_image_shdr(addr);
|
2002-09-20 10:59:08 +00:00
|
|
|
} else {
|
2012-09-16 06:55:05 +00:00
|
|
|
puts("## Not an ELF image, assuming binary\n");
|
2002-09-20 10:59:08 +00:00
|
|
|
/* leave addr as load_addr */
|
|
|
|
}
|
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
printf("## Using bootline (@ 0x%lx): %s\n", bootaddr,
|
2002-09-20 10:59:08 +00:00
|
|
|
(char *) bootaddr);
|
2012-09-16 06:55:05 +00:00
|
|
|
printf("## Starting vxWorks at 0x%08lx ...\n", addr);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2011-11-18 09:06:52 +00:00
|
|
|
dcache_disable();
|
|
|
|
((void (*)(int)) addr) (0);
|
2002-09-20 10:59:08 +00:00
|
|
|
|
2012-09-16 06:55:05 +00:00
|
|
|
puts("## vxWorks terminated\n");
|
2002-09-20 10:59:08 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
* A very simple elf loader, assumes the image is valid, returns the
|
|
|
|
* entry point address.
|
|
|
|
* ====================================================================== */
|
2010-10-02 19:44:53 +00:00
|
|
|
static unsigned long load_elf_image_phdr(unsigned long addr)
|
|
|
|
{
|
|
|
|
Elf32_Ehdr *ehdr; /* Elf header structure pointer */
|
|
|
|
Elf32_Phdr *phdr; /* Program header structure pointer */
|
|
|
|
int i;
|
|
|
|
|
|
|
|
ehdr = (Elf32_Ehdr *) addr;
|
|
|
|
phdr = (Elf32_Phdr *) (addr + ehdr->e_phoff);
|
|
|
|
|
|
|
|
/* Load each program header */
|
|
|
|
for (i = 0; i < ehdr->e_phnum; ++i) {
|
2012-09-16 06:55:06 +00:00
|
|
|
void *dst = (void *)(uintptr_t) phdr->p_paddr;
|
2010-10-02 19:44:53 +00:00
|
|
|
void *src = (void *) addr + phdr->p_offset;
|
|
|
|
debug("Loading phdr %i to 0x%p (%i bytes)\n",
|
|
|
|
i, dst, phdr->p_filesz);
|
|
|
|
if (phdr->p_filesz)
|
|
|
|
memcpy(dst, src, phdr->p_filesz);
|
|
|
|
if (phdr->p_filesz != phdr->p_memsz)
|
2012-09-16 06:55:05 +00:00
|
|
|
memset(dst + phdr->p_filesz, 0x00,
|
|
|
|
phdr->p_memsz - phdr->p_filesz);
|
2010-10-02 19:44:53 +00:00
|
|
|
flush_cache((unsigned long)dst, phdr->p_filesz);
|
|
|
|
++phdr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ehdr->e_entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned long load_elf_image_shdr(unsigned long addr)
|
2002-09-20 10:59:08 +00:00
|
|
|
{
|
|
|
|
Elf32_Ehdr *ehdr; /* Elf header structure pointer */
|
|
|
|
Elf32_Shdr *shdr; /* Section header structure pointer */
|
|
|
|
unsigned char *strtab = 0; /* String table pointer */
|
|
|
|
unsigned char *image; /* Binary image pointer */
|
|
|
|
int i; /* Loop counter */
|
|
|
|
|
|
|
|
/* -------------------------------------------------- */
|
|
|
|
|
|
|
|
ehdr = (Elf32_Ehdr *) addr;
|
|
|
|
|
|
|
|
/* Find the section header string table for output info */
|
|
|
|
shdr = (Elf32_Shdr *) (addr + ehdr->e_shoff +
|
2012-09-16 06:55:05 +00:00
|
|
|
(ehdr->e_shstrndx * sizeof(Elf32_Shdr)));
|
2002-09-20 10:59:08 +00:00
|
|
|
|
|
|
|
if (shdr->sh_type == SHT_STRTAB)
|
|
|
|
strtab = (unsigned char *) (addr + shdr->sh_offset);
|
|
|
|
|
|
|
|
/* Load each appropriate section */
|
|
|
|
for (i = 0; i < ehdr->e_shnum; ++i) {
|
|
|
|
shdr = (Elf32_Shdr *) (addr + ehdr->e_shoff +
|
2012-09-16 06:55:05 +00:00
|
|
|
(i * sizeof(Elf32_Shdr)));
|
2002-09-20 10:59:08 +00:00
|
|
|
|
|
|
|
if (!(shdr->sh_flags & SHF_ALLOC)
|
|
|
|
|| shdr->sh_addr == 0 || shdr->sh_size == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strtab) {
|
2009-07-23 21:31:58 +00:00
|
|
|
debug("%sing %s @ 0x%08lx (%ld bytes)\n",
|
2002-09-20 10:59:08 +00:00
|
|
|
(shdr->sh_type == SHT_NOBITS) ?
|
|
|
|
"Clear" : "Load",
|
|
|
|
&strtab[shdr->sh_name],
|
|
|
|
(unsigned long) shdr->sh_addr,
|
|
|
|
(long) shdr->sh_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shdr->sh_type == SHT_NOBITS) {
|
2012-09-16 06:55:06 +00:00
|
|
|
memset((void *)(uintptr_t) shdr->sh_addr, 0,
|
|
|
|
shdr->sh_size);
|
2002-09-20 10:59:08 +00:00
|
|
|
} else {
|
|
|
|
image = (unsigned char *) addr + shdr->sh_offset;
|
2012-09-16 06:55:06 +00:00
|
|
|
memcpy((void *)(uintptr_t) shdr->sh_addr,
|
2002-09-20 10:59:08 +00:00
|
|
|
(const void *) image,
|
|
|
|
shdr->sh_size);
|
|
|
|
}
|
2012-09-16 06:55:05 +00:00
|
|
|
flush_cache(shdr->sh_addr, shdr->sh_size);
|
2002-09-20 10:59:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ehdr->e_entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ====================================================================== */
|
2003-07-01 21:06:45 +00:00
|
|
|
U_BOOT_CMD(
|
2010-10-02 19:44:53 +00:00
|
|
|
bootelf, 3, 0, do_bootelf,
|
2009-01-28 00:03:12 +00:00
|
|
|
"Boot from an ELF image in memory",
|
2010-10-02 19:44:53 +00:00
|
|
|
"[-p|-s] [address]\n"
|
|
|
|
"\t- load ELF image at [address] via program headers (-p)\n"
|
|
|
|
"\t or via section headers (-s)"
|
2003-06-27 21:31:46 +00:00
|
|
|
);
|
|
|
|
|
2003-07-01 21:06:45 +00:00
|
|
|
U_BOOT_CMD(
|
|
|
|
bootvx, 2, 0, do_bootvx,
|
2009-01-28 00:03:12 +00:00
|
|
|
"Boot vxWorks from an ELF image",
|
2009-05-24 15:06:54 +00:00
|
|
|
" [address] - load address of vxWorks ELF image."
|
2003-06-27 21:31:46 +00:00
|
|
|
);
|