http://continue-to-challenge.blogspot.jp/2016/11/fon2405e_28.html
またまた魔が差して、 他の基板からMX25L6405D (8192 Kbytes)を引っぺがして交換してみた。
もともと乗っていたのがMX25L8006Eだから上位品?。
すんなりU-Bootでのファーム書き換えはできた。
せっかくなので、OpenwrtからスピンオフしたというLEDEを導入してみることにした。
手順0 フラッシュ交換メモ
忘れそうなので・・・。
0.u-boot他を旧フラッシュからバックアップ
cat /dev/mtdblock0 > /tmp/mtdblock0.img <Uboot>3と4はu-bootから書き込むからここではバックアップしない
cat /dev/mtdblock1 > /tmp/mtdblock1.img <Config>
cat /dev/mtdblock2 > /tmp/mtdblock2.img <RF>
mtdblock0-2.imgはPCに退避させておく
1.u-bootの起動メニューで「2」入力しコンソール?に入る
2.通電状態でフラッシュ交換する(ハイリスク!)
3.ファーム書き換えを実行
KernelとRootFSが書き換えられ、その後linuxのブートに入る
4.新フラッシュにu-boot他を書き込む
cp /tmp/mtdblock0.img /dev/mtdblock0今思えばu-bootさえ書き込めれば、あとはLEDE書き込むから
cp /tmp/mtdblock1.img /dev/mtdblock1
cp /tmp/mtdblock2.img /dev/mtdblock2
別にやらなくても良かった。
手順1 LEDEのカーネルソース入手
基本的には以下の手順だけど
https://lede-project.org/docs/guide-developer/the-source-code
https://lede-project.org/docs/guide-developer/use-buildsystem
具体的な手順は次のような感じ。簡単だね。
git clone https://git.lede-project.org/source.git
./scripts/feeds update -a
./scripts/feeds install -a
手順2 FON2405E用にカスタマイズ・Device Tree Source (dts)を作成
オリジナルのFON2405Eとは違うのでFON2405EKAI(改)とした。
変更点をpatchにしてみた。
完成するまでは紆余曲折あって大変だったけど。 改めてみると変更点って大したこと無いね。
(実は9月末くらいから悩みながらやっていた)
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
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh | |
index 4411bab..2b2db97 100644 | |
--- a/target/linux/ramips/base-files/etc/diag.sh | |
+++ b/target/linux/ramips/base-files/etc/diag.sh | |
@@ -304,6 +304,9 @@ get_status_led() { | |
zbt-wg3526-32M) | |
status_led="zbt-wg3526:green:status" | |
;; | |
+ fon2405ekai) | |
+ status_led="fon2405ekai:green:wps" | |
+ ;; | |
esac | |
} | |
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh | |
index 07e776c..61c9fb2 100755 | |
--- a/target/linux/ramips/base-files/lib/ramips.sh | |
+++ b/target/linux/ramips/base-files/lib/ramips.sh | |
@@ -457,6 +457,9 @@ ramips_board_detect() { | |
*"RT-G32 B1") | |
name="rt-g32-b1" | |
;; | |
+ *"FON2405E Kai") | |
+ name="fon2405ekai" | |
+ ;; | |
*"RT-N10+") | |
name="rt-n10-plus" | |
;; | |
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh | |
index 99ebe35..8e7df68 100755 | |
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh | |
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh | |
@@ -58,6 +58,7 @@ platform_check_image() { | |
f7c027|\ | |
firewrt|\ | |
fonera20n|\ | |
+ fon2405ekai|\ | |
freestation5|\ | |
gb-pc1|\ | |
gl-mt300a|\ | |
diff --git a/target/linux/ramips/dts/FON2405EKAI.dts b/target/linux/ramips/dts/FON2405EKAI.dts | |
index e69de29..f811ca1 100644 | |
--- a/target/linux/ramips/dts/FON2405EKAI.dts | |
+++ b/target/linux/ramips/dts/FON2405EKAI.dts | |
@@ -0,0 +1,94 @@ | |
+/dts-v1/; | |
+ | |
+#include "rt3050.dtsi" | |
+ | |
+#include <dt-bindings/gpio/gpio.h> | |
+#include <dt-bindings/input/input.h> | |
+ | |
+/ { | |
+ compatible = "fon,fon2405ekai", "ralink,rt3050-soc"; | |
+ model = "FON2405E Kai"; | |
+ | |
+ gpio-keys-polled { | |
+ compatible = "gpio-keys-polled"; | |
+ #address-cells = <1>; | |
+ #size-cells = <0>; | |
+ poll-interval = <20>; | |
+ | |
+ reset { | |
+ label = "reset"; | |
+ gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; | |
+ linux,code = <KEY_RESTART>; | |
+ }; | |
+ | |
+ wps { | |
+ label = "wps"; | |
+ gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; | |
+ linux,code = <KEY_WPS_BUTTON>; | |
+ }; | |
+ }; | |
+ gpio-leds { | |
+ compatible = "gpio-leds"; | |
+ wan { | |
+ label = "fon2405ekai:green:wan"; | |
+ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ LAN { | |
+ label = "fon2405ekai:green:lan"; | |
+ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ WPS { | |
+ label = "fon2405ekai:green:wps"; | |
+ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&spi0 { | |
+ status = "okay"; | |
+ | |
+ m25p80@0 { | |
+ #address-cells = <1>; | |
+ #size-cells = <1>; | |
+ compatible = "jedec,spi-nor"; | |
+ reg = <0>; | |
+ spi-max-frequency = <10000000>; | |
+ | |
+ partition@0 { | |
+ label = "u-boot"; | |
+ reg = <0x0 0x10000>; | |
+ read-only; | |
+ }; | |
+ | |
+ devconf: partition@10000 { | |
+ label = "devconf"; | |
+ reg = <0x10000 0x10000>; | |
+ read-only; | |
+ }; | |
+ firmware: partition@20000 { | |
+ label = "firmware"; | |
+ reg = <0x20000 0x7b0000>; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+&pinctrl { | |
+ state_default: pinctrl0 { | |
+ gpio { | |
+ ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf"; | |
+ ralink,function = "gpio"; | |
+ }; | |
+ }; | |
+}; | |
+ | |
+ðernet { | |
+ mtd-mac-address = <&devconf 0x4>; | |
+}; | |
+ | |
+&esw { | |
+ mediatek,portmap = <0x2f>; | |
+}; | |
+ | |
+&wmac { | |
+ ralink,mtd-eeprom = <&devconf 0>; | |
+}; | |
diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk | |
index 4e82eb4..b6ff7c0 100644 | |
--- a/target/linux/ramips/image/rt305x.mk | |
+++ b/target/linux/ramips/image/rt305x.mk | |
@@ -623,6 +623,14 @@ define Device/rt-g32-b1 | |
endef | |
TARGET_DEVICES += rt-g32-b1 | |
+define Device/fon2405ekai | |
+ DTS := FON2405EKAI | |
+ BLOCKSIZE := 4k | |
+ IMAGE_SIZE := $(ralink_default_fw_size_8M) | |
+ DEVICE_TITLE := FON FON2405E KAI | |
+endef | |
+TARGET_DEVICES += fon2405ekai | |
+ | |
define Device/rt-n10-plus | |
DTS := RT-N10-PLUS | |
BLOCKSIZE := 64k | |
diff --git a/target/linux/ramips/rt305x/config-4.9 b/target/linux/ramips/rt305x/config-4.9 | |
index d7b5303..309094f 100644 | |
--- a/target/linux/ramips/rt305x/config-4.9 | |
+++ b/target/linux/ramips/rt305x/config-4.9 | |
@@ -110,6 +110,7 @@ CONFIG_IRQ_FORCED_THREADING=y | |
CONFIG_IRQ_INTC=y | |
CONFIG_IRQ_MIPS_CPU=y | |
CONFIG_IRQ_WORK=y | |
+CONFIG_LEDS_GPIO=y | |
CONFIG_LIBFDT=y | |
CONFIG_MDIO_BOARDINFO=y | |
CONFIG_MIPS=y | |
@@ -192,6 +193,5 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y | |
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y | |
CONFIG_SYS_SUPPORTS_MIPS16=y | |
CONFIG_TICK_CPU_ACCOUNTING=y | |
-CONFIG_USB_SUPPORT=y | |
CONFIG_USE_OF=y | |
CONFIG_WATCHDOG_CORE=y |
手順3 カーネルイメージ作成
適宜、設定を行う
make menuconfigそして
make kernel_menuconfig
make -j4 V=99
lede-ramips-rt305x-fon2405ekai-initramfs-kernel.bin
lede-ramips-rt305x-fon2405ekai-squashfs-sysupgrade.bin
が作成される
手順4 ファームアップ
まずは、u-bootからファームアップを行う
lede-ramips-rt305x-fon2405ekai-initramfs-kernel.bin
を使う。
これで起動すると・・・。
[ 4.689131] m25p80 spi0.0: mx25l6405d (8192 Kbytes)と、rootfsがない状態になる。
[ 4.699191] 3 ofpart partitions found on MTD device spi0.0
[ 4.710330] Creating 3 MTD partitions on "spi0.0":
[ 4.720086] 0x000000000000-0x000000010000 : "u-boot"
[ 4.733996] 0x000000010000-0x000000020000 : "devconf"
[ 4.749129] 0x000000020000-0x0000007d0000 : "firmware"
設定変更しても反映されない悲しい状態。
どうやらsysupgradeにて再度ファームアップが必要みたい(たぶん)。
sysupgrade -v /tmp/lede-ramips-rt305x-fon2405ekai-squashfs-sysupgrade.bin
このあと起動すると
[ 0.614392] m25p80 spi0.0: mx25l6405d (8192 Kbytes)となった。やったー。
[ 0.624447] 3 ofpart partitions found on MTD device spi0.0
[ 0.635587] Creating 3 MTD partitions on "spi0.0":
[ 0.645343] 0x000000000000-0x000000010000 : "u-boot"
[ 0.659229] 0x000000010000-0x000000020000 : "devconf"
[ 0.674223] 0x000000020000-0x0000007d0000 : "firmware"
[ 1.385424] 2 uimage-fw partitions found on MTD device firmware
[ 1.397553] 0x000000020000-0x000000147454 : "kernel"
[ 1.411314] 0x000000147454-0x0000007d0000 : "rootfs"
[ 1.426108] mtd: device 4 (rootfs) set to be root filesystem
[ 1.439008] 1 squashfs-split partitions found on MTD device rootfs
[ 1.451676] 0x000000331000-0x0000007d0000 : "rootfs_data"
Luciも開けた!
諦めずにやってよかったー。
//SST26VF032bもどうにかしないと
<参考>
https://wiki.openwrt.org/doc/devel/add.new.platform
https://wiki.openwrt.org/doc/devel/add.new.device
https://wiki.openwrt.org/doc/howto/build
https://wiki.openwrt.org/doc/techref/flash.layout
https://lede-project.org/docs/user-guide/extroot_configuration
http://rainbowdevil.jp/?p=1247
http://www.srchack.org/article.php?story=20150829103857687