aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
Diffstat (limited to 'target')
-rw-r--r--target/linux/gemini/config-4.142
-rw-r--r--target/linux/gemini/config-4.192
-rw-r--r--target/linux/gemini/image/Makefile23
-rw-r--r--target/linux/gemini/patches-4.19/0019-ARM-dts-gemini-Indent-DIR-685-partition-table.patch110
-rw-r--r--target/linux/gemini/patches-4.19/0020-ARM-dts-Augment-DIR-685-partition-table-for-OpenWrt.patch40
5 files changed, 174 insertions, 3 deletions
diff --git a/target/linux/gemini/config-4.14 b/target/linux/gemini/config-4.14
index 326b05c089..ef5900771e 100644
--- a/target/linux/gemini/config-4.14
+++ b/target/linux/gemini/config-4.14
@@ -277,6 +277,8 @@ CONFIG_MTD_CFI_STAA=y
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_OF_GEMINI=y
+CONFIG_MTD_SPLIT_FIRMWARE=y
+CONFIG_MTD_SPLIT_WRGG_FW=y
CONFIG_MULTI_IRQ_HANDLER=y
CONFIG_NAMESPACES=y
CONFIG_NEED_DMA_MAP_STATE=y
diff --git a/target/linux/gemini/config-4.19 b/target/linux/gemini/config-4.19
index 7025ec149c..014175ea13 100644
--- a/target/linux/gemini/config-4.19
+++ b/target/linux/gemini/config-4.19
@@ -330,6 +330,8 @@ CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_OF_GEMINI=y
CONFIG_MTD_REDBOOT_PARTS=y
+CONFIG_MTD_SPLIT_FIRMWARE=y
+CONFIG_MTD_SPLIT_WRGG_FW=y
CONFIG_NAMESPACES=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_KUSER_HELPERS=y
diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile
index 7fcac8051f..9dd37ab702 100644
--- a/target/linux/gemini/image/Makefile
+++ b/target/linux/gemini/image/Makefile
@@ -10,8 +10,8 @@ include $(INCLUDE_DIR)/image.mk
# Cook a "WRGG" image, this board is apparently one in the D-Link
# WRGG family and uses the exact same firmware format as other
# D-Link devices.
-define Build/dir685-images
- mkwrggimg -i $(IMAGE_KERNEL) \
+define Build/dir685-image
+ mkwrggimg -i $@ \
-o $@.new \
-d /dev/mtdblock/1 \
-s wrgns01_dlwbr_dir685RBWW \
@@ -22,6 +22,12 @@ define Build/dir685-images
mv $@.new $@
endef
+# Padding added after the rootfs to an even 128k boundary
+# as this is 128k eraseblocks flash.
+define Build/dir685-pad-rootfs
+ $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 128 >>$@
+endef
+
# Build D-Link DNS-313 images using the special header tool.
# rootfs.tgz and rd.tgz contains nothing, we only need them
# to satisfy the boot loader on the device. The zImage is
@@ -121,6 +127,16 @@ GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \
samba36-server mdadm cfdisk fdisk e2fsprogs badblocks \
partx-utils
+# The DIR-685 flash layout is kernel in WRGG format, padded and followed
+# by the appended rootfs followed by some reasonable JFFS padding, the
+# remainder will be used by JFFS2 through overlayfs.
+#
+# - For the factory image, the WRGG image includes the rootfs so that the
+# default firmware will flash it properly as all it knows is WRGG format.
+# - For the sysupgrade, we do not include the rootfs in the kernel image
+# so it is not needelessly tossed into the RAM by the boot loader.
+# This will be flashed from OpenWrt userland anyways so we only need
+# the minimum to make the boot loader happy.
define Device/dlink_dir-685
DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router
DEVICE_DTS := gemini-dlink-dir-685
@@ -128,7 +144,8 @@ define Device/dlink_dir-685
kmod-switch-rtl8366rb swconfig \
kmod-rt2800-pci
IMAGES := factory.bin
- IMAGE/factory.bin := dir685-images
+ # Pad to 128k erase blocks with 160 bytes WRGG header
+ IMAGE/factory.bin := append-kernel | pad-offset 128k 160 | append-rootfs | dir685-pad-rootfs | dir685-image
endef
TARGET_DEVICES += dlink_dir-685
diff --git a/target/linux/gemini/patches-4.19/0019-ARM-dts-gemini-Indent-DIR-685-partition-table.patch b/target/linux/gemini/patches-4.19/0019-ARM-dts-gemini-Indent-DIR-685-partition-table.patch
new file mode 100644
index 0000000000..b121ca174e
--- /dev/null
+++ b/target/linux/gemini/patches-4.19/0019-ARM-dts-gemini-Indent-DIR-685-partition-table.patch
@@ -0,0 +1,110 @@
+From 4a228ecf553e879bae384e634bb6413438e81a0e Mon Sep 17 00:00:00 2001
+From: Linus Walleij <linus.walleij@linaro.org>
+Date: Mon, 11 Mar 2019 15:43:05 +0100
+Subject: [PATCH 1/2] ARM: dts: gemini: Indent DIR-685 partition table
+
+It is discouraged to have OF partitions as subnodes directly
+under the device, create a "partitions" subnode and put the
+partitions inside it.
+
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+---
+ arch/arm/boot/dts/gemini-dlink-dir-685.dts | 82 ++++++++++++----------
+ 1 file changed, 44 insertions(+), 38 deletions(-)
+
+diff --git a/arch/arm/boot/dts/gemini-dlink-dir-685.dts b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
+index 9b2824816ddc..50ff65d95f26 100644
+--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts
++++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
+@@ -267,44 +267,50 @@
+ /* 32MB of flash */
+ reg = <0x30000000 0x02000000>;
+
+- /*
+- * This "RedBoot" is the Storlink derivative.
+- */
+- partition@0 {
+- label = "RedBoot";
+- reg = <0x00000000 0x00040000>;
+- read-only;
+- };
+- /*
+- * This firmware image contains the kernel catenated
+- * with the squashfs root filesystem. For some reason
+- * this is called "upgrade" on the vendor system.
+- */
+- partition@40000 {
+- label = "upgrade";
+- reg = <0x00040000 0x01f40000>;
+- read-only;
+- };
+- /* RGDB, Residental Gateway Database? */
+- partition@1f80000 {
+- label = "rgdb";
+- reg = <0x01f80000 0x00040000>;
+- read-only;
+- };
+- /*
+- * This partition contains MAC addresses for WAN,
+- * WLAN and LAN, and the country code (for wireless
+- * I guess).
+- */
+- partition@1fc0000 {
+- label = "nvram";
+- reg = <0x01fc0000 0x00020000>;
+- read-only;
+- };
+- partition@1fe0000 {
+- label = "LangPack";
+- reg = <0x01fe0000 0x00020000>;
+- read-only;
++ partitions {
++ compatible = "fixed-partitions";
++ #address-cells = <1>;
++ #size-cells = <1>;
++
++ /*
++ * This "RedBoot" is the Storlink derivative.
++ */
++ partition@0 {
++ label = "RedBoot";
++ reg = <0x00000000 0x00040000>;
++ read-only;
++ };
++ /*
++ * This firmware image contains the kernel catenated
++ * with the squashfs root filesystem. For some reason
++ * this is called "upgrade" on the vendor system.
++ */
++ partition@40000 {
++ label = "upgrade";
++ reg = <0x00040000 0x01f40000>;
++ read-only;
++ };
++ /* RGDB, Residental Gateway Database? */
++ partition@1f80000 {
++ label = "rgdb";
++ reg = <0x01f80000 0x00040000>;
++ read-only;
++ };
++ /*
++ * This partition contains MAC addresses for WAN,
++ * WLAN and LAN, and the country code (for wireless
++ * I guess).
++ */
++ partition@1fc0000 {
++ label = "nvram";
++ reg = <0x01fc0000 0x00020000>;
++ read-only;
++ };
++ partition@1fe0000 {
++ label = "LangPack";
++ reg = <0x01fe0000 0x00020000>;
++ read-only;
++ };
+ };
+ };
+
+--
+2.20.1
+
diff --git a/target/linux/gemini/patches-4.19/0020-ARM-dts-Augment-DIR-685-partition-table-for-OpenWrt.patch b/target/linux/gemini/patches-4.19/0020-ARM-dts-Augment-DIR-685-partition-table-for-OpenWrt.patch
new file mode 100644
index 0000000000..bf044e0c69
--- /dev/null
+++ b/target/linux/gemini/patches-4.19/0020-ARM-dts-Augment-DIR-685-partition-table-for-OpenWrt.patch
@@ -0,0 +1,40 @@
+From 854934b0ce8e758ce581f5ddbc30e618ab46fbdb Mon Sep 17 00:00:00 2001
+From: Linus Walleij <linus.walleij@linaro.org>
+Date: Mon, 11 Mar 2019 15:44:29 +0100
+Subject: [PATCH 2/2] ARM: dts: Augment DIR-685 partition table for OpenWrt
+
+Rename the firmware partition so that the firmware MTD
+splitter will do its job, drop the rootfs arguments as
+the MTD splitter will set this up automatically.
+
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+---
+ arch/arm/boot/dts/gemini-dlink-dir-685.dts | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/boot/dts/gemini-dlink-dir-685.dts b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
+index 50ff65d95f26..7db30cc9d189 100644
+--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts
++++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
+@@ -20,7 +20,7 @@
+ };
+
+ chosen {
+- bootargs = "console=ttyS0,19200n8 root=/dev/sda1 rw rootwait consoleblank=300";
++ bootargs = "console=ttyS0,19200n8 consoleblank=300";
+ stdout-path = "uart0:19200n8";
+ };
+
+@@ -286,7 +286,8 @@
+ * this is called "upgrade" on the vendor system.
+ */
+ partition@40000 {
+- label = "upgrade";
++ compatible = "wrg";
++ label = "firmware";
+ reg = <0x00040000 0x01f40000>;
+ read-only;
+ };
+--
+2.20.1
+