mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] bootm: fix initrd handling
Date: Mon, 30 Apr 2012 13:39:42 +0200	[thread overview]
Message-ID: <1335785982-18864-1-git-send-email-s.hauer@pengutronix.de> (raw)

bootm_initrd tests for data->initrd, but this never becomes true because
the setting of data->initrd is inside a if(bootm_initrd()). Fix this. Also,
do not support the initrd options when initrd is disabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/bootm.c |   24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index 322e74f..0c0e56a 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -51,18 +51,6 @@
 
 static LIST_HEAD(handler_list);
 
-#ifdef CONFIG_CMD_BOOTM_INITRD
-static inline int bootm_initrd(struct image_data *data)
-{
-	return data->initrd ? 1 : 0;
-}
-#else
-static inline int bootm_initrd(struct image_data *data)
-{
-	return 0;
-}
-#endif
-
 int register_image_handler(struct image_handler *handler)
 {
 	list_add_tail(&handler->list, &handler_list);
@@ -258,6 +246,14 @@ static void bootm_image_name_and_no(char *name, int *no)
 	*no = simple_strtoul(at, NULL, 10);
 }
 
+#define BOOTM_OPTS_COMMON "ca:e:vo:f"
+
+#ifdef CONFIG_CMD_BOOTM_INITRD
+#define BOOTM_OPTS BOOTM_OPTS_COMMON "L:r:"
+#else
+#define BOOTM_OPTS BOOTM_OPTS_COMMON
+#endif
+
 static int do_bootm(int argc, char *argv[])
 {
 	int opt;
@@ -275,7 +271,7 @@ static int do_bootm(int argc, char *argv[])
 	data.verify = 0;
 	data.verbose = 0;
 
-	while ((opt = getopt(argc, argv, "cL:r:a:e:vo:f")) > 0) {
+	while ((opt = getopt(argc, argv, BOOTM_OPTS)) > 0) {
 		switch(opt) {
 		case 'c':
 			data.verify = 1;
@@ -336,7 +332,7 @@ static int do_bootm(int argc, char *argv[])
 		}
 	}
 
-	if (bootm_initrd(&data)) {
+	if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD) && data.initrd_file) {
 		bootm_image_name_and_no(data.initrd_file, &data.initrd_num);
 
 		initrd_type = file_name_detect_type(data.initrd_file);
-- 
1.7.10


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

                 reply	other threads:[~2012-04-30 11:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1335785982-18864-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.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