mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jan Remmet <j.remmet@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] bootm: get file type before bootm_open_os_uimage
Date: Thu, 19 Nov 2015 13:58:24 +0100	[thread overview]
Message-ID: <1447937904-4637-3-git-send-email-j.remmet@phytec.de> (raw)
In-Reply-To: <1447937904-4637-1-git-send-email-j.remmet@phytec.de>

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>
---
 common/bootm.c | 39 ++++++++++++++++++++++-----------------
 1 file 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 {
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-11-19 13:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 12:58 bootm multi uimage from nand Jan Remmet
2015-11-19 12:58 ` [PATCH 1/2] bootm: cleanup bootm_open_oftree Jan Remmet
2015-11-19 12:58 ` Jan Remmet [this message]
2015-11-20  7:41 ` bootm multi uimage from nand Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447937904-4637-3-git-send-email-j.remmet@phytec.de \
    --to=j.remmet@phytec.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox