提交 f320a4d8 编写于 作者: S Simon Glass 提交者: Tom Rini

bootm: Use selected configuration for ramdisk and fdt

If a specific configuraion is selected by the bootm command, e.g. with
'bootm 84000000#recoveryconf' we must honour this for not just the kernel,
but also the ramdisk and FDT.

In the conversion to using a common fit_image_load() function for loading
images from FITs (commits a51ec63b and 53f375fa) this feature was lost.
Reinstate it by passing the selected configuration back from
fit_image_load() to boot_get_kernel(), then use this configuration
(which is stored in images->fit_uname_cfg) in both boot_get_ramdisk()
and boot_get_fdt().
Signed-off-by: NSimon Glass <sjg@chromium.org>
上级 7af26b16
...@@ -988,7 +988,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, ...@@ -988,7 +988,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
case IMAGE_FORMAT_FIT: case IMAGE_FORMAT_FIT:
os_noffset = fit_image_load(images, FIT_KERNEL_PROP, os_noffset = fit_image_load(images, FIT_KERNEL_PROP,
img_addr, img_addr,
&fit_uname_kernel, fit_uname_config, &fit_uname_kernel, &fit_uname_config,
IH_ARCH_DEFAULT, IH_TYPE_KERNEL, IH_ARCH_DEFAULT, IH_TYPE_KERNEL,
BOOTSTAGE_ID_FIT_KERNEL_START, BOOTSTAGE_ID_FIT_KERNEL_START,
FIT_LOAD_IGNORED, os_data, os_len); FIT_LOAD_IGNORED, os_data, os_len);
...@@ -997,6 +997,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, ...@@ -997,6 +997,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
images->fit_hdr_os = map_sysmem(img_addr, 0); images->fit_hdr_os = map_sysmem(img_addr, 0);
images->fit_uname_os = fit_uname_kernel; images->fit_uname_os = fit_uname_kernel;
images->fit_uname_cfg = fit_uname_config;
images->fit_noffset_os = os_noffset; images->fit_noffset_os = os_noffset;
break; break;
#endif #endif
......
...@@ -243,7 +243,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, ...@@ -243,7 +243,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
ulong load, load_end; ulong load, load_end;
void *buf; void *buf;
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
const char *fit_uname_config = NULL; const char *fit_uname_config = images->fit_uname_cfg;
const char *fit_uname_fdt = NULL; const char *fit_uname_fdt = NULL;
ulong default_addr; ulong default_addr;
int fdt_noffset; int fdt_noffset;
...@@ -367,7 +367,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, ...@@ -367,7 +367,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
fdt_noffset = fit_image_load(images, fdt_noffset = fit_image_load(images,
FIT_FDT_PROP, FIT_FDT_PROP,
fdt_addr, &fit_uname_fdt, fdt_addr, &fit_uname_fdt,
fit_uname_config, &fit_uname_config,
arch, IH_TYPE_FLATDT, arch, IH_TYPE_FLATDT,
BOOTSTAGE_ID_FIT_FDT_START, BOOTSTAGE_ID_FIT_FDT_START,
FIT_LOAD_OPTIONAL, &load, &len); FIT_LOAD_OPTIONAL, &load, &len);
......
...@@ -1478,12 +1478,13 @@ int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name, ...@@ -1478,12 +1478,13 @@ int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name,
} }
int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr, int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
const char **fit_unamep, const char *fit_uname_config, const char **fit_unamep, const char **fit_uname_configp,
int arch, int image_type, int bootstage_id, int arch, int image_type, int bootstage_id,
enum fit_load_op load_op, ulong *datap, ulong *lenp) enum fit_load_op load_op, ulong *datap, ulong *lenp)
{ {
int cfg_noffset, noffset; int cfg_noffset, noffset;
const char *fit_uname; const char *fit_uname;
const char *fit_uname_config;
const void *fit; const void *fit;
const void *buf; const void *buf;
size_t size; size_t size;
...@@ -1493,6 +1494,7 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr, ...@@ -1493,6 +1494,7 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
fit = map_sysmem(addr, 0); fit = map_sysmem(addr, 0);
fit_uname = fit_unamep ? *fit_unamep : NULL; fit_uname = fit_unamep ? *fit_unamep : NULL;
fit_uname_config = fit_uname_configp ? *fit_uname_configp : NULL;
printf("## Loading %s from FIT Image at %08lx ...\n", prop_name, addr); printf("## Loading %s from FIT Image at %08lx ...\n", prop_name, addr);
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT); bootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT);
...@@ -1658,6 +1660,8 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr, ...@@ -1658,6 +1660,8 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
*lenp = len; *lenp = len;
if (fit_unamep) if (fit_unamep)
*fit_unamep = (char *)fit_uname; *fit_unamep = (char *)fit_uname;
if (fit_uname_configp)
*fit_uname_configp = (char *)fit_uname_config;
return noffset; return noffset;
} }
...@@ -811,7 +811,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, ...@@ -811,7 +811,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
char *end; char *end;
#endif #endif
#if defined(CONFIG_FIT) #if defined(CONFIG_FIT)
const char *fit_uname_config = NULL; const char *fit_uname_config = images->fit_uname_cfg;
const char *fit_uname_ramdisk = NULL; const char *fit_uname_ramdisk = NULL;
ulong default_addr; ulong default_addr;
int rd_noffset; int rd_noffset;
...@@ -907,7 +907,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, ...@@ -907,7 +907,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
case IMAGE_FORMAT_FIT: case IMAGE_FORMAT_FIT:
rd_noffset = fit_image_load(images, FIT_RAMDISK_PROP, rd_noffset = fit_image_load(images, FIT_RAMDISK_PROP,
rd_addr, &fit_uname_ramdisk, rd_addr, &fit_uname_ramdisk,
fit_uname_config, arch, &fit_uname_config, arch,
IH_TYPE_RAMDISK, IH_TYPE_RAMDISK,
BOOTSTAGE_ID_FIT_RD_START, BOOTSTAGE_ID_FIT_RD_START,
FIT_LOAD_REQUIRED, &rd_data, &rd_len); FIT_LOAD_REQUIRED, &rd_data, &rd_len);
......
...@@ -439,8 +439,9 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, ...@@ -439,8 +439,9 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
* @param fit_unamep On entry this is the requested image name * @param fit_unamep On entry this is the requested image name
* (e.g. "kernel@1") or NULL to use the default. On exit * (e.g. "kernel@1") or NULL to use the default. On exit
* points to the selected image name * points to the selected image name
* @param fit_uname_config Requested configuration name, or NULL for the * @param fit_uname_configp On entry this is the requested configuration
* default * name (e.g. "conf@1") or NULL to use the default. On
* exit points to the selected configuration name.
* @param arch Expected architecture (IH_ARCH_...) * @param arch Expected architecture (IH_ARCH_...)
* @param image_type Required image type (IH_TYPE_...). If this is * @param image_type Required image type (IH_TYPE_...). If this is
* IH_TYPE_KERNEL then we allow IH_TYPE_KERNEL_NOLOAD * IH_TYPE_KERNEL then we allow IH_TYPE_KERNEL_NOLOAD
...@@ -453,7 +454,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, ...@@ -453,7 +454,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
* @param lenp Returns length of loaded image * @param lenp Returns length of loaded image
*/ */
int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr, int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
const char **fit_unamep, const char *fit_uname_config, const char **fit_unamep, const char **fit_uname_configp,
int arch, int image_type, int bootstage_id, int arch, int image_type, int bootstage_id,
enum fit_load_op load_op, ulong *datap, ulong *lenp); enum fit_load_op load_op, ulong *datap, ulong *lenp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册