Skip to contentSkip to conversation

PATCH Kevin Paul Herbert 1 participant 1 message Oct 13, 2011 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

From: Kevin Paul Herbert <[email protected]>
To: [email protected]
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.

---
 include/mtd/ubi-media.h |    4 +++-
 ubi-utils/libubigen.c   |    1 +
 2 files changed, 4 insertions(+), 1 deletions(-)
include/mtd/ubi-media.h +3 -1
index 08bec3e..30ea063 100644
@@ -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));
 
ubi-utils/libubigen.c +1 -0
index 9eaa7f5..60fec85 100644
@@ -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);
Signature · 1 line
1.7.4.1