Set default UBI partition name at configuration
PATCH 1/1 Set default UBI partition name at configuration
As usually fixed partition used for UBI.
So it's defined at configuration and use it.
---
common/cmd_ubi.c +12 -8
@@ -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);
include/configs/apollon.h +2 -1
@@ -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 */
PATCH 1/1 Set default UBI partition name at configuration
Quoted 4 lines · Kyungmin Park
As usually fixed partition used for UBI.
So it's defined at configuration and use it.Signed-off-by Kyungmin Park <[email protected]>
Please find a few comment below.
Quoted 30 lines
common/cmd_ubi.c +5
-6@@ -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 ;
common/cmd_ubi.c static int do_ubi(cmd_tbl_t * cmdtp, int flag, int · line 483
Quoted 5 lines
common/cmd_ubi.c +1
-1@@ -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) {
You only add this feature for the OneNAND part. Please add it for NOR & NAND as well. You need a different approach then though. By simply adding this part_name via the board config header, you can't distinguish between the different FLASH choices.
common/cmd_ubi.c static int do_ubi(cmd_tbl_t * cmdtp, int flag, int · line 496
Quoted 10 lines
common/cmd_ubi.c +2
-1strcpy (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 (argc >= 4) strcpy(ubi_dev.part_name, argv[3]);
common/cmd_ubi.c static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) · line 498
Quoted 2 lines
common/cmd_ubi.c +2
-0+if (strcmp (ubi_dev.part_name,"" ) ==0 ) { +printf ("Please give part name\n" );
printf("Please enter partition name!\n");Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================