@ -555,7 +555,8 @@ const char *genimg_get_os_name (uint8_t os)
const char * genimg_get_arch_name ( uint8_t arch )
{
return ( get_table_entry_name ( uimage_arch , " Unknown Architecture " , arch ) ) ;
return ( get_table_entry_name ( uimage_arch , " Unknown Architecture " ,
arch ) ) ;
}
const char * genimg_get_type_name ( uint8_t type )
@ -565,7 +566,8 @@ const char *genimg_get_type_name (uint8_t type)
const char * genimg_get_comp_name ( uint8_t comp )
{
return ( get_table_entry_name ( uimage_comp , " Unknown Compression " , comp ) ) ;
return ( get_table_entry_name ( uimage_comp , " Unknown Compression " ,
comp ) ) ;
}
/**
@ -710,19 +712,23 @@ ulong genimg_get_image (ulong img_addr)
/* get data size */
switch ( genimg_get_format ( ( void * ) ram_addr ) ) {
case IMAGE_FORMAT_LEGACY :
d_size = image_get_data_size ( ( const image_header_t * ) ram_addr ) ;
debug ( " Legacy format image found at 0x%08lx, size 0x%08lx \n " ,
d_size = image_get_data_size (
( const image_header_t * ) ram_addr ) ;
debug ( " Legacy format image found at 0x%08lx, "
" size 0x%08lx \n " ,
ram_addr , d_size ) ;
break ;
# if defined(CONFIG_FIT)
case IMAGE_FORMAT_FIT :
d_size = fit_get_size ( ( const void * ) ram_addr ) - h_size ;
debug ( " FIT/FDT format image found at 0x%08lx, size 0x%08lx \n " ,
debug ( " FIT/FDT format image found at 0x%08lx, "
" size 0x%08lx \n " ,
ram_addr , d_size ) ;
break ;
# endif
default :
printf ( " No valid image found at 0x%08lx \n " , img_addr ) ;
printf ( " No valid image found at 0x%08lx \n " ,
img_addr ) ;
return ram_addr ;
}
@ -825,17 +831,20 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,
if ( fit_parse_conf ( argv [ 2 ] , default_addr ,
& rd_addr , & fit_uname_config ) ) {
debug ( " * ramdisk: config '%s' from image at 0x%08lx \n " ,
debug ( " * ramdisk: config '%s' from image at "
" 0x%08lx \n " ,
fit_uname_config , rd_addr ) ;
} else if ( fit_parse_subimage ( argv [ 2 ] , default_addr ,
& rd_addr , & fit_uname_ramdisk ) ) {
debug ( " * ramdisk: subimage '%s' from image at 0x%08lx \n " ,
debug ( " * ramdisk: subimage '%s' from image at "
" 0x%08lx \n " ,
fit_uname_ramdisk , rd_addr ) ;
} else
# endif
{
rd_addr = simple_strtoul ( argv [ 2 ] , NULL , 16 ) ;
debug ( " * ramdisk: cmdline image address = 0x%08lx \n " ,
debug ( " * ramdisk: cmdline image address = "
" 0x%08lx \n " ,
rd_addr ) ;
}
# if defined(CONFIG_FIT)
@ -845,7 +854,8 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,
*/
rd_addr = ( ulong ) images - > fit_hdr_os ;
fit_uname_config = images - > fit_uname_cfg ;
debug ( " * ramdisk: using config '%s' from image at 0x%08lx \n " ,
debug ( " * ramdisk: using config '%s' from image "
" at 0x%08lx \n " ,
fit_uname_config , rd_addr ) ;
/*
@ -853,13 +863,15 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,
* if not , don ' t try to use it , quit silently .
*/
fit_hdr = ( void * ) rd_addr ;
cfg_noffset = fit_conf_get_node ( fit_hdr , fit_uname_config ) ;
cfg_noffset = fit_conf_get_node ( fit_hdr ,
fit_uname_config ) ;
if ( cfg_noffset < 0 ) {
debug ( " * ramdisk: no such config \n " ) ;
return 1 ;
}
rd_noffset = fit_conf_get_ramdisk_node ( fit_hdr , cfg_noffset ) ;
rd_noffset = fit_conf_get_ramdisk_node ( fit_hdr ,
cfg_noffset ) ;
if ( rd_noffset < 0 ) {
debug ( " * ramdisk: no ramdisk in config \n " ) ;
return 0 ;
@ -912,21 +924,28 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,
* fit_conf_get_node ( ) will try to find default config node
*/
show_boot_progress ( 122 ) ;
cfg_noffset = fit_conf_get_node ( fit_hdr , fit_uname_config ) ;
cfg_noffset = fit_conf_get_node ( fit_hdr ,
fit_uname_config ) ;
if ( cfg_noffset < 0 ) {
puts ( " Could not find configuration node \n " ) ;
puts ( " Could not find configuration "
" node \n " ) ;
show_boot_progress ( - 122 ) ;
return 1 ;
}
fit_uname_config = fdt_get_name ( fit_hdr , cfg_noffset , NULL ) ;
printf ( " Using '%s' configuration \n " , fit_uname_config ) ;
fit_uname_config = fdt_get_name ( fit_hdr ,
cfg_noffset , NULL ) ;
printf ( " Using '%s' configuration \n " ,
fit_uname_config ) ;
rd_noffset = fit_conf_get_ramdisk_node ( fit_hdr , cfg_noffset ) ;
fit_uname_ramdisk = fit_get_name ( fit_hdr , rd_noffset , NULL ) ;
rd_noffset = fit_conf_get_ramdisk_node ( fit_hdr ,
cfg_noffset ) ;
fit_uname_ramdisk = fit_get_name ( fit_hdr ,
rd_noffset , NULL ) ;
} else {
/* get ramdisk component image node offset */
show_boot_progress ( 123 ) ;
rd_noffset = fit_image_get_node ( fit_hdr , fit_uname_ramdisk ) ;
rd_noffset = fit_image_get_node ( fit_hdr ,
fit_uname_ramdisk ) ;
}
if ( rd_noffset < 0 ) {
puts ( " Could not find subimage node \n " ) ;
@ -934,14 +953,17 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,
return 1 ;
}
printf ( " Trying '%s' ramdisk subimage \n " , fit_uname_ramdisk ) ;
printf ( " Trying '%s' ramdisk subimage \n " ,
fit_uname_ramdisk ) ;
show_boot_progress ( 125 ) ;
if ( ! fit_check_ramdisk ( fit_hdr , rd_noffset , arch , images - > verify ) )
if ( ! fit_check_ramdisk ( fit_hdr , rd_noffset , arch ,
images - > verify ) )
return 1 ;
/* get ramdisk image data address and length */
if ( fit_image_get_data ( fit_hdr , rd_noffset , & data , & size ) ) {
if ( fit_image_get_data ( fit_hdr , rd_noffset , & data ,
& size ) ) {
puts ( " Could not find ramdisk subimage data! \n " ) ;
show_boot_progress ( - 127 ) ;
return 1 ;
@ -952,7 +974,8 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,
rd_len = size ;
if ( fit_image_get_load ( fit_hdr , rd_noffset , & rd_load ) ) {
puts ( " Can't get ramdisk subimage load address! \n " ) ;
puts ( " Can't get ramdisk subimage load "
" address! \n " ) ;
show_boot_progress ( - 129 ) ;
return 1 ;
}
@ -969,7 +992,9 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,
return 1 ;
}
} else if ( images - > legacy_hdr_valid & &
image_check_type ( & images - > legacy_hdr_os_copy , IH_TYPE_MULTI ) ) {
image_check_type ( & images - > legacy_hdr_os_copy ,
IH_TYPE_MULTI ) ) {
/*
* Now check if we have a legacy mult - component image ,
* get second entry data start address and len .
@ -1058,9 +1083,11 @@ int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
lmb_reserve ( lmb , rd_data , rd_len ) ;
} else {
if ( initrd_high )
* initrd_start = ( ulong ) lmb_alloc_base ( lmb , rd_len , 0x1000 , initrd_high ) ;
* initrd_start = ( ulong ) lmb_alloc_base ( lmb ,
rd_len , 0x1000 , initrd_high ) ;
else
* initrd_start = ( ulong ) lmb_alloc ( lmb , rd_len , 0x1000 ) ;
* initrd_start = ( ulong ) lmb_alloc ( lmb , rd_len ,
0x1000 ) ;
if ( * initrd_start = = 0 ) {
puts ( " ramdisk - allocation error \n " ) ;
@ -1332,8 +1359,8 @@ error:
* 1 , if fdt image is found but corrupted
* of_flat_tree and of_size are set to 0 if no fdt exists
*/
int boot_get_fdt ( int flag , int argc , char * const argv [ ] , bootm_headers_t * images ,
char * * of_flat_tree , ulong * of_size )
int boot_get_fdt ( int flag , int argc , char * const argv [ ] ,
bootm_headers_t * images , char * * of_flat_tree , ulong * of_size )
{
const image_header_t * fdt_hdr ;
ulong fdt_addr ;
@ -1372,17 +1399,20 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
if ( fit_parse_conf ( argv [ 3 ] , default_addr ,
& fdt_addr , & fit_uname_config ) ) {
debug ( " * fdt: config '%s' from image at 0x%08lx \n " ,
debug ( " * fdt: config '%s' from image at "
" 0x%08lx \n " ,
fit_uname_config , fdt_addr ) ;
} else if ( fit_parse_subimage ( argv [ 3 ] , default_addr ,
& fdt_addr , & fit_uname_fdt ) ) {
debug ( " * fdt: subimage '%s' from image at 0x%08lx \n " ,
debug ( " * fdt: subimage '%s' from image at "
" 0x%08lx \n " ,
fit_uname_fdt , fdt_addr ) ;
} else
# endif
{
fdt_addr = simple_strtoul ( argv [ 3 ] , NULL , 16 ) ;
debug ( " * fdt: cmdline image address = 0x%08lx \n " ,
debug ( " * fdt: cmdline image address = "
" 0x%08lx \n " ,
fdt_addr ) ;
}
# if defined(CONFIG_FIT)
@ -1392,7 +1422,8 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
*/
fdt_addr = ( ulong ) images - > fit_hdr_os ;
fit_uname_config = images - > fit_uname_cfg ;
debug ( " * fdt: using config '%s' from image at 0x%08lx \n " ,
debug ( " * fdt: using config '%s' from image "
" at 0x%08lx \n " ,
fit_uname_config , fdt_addr ) ;
/*
@ -1430,7 +1461,8 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
switch ( genimg_get_format ( ( void * ) fdt_addr ) ) {
case IMAGE_FORMAT_LEGACY :
/* verify fdt_addr points to a valid image header */
printf ( " ## Flattened Device Tree from Legacy Image at %08lx \n " ,
printf ( " ## Flattened Device Tree from Legacy Image "
" at %08lx \n " ,
fdt_addr ) ;
fdt_hdr = image_get_fdt ( fdt_addr ) ;
if ( ! fdt_hdr )
@ -1473,7 +1505,8 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
* FIT image
*/
fit_hdr = ( void * ) fdt_addr ;
printf ( " ## Flattened Device Tree from FIT Image at %08lx \n " ,
printf ( " ## Flattened Device Tree from FIT "
" Image at %08lx \n " ,
fdt_addr ) ;
if ( ! fit_uname_fdt ) {
@ -1488,7 +1521,9 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
fit_uname_config ) ;
if ( cfg_noffset < 0 ) {
fdt_error ( " Could not find configuration node \n " ) ;
fdt_error ( " Could not find "
" configuration "
" node \n " ) ;
goto error ;
}
@ -1497,17 +1532,20 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
printf ( " Using '%s' configuration \n " ,
fit_uname_config ) ;
fdt_noffset = fit_conf_get_fdt_node ( fit_hdr ,
fdt_noffset = fit_conf_get_fdt_node (
fit_hdr ,
cfg_noffset ) ;
fit_uname_fdt = fit_get_name ( fit_hdr ,
fdt_noffset , NULL ) ;
} else {
/* get FDT component image node offset */
fdt_noffset = fit_image_get_node ( fit_hdr ,
fdt_noffset = fit_image_get_node (
fit_hdr ,
fit_uname_fdt ) ;
}
if ( fdt_noffset < 0 ) {
fdt_error ( " Could not find subimage node \n " ) ;
fdt_error ( " Could not find subimage "
" node \n " ) ;
goto error ;
}
@ -1521,7 +1559,8 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
/* get ramdisk image data address and length */
if ( fit_image_get_data ( fit_hdr , fdt_noffset ,
& data , & size ) ) {
fdt_error ( " Could not find FDT subimage data " ) ;
fdt_error ( " Could not find FDT "
" subimage data " ) ;
goto error ;
}
@ -1548,8 +1587,10 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
goto error ;
}
printf ( " Loading FDT from 0x%08lx to 0x%08lx \n " ,
( ulong ) data , load_start ) ;
printf ( " Loading FDT from 0x%08lx "
" to 0x%08lx \n " ,
( ulong ) data ,
load_start ) ;
memmove ( ( void * ) load_start ,
( void * ) data , size ) ;
@ -1571,18 +1612,21 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
*/
fdt_blob = ( char * ) fdt_addr ;
debug ( " * fdt: raw FDT blob \n " ) ;
printf ( " ## Flattened Device Tree blob at %08lx \n " , ( long ) fdt_blob ) ;
printf ( " ## Flattened Device Tree blob at "
" %08lx \n " , ( long ) fdt_blob ) ;
}
break ;
default :
puts ( " ERROR: Did not find a cmdline Flattened Device Tree \n " ) ;
puts ( " ERROR: Did not find a cmdline Flattened Device "
" Tree \n " ) ;
goto error ;
}
printf ( " Booting using the fdt blob at 0x%p \n " , fdt_blob ) ;
} else if ( images - > legacy_hdr_valid & &
image_check_type ( & images - > legacy_hdr_os_copy , IH_TYPE_MULTI ) ) {
image_check_type ( & images - > legacy_hdr_os_copy ,
IH_TYPE_MULTI ) ) {
ulong fdt_data , fdt_len ;
@ -1594,7 +1638,8 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag
" component Image at %08lX \n " ,
( ulong ) images - > legacy_hdr_os ) ;
image_multi_getimg ( images - > legacy_hdr_os , 2 , & fdt_data , & fdt_len ) ;
image_multi_getimg ( images - > legacy_hdr_os , 2 , & fdt_data ,
& fdt_len ) ;
if ( fdt_len ) {
fdt_blob = ( char * ) fdt_data ;
@ -1855,7 +1900,8 @@ void fit_print_contents (const void *fit)
}
/* Process its subnodes, print out component images details */
for ( ndepth = 0 , count = 0 , noffset = fdt_next_node ( fit , images_noffset , & ndepth ) ;
for ( ndepth = 0 , count = 0 ,
noffset = fdt_next_node ( fit , images_noffset , & ndepth ) ;
( noffset > = 0 ) & & ( ndepth > 0 ) ;
noffset = fdt_next_node ( fit , noffset , & ndepth ) ) {
if ( ndepth = = 1 ) {
@ -1884,7 +1930,8 @@ void fit_print_contents (const void *fit)
printf ( " %s Default Configuration: '%s' \n " , p , uname ) ;
/* Process its subnodes, print out configurations details */
for ( ndepth = 0 , count = 0 , noffset = fdt_next_node ( fit , confs_noffset , & ndepth ) ;
for ( ndepth = 0 , count = 0 ,
noffset = fdt_next_node ( fit , confs_noffset , & ndepth ) ;
( noffset > = 0 ) & & ( ndepth > 0 ) ;
noffset = fdt_next_node ( fit , noffset , & ndepth ) ) {
if ( ndepth = = 1 ) {
@ -2604,11 +2651,13 @@ int fit_image_set_hashes (void *fit, int image_noffset)
return - 1 ;
}
if ( calculate_hash ( data , size , algo , value , & value_len ) ) {
if ( calculate_hash ( data , size , algo , value ,
& value_len ) ) {
printf ( " Unsupported hash algorithm (%s) for "
" '%s' hash node in '%s' image node \n " ,
algo , fit_get_name ( fit , noffset , NULL ) ,
fit_get_name ( fit , image_noffset , NULL ) ) ;
fit_get_name ( fit , image_noffset ,
NULL ) ) ;
return - 1 ;
}
@ -2720,8 +2769,10 @@ int fit_image_check_hashes (const void *fit, int image_noffset)
goto error ;
}
if ( calculate_hash ( data , size , algo , value , & value_len ) ) {
err_msg = " error! \n Unsupported hash algorithm " ;
if ( calculate_hash ( data , size , algo , value ,
& value_len ) ) {
err_msg = " error! \n "
" Unsupported hash algorithm " ;
goto error ;
}
@ -2951,9 +3002,11 @@ int fit_conf_get_node (const void *fit, const char *conf_uname)
if ( conf_uname = = NULL ) {
/* get configuration unit name from the default property */
debug ( " No configuration specified, trying default... \n " ) ;
conf_uname = ( char * ) fdt_getprop ( fit , confs_noffset , FIT_DEFAULT_PROP , & len ) ;
conf_uname = ( char * ) fdt_getprop ( fit , confs_noffset ,
FIT_DEFAULT_PROP , & len ) ;
if ( conf_uname = = NULL ) {
fit_get_debug ( fit , confs_noffset , FIT_DEFAULT_PROP , len ) ;
fit_get_debug ( fit , confs_noffset , FIT_DEFAULT_PROP ,
len ) ;
return len ;
}
debug ( " Found default configuration: '%s' \n " , conf_uname ) ;
@ -2961,7 +3014,8 @@ int fit_conf_get_node (const void *fit, const char *conf_uname)
noffset = fdt_subnode_offset ( fit , confs_noffset , conf_uname ) ;
if ( noffset < 0 ) {
debug ( " Can't get node offset for configuration unit name: '%s' (%s) \n " ,
debug ( " Can't get node offset for configuration unit name: "
" '%s' (%s) \n " ,
conf_uname , fdt_strerror ( noffset ) ) ;
}
@ -3097,7 +3151,8 @@ void fit_conf_print (const void *fit, int noffset, const char *p)
* 0 , on failure
*/
# ifndef USE_HOSTCC
static int fit_check_ramdisk ( const void * fit , int rd_noffset , uint8_t arch , int verify )
static int fit_check_ramdisk ( const void * fit , int rd_noffset , uint8_t arch ,
int verify )
{
fit_image_print ( fit , rd_noffset , " " ) ;