Skip to contentSkip to conversation

common, ubi: add ubi check volumename command

PATCH In review Heiko Schocher 2 participants 5 messages Jan 25, 2014 – Feb 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common, ubi: add ubi check volumename command

check with this ubi command, if a UBI volume with "volumename" exists in current ubi device.

---
 common/cmd_ubi.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
common/cmd_ubi.c +31 -0
index 122ba7e..7c4d950 100644
@@ -123,6 +123,27 @@ static int ubi_info(int layout)
 	return 0;
 }
 
+static int ubi_check_volumename(const struct ubi_volume *vol, char *name)
+{
+	return strcmp(vol->name, name);
+}
+
+static int ubi_check(char *name)
+{
+	int i;
+
+	for (i = 0; i < (ubi->vtbl_slots + 1); i++) {
+		if (!ubi->volumes[i])
+			continue;	/* Empty record */
+
+		if (!ubi_check_volumename(ubi->volumes[i], name))
+			return 0;
+	}
+
+	return -EEXIST;
+}
+
+
 static int verify_mkvol_req(const struct ubi_device *ubi,
 			    const struct ubi_mkvol_req *req)
 {
@@ -558,6 +579,14 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return ubi_info(layout);
 	}
 
+	if (strcmp(argv[1], "check") == 0) {
+		if (argc > 2)
+			return ubi_check(argv[2]);
+
+		printf("Error, no volume name passed\n");
+		return 1;
+	}
+
 	if (strncmp(argv[1], "create", 6) == 0) {
 		int dynamic = 1;	/* default: dynamic volume */
 
@@ -663,6 +692,8 @@ U_BOOT_CMD(
 		" header offset)\n"
 	"ubi info [l[ayout]]"
 		" - Display volume and ubi layout information\n"
+	"ubi check volumename"
+		" - check if volumename exists\n"
 	"ubi create[vol] volume [size] [type]"
 		" - create volume name with size\n"
 	"ubi write[vol] address volume size"
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 common, itest: pass u-boot env variables to itest.s

compare two U-Boot Environment variables with itest.s, example:

=> print tmp ver
tmp=U-Boot 2013.10-g75e
ver=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX
=> print check_ub_ver
check_ub_ver=if itest.s \${tmp} == \${ver}; then echo equal; else echo diff ;fi => run check_ub_ver
diff
=> setenv tmp U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX => print tmp ver
tmp=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX ver=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX
=> run check_ub_ver
equal

---
 common/cmd_itest.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
common/cmd_itest.c +13 -0
index 29f8076..ae2527b 100644
@@ -71,6 +71,19 @@ static char * evalstr(char *s)
 	/* if the parameter starts with a * then assume a string pointer else its a literal */
 	if (s[0] == '*') {
 		return (char *)simple_strtoul(&s[1], NULL, 16);
+	} else if (s[0] == '$') {
+		int i = 2;
+
+		if (s[1] != '{')
+			return NULL;
+
+		while (s[i] != '}') {
+			if (s[i] == 0)
+				return NULL;
+			i++;
+		}
+		s[i] = 0;
+		return  getenv((const char *)&s[2]);
 	} else {
 		return s;
 	}
Signature · 1 line
1.8.3.1
#2 lore raw

[U-Boot] common, itest: pass u-boot env variables to itest.s

Quoted 16 lines · Heiko Schocher

compare two U-Boot Environment variables with itest.s, example:

=> print tmp ver
tmp=U-Boot 2013.10-g75e
ver=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX
=> print check_ub_ver
check_ub_ver=if itest.s \${tmp} == \${ver}; then echo equal; else echo diff ;fi => run check_ub_ver
diff
=> setenv tmp U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX => print tmp ver
tmp=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX ver=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX
=> run check_ub_ver
equal

Quoted 1 line

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140221/9ea39740/attachment.pgp>
#3 lore raw

PATCH 1/1 i2c, bootcount: add support for bootcounter on i2c devices

In reply to Heiko Schocher

add support for bootcounter on an i2c device. And add a README for all bootcounter options.

---
 README                            | 20 ++++++++++++++++++
 drivers/bootcount/Makefile        |  1 +
 drivers/bootcount/bootcount_i2c.c | 44 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 drivers/bootcount/bootcount_i2c.c
README +20 -0
index aea82be..bb0751e 100644
@@ -2837,6 +2837,26 @@ CBFS (Coreboot Filesystem) support
 		The signing part is build into mkimage regardless of this
 		option.
 
+- bootcount support:
+		CONFIG_BOOTCOUNT_LIMIT
+
+		This enables the bootcounter support, see:
+		http://www.denx.de/wiki/DULG/UBootBootCountLimit
+
+		CONFIG_AT91SAM9XE
+		enable special bootcounter support on at91sam9xe based boards.
+		CONFIG_BLACKFIN
+		enable special bootcounter support on blackfin based boards.
+		CONFIG_SOC_DA8XX
+		enable special bootcounter support on da850 based boards.
+		CONFIG_BOOTCOUNT_RAM
+		enable support for the bootcounter in RAM
+		CONFIG_BOOTCOUNT_I2C
+		enable support for the bootcounter on an i2c (like RTC) device.
+			CONFIG_SYS_I2C_RTC_ADDR = i2c chip address
+			CONFIG_SYS_BOOTCOUNT_ADDR = i2c addr which is used for
+						    the bootcounter.
+			CONFIG_BOOTCOUNT_ALEN = address len
 
 - Show boot progress:
 		CONFIG_SHOW_BOOT_PROGRESS
drivers/bootcount/Makefile +1 -0
index bed6971..6f1c419 100644
@@ -9,3 +9,4 @@ obj-$(CONFIG_SOC_DA8XX)		+= bootcount_davinci.o
 obj-$(CONFIG_BOOTCOUNT_AM33XX)	+= bootcount_davinci.o
 obj-$(CONFIG_BOOTCOUNT_RAM)	+= bootcount_ram.o
 obj-$(CONFIG_BOOTCOUNT_ENV)	+= bootcount_env.o
+obj-$(CONFIG_BOOTCOUNT_I2C)	+= bootcount_i2c.o
drivers/bootcount/bootcount_i2c.c new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Heiko Schocher
Quoted 4 lines · Heiko Schocher

check with this ubi command, if a UBI volume with "volumename" exists in current ubi device.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140221/16578d33/attachment.pgp>