No subject
Kevin Paul Herbert
kevin.herbert at meraki.com
Thu Oct 13 19:41:37 EDT 2011
From: Kevin Paul Herbert <kph at meraki.net>
To: linux-mtd at 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 at 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
More information about the linux-mtd
mailing list