0042-firmware-utils-mkfwimage-fix-firmware_max_length-for-XM-layout.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Thu, 25 Feb 2016 21:42:14 +0100
  3. Subject: firmware-utils: mkfwimage: fix firmware_max_length for XM layout
  4. The new u-boot version bundled with the 5.6.x firmwares from Ubiquiti gets
  5. confused by the smaller rootfs partition size; this can lead to various
  6. issues:
  7. 1. We've gotten reports that flashing from the 5.6.x stock firmware to
  8. OpenWrt will brick devices; I wasn't able to reproduce this myself
  9. 2. Flashing from 5.5.x stock firmware to OpenWrt and back to stock (via
  10. TFTP recovery), following by an update to 5.6.x via web interface can
  11. yield a bricked device with the following properties:
  12. - It can't be booted without entering commands over a serial console, as
  13. u-boot supplies the wrong MTD layout
  14. - The web interface won't accept any image with the original flash
  15. layout, so stock firmware upgrades are impossible
  16. - As the TFTP recovery doesn't update u-boot, returning to the old
  17. u-boot from firmware 5.5.x is impossible
  18. To recover from 2., creating an OpenWrt image which doesn't set u-boot as
  19. read-only and flashing a backup of the old u-boot from there is the only
  20. way known to me. (Fixing the mtdparts variable in u-boot-env from OpenWrt
  21. might also work; settings this from u-boot over serial didn't have
  22. any permanent effect.)
  23. Fix all of this by setting the correct flash layout also used by the stock
  24. firmware. Flashing has been tested from both firmware 5.5.x and 5.6.x. The
  25. fixed layout also matches the mtdparts defined by OpenWrt.
  26. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
  27. diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c
  28. index 5dae284..d8d5239 100644
  29. --- a/tools/firmware-utils/src/mkfwimage.c
  30. +++ b/tools/firmware-utils/src/mkfwimage.c
  31. @@ -79,7 +79,7 @@ fw_layout_t fw_layout_data[] = {
  32. .name = "XM",
  33. .kern_start = 0x9f050000,
  34. .kern_entry = 0x80002000,
  35. - .firmware_max_length= 0x006A0000,
  36. + .firmware_max_length= 0x00760000,
  37. },
  38. {
  39. .name = "UBDEV01",