common: image: support IMAGE_PARAM_INVAL as placeholder address flag
User maybe not want to set a fixed address, leave it to U-Boot. This is a compatible method for different board and platforms. Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Change-Id: I01accbc0f116856276610bfaea8de2f7e1275bb0
This commit is contained in:
parent
40d08d0f10
commit
957222d7c6
|
@ -192,6 +192,26 @@ static const struct table_info table_info[IH_COUNT] = {
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Legacy format routines */
|
/* Legacy format routines */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
#ifndef USE_HOSTCC
|
||||||
|
#ifndef CONFIG_SPL_BUILD
|
||||||
|
uint32_t image_get_load(const image_header_t *hdr)
|
||||||
|
{
|
||||||
|
uint32_t load = uimage_to_cpu(hdr->ih_load);
|
||||||
|
|
||||||
|
return (load == IMAGE_PARAM_INVAL) ?
|
||||||
|
env_get_ulong("kernel_addr_r", 16, 0) : load;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t image_get_ep(const image_header_t *hdr)
|
||||||
|
{
|
||||||
|
uint32_t ep = uimage_to_cpu(hdr->ih_ep);
|
||||||
|
|
||||||
|
return (ep == IMAGE_PARAM_INVAL) ?
|
||||||
|
env_get_ulong("kernel_addr_r", 16, 0) : ep;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
int image_check_hcrc(const image_header_t *hdr)
|
int image_check_hcrc(const image_header_t *hdr)
|
||||||
{
|
{
|
||||||
ulong hcrc;
|
ulong hcrc;
|
||||||
|
|
|
@ -725,9 +725,17 @@ image_get_hdr_l(magic) /* image_get_magic */
|
||||||
image_get_hdr_l(hcrc) /* image_get_hcrc */
|
image_get_hdr_l(hcrc) /* image_get_hcrc */
|
||||||
image_get_hdr_l(time) /* image_get_time */
|
image_get_hdr_l(time) /* image_get_time */
|
||||||
image_get_hdr_l(size) /* image_get_size */
|
image_get_hdr_l(size) /* image_get_size */
|
||||||
|
image_get_hdr_l(dcrc) /* image_get_dcrc */
|
||||||
|
#ifdef USE_HOSTCC
|
||||||
image_get_hdr_l(load) /* image_get_load */
|
image_get_hdr_l(load) /* image_get_load */
|
||||||
image_get_hdr_l(ep) /* image_get_ep */
|
image_get_hdr_l(ep) /* image_get_ep */
|
||||||
image_get_hdr_l(dcrc) /* image_get_dcrc */
|
#elif defined(CONFIG_SPL_BUILD)
|
||||||
|
image_get_hdr_l(load) /* image_get_load */
|
||||||
|
image_get_hdr_l(ep) /* image_get_ep */
|
||||||
|
#else
|
||||||
|
uint32_t image_get_load(const image_header_t *hdr);
|
||||||
|
uint32_t image_get_ep(const image_header_t *hdr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define image_get_hdr_b(f) \
|
#define image_get_hdr_b(f) \
|
||||||
static inline uint8_t image_get_##f(const image_header_t *hdr) \
|
static inline uint8_t image_get_##f(const image_header_t *hdr) \
|
||||||
|
|
Loading…
Reference in New Issue