uboot-kirkwood: fix malformed boot configuration
authorAlberto Bursi <alberto.bursi@outlook.it>
Tue, 26 Jun 2018 19:48:09 +0000 (21:48 +0200)
committerMathias Kresin <dev@kresin.me>
Wed, 27 Jun 2018 06:42:54 +0000 (08:42 +0200)
With current uboot default configuration the bootloader will
fail to start the OpenWrt firmware with the following error:
-----
unexpected character 'b' at the end of partition
Error initializing mtdparts!
incorrect device type in ubi
Partition ubi not found!
Error, no UBI device/partition selected!
Wrong Image Format for bootm command
Error occured, error code = 112
-----

If the uboot configuration is examined with printenv
I can see that mdtparts line (on a nsa310) is wrong:
-----
mtdparts=mtdparts=orion_nand:0x0c0000(uboot),
0x80000(uboot_env),0x7ec0000(ubi)bootargs_root=
----

The "bootargs_root=" that was appended to it should not be there.

Fix the issue by adding a \0 line terminator at the end of affected lines,
mimicking what is also done by uboot upstream.

This issue was detected and confirmed on a nsa310, nsa325 and
a pogoplug v4, but it's not hardware-specific, so apply the same fix
to other devices as well.

Note that the issue is with the uboot's integrated boot configuration,
which is not used unless the uboot configuration in flash is unavailable
(erased or corrupted), which happens only on first time installation,
or if the user deletes the uboot configuration when upgrading uboot.
People just upgrading from an older uboot without erasing their previous
uboot configuration stored in flash would not have noticed this issue.

Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it>
package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch
package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch
package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch
package/boot/uboot-kirkwood/patches/110-dockstar.patch
package/boot/uboot-kirkwood/patches/120-iconnect.patch
package/boot/uboot-kirkwood/patches/130-ib62x0.patch
package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch
package/boot/uboot-kirkwood/patches/150-goflexhome.patch

index f1612d8565b13c4c2903a2e4822edec762db3e7e..264c160748c32d83335b2a37df582c67551e8234 100644 (file)
@@ -627,7 +627,7 @@ NOTE: this patch is ready for upstream, LEDE-specific parts are in
 +#define CONFIG_EXTRA_ENV_SETTINGS \
 +      "console=console=ttyS0,115200\0"        \
 +      "mtdids=nand0=orion_nand\0"             \
-+      "mtdparts="CONFIG_MTDPARTS_DEFAULT      \
++      "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
 +      "bootargs_root=\0"
 +
 +/*
index 7fed859031cf8dc28bfe48ee9e3f94b420b6c413..0ce3fe02e1ce7aa9aaee3561d74ca8d004066571 100644 (file)
 +#define CONFIG_EXTRA_ENV_SETTINGS \
 +      "console=console=ttyS0,115200\0"        \
 +      "mtdids=nand0=orion_nand\0"             \
-+      "mtdparts="CONFIG_MTDPARTS_DEFAULT      \
++      "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
 +      "bootargs_root=\0"
 +
 +/*
index b9e023c4f7d2d735d26c915a38a36dad42c8cfa9..568c8bf5f0560cf5670532e2ff91cc626caff419 100644 (file)
 +#define CONFIG_EXTRA_ENV_SETTINGS \
 +      "console=console=ttyS0,115200\0"        \
 +      "mtdids=nand0=orion_nand\0"             \
-+      "mtdparts="CONFIG_MTDPARTS_DEFAULT      \
++      "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
 +      "bootargs_root=\0"
 +
 +/*
index 06ec507c885f9b61ccd6ac3e7a8ae08409a7fcd8..ff2c33877b683d1ac6ba2d2b016af63984fc5ed6 100644 (file)
@@ -39,7 +39,7 @@
 -      "bootargs_root=ubi.mtd=1 root=ubi0:root rootfstype=ubifs ro\0"
 +      "console=console=ttyS0,115200\0"        \
 +      "mtdids=nand0=orion_nand\0"             \
-+      "mtdparts="CONFIG_MTDPARTS_DEFAULT      \
++      "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
 +      "bootargs_root=\0"
 
  /*
index dcccf58eaf77d82ce1479c819103701eec334dbe..114aa1559da26d95f37eda483cf3503d2ad8c454 100644 (file)
  #define CONFIG_EXTRA_ENV_SETTINGS \
        "console=console=ttyS0,115200\0"        \
        "mtdids=nand0=orion_nand\0"             \
-       "mtdparts="CONFIG_MTDPARTS_DEFAULT      \
+-      "mtdparts="CONFIG_MTDPARTS_DEFAULT      \
 -      "kernel=/boot/uImage\0"                 \
 -      "bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
++      "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
 +      "bootargs_root=\0"
 
  /*
index 4b1afb837e1836080046f2c8ee79f439f95e9fbf..269cf7336de458fbdfe577c365bd51fd6bcc39ff 100644 (file)
  #define CONFIG_EXTRA_ENV_SETTINGS \
        "console=console=ttyS0,115200\0"                                \
        "mtdids=nand0=orion_nand\0"                                     \
-       "mtdparts="CONFIG_MTDPARTS_DEFAULT                      \
+-      "mtdparts="CONFIG_MTDPARTS_DEFAULT                      \
 -      "kernel=/boot/zImage\0"                                         \
 -      "fdt=/boot/ib62x0.dtb\0"                                        \
 -      "bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0"
++      "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0"                 \
 +      "bootargs_root=\0"
 
  /*
index 330821babd149b363fe2402d0461a455a9e09d7b..26217fadd702d69918255929083d0216e75eed02 100644 (file)
@@ -29,7 +29,7 @@
 -      "ext2load usb 0:1 0x01100000 /uInitrd\0"
 +      "console=console=ttyS0,115200\0"        \
 +      "mtdids=nand0=orion_nand\0"             \
-+      "mtdparts="CONFIG_MTDPARTS_DEFAULT      \
++      "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
 +      "bootargs_root=\0"
 
  /*
index 0f77ea720a37b7433f3ec5da10f1ba9a28b3475b..2104b67b513dcaf06ba0502217c21236c02d5ec1 100644 (file)
  #define CONFIG_EXTRA_ENV_SETTINGS \
        "console=console=ttyS0,115200\0" \
        "mtdids=nand0=orion_nand\0" \
-       "mtdparts="CONFIG_MTDPARTS_DEFAULT \
+-      "mtdparts="CONFIG_MTDPARTS_DEFAULT \
 -      "kernel=/boot/uImage\0" \
 -      "bootargs_root=ubi.mtd=root root=ubi0:root rootfstype=ubifs ro\0"
++      "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
 +      "bootargs_root=\0"
 
  /*