summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorRod Whitby <rod@whitby.id.au>2006-12-17 03:05:52 +0000
committerRod Whitby <rod@whitby.id.au>2006-12-17 03:05:52 +0000
commitb3dcce7d75b7f0a6a73d9c3229fb78d5ab9cf6ce (patch)
tree319444153326a124f2facaa028aa83b69ab5ee5f /target
parentee1839c4f2e5c8d6c01d7ec82ba3d1f295190230 (diff)
downloadmtk-20170518-b3dcce7d75b7f0a6a73d9c3229fb78d5ab9cf6ce.zip
mtk-20170518-b3dcce7d75b7f0a6a73d9c3229fb78d5ab9cf6ce.tar.gz
mtk-20170518-b3dcce7d75b7f0a6a73d9c3229fb78d5ab9cf6ce.tar.bz2
Replaced non-working (on NAS100d) redboot byteswap partition truncate patch with the one that has been tested on NSLU2, NAS100d, Loft, etc., accepted by linux-mtd, and should be in 2.6.20
SVN-Revision: 5813
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic-2.6/patches/050-mtdpart-redboot-partition-truncate.patch61
-rw-r--r--target/linux/generic-2.6/patches/050-mtdpart_redboot_byteswap_partition_truncate.patch61
2 files changed, 61 insertions, 61 deletions
diff --git a/target/linux/generic-2.6/patches/050-mtdpart-redboot-partition-truncate.patch b/target/linux/generic-2.6/patches/050-mtdpart-redboot-partition-truncate.patch
new file mode 100644
index 0000000..2e2cde0
--- /dev/null
+++ b/target/linux/generic-2.6/patches/050-mtdpart-redboot-partition-truncate.patch
@@ -0,0 +1,61 @@
+Redboot supports storing the FIS directory and the RedBoot
+configuration information in the same block of flash memory. This is
+not the most common RedBoot configuration, but it is used on
+commercially available boards supported by the kernel.
+
+A recent patch to mtd/redboot.c (http://lkml.org/lkml/2006/3/20/410)
+which corrected the skipping of deleted table entries has exposed the
+latent problem of the kernel redboot parser running off the end of the
+FIS directory and interpreting the RedBoot configuration information
+as table entries.
+
+This patch terminates the table parsing when the first truly empty
+entry is found (table entry deletion only clears the first byte of the
+name, so two cleared bytes in a row indicates the end of the table),
+thereby supporting the combined redboot FIS directory and RedBoot
+configuration information flash layout scenario.
+
+Signed-off-by: Rod Whitby <rod@whitby.id.au>
+--
+
+Index: linux-2.6.19/drivers/mtd/redboot.c
+===================================================================
+--- linux-2.6.19.orig/drivers/mtd/redboot.c
++++ linux-2.6.19/drivers/mtd/redboot.c
+@@ -96,7 +96,19 @@ static int parse_redboot_partitions(stru
+ */
+ if (swab32(buf[i].size) == master->erasesize) {
+ int j;
+- for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) {
++ for (j = 0; j < numslots; ++j) {
++
++ /* A single 0xff denotes a deleted entry.
++ * Two of them in a row is the end of the table.
++ */
++ if (buf[j].name[0] == 0xff) {
++ if (buf[j].name[1] == 0xff) {
++ break;
++ } else {
++ continue;
++ }
++ }
++
+ /* The unsigned long fields were written with the
+ * wrong byte sex, name and pad have no byte sex.
+ */
+@@ -123,8 +135,13 @@ static int parse_redboot_partitions(stru
+ for (i = 0; i < numslots; i++) {
+ struct fis_list *new_fl, **prev;
+
+- if (buf[i].name[0] == 0xff)
+- continue;
++ if (buf[i].name[0] == 0xff) {
++ if (buf[i].name[1] == 0xff) {
++ break;
++ } else {
++ continue;
++ }
++ }
+ if (!redboot_checksum(&buf[i]))
+ break;
+
diff --git a/target/linux/generic-2.6/patches/050-mtdpart_redboot_byteswap_partition_truncate.patch b/target/linux/generic-2.6/patches/050-mtdpart_redboot_byteswap_partition_truncate.patch
deleted file mode 100644
index 2d05792..0000000
--- a/target/linux/generic-2.6/patches/050-mtdpart_redboot_byteswap_partition_truncate.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-diff -urN linux-2.6.19.old/drivers/mtd/redboot.c linux-2.6.19.dev/drivers/mtd/redboot.c
---- linux-2.6.19.old/drivers/mtd/redboot.c 2006-11-29 22:57:37.000000000 +0100
-+++ linux-2.6.19.dev/drivers/mtd/redboot.c 2006-12-14 03:13:35.000000000 +0100
-@@ -92,22 +92,47 @@
- * swab32(erasesize) then we know we are looking at
- * a byte swapped FIS directory - swap all the entries!
- * (NOTE: this is 'size' not 'data_length'; size is
-- * the full size of the entry.)
-+ * the full size of the entry.)
-+ *
-+ * Handle cases where the FIS directory is less than
-+ * a full erase block (like combine FIS directory
-+ * and RedBoot config).
-+ *
-+ * IMHO the best solution would be to compute the
-+ * flash address of the RedBoot FIS directory and
-+ * compare that with the entry in the FIS directory
-+ * entry swabbed. However, I haven't yet figured out
-+ * how to compute that.
- */
-- if (swab32(buf[i].size) == master->erasesize) {
-+
-+ unsigned long erasesize_mask = master->erasesize -1;
-+ unsigned long eraseaddr_mask = 0xFFFFFFFF ^ erasesize_mask;
-+
-+ if (((swab32(buf[i].size)+erasesize_mask)
-+ & eraseaddr_mask) == master->erasesize) {
- int j;
-- for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) {
-+
-+ /* N.B. The full table being processed so adjust size now */
-+ numslots = swab32(buf[i].size) / sizeof (struct fis_image_desc);
-+ for (j = 0; j < numslots; ++j) {
- /* The unsigned long fields were written with the
- * wrong byte sex, name and pad have no byte sex.
-+ *
-+ * Only process non-deleted entries. Don't exit early.
- */
-- swab32s(&buf[j].flash_base);
-- swab32s(&buf[j].mem_base);
-- swab32s(&buf[j].size);
-- swab32s(&buf[j].entry_point);
-- swab32s(&buf[j].data_length);
-- swab32s(&buf[j].desc_cksum);
-- swab32s(&buf[j].file_cksum);
-+ if (buf[j].name[0] != 0xff) {
-+ swab32s(&buf[j].flash_base);
-+ swab32s(&buf[j].mem_base);
-+ swab32s(&buf[j].size);
-+ swab32s(&buf[j].entry_point);
-+ swab32s(&buf[j].data_length);
-+ swab32s(&buf[j].desc_cksum);
-+ swab32s(&buf[j].file_cksum);
-+ }
- }
-+ } else {
-+ /* Update numslots based on actual FIS directory size */
-+ numslots = buf[i].size / sizeof (struct fis_image_desc);
- }
- break;
- }