From: Kevin Paul Herbert <kevin.herbert@meraki.com>
To: <linux-mtd@lists.infradead.org>
Date: Thu, 13 Oct 2011 16:41:37 -0700 (PDT) [thread overview]
Message-ID: <20111013234138.07E0CA1DDD@snowflake> (raw)
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
reply other threads:[~2011-10-13 23:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111013234138.07E0CA1DDD@snowflake \
--to=kevin.herbert@meraki.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox