大破ログ

日々大破、それと側転少々。PC関連その他、気になったことなどをつらつらと。

WXR-2533DHPをOpenWrtでサポートしてみる(経過報告)

2019/02/17 追記: WXR-2533DHPは既にOpenWrt公式にてサポート済みです。

Twitterのほうで色々悩みながら進めてるOpenWrt (LEDE)におけるBUFFALO WXR-2533DHPのサポート追加ですが、まだまだ終わりが見えません。なのでとりあえず経過報告です。

状況

  • OpenWrtのinitramfsイメージでブートできる
    • U-Bootから [sourcecode] run ramboot [/sourcecode]を実行すると、192.168.11.10に "wxr2300-initramfs.uImage" を取りに行く
  • initramfsでブートして、ubiformatを使用してmtd0にOpenWrtを焼き込んで再起動、U-Bootのイメージチェックを特定の操作で回避するとOpenWrtでブートできる
    • ブート中断してU-Bootのコンソールに入り、 [sourcecode] bootipq [/sourcecode]を実行
  • 回避策を使わずにそのままブートさせた場合、U-BootによるNAND内bank1, bank2のチェックの際にrootfsのchecksumがエラーだとして弾かれ、bank2からbank1へ書き戻されてしまう
  • U-Bootがチェックに使用するchecksumは、kernelはヘッダに含まれるdata CRC、rootfsは末尾 1Byte
    • v1.32では 0x64 、v1.33では 0xD3
    • メーカーのアップデートファームを展開した場合、rootfsのchecksumの後ろにさらに不明な値が 1Byte付く。
  • rootfsのchecksum算出方法が不明

U-Bootやハードウェアなどの詳細に関しては、雑記の WXR-2533DHP - 大破雑記帳 を参照

作業用OpenWrt リポジトリ

2020/04/19 追記: WXR-2533DHPのサポートは既に完了し、OpenWrt本体にマージ済みのため下記branchは削除しました。

musashino-build/openwrt - devadd/wxr-2533dhp

OpenWrt ファーム

現状ビルドできているファーム。LEDはWANやLAN、USBなどにそれぞれ設定済み taiha.net/jenkins

  • initramfs
    • openwrt-ipq806x-WXR-2533DHP-initramfs-uImage
      run ramboot用
  • squashfs
    • openwrt-ipq806x-WXR-2533DHP-squashfs-nand-factory.ubi
      initramfsでの [sourcecode] ubiformat -f /dev/mtd0 [/sourcecode] 実行用
  • factory
    • openwrt-ipq806x-WXR-2533DHP-squashfs-factory.bin
      factoryイメージ(を目指したいもの)。現状正しく投入できず要調整(作り方はたぶんar71xxのBHR-4GRV2が近い)

一言

rootfsのchecksumがどこにあるのか謎だったところから進んだが、今度はchecksumの算出方法が全く分からない。詳しい方、いつでもお待ちしております。

ログ

  • bootm="bootipq debug"(一部) [sourcecode] BUFFALO WXR-2533DHP U-Boot Ver 1.14 (May 18 2015 - 13:24:36) CPU: IPQ8064 clock 1.4 GHz DRAM: DDR3 512 MiB clock 533 MHz NAND: ECC 4 bits, 256 MiB SF: Detected W25Q32 with page size 64 KiB, total 4 MiB MMC: In: serial Out: serial Err: serial cdp: get part failed for 0:HLOS cdp: get part failed for rootfs Net: MAC2 addr:74:3:bd:bc:1d:98 athrs17_reg_init: complete athrs17_vlan_config ...done S17c init done eth1 Memory Test Start Pattern: 55555555 Pattern: AAAAAAAA Pattern: 00000000 Memory Test Pass Hit any key to stop autoboot: 0 Checking Bank1 Image ... Creating 1 MTD partitions on "nand0": 0x000000000000-0x000004000000 : "mtd=0" Bank1 Image is good kernel_checksum is 0x74fdd894 , rootfs_checksum is 0x64 Checking Bank2 Image ... Creating 1 MTD partitions on "nand0": 0x000004000000-0x000008000000 : "mtd=0" Bank2 Image is good kernel_checksum is 0x74fdd894 , rootfs_checksum is 0x64 Bank1 Image the same as Bank2 Image MMC Device 0 not found dmagic1 0 dmagic2 0 MMC Device 0 not found Using nand device 1 Device 1: nand1... is now current device bootargs=console=ttyHSL1,115200n8 ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs Booting from flash set mtdids nand0=nand0 && set mtdparts mtdparts=nand0:0x4000000@0x0(fs),${msmparts} && ubi part fs && ubi read 0x44000000 kernel && bootm 0x44000000 Creating 1 MTD partitions on "nand0": 0x000000000000-0x000004000000 : "mtd=0" Image Name: Linux-3.4.103 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1826120 Bytes = 1.7 MiB Load Address: 41508000 Entry Point: 41508000 Loading Kernel Image ... OK OK Setting up atags for msm partition: rootfs device nand0 , # parts = 1 #: name size offset mask_flags 0: fs 0x04000000 0x00000000 0 active partition: nand0,0 - (fs) 0x04000000 @ 0x00000000 defaults: mtdids : none mtdparts: none Using machid 0x1260 from environment Starting kernel ... [/sourcecode]
  • run ramboot(一部) [sourcecode] BUFFALO WXR-2533DHP U-Boot Ver 1.14 (May 18 2015 - 13:24:36) CPU: IPQ8064 clock 1.4 GHz DRAM: DDR3 512 MiB clock 533 MHz NAND: ECC 4 bits, 256 MiB SF: Detected W25Q32 with page size 64 KiB, total 4 MiB MMC: In: serial Out: serial Err: serial cdp: get part failed for 0:HLOS cdp: get part failed for rootfs Net: MAC2 addr:74:3:bd:bc:1d:98 athrs17_reg_init: complete athrs17_vlan_config ...done S17c init done eth1 Memory Test Start Pattern: 55555555 Pattern: AAAAAAAA Pattern: 00000000 Memory Test Pass Hit any key to stop autoboot: 0 (IPQ) # run ramboot Using eth1 device TFTP from server 192.168.11.10; our IP address is 192.168.11.1 Filename 'wxr2300dhp-initramfs.uImage'. Load address: 0x44000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ############################### done Bytes transferred = 5478980 (539a44 hex) Image Name: ARM OpenWrt Linux-4.9.73 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 5478916 Bytes = 5.2 MiB Load Address: 42208000 Entry Point: 42208000 Loading Kernel Image ... OK OK mtdids not defined, no default present info: "mtdparts" not set Using machid 0x1260 from environment Starting kernel ... [/sourcecode]
  • ubiformat -f /dev/mtd0(一部) [sourcecode] root@OpenWrt:/# cd /tmp root@OpenWrt:/tmp# wget http://taiha.net/jenkins/job/OpenWrt-master-BUFFALO-WXR- 2533DHP/lastSuccessfulBuild/artifact/bin/targets/ipq806x/generic/openwrt-ipq806x -WXR-2533DHP-squashfs-nand-factory.ubi Downloading 'http://taiha.net/jenkins/job/OpenWrt-master-BUFFALO-WXR-2533DHP/lastSuccessfulBuild/artifact/bin/targets/ipq806x/generic/openwrt-ipq806x-WXR-2533DHP-squashfs-nand-factory.ubi' Connecting to 240b:12:500:6570:c822:64a3:7e11:4961:80 Writing to 'openwrt-ipq806x-WXR-2533DHP-squashfs-nand-factory.ubi' openwrt-ipq806x-WXR- 100% |*******************************| 6144k 0:00:00 ETA Download completed (6291456 bytes) root@OpenWrt:/tmp# ubiformat -f openwrt-ipq806x-WXR-2533DHP-squashfs-nand-factor y.ubi /dev/mtd0 ubiformat: error!: please, first detach mtd0 (/dev/mtd0) from ubi0 root@OpenWrt:/tmp# ubidetach -p /dev/mtd0 [ 388.945705] ubi0: detaching mtd0 [ 388.947550] ubi0: mtd0 is detached root@OpenWrt:/tmp# ubiformat -f openwrt-ipq806x-WXR-2533DHP-squashfs-nand-factor y.ubi /dev/mtd0 ubiformat: mtd0 (nand), size 67108864 bytes (64.0 MiB), 512 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes libscan: scanning eraseblock 511 -- 100 % complete ubiformat: 512 eraseblocks have valid erase counter, mean value is 1 ubiformat: flashing eraseblock 47 -- 100 % complete ubiformat: formatting eraseblock 511 -- 100 % complete root@OpenWrt:/tmp# reboot root@OpenWrt:/tmp# [ 407.346606] br-lan: port 1(eth1.1) entered disabled state [ 407.354586] device eth1.1 left promiscuous mode [ 407.354607] device eth1 left promiscuous mode [ 407.358018] br-lan: port 1(eth1.1) entered disabled state [ 407.373520] IPv6: ADDRCONF(NETDEV_UP): eth1.1: link is not ready [ 411.923545] reboot: Restarting system BUFFALO WXR-2533DHP U-Boot Ver 1.14 (May 18 2015 - 13:24:36) CPU: IPQ8064 clock 1.4 GHz DRAM: DDR3 512 MiB clock 533 MHz NAND: ECC 4 bits, 256 MiB SF: Detected W25Q32 with page size 64 KiB, total 4 MiB MMC: In: serial Out: serial Err: serial cdp: get part failed for 0:HLOS cdp: get part failed for rootfs Net: MAC2 addr:74:3:bd:bc:1d:98 athrs17_reg_init: complete athrs17_vlan_config ...done S17c init done eth1 Memory Test Start Pattern: 55555555 Pattern: AAAAAAAA Pattern: 00000000 Memory Test Pass Hit any key to stop autoboot: 0 Checking Bank1 Image ... Creating 1 MTD partitions on "nand0": 0x000000000000-0x000004000000 : "mtd=0" UBI: volume 2 ("ubi_rootfs_data") re-sized from 9 to 457 LEBs Rootfs Checksum Error Bank1 Image is fail Checking Bank2 Image ... Creating 1 MTD partitions on "nand0": 0x000004000000-0x000008000000 : "mtd=0" Bank2 Image is good kernel_checksum is 0x74fdd894 , rootfs_checksum is 0x64 Cpoy to Bank1 Image from Bank2 Image Creating 1 MTD partitions on "nand0": 0x000000000000-0x000004000000 : "mtd=0" 1826184 bytes written to volume kernel size > volume size! Aborting! NAND erase: device 0 offset 0x0, size 0x4000000 Erasing at 0x3fe0000 -- 100% complete. OK Try again Checking Bank1 Image ... Creating 1 MTD partitions on "nand0": 0x000000000000-0x000004000000 : "mtd=0" UBI: empty MTD device detected UBI: create volume table (copy #1) UBI: create volume table (copy #2) UBI Volume is empty Bank1 Image is fail NAND erase: device 0 offset 0x0, size 0x4000000 Erasing at 0x3fe0000 -- 100% complete. OK Creating 1 MTD partitions on "nand0": 0x000000000000-0x000004000000 : "mtd=0" UBI: empty MTD device detected UBI: create volume table (copy #1) UBI: create volume table (copy #2) Creating dynamic volume kernel of size 5332992 Creating dynamic volume ubi_rootfs of size 31490048 Creating dynamic volume ubi_rootfs_data of size 5332992 Bank1 UBI Partition is Broken Checking Bank2 Image ... Creating 1 MTD partitions on "nand0": 0x000004000000-0x000008000000 : "mtd=0" Bank2 Image is good kernel_checksum is 0x74fdd894 , rootfs_checksum is 0x64 Cpoy to Bank1 Image from Bank2 Image Creating 1 MTD partitions on "nand0": 0x000000000000-0x000004000000 : "mtd=0" 1826184 bytes written to volume kernel 15233705 bytes written to volume ubi_rootfs MMC Device 0 not found dmagic1 0 dmagic2 0 MMC Device 0 not found Using nand device 1 Device 1: nand1... is now current device bootargs=console=ttyHSL1,115200n8 ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs Booting from flash set mtdids nand0=nand0 && set mtdparts mtdparts=nand0:0x4000000@0x0(fs),${msmparts} && ubi part fs && ubi read 0x44000000 kernel && bootm 0x44000000 Creating 1 MTD partitions on "nand0": 0x000000000000-0x000004000000 : "mtd=0" Image Name: Linux-3.4.103 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1826120 Bytes = 1.7 MiB Load Address: 41508000 Entry Point: 41508000 Loading Kernel Image ... OK OK Setting up atags for msm partition: rootfs device nand0 , # parts = 1 #: name size offset mask_flags 0: fs 0x04000000 0x00000000 0 active partition: nand0,0 - (fs) 0x04000000 @ 0x00000000 defaults: mtdids : none mtdparts: none Using machid 0x1260 from environment Starting kernel ... [/sourcecode]