-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ath79: POC for DT-based expansion-friendly fw
On former ar71xx, official firmwares could be directly flashed into a device with expanded flash, provided that partitions like "art" have been relocated to the end of the expanded flash, but it does not work well on the current ath79, because the offset of all partitions is set in the device tree. If partitions like "art" are kept in their original offset, flashing an official firmware to an expanded device can work, but extra space beyond the original end will not be usable. However, there are special "offset" and "size" values documented in include/linux/mtd/partitions.h of Linux: // consume as much as possible, leaving size after the end of partition. #define MTDPART_OFS_RETAIN (uint64_t)(-3) // the partition will start at the next erase block. #define MTDPART_OFS_NXTBLK (uint64_t)(-2) // the partition will start where the previous one ended. #define MTDPART_OFS_APPEND (uint64_t)(-1) // the partition will extend to the end of the master MTD device. #define MTDPART_SIZ_FULL (0) When these special values are used, the actual offset and size of a partition will be determined at runtime. As a result, MTDPART_OFS_RETAIN could be used to define the "offset" of the original writable partition. Its "size" is used to retain spaces for read-only partitions after it. (e.g. art) All partitions after it could use MTDPART_OFS_APPEND for its "offset". However, since these special values have uint64_t type, the #address-cells should be 2 and format <high32 low32> should be used, e.g. <(-1) (-3)> for MTDPART_OFS_RETAIN. If official firmwares are built in this way, they will be flashed to a well-expanded device again, and can claim all extra space. Partitions like art could still be relocated to the end of the expanded flash, as many bootloaders expect. Now applied only to tplink ath79 targets with "classic flash layout", as tplink_classic_flash_layout.dtsi shows. Tested on my tplink tl-wdr4310 (unexpanded), and tl-wdr4900v2 (expanded to 16MiB). Signed-off-by: Edward Chow <equu@openmail.cc>
- Loading branch information
1 parent
497012a
commit 2db5f0f
Showing
33 changed files
with
169 additions
and
733 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.