public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* (no subject)
@ 2011-10-13 23:41 Kevin Paul Herbert
  0 siblings, 0 replies; only message in thread
From: Kevin Paul Herbert @ 2011-10-13 23:41 UTC (permalink / raw)
  To: linux-mtd

From: Kevin Paul Herbert <kph@meraki.net>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] [MTD-UTILS] UBI: Track the PEB size in the UBI EC header


The UBI header does not contain the PEB size, so it is not possible
to do any consistency checking to verify that the PEB size is
consistent with the actual erase size of the flash.

This patch adds a peb_size field to each erase block and initializes
is. A subsequent patch will enable usage of this feature in the kernel.

Signed-off-by: Kevin Paul Herbert <kph@meraki.net>
---
 include/mtd/ubi-media.h |    4 +++-
 ubi-utils/libubigen.c   |    1 +
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/mtd/ubi-media.h b/include/mtd/ubi-media.h
index 08bec3e..30ea063 100644
--- a/include/mtd/ubi-media.h
+++ b/include/mtd/ubi-media.h
@@ -130,6 +130,7 @@ enum {
  * @vid_hdr_offset: where the VID header starts
  * @data_offset: where the user data start
  * @image_seq: image sequence number
+ * @peb_size: size of PEB, must be multiple of erase size
  * @padding2: reserved for future, zeroes
  * @hdr_crc: erase counter header CRC checksum
  *
@@ -162,7 +163,8 @@ struct ubi_ec_hdr {
 	__be32  vid_hdr_offset;
 	__be32  data_offset;
 	__be32  image_seq;
-	__u8    padding2[32];
+	__be32	peb_size;
+	__u8    padding2[28];
 	__be32  hdr_crc;
 } __attribute__ ((packed));
 
diff --git a/ubi-utils/libubigen.c b/ubi-utils/libubigen.c
index 9eaa7f5..60fec85 100644
--- a/ubi-utils/libubigen.c
+++ b/ubi-utils/libubigen.c
@@ -135,6 +135,7 @@ void ubigen_init_ec_hdr(const struct ubigen_info *ui,
 	hdr->vid_hdr_offset = cpu_to_be32(ui->vid_hdr_offs);
 	hdr->data_offset = cpu_to_be32(ui->data_offs);
 	hdr->image_seq = cpu_to_be32(ui->image_seq);
+	hdr->peb_size = cpu_to_be32(ui->peb_size);
 
 	crc = mtd_crc32(UBI_CRC32_INIT, hdr, UBI_EC_HDR_SIZE_CRC);
 	hdr->hdr_crc = cpu_to_be32(crc);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-13 23:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-13 23:41 Kevin Paul Herbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox