summaryrefslogtreecommitdiffstats
path: root/common/bootm.c
diff options
context:
space:
mode:
authorJan Remmet <j.remmet@phytec.de>2015-11-19 13:58:24 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-11-20 08:35:18 +0100
commit39c858ede8fd3e15c15594699cf25cff2c1da3a2 (patch)
treef54c8c34330a0c3f74359559a853c93deda433ae /common/bootm.c
parent5ec644e7d8a3523d2890f3f93ad6c7b8d37b707a (diff)
downloadbarebox-39c858ede8fd3e15c15594699cf25cff2c1da3a2.tar.gz
bootm: get file type before bootm_open_os_uimage
Using a multi uimage stored in nand didn't work. Only one open for the bb file is allowed. The file type detection after bootm_open_os_uimage will fail. bootm_open_initrd_uimage and bootm_open_oftree_uimage already check if they can reuse data->os. Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/bootm.c')
-rw-r--r--common/bootm.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/common/bootm.c b/common/bootm.c
index ec1758b..08125e7 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -415,6 +415,28 @@ int bootm_boot(struct bootm_data *bootm_data)
goto err_out;
}
+ if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD) && data->initrd_file) {
+ initrd_type = file_name_detect_type(data->initrd_file);
+
+ if ((int)initrd_type < 0) {
+ printf("could not open %s: %s\n", data->initrd_file,
+ strerror(-initrd_type));
+ ret = (int)initrd_type;
+ goto err_out;
+ }
+ }
+
+ if (IS_ENABLED(CONFIG_OFTREE) && data->oftree_file) {
+ oftree_type = file_name_detect_type(data->oftree_file);
+
+ if ((int)oftree_type < 0) {
+ printf("could not open %s: %s\n", data->oftree_file,
+ strerror(-oftree_type));
+ ret = (int) oftree_type;
+ goto err_out;
+ }
+ }
+
if (os_type == filetype_uimage) {
ret = bootm_open_os_uimage(data);
if (ret) {
@@ -425,14 +447,6 @@ int bootm_boot(struct bootm_data *bootm_data)
}
if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD) && data->initrd_file) {
-
- initrd_type = file_name_detect_type(data->initrd_file);
- if ((int)initrd_type < 0) {
- printf("could not open %s: %s\n", data->initrd_file,
- strerror(-initrd_type));
- ret = (int)initrd_type;
- goto err_out;
- }
if (initrd_type == filetype_uimage) {
ret = bootm_open_initrd_uimage(data);
if (ret) {
@@ -452,19 +466,10 @@ int bootm_boot(struct bootm_data *bootm_data)
if (IS_ENABLED(CONFIG_OFTREE)) {
if (data->oftree_file) {
- oftree_type = file_name_detect_type(data->oftree_file);
-
if (oftree_type == filetype_uimage)
ret = bootm_open_oftree_uimage(data);
if (oftree_type == filetype_oftree)
ret = bootm_open_oftree(data);
- if ((int)oftree_type < 0) {
- printf("could not open %s: %s\n",
- data->oftree_file,
- strerror(-oftree_type));
- ret = (int) oftree_type;
- }
-
if (ret)
goto err_out;
} else {