2019年8月18日日曜日

Openwrtでオレオレなレポジトリ

暑くてやる気が1/3くらいになっている。
そんなんで、いろいろミスするよね・・・。
今回は、fon2405e改にasterisk入れようと思ったけど、フラッシュメモリ8MBじゃあ到底入らなかった。
事前に検証しておけばよかったね。
ということで、タイトルがこんな感じになっている。

久しぶりのソースからビルド

基本的には、前回と同じだけど。
https://continue-to-challenge.blogspot.com/2019/01/fon2405eopenwrt.html
fon2405e用にいくつか変えないといけない。

Openwrtのソース取得→生成

git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a

ベースとなる変更

変更点は以下の3ファイル
ファイル名だったりが前回と違うみたい。
grep -lri fon2405e target/
target/linux/ramips/image/rt305x.mk
target/linux/ramips/dts/rt3050_fon_fon2405ekai.dts
target/linux/ramips/base-files/etc/board.d/01_leds

rt305x.mk

前回と記載内容がちょっと異なる。
@@ -527,6 +527,16 @@ define Device/fon_fonera-20n
 endef
 TARGET_DEVICES += fon_fonera-20n
 
 +define Device/fon_fon2405ekai
+  MTK_SOC := rt3050
+  IMAGE_SIZE := 7872k
+  IMAGES += factory.bin
+  DEVICE_VENDOR := Fon
+  DEVICE_MODEL := Fon2405ekai
+  SUPPORTED_DEVICES += fon_fon2405ekai
+endef
+TARGET_DEVICES += fon_fon2405ekai
+
 define Device/hame_mpr-a1
   MTK_SOC := rt5350
   BLOCKSIZE := 4k

rt3050_fon_fon2405ekai.dts

[partition@20000]に「compatible = “denx,uimage”;」を追加した。
これがないとoverlayが出来ないみたい。
@@ -0,0 +1,104 @@
+/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";
+
+ aliases {
+  led-boot = &led_power_green;
+  led-failsafe = &led_power_green;
+  led-running = &led_power_green;
+  led-upgrade = &led_power_green;
+ };
+
+ gpio-keys-polled {
+  compatible = "gpio-keys-polled";
+  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>;
+  };
+  led_power_green: 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 {
+  compatible = "jedec,spi-nor";
+  reg = <0>;
+  spi-max-frequency = <10000000>;
+
+  partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+            partition@0 {
+                label = "u-boot";
+                reg = <0x0 0x10000>;
+                read-only;
+            };
+
+            devconf: partition@10000 {
+                label = "devconf";
+                reg = <0x10000 0x10000>;
+                read-only;
+            };
+
+            firmware: partition@20000 {
+                compatible = "denx,uimage";
+                label = "firmware";
+                reg = <0x20000 0x7b0000>;
+            };
+        };
+ };
+};
+
+&pinctrl {
+ state_default: pinctrl0 {
+  gpio {
+   ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf";
+   ralink,function = "gpio";
+  };
+ };
+};
+
+&ethernet {
+ mtd-mac-address = <&devconf 0x4>;
+};
+
+&esw {
+ mediatek,portmap = <0x2f>;
+};
+
+&wmac {
+ ralink,mtd-eeprom = <&devconf 0>;
+};

01_leds

@@ -170,6 +170,7 @@ dlink,dwr-922-e2)
  ucidef_set_led_netdev "4g" "4g" "$boardname:green:4g" "wwan0" "tx rx"
  ;;
 dovado,tiny-ac|\
+fon,fon2405ekai|\
 fon,fonera-20n)
  set_wifi_led "$boardname:orange:wifi"
  ;;

ビルド

make -j4 V=99
ls -l bin/targets/ramips/rt305x/
合計 9972
-rw-r--r-- 1 adeno adeno    2505  8月 18 16:36 config.buildinfo
-rw-r--r-- 1 adeno adeno     263  8月 18 16:36 feeds.buildinfo
-rw-r--r-- 1 adeno adeno    3099  8月 18 16:39 openwrt-ramips-rt305x-fon-fon2405ekai.manifest
-rw-r--r-- 1 adeno adeno 3361462  8月 18 16:39 openwrt-ramips-rt305x-fon_fon2405ekai-initramfs-kernel.bin
-rw-r--r-- 1 adeno adeno 3407898  8月 18 16:39 openwrt-ramips-rt305x-fon_fon2405ekai-squashfs-factory.bin
-rw-r--r-- 1 adeno adeno 3408666  8月 18 16:39 openwrt-ramips-rt305x-fon_fon2405ekai-squashfs-sysupgrade.bin
drwxr-xr-x 2 adeno adeno    4096  8月 18 16:37 packages
-rw-r--r-- 1 adeno adeno     740  8月 18 16:39 sha256sums
-rw-r--r-- 1 adeno adeno      17  8月 18 16:36 version.buildinfo
これの[openwrt-ramips-rt305x-fon_fon2405ekai-initramfs-kernel.bin]を使って書き換えを行う

Luciアクセス

Web(Lcui)にアクセスしてみる


(OpenWrt SNAPSHOT, r0+10779-51fec85)

[openwrt-ramips-rt305x-fon_fon2405ekai-squashfs-sysupgrade.bin]にてファームアップを行う。これで、overlayされる。
#df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.0M      3.0M         0 100% /rom
tmpfs                    13.9M    432.0K     13.5M   3% /tmp
tmpfs                    13.9M     68.0K     13.8M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock5            4.5M    248.0K      4.2M   5% /overlay
overlayfs:/overlay        4.5M    248.0K      4.2M   5% /
これで準備できた

オレオレなリポジトリ

https://qiita.com/hnw/items/17f3a63dbc153f8a5c34
を参考にオレオレのリポジトリを追加する

サーバー側の準備

ls -l bin/packages/mipsel_24kc/
合計 20
drwxr-xr-x 2 adeno adeno 4096  8月 18 16:37 base
drwxr-xr-x 2 adeno adeno 4096  8月 18 02:10 luci
drwxr-xr-x 2 adeno adeno 4096  8月 18 02:11 packages
drwxr-xr-x 2 adeno adeno 4096  8月 18 01:30 routing
drwxr-xr-x 2 adeno adeno 4096  8月 18 16:38 telephony
このデイレクトリをルートにhttpサーバーを構築する。
今回は一時的に欲しいだけなのでphpを用いて
php -S 192.168.2.10:8000
これでOK

デバイス側の準備

/etc/opkg/customfeeds.conf
# add your custom package feeds here
#
# src/gz example_feed_name http://www.example.com/path/to/files
src/gz my_feed_base http://192.168.2.10:8000/base
src/gz my_feed_luci http://192.168.2.10:8000/luci
src/gz my_feed_packages http://192.168.2.10:8000/packages
src/gz my_feed_routing http://192.168.2.10:8000/routing
src/gz my_feed_telephony http://192.168.2.10:8000/telephony
これでOK
opkg updateとかやってみて、ちゃんとオレオレから取得出るかを確認する

asteriskのインストール(容量不足で失敗)

opkg install asterisk16 asterisk16-cdr asterisk16-chan-sip \
asterisk16-codec-gsm asterisk16-codec-ulaw asterisk16-format-gsm \
asterisk16-format-pcm asterisk16-res-agi asterisk16-res-rtp-asterisk
途中まではうまく行ったけど、容量不足で失敗…。
こうなったらeMMCとかMMCカードか?
今日はここまで。

0 件のコメント:

コメントを投稿