mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-28 01:28:59 +00:00
3f7637b050
The Synology DS213j is a rather dated dual-bay SATA NAS based on on the Marvell Armada-370 SoC. It has long been supported in vanilla Linux, however, flash partitioning there didn't match with reality (ie. the bootloaders expectations) and nobody cared to wrap up OpenWrt support for the device. CPU: Marvell Armada-370 ARMv7 SoC @ 1200 MHz RAM: 512 MB DDR3 Flash: 8 MB (Micron Technology N25Q064) Network: 1x 1000M/100M/10M Ethernet (Marvell 88E1510) SATA: 2x 3.0Gbps USB: 2x USB 2.0 As OS options are becoming limited on that still quite useful hardware, patch the flash partitions to be able to get the most out of it when using OpenWrt. The vendor firmware loads kernel and initrd from fixed addresses in the flash, not making use of a modifyable environment stored in flash which is stored at a location right in the middle of the vendor's zImage partition (at 0x100000). Stock firmware flash layout: 0x000000 ~ 0x0c0000 : "RedBoot" (actually U-Boot) 0x0c0000 ~ 0x390000 : "zImage" 0x390000 ~ 0x7d0000 : "rd.gz" 0x7d0000 ~ 0x7e0000 : "vendor" (contains MAC address, serial no) 0x7e0000 ~ 0x7f0000 : "RedBoot Config" (unused? legacy left-over) 0x7f0000 ~ 0x800000 : "FIS directory" (unused? legacy left-over) OpenWrt flash layout: 0x000000 ~ 0x0c0000 : "u-boot" 0x0c0000 ~ 0x100000 : "gap" 0x100000 ~ 0x110000 : "u-boot-env" 0x110000 ~ 0x7d0000 : "kernel" 0x7d0000 ~ 0x7e0000 : "vendor" (contains MAC address, serial no) 0x7e0000 ~ 0x800000 : "gap2" "kernel", "gap" and "gap2" are concatenated using the mtd-concat virtual MTD driver, resulting in a partition "firmware" used by OpenWrt for kernel, rootfs and rootfs-overlay, 0x720000 (7296kiB) in total. Installation: 1. Connect to internal serial console port and Ethernet port, providing a TFTP server at a static IPv4 address, e.g. 192.168.1.254/24. 2. Interrupt bootloader using CTRL+C 3. Configure bootloader to load OpenWrt on future boot: setenv bootcmd "bootm f4110000" saveenv 4. Load and boot initramfs image via TFTP: setenv ipaddr 192.168.1.1 setenv serverip 192.168.1.254 tftpboot openwrt-mvebu-cortexa9-synology_ds213j-initramfs-kernel.bin bootm 5. Use sysupgrade to load final image. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
135 lines
3.2 KiB
Diff
135 lines
3.2 KiB
Diff
--- a/arch/arm/boot/dts/armada-370-synology-ds213j.dts
|
|
+++ b/arch/arm/boot/dts/armada-370-synology-ds213j.dts
|
|
@@ -31,6 +31,7 @@
|
|
|
|
chosen {
|
|
stdout-path = "serial0:115200n8";
|
|
+ append-rootblock = "nullparameter="; /* override the bootloader args */
|
|
};
|
|
|
|
memory@0 {
|
|
@@ -94,6 +95,8 @@
|
|
status = "okay";
|
|
phy = <&phy1>;
|
|
phy-mode = "sgmii";
|
|
+ nvmem-cells = <&macaddr_vendor_0>;
|
|
+ nvmem-cell-names = "mac-address";
|
|
};
|
|
|
|
sata@a0000 {
|
|
@@ -175,6 +178,24 @@
|
|
gpio = <&gpio1 30 GPIO_ACTIVE_HIGH>;
|
|
};
|
|
};
|
|
+
|
|
+ virtual_flash {
|
|
+ compatible = "mtd-concat";
|
|
+
|
|
+ devices = <&mtd_kernel &mtd_gap &mtd_gap2>;
|
|
+
|
|
+ partitions {
|
|
+ compatible = "fixed-partitions";
|
|
+ #address-cells = <1>;
|
|
+ #size-cells = <1>;
|
|
+
|
|
+ partition@0 {
|
|
+ compatible = "openwrt,uimage", "denx,uimage";
|
|
+ label = "firmware";
|
|
+ reg = <0x0 0x0>;
|
|
+ };
|
|
+ };
|
|
+ };
|
|
};
|
|
|
|
&mdio {
|
|
@@ -265,48 +286,52 @@
|
|
reg = <0>; /* Chip select 0 */
|
|
spi-max-frequency = <20000000>;
|
|
|
|
- /*
|
|
- * Warning!
|
|
- *
|
|
- * Synology u-boot uses its compiled-in environment
|
|
- * and it seems Synology did not care to change u-boot
|
|
- * default configuration in order to allow saving a
|
|
- * modified environment at a sensible location. So,
|
|
- * if you do a 'saveenv' under u-boot, your modified
|
|
- * environment will be saved at 1MB after the start
|
|
- * of the flash, i.e. in the middle of the uImage.
|
|
- * For that reason, it is strongly advised not to
|
|
- * change the default environment, unless you know
|
|
- * what you are doing.
|
|
- */
|
|
- partition@0 { /* u-boot */
|
|
- label = "RedBoot";
|
|
- reg = <0x00000000 0x000c0000>; /* 768KB */
|
|
- };
|
|
+ partitions {
|
|
+ compatible = "fixed-partitions";
|
|
|
|
- partition@c0000 { /* uImage */
|
|
- label = "zImage";
|
|
- reg = <0x000c0000 0x002d0000>; /* 2880KB */
|
|
- };
|
|
+ partition@0 { /* u-boot */
|
|
+ label = "u-boot";
|
|
+ reg = <0x00000000 0x000c0000>; /* 768KB */
|
|
+ read-only;
|
|
+ };
|
|
|
|
- partition@390000 { /* uInitramfs */
|
|
- label = "rd.gz";
|
|
- reg = <0x00390000 0x00440000>; /* 4250KB */
|
|
- };
|
|
+ mtd_gap: partition@c0000 { /* gap */
|
|
+ label = "gap";
|
|
+ reg = <0x000c0000 0x00040000>; /* 256KB */
|
|
+ };
|
|
|
|
- partition@7d0000 { /* MAC address and serial number */
|
|
- label = "vendor";
|
|
- reg = <0x007d0000 0x00010000>; /* 64KB */
|
|
- };
|
|
+ partition@100000 { /* u-boot-env */
|
|
+ label = "u-boot-env";
|
|
+ reg = <0x00100000 0x00010000>; /* 64KB */
|
|
+ };
|
|
|
|
- partition@7e0000 {
|
|
- label = "RedBoot config";
|
|
- reg = <0x007e0000 0x00010000>; /* 64KB */
|
|
- };
|
|
+ mtd_kernel: partition@110000 {
|
|
+ label = "kernel";
|
|
+ reg = <0x00110000 0x006c0000>; /* 6912KB */
|
|
+ };
|
|
|
|
- partition@7f0000 {
|
|
- label = "FIS directory";
|
|
- reg = <0x007f0000 0x00010000>; /* 64KB */
|
|
+ partition@7d0000 { /* MAC address and serial number */
|
|
+ reg = <0x007d0000 0x00010000>; /* 64KB */
|
|
+ label = "vendor";
|
|
+ read-only;
|
|
+
|
|
+ compatible = "nvmem-cells";
|
|
+
|
|
+ nvmem-layout {
|
|
+ compatible = "fixed-layout";
|
|
+ #address-cells = <1>;
|
|
+ #size-cells = <1>;
|
|
+
|
|
+ macaddr_vendor_0: macaddr@0 {
|
|
+ reg = <0x0 0x6>;
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+
|
|
+ mtd_gap2: partition@7e0000 {
|
|
+ label = "gap2";
|
|
+ reg = <0x007e0000 0x00020000>; /* 128KB */
|
|
+ };
|
|
};
|
|
};
|
|
};
|