diff options
author | Thibaut VARENE <hacks@slashdirt.org> | 2017-02-15 11:40:06 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-02-22 22:52:20 +0100 |
commit | f6a52bf3374682475e92c1960c19df8e6c1ea9b2 (patch) | |
tree | fab3799d76c561a1c4ab490c8febb7a3e07574dd | |
parent | 53c862705dc04b6a499c2ed47158bcc20954184c (diff) | |
download | upstream-f6a52bf3374682475e92c1960c19df8e6c1ea9b2.tar.gz upstream-f6a52bf3374682475e92c1960c19df8e6c1ea9b2.tar.bz2 upstream-f6a52bf3374682475e92c1960c19df8e6c1ea9b2.zip |
ar71xx: Enable mtdsplit support for RB SPI NOR devices
This patch enables mtdsplit for the MikroTik subtarget.
It converts mach-rbspi.c to use a single "firmware" partition.
Finally, it converts the SPI NOR profile to metadata images:
the original combined-image format is gone, the images are now
"standard" sysupgrade images with metadata appended.
Note: kernel2minor apparently pads the kernel container to erase-block
boundary, but this is undocumented behaviour, so we do not rely on it
and call pad-to anyway.
Note: in platform.sh, the boards are tested last in platform_check_image()
as this should eventually become the "*)" default case when more devices
switch to metadata images.
Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
-rwxr-xr-x | target/linux/ar71xx/base-files/lib/upgrade/platform.sh | 21 | ||||
-rw-r--r-- | target/linux/ar71xx/config-4.4 | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c | 18 | ||||
-rw-r--r-- | target/linux/ar71xx/image/mikrotik.mk | 9 |
4 files changed, 17 insertions, 32 deletions
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 7423c38c5f..d48135a6d3 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -344,11 +344,6 @@ platform_check_image() { ls-sr71|\ pb42|\ pb44|\ - rb-750-r2|\ - rb-750up-r2|\ - rb-941-2nd|\ - rb-951ui-2nd|\ - rb-mapl-2nd|\ routerstation-pro|\ routerstation|\ wp543|\ @@ -637,6 +632,14 @@ platform_check_image() { return 0; ;; + # these boards use metadata images + rb-750-r2|\ + rb-750up-r2|\ + rb-941-2nd|\ + rb-951ui-2nd|\ + rb-mapl-2nd) + return 0 + ;; esac echo "Sysupgrade is not yet supported on $board." @@ -707,14 +710,6 @@ platform_do_upgrade() { local board=$(ar71xx_board_name) case "$board" in - rb-750-r2|\ - rb-750up-r2|\ - rb-941-2nd|\ - rb-951ui-2nd|\ - rb-mapl-2nd) - PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD=1 - platform_do_upgrade_combined "$ARGV" - ;; all0258n) platform_do_upgrade_allnet "0x9f050000" "$ARGV" ;; diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index 0e2d786551..206ace62f7 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -380,6 +380,7 @@ CONFIG_MTD_SPLIT_LZMA_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_MTD_SPLIT_WRGG_FW=y +CONFIG_MTD_SPLIT_MINOR_FW=y CONFIG_MTD_TPLINK_PARTS=y CONFIG_MYLOADER=y CONFIG_NEED_DMA_MAP_STATE=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c index b6b3338845..aeeeca6243 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c @@ -60,7 +60,6 @@ #define RB_ROUTERBOOT_OFFSET 0x0000 #define RB_BIOS_SIZE 0x1000 #define RB_SOFT_CFG_SIZE 0x1000 -#define RB_KERNEL_SIZE (2 * 1024 * 1024) /* 2MB kernel */ /* Flash partitions indexes */ enum { @@ -69,8 +68,7 @@ enum { RBSPI_PART_BIOS, RBSPI_PART_RBOOT2, RBSPI_PART_SCONF, - RBSPI_PART_KERN, - RBSPI_PART_ROOT, + RBSPI_PART_FIRMW, RBSPI_PARTS }; @@ -79,8 +77,6 @@ static struct mtd_partition rbspi_spi_partitions[RBSPI_PARTS]; /* * Setup the SPI flash partition table based on initial parsing. * The kernel can be at any aligned position and have any size. - * The size of the kernel partition is the desired RB_KERNEL_SIZE - * minus the size of the preceding partitions (128KB). */ static void __init rbspi_init_partitions(const struct rb_info *info) { @@ -114,16 +110,10 @@ static void __init rbspi_init_partitions(const struct rb_info *info) parts[RBSPI_PART_SCONF].offset = info->soft_cfg_offs; parts[RBSPI_PART_SCONF].size = RB_SOFT_CFG_SIZE; - parts[RBSPI_PART_KERN].name = "kernel"; - parts[RBSPI_PART_KERN].offset = parts[RBSPI_PART_SCONF].offset + parts[RBSPI_PART_FIRMW].name = "firmware"; + parts[RBSPI_PART_FIRMW].offset = parts[RBSPI_PART_SCONF].offset + parts[RBSPI_PART_SCONF].size; - parts[RBSPI_PART_KERN].size = RB_KERNEL_SIZE - - parts[RBSPI_PART_KERN].offset; - - parts[RBSPI_PART_ROOT].name = "rootfs"; - parts[RBSPI_PART_ROOT].offset = parts[RBSPI_PART_KERN].offset - + parts[RBSPI_PART_KERN].size; - parts[RBSPI_PART_ROOT].size = MTDPART_SIZ_FULL; + parts[RBSPI_PART_FIRMW].size = MTDPART_SIZ_FULL; } static struct flash_platform_data rbspi_spi_flash_data = { diff --git a/target/linux/ar71xx/image/mikrotik.mk b/target/linux/ar71xx/image/mikrotik.mk index c7cf15d061..9338e5f916 100644 --- a/target/linux/ar71xx/image/mikrotik.mk +++ b/target/linux/ar71xx/image/mikrotik.mk @@ -27,14 +27,13 @@ TARGET_DEVICES += nand-64m nand-large define Device/rb-nor-flash-16M DEVICE_TITLE := MikroTik RouterBoard with 16 MB SPI NOR flash DEVICE_PACKAGES := rbcfg - BLOCKSIZE := 64k IMAGE_SIZE := 16000k LOADER_TYPE := elf KERNEL_INSTALL := 1 - KERNEL := kernel-bin | lzma | loader-kernel | kernel2minor -s 1024 -e - KERNEL_INITRAMFS := kernel-bin | lzma | loader-kernel - IMAGES := sysupgrade.bin - IMAGE/sysupgrade.bin = append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) + KERNEL := kernel-bin | lzma | loader-kernel + SUPPORTED_DEVICES := rb-750-r2 rb-750up-r2 rb-941-2nd rb-951ui-2nd rb-mapl-2nd + IMAGE/sysupgrade.bin = append-kernel | kernel2minor -s 1024 -e | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) endef TARGET_DEVICES += rb-nor-flash-16M |