All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyungmin Park <kmpark@infradead.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] [UBI] Set default UBI partition name at configuration
Date: Wed, 26 Nov 2008 09:52:42 +0900	[thread overview]
Message-ID: <20081126005242.GA3712@july> (raw)

As usually fixed partition used for UBI.
So it's defined at configuration and use it.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 8446765..d018dc1 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -40,7 +40,11 @@ struct selected_dev {
 	struct mtd_info *mtd_info;
 };
 
-static struct selected_dev ubi_dev;
+static struct selected_dev ubi_dev = {
+#ifdef CONFIG_UBI_PART_NAME
+	.part_name	= CONFIG_UBI_PART_NAME,
+#endif
+};
 
 static void ubi_dump_vol_info(const struct ubi_volume *vol)
 {
@@ -455,11 +459,6 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 			return 0;
 		}
 
-		if (argc < 4) {
-			printf("Usage:\n%s\n", cmdtp->usage);
-			return 1;
-		}
-
 		/* todo: get dev number for NAND... */
 		ubi_dev.nr = 0;
 
@@ -481,7 +480,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 		}
 #endif
 #if defined(CONFIG_CMD_ONENAND)
-		if (strcmp(argv[2], "onenand") == 0) {
+		if (strcmp(argv[2], "onenand") == 0 || ubi_dev.part_name) {
 			strcpy(ubi_dev.dev_name, "OneNAND");
 			ubi_dev.type = DEV_TYPE_ONENAND;
 			ubi_dev.mtd_info = &onenand_mtd;
@@ -493,7 +492,12 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 			return 1;
 		}
 
-		strcpy(ubi_dev.part_name, argv[3]);
+		if (argv[3])
+			strcpy(ubi_dev.part_name, argv[3]);
+		if (strcmp(ubi_dev.part_name, "") == 0) {
+			printf("Please give part name\n");
+			return 1;
+		}
 		err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name);
 		if (err) {
 			printf("UBI init error %d\n", err);
diff --git a/include/configs/apollon.h b/include/configs/apollon.h
index dff47fc..a29d739 100644
--- a/include/configs/apollon.h
+++ b/include/configs/apollon.h
@@ -259,13 +259,14 @@
 
 #ifdef CONFIG_SYS_USE_UBI
 #define CONFIG_JFFS2_CMDLINE
+#define CONFIG_UBI_PART_NAME	"UBI"
 #define MTDIDS_DEFAULT		"onenand0=onenand"
 #define MTDPARTS_DEFAULT	"mtdparts=onenand:128k(bootloader),"	\
 					"128k(params),"			\
 					"2m(kernel),"			\
 					"16m(rootfs),"			\
 					"32m(fs),"			\
-					"-(ubifs)"
+					"-(UBI)"
 #endif
 
 #endif /* __CONFIG_H */

             reply	other threads:[~2008-11-26  0:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-26  0:52 Kyungmin Park [this message]
2008-11-26  8:47 ` [U-Boot] [PATCH] [UBI] Set default UBI partition name at configuration Stefan Roese

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=20081126005242.GA3712@july \
    --to=kmpark@infradead.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.