カテゴリー: LEDE / OpenWrt

TS3400D メモ

マイコンとのやり取りがバイナリデータなのが面倒。ASCIIベースなら楽だったのだが

コンソール

  • フロントのシリアルコンソールは内蔵しているマイコンによって入力が無効化されている
    有効化するには既定で “serialmode_ups” に設定されているモードを “serialmode_console” に変更する必要がある
    参考:

    root@OpenWrt:~# stty -F /dev/ttyS3 38400 parenb      # ttyS3のbaudrateを38400bpsに、パリティを有効にセット
    root@OpenWrt:~# echo -e "\x00\x0f\xf1" > /dev/ttyS3  # シリアルポートのモードを "serialmode_console" にセット
    root@OpenWrt:~# echo -e "\x00\x0f\xf1" > /dev/ttyS3  # 1回では正しく機能していないようなので再度送出
    

    で可。

FortiGate 50Eメモ

ファームウェアヘッダ

gzip圧縮前のデータに付するヘッダ

  0x0 - 0xf  : ?
 0x10 - 0x2f : Image Name
 0x30 - 0x17f: ?
0x180 - 0x183: Kernel Offset*
0x184 - 0x187: Kernel Length*
0x188 - 0x18b: RootFS Offset (ext2)*
0x18c - 0x18f: RootFS Length (ext2)*
0x190 - 0x193: DTB Offset
0x194 - 0x197: DTB Length
0x198 - 0x19b: Data Offset (jffs2)
0x19c - 0x19f: Data Length (jffs2)
0x1a0 - 0x1ff: ?

*: required for bootloader tftp
  • initramfsイメージとして投入する場合、Kernel Offset/Length, RootFS Offset/Lengthのみでチェックを通せた。RootFSの値2つについては、initramfsイメージにおいてはデータが存在しない為、0xFFFF0000(LE値の為、実際の値は 0x0000FFFF (65535 bytes))を置くことで通せた。マイナスにすると恐らくデータが存在しない扱いになってエラーとなる。
  • DTBのOffset/Lengthが存在しない場合、ブートローダはTFTPで渡したイメージを直接ブートする際bootargsを渡さなくなる模様。

その他

  • ブートローダにTFTPで渡すデータはgzipで圧縮されている必要がある。gzip圧縮する際のファイル名もチェックされているようで、 “FGT50E-0.00-FW-build0000-000000-patch00” の名前で通ることを確認済み。恐らくいくらか短縮可能で、最初の “FGT50E-” くらいしか見ていないような気もする(未検証)。→ “FGT50E” だけでチェックを通せた。
  • フロントのLAN1-5のSPEED LED 2色(緑/橙)とWAN1, WAN2のSPEED LED 2色のうち緑の計12個のLEDは、PHYやSwitchの直接管理ではなくI2CのGPIOエキスパンダにより提供されている。OpenWrtにおいてはPHYやSwitchがリンクスピードによるLEDトリガを提供しない為、メーカーファームのような挙動は恐らく不可。
    尚、WAN1, WAN2のSPEED LEDのうち橙 (100Mbps)についてはPHYの直接管理となっている為、100Mbpsでリンクした際問題無く点灯する。
    また、LINK/ACT LEDは全てPHY/Switchによる管理である為、これも問題無く機能する。
  • フロントに存在するLEDのうち、1か所に2色を持つものは両方を同時に点灯させることはできない配線になっている模様。
    片方を点けた状態でもう片方を点けようとすると、先に点いていた方が消灯し、後に点けようとした方も点灯しない。

SA-W2 OpenWrt bootlog

コンソール出せるようになるまで散々手こずったのを解決して色々頑張った記念



General initialization - Version: 1.0.0
Detected Device ID 6810
High speed PHY - Version: 2.0

Init Customer board board SerDes lanes topology details:
 | Lane # | Speed|    Type     |
 ------------------------------|
 |   0    |  5   |  PCIe0      |
 |   5    |  5   |  PCIe2      |
 -------------------------------
:** Link is Gen1, check the EP capability 
PCIe, Idx 0: remains Gen1
:** Link is Gen1, check the EP capability 
PCIe, Idx 2: remains Gen1
High speed PHY - Ended Successfully
DDR3 Training Sequence - Ver TIP-1.39.0
DDR3 Training Sequence - Switching XBAR Window to FastPath Window 
DDR3 Training Sequence - Ended Successfully

SA-W2 IPL Monitor version 1.20
Copyright 2003-2016 Internet Initiative Japan Inc.

boot: Boot from Flash... 
Reading FLASH. Done.
Firmware checksum is correct.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.15.92 ([email protected]) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 12.2.0 r21272+750-b97e5ac785) 12.2.0, GNU ld (GNU Binutils) 2.39) #0 SMP Sat Feb 11 07:41:35 2023
[    0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: IIJ SA-W2
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] percpu: Embedded 11 pages/cpu s14028 r8192 d22836 u45056
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: console=ttyS0,115200n8
[    0.000000] Bootloader command line not present
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 246328K/262144K available (8192K kernel code, 631K rwdata, 1884K rodata, 1024K init, 232K bss, 15816K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] L2C: DT/platform modifies aux control register: 0x06070000 -> 0x16070000
[    0.000000] L2C-310 enabling early BRESP for Cortex-A9
[    0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[    0.000000] L2C-310 D prefetch enabled, offset 1 lines
[    0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[    0.000000] L2C-310 Coherent cache controller enabled, 16 ways, 1024 kB
[    0.000000] L2C-310 Coherent: CACHE_ID 0x410054c9, AUX_CTRL 0x56070001
[    0.000001] sched_clock: 64 bits at 533MHz, resolution 1ns, wraps every 2199023255551ns
[    0.000022] clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x7aed16d152, max_idle_ns: 440795225656 ns
[    0.000043] Switching to timer-based delay loop, resolution 1ns
[    0.000215] Ignoring duplicate/late registration of read_current_timer delay
[    0.000224] clocksource: armada_370_xp_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 76450417870 ns
[    0.000445] Calibrating delay loop (skipped), value calculated using timer frequency.. 1066.00 BogoMIPS (lpj=5330000)
[    0.000458] pid_max: default: 32768 minimum: 301
[    0.000578] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000590] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001095] CPU: Testing write buffer coherency: ok
[    0.001115] CPU0: Spectre v2: using BPIALL workaround
[    0.001237] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.001659] Setting up static identity map for 0x100000 - 0x100060
[    0.001762] mvebu-soc-id: MVEBU SoC ID=0x6810, Rev=0x4
[    0.001869] mvebu-pmsu: Initializing Power Management Service Unit
[    0.001956] rcu: Hierarchical SRCU implementation.
[    0.002062] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.002123] smp: Bringing up secondary CPUs ...
[    0.002129] smp: Brought up 1 node, 1 CPU
[    0.002136] SMP: Total of 1 processors activated (1066.00 BogoMIPS).
[    0.002144] CPU: All CPU(s) started in SVC mode.
[    0.004466] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    0.004533] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.004548] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.004618] pinctrl core: initialized pinctrl subsystem
[    0.005311] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.005925] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.006484] thermal_sys: Registered thermal governor 'step_wise'
[    0.006542] cpuidle: using governor ladder
[    0.006700] mvebu-pmsu: CPU hotplug support is currently broken on Armada 38x: disabling
[    0.006709] mvebu-pmsu: CPU idle is currently broken on Armada 38x: disabling
[    0.016828] cryptd: max_cpu_qlen set to 1000
[    0.018375] SCSI subsystem initialized
[    0.018594] usbcore: registered new interface driver usbfs
[    0.018624] usbcore: registered new interface driver hub
[    0.018647] usbcore: registered new device driver usb
[    0.019384] clocksource: Switched to clocksource arm_global_timer
[    0.019853] NET: Registered PF_INET protocol family
[    0.019961] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.020344] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.020373] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.020384] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.020404] TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.020434] TCP: Hash tables configured (established 2048 bind 2048)
[    0.020476] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.020500] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.020624] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.020648] PCI: CLS 0 bytes, default 64
[    0.022327] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.025061] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.025069] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.027235] armada-38x-pinctrl d0018000.pinctrl: registered pinctrl driver
[    0.027748] gpio-2 (usb-hub-reset): hogged as output/high
[    0.027866] debugfs: Directory 'd0018100.gpio' with parent 'regmap' already present!
[    0.028192] debugfs: Directory 'd0018140.gpio' with parent 'regmap' already present!
[    0.028515] mvebu-pcie soc:pcie: host bridge /soc/pcie ranges:
[    0.028549] mvebu-pcie soc:pcie:      MEM 0x00d0080000..0x00d0081fff -> 0x0000080000
[    0.028572] mvebu-pcie soc:pcie:      MEM 0x00d0040000..0x00d0041fff -> 0x0000040000
[    0.028592] mvebu-pcie soc:pcie:      MEM 0x00d0044000..0x00d0045fff -> 0x0000044000
[    0.028610] mvebu-pcie soc:pcie:      MEM 0x00d0048000..0x00d0049fff -> 0x0000048000
[    0.028628] mvebu-pcie soc:pcie:      MEM 0xffffffffffffffff..0x00fffffffe -> 0x0100000000
[    0.028646] mvebu-pcie soc:pcie:       IO 0xffffffffffffffff..0x00fffffffe -> 0x0100000000
[    0.028663] mvebu-pcie soc:pcie:      MEM 0xffffffffffffffff..0x00fffffffe -> 0x0200000000
[    0.028679] mvebu-pcie soc:pcie:       IO 0xffffffffffffffff..0x00fffffffe -> 0x0200000000
[    0.028696] mvebu-pcie soc:pcie:      MEM 0xffffffffffffffff..0x00fffffffe -> 0x0300000000
[    0.028709] mvebu-pcie soc:pcie:       IO 0xffffffffffffffff..0x00fffffffe -> 0x0300000000
[    0.028867] mvebu-pcie soc:pcie: PCI host bridge to bus 0000:00
[    0.028878] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.028890] pci_bus 0000:00: root bus resource [mem 0xd0080000-0xd0081fff] (bus address [0x00080000-0x00081fff])
[    0.028900] pci_bus 0000:00: root bus resource [mem 0xd0040000-0xd0041fff] (bus address [0x00040000-0x00041fff])
[    0.028909] pci_bus 0000:00: root bus resource [mem 0xd0044000-0xd0045fff] (bus address [0x00044000-0x00045fff])
[    0.028918] pci_bus 0000:00: root bus resource [mem 0xd0048000-0xd0049fff] (bus address [0x00048000-0x00049fff])
[    0.028927] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xe7ffffff]
[    0.028934] pci_bus 0000:00: root bus resource [io  0x1000-0xeffff]
[    0.029028] pci 0000:00:01.0: [11ab:6810] type 01 class 0x060400
[    0.029279] pci 0000:00:03.0: [11ab:6810] type 01 class 0x060400
[    0.030432] PCI: bus0: Fast back to back transfers disabled
[    0.030443] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.030456] pci 0000:00:03.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.030552] pci 0000:01:00.0: [168c:002e] type 00 class 0x028000
[    0.030578] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x0000ffff 64bit]
[    0.030687] pci 0000:01:00.0: supports D1
[    0.030695] pci 0000:01:00.0: PME# supported from D0 D1 D3hot
[    0.031889] PCI: bus1: Fast back to back transfers disabled
[    0.031899] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.031988] pci 0000:02:00.0: [168c:003c] type 00 class 0x028000
[    0.032013] pci 0000:02:00.0: reg 0x10: [mem 0x00000000-0x001fffff 64bit]
[    0.032047] pci 0000:02:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
[    0.032125] pci 0000:02:00.0: supports D1
[    0.032132] pci 0000:02:00.0: PME# supported from D0 D1 D3hot
[    0.033319] PCI: bus2: Fast back to back transfers disabled
[    0.033329] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 02
[    0.033370] pci 0000:00:01.0: BAR 8: assigned [mem 0xe0000000-0xe00fffff]
[    0.033383] pci 0000:00:03.0: BAR 8: assigned [mem 0xe0200000-0xe04fffff]
[    0.033394] pci 0000:01:00.0: BAR 0: assigned [mem 0xe0000000-0xe000ffff 64bit]
[    0.033410] pci 0000:00:01.0: PCI bridge to [bus 01]
[    0.033420] pci 0000:00:01.0:   bridge window [mem 0xe0000000-0xe00fffff]
[    0.033439] pci 0000:02:00.0: BAR 0: assigned [mem 0xe0200000-0xe03fffff 64bit]
[    0.033455] pci 0000:02:00.0: BAR 6: assigned [mem 0xe0400000-0xe040ffff pref]
[    0.033464] pci 0000:00:03.0: PCI bridge to [bus 02]
[    0.033473] pci 0000:00:03.0:   bridge window [mem 0xe0200000-0xe04fffff]
[    0.033805] mv_xor d0060800.xor: Marvell shared XOR driver
[    0.099963] mv_xor d0060800.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[    0.100144] mv_xor d0060900.xor: Marvell shared XOR driver
[    0.159958] mv_xor d0060900.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[    0.160176] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.160558] printk: console [ttyS0] disabled
[    0.180673] d0012000.serial: ttyS0 at MMIO 0xd0012000 (irq = 29, base_baud = 15625000) is a 16550A
[    1.131419] printk: console [ttyS0] enabled
[    1.139287] loop: module loaded
[    1.147087] spi-nor spi1.0: w25q256 (32768 Kbytes)
[    1.152239] 5 fixed-partitions partitions found on MTD device spi1.0
[    1.158636] OF: Bad cell count for /soc/spi@10680/flash@0/partitions
[    1.165067] OF: Bad cell count for /soc/spi@10680/flash@0/partitions
[    1.171679] OF: Bad cell count for /soc/spi@10680/flash@0/partitions
[    1.178073] OF: Bad cell count for /soc/spi@10680/flash@0/partitions
[    1.184554] Creating 5 MTD partitions on "spi1.0":
[    1.189364] 0x000000000000-0x000000100000 : "bootloader"
[    1.195773] 0x000000100000-0x000000110000 : "bootloader-env"
[    1.201817] 0x000000110000-0x000000200000 : "board_info"
[    1.207838] 0x000000200000-0x000001100000 : "firmware"
[    1.213944] 2 seil-fw partitions found on MTD device firmware
[    1.219740] Creating 2 MTD partitions on "firmware":
[    1.224723] 0x000000000000-0x000000370000 : "kernel"
[    1.230260] 0x000000370000-0x000000f00000 : "rootfs"
[    1.235531] mtd: setting mtd5 (rootfs) as root device
[    1.240947] 1 squashfs-split partitions found on MTD device rootfs
[    1.247152] 0x000000800000-0x000000f00000 : "rootfs_data"
[    1.252952] 0x000001100000-0x000002000000 : "rescue"
[    1.265188] mv88e6085 d0072004.mdio-mii:00: switch 0x1720 detected: Marvell 88E6172, revision 1
[    1.443907] mvneta_bm d00c8000.bm: Buffer Manager for network controller enabled
[    1.454326] mvneta d0070000.ethernet eth0: Using device tree mac address 00:e0:4d:3c:b7:18
[    1.462841] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.469405] ehci-platform: EHCI generic platform driver
[    1.474747] ehci-orion: EHCI orion driver
[    1.478926] orion-ehci d0058000.usb: EHCI Host Controller
[    1.484369] orion-ehci d0058000.usb: new USB bus registered, assigned bus number 1
[    1.492027] orion-ehci d0058000.usb: irq 45, io mem 0xd0058000
[    1.519431] orion-ehci d0058000.usb: USB 2.0 started, EHCI 1.00
[    1.525752] hub 1-0:1.0: USB hub found
[    1.529746] hub 1-0:1.0: 1 port detected
[    1.534267] usbcore: registered new interface driver usb-storage
[    1.540841] armada38x-rtc d00a3800.rtc: registered as rtc0
[    1.546421] armada38x-rtc d00a3800.rtc: setting system clock to 2003-08-17T08:39:27 UTC (1061109567)
[    1.555777] i2c_dev: i2c /dev entries driver
[    1.562692] orion_wdt: Initial timeout 171 sec
[    1.567436] sdhci: Secure Digital Host Controller Interface driver
[    1.573674] sdhci: Copyright(c) Pierre Ossman
[    1.578170] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.589004] marvell-cesa d0090000.crypto: CESA device successfully registered
[    1.596809] NET: Registered PF_INET6 protocol family
[    1.603097] Segment Routing with IPv6
[    1.606809] In-situ OAM (IOAM) with IPv6
[    1.610835] NET: Registered PF_PACKET protocol family
[    1.616270] 8021q: 802.1Q VLAN Support v1.8
[    1.620542] Registering SWP/SWPB emulation handler
[    1.629518] mv88e6085 d0072004.mdio-mii:00: switch 0x1720 detected: Marvell 88E6172, revision 1
[    1.819390] usb 1-1: new high-speed USB device number 2 using orion-ehci
[    2.020176] hub 1-1:1.0: USB hub found
[    2.024130] hub 1-1:1.0: 2 ports detected
[    2.085576] mv88e6085 d0072004.mdio-mii:00: configuring for fixed/rgmii-id link mode
[    2.096704] mv88e6085 d0072004.mdio-mii:00: Link is Up - 1Gbps/Full - flow control off
[    2.197108] mv88e6085 d0072004.mdio-mii:00 ge1_0 (uninitialized): PHY [mv88e6xxx-1:00] driver [Marvell 88E1540] (irq=62)
[    2.311352] mv88e6085 d0072004.mdio-mii:00 ge1_1 (uninitialized): PHY [mv88e6xxx-1:01] driver [Marvell 88E1540] (irq=63)
[    2.419169] mv88e6085 d0072004.mdio-mii:00 ge1_2 (uninitialized): PHY [mv88e6xxx-1:02] driver [Marvell 88E1540] (irq=64)
[    2.531349] mv88e6085 d0072004.mdio-mii:00 ge1_3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=65)
[    2.639227] mv88e6085 d0072004.mdio-mii:00 ge0 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=66)
[    2.653419] DSA: tree 0 setup
[    2.680484] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    2.688365] Freeing unused kernel image (initmem) memory: 1024K
[    2.694575] Run /sbin/init as init process
[    3.567347] init: Console is alive
[    3.570927] init: - watchdog -
[    5.646326] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    5.743371] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    5.753290] init: - preinit -
[    7.835269] random: jshn: uninitialized urandom read (4 bytes read)
[    7.945738] random: jshn: uninitialized urandom read (4 bytes read)
[    7.965435] random: jshn: uninitialized urandom read (4 bytes read)
[    8.751669] mvneta d0070000.ethernet eth0: configuring for fixed/rgmii link mode
[    8.759699] mvneta d0070000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[    8.767585] mv88e6085 d0072004.mdio-mii:00 ge1_0: configuring for phy/gmii link mode
[    8.777979] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   10.980081] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[   11.002544] urandom-seed: Seed file not found (/etc/urandom.seed)
[   11.122461] procd: - early -
[   11.125424] procd: - watchdog -
[   11.764857] procd: - watchdog -
[   11.768237] procd: - ubus -
[   11.876687] random: ubusd: uninitialized urandom read (4 bytes read)
[   11.883810] random: ubusd: uninitialized urandom read (4 bytes read)
[   11.975926] random: ubusd: uninitialized urandom read (4 bytes read)
[   11.984184] procd: - init -
Please press Enter to activate this console.
[   12.912244] random: jshn: uninitialized urandom read (4 bytes read)
[   12.936750] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.949554] random: ubus: uninitialized urandom read (4 bytes read)
[   12.988966] urngd: v1.0.2 started.
[   13.044494] kmodloader: loading kernel modules from /etc/modules.d/*
[   13.157079] random: crng init done
[   13.160530] random: 25 urandom warning(s) missed due to ratelimiting
[   13.252877] Loading modules backported from Linux version v6.1-rc8-0-g76dcd734eca2
[   13.260508] Backport generated by backports.git v5.15.81-1-41-g02e352527db5
[   13.687146] PPP generic driver version 2.4.2
[   13.692933] NET: Registered PF_PPPOX protocol family
[   13.707289] ath10k 5.15 driver, optimized for CT firmware, probing pci device: 0x3c.
[   13.715488] pci 0000:00:03.0: enabling device (0140 -> 0142)
[   13.721222] ath10k_pci 0000:02:00.0: enabling device (0140 -> 0142)
[   13.727733] ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
[   14.103519] ath10k_pci 0000:02:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 0000:0000
[   14.112845] ath10k_pci 0000:02:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   14.122764] ath10k_pci 0000:02:00.0: firmware ver 10.1-ct-8x-__fW-022-ecad3248 api 2 features wmi-10.x,has-wmi-mgmt-tx,mfp,txstatus-noack,wmi-10.x-CT,ratemask-CT,txrate-CT,get-temp-CT,tx-rc-CT,cust-stats-CT,retry-gt2-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT crc32 3e4cf97f
[   14.172961] ath10k_pci 0000:02:00.0: Loading BDF type 0
[   14.419606] ath10k_pci 0000:02:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
[   15.279325] ath10k_pci 0000:02:00.0: 10.1 wmi init: vdevs: 16  peers: 127  tid: 256
[   15.296045] ath10k_pci 0000:02:00.0: wmi print 'P 128 V 8 T 410'
[   15.302123] ath10k_pci 0000:02:00.0: wmi print 'msdu-desc: 1424  sw-crypt: 0 ct-sta: 0'
[   15.310165] ath10k_pci 0000:02:00.0: wmi print 'alloc rem: 24984 iram: 38672'
[   15.373658] ath10k_pci 0000:02:00.0: htt-ver 2.1 wmi-op 2 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1
[   15.383377] ath10k_pci 0000:02:00.0: NOTE:  Firmware DBGLOG output disabled in debug_mask: 0x10000000
[   15.532803] pci 0000:00:01.0: enabling device (0140 -> 0142)
[   15.538503] ath9k 0000:01:00.0: enabling device (0140 -> 0142)
[   15.644808] ieee80211 phy1: Atheros AR9287 Rev:2 mem=0xd0c80000, irq=81
[   15.654475] ath10k_pci 0000:02:00.0: DFS region 0x0 not supported, will trigger radar for every pulse
[   15.999865] kmodloader: done loading kernel modules from /etc/modules.d/*
[   33.774300] mvneta d0070000.ethernet eth0: Link is Down
[   33.795897] mvneta d0070000.ethernet eth0: configuring for fixed/rgmii link mode
[   33.803677] mvneta d0070000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[   33.826372] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   33.848491] mv88e6085 d0072004.mdio-mii:00 ge1_0: configuring for phy/gmii link mode
[   33.879970] br-lan: port 1(ge1_0) entered blocking state
[   33.885324] br-lan: port 1(ge1_0) entered disabled state
[   33.932226] device ge1_0 entered promiscuous mode
[   33.936961] device eth0 entered promiscuous mode
[   34.069910] mv88e6085 d0072004.mdio-mii:00 ge1_1: configuring for phy/gmii link mode
[   34.099026] br-lan: port 2(ge1_1) entered blocking state
[   34.104412] br-lan: port 2(ge1_1) entered disabled state
[   34.176390] device ge1_1 entered promiscuous mode
[   34.188374] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   34.215252] jffs2_build_filesystem(): unlocking the mtd device... 
[   34.215262] done.
[   34.223434] jffs2_build_filesystem(): erasing all blocks after the end marker... 
[   34.226063] mv88e6085 d0072004.mdio-mii:00 ge1_2: configuring for phy/gmii link mode
[   34.318906] br-lan: port 3(ge1_2) entered blocking state
[   34.324286] br-lan: port 3(ge1_2) entered disabled state
[   34.369661] device ge1_2 entered promiscuous mode
[   34.388467] mv88e6085 d0072004.mdio-mii:00 ge1_3: configuring for phy/gmii link mode
[   34.536144] br-lan: port 4(ge1_3) entered blocking state
[   34.541535] br-lan: port 4(ge1_3) entered disabled state
[   34.604326] device ge1_3 entered promiscuous mode
[   34.639419] mv88e6085 d0072004.mdio-mii:00 ge0: configuring for phy/gmii link mode
[   38.135669] mv88e6085 d0072004.mdio-mii:00 ge0: Link is Up - 1Gbps/Full - flow control rx/tx
[   38.144192] IPv6: ADDRCONF(NETDEV_CHANGE): ge0: link becomes ready
[   63.117643] done.
[   63.119596] jffs2: notice: (2257) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   63.272817] overlayfs: upper fs does not support tmpfile.



BusyBox v1.36.0 (2023-02-11 07:41:35 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r22041+7-b932285141
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# ubus call system board
{
        "kernel": "5.15.92",
        "hostname": "OpenWrt",
        "system": "ARMv7 Processor rev 1 (v7l)",
        "model": "IIJ SA-W2",
        "board_name": "iij,sa-w2",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "revision": "r22041+7-b932285141",
                "target": "mvebu/cortexa9",
                "description": "OpenWrt SNAPSHOT r22041+7-b932285141"
        }
}
root@OpenWrt:/# 

SA-W2 メモ

MPP

mpp00: uart0
mpp01: uart0
mpp02: usb(smsc_usb2514b_reset)
mpp03:
mpp04: mdio
mpp05: mdio
mpp06: ge0
mpp07: ge0
mpp08: ge0
mpp09: ge0
mpp10: ge0
mpp11: ge0
mpp12: ge0
mpp13: ge0
mpp14: ge0
mpp15: ge0
mpp16: ge0
mpp17: ge0
mpp18: key(init)
mpp19: led(green_wlan5g)
mpp20: led(red_wlan5g)
mpp21: ge1
mpp22:
mpp23:
mpp24: pcie(AR9287_reset)
mpp25:
mpp26:
mpp27: ge1
mpp28: ge1
mpp29: ge1
mpp30: ge1
mpp31: ge1
mpp32: ge1
mpp33: led(green_status)
mpp34: led(red_status)
mpp35: led(green_mobile)
mpp36: led(red_mobile)
mpp37: ge1
mpp38: ge1
mpp39: ge1
mpp40: ge1
mpp41: ge1
mpp42:
mpp43:
mpp44: led(green_wlan2g)
mpp45: led(red_wlan2g)
mpp46: led(green_power)
mpp47: led(red_power)
mpp48: usb(over current port0)
mpp49: usb(over current port1)
mpp50:
mpp51:
mpp52: usb(vbus_port0)
mpp53: usb(vbus_port1)
mpp54: led(green_usb1)
mpp55: led(green_usb0)
mpp56: spi1
mpp57: spi1
mpp58: spi1
mpp59: spi1

2022年やったこと

これは mstdn.maud.io Advent Calendar 2022 13日目の記事です。

さて、2022年も12月、去年はrealtek targetについての記事を書きましたが、早いもので1年が経ちました。
今年は2022年にやったことについて色々書き散らかしていきます。

NASにおけるOpenWrtサポート
国内メーカーが販売したNASをOpenWrtでサポートする為の作業を実施。
現時点では以下の4機種を有し、そのうちI-O DATAの3機種で作業が進行中。

  • BUFFALO TS3400D
  • I-O DATA HDL-A
  • I-O DATA HDL2-A
  • I-O DATA HDL2-AAX
ルータ / スイッチングハブにおけるOpenWrtサポート
いつも通り、ルータやスイッチングハブをOpenWrtでサポートする為の作業を実施。

新規確保

  • ELECOM WRC-2533GHBK2-T
  • IIJ SA-W2

上記のうち、SA-W2はどうにもブートできるところまで到達しない為、現在保留中。

確保済み機種

  • BUFFALO WCR-1166DS
  • ELECOM WRC-2533GS2
  • ELECOM WRC-X3200GST3
  • I-O DATA BSH-G24MB
  • Panasonic Switch-M*eG PN28xx0Kシリーズ (8/16/24/48)
  • Sony NCP-HG100/Cellular

上記のうち、WCR-1166DSは既存サポートの修正で、それ以外が新規サポートがマージされた機種。
それぞれ個別の記事がメインのブログに存在しているので、詳細についてはそちらを参照。

NetBSDなAtermにおけるOpenWrtサポート
U-Bootなど汎用的なものではない、独自らしきブートローダを採用していることから、これまでdirty hack無しでのOpenWrtサポートができず私的サポートに限定していた、NetBSDベースのAterm機のサポートをトライ。
これに該当する機種においては、Flash内のシステム領域(通常 0x40000 からFlash終端まで)に独自らしきファイルシステムが形成されており、その中にファイルとしてOSイメージ (kernel + rootfs) が存在している。これを上手いことファイルではなく生データとして扱うことで、OpenWrtとうかLinux Kernelから扱えるようにすることを目指した。

       0        0x20000  0x40000
       +--------+--------+--------------------------------+
       |        |        |                                |
 Flash |  Boot  | Config |             System             |
       |        |        |                                |
       +--------+--------+--------------------------------+
                         |                                |
       +-----------------+                                |
       |                                                  |
       v                                                  v
       +-----------+-----------+--------------------------+
       |           |           |                          |
System |   Data1   |   Data2   |         (unused)         |
       |           |           |                          |
       +-----------+-----------+--------------------------+
       |           |
       |           +--------------------------------------+
       |                                                  |
       v                                                  v
       +------+--------------+------+--------------+------+
       |      |              |      |              |      |
 Data1 |Header|     Data     |Header|     Data     | ...  |
       |(0x40)|   (0xFFC0)   |(0x40)|   (0xFFC0)   |      |
       +------+--------------+------+--------------+------+

現時点では、そのファイルシステム内のファイルを生データとして扱うことについてはおおよそ実現できており、あとは細かい取り扱いを行うドライバを用意すればおよそ正しい形でOpenWrtをブートできるようになると思われる。
ただし、該当するAtermにおいてはブート時にファームウェアデータに “TP” (Test Program?) が付けられていることが求められ、これ無しではブートに失敗する。現時点では一旦メーカーファームウェアのものを使用しているが、著作権やライセンスの関係でOpenWrt公式で使用することはできない為、ダミーのTPが必要であるものの、アセンブラについての知識に乏しく未だ作成できていない。

サーバ用ルータの置き換え
自室のサーバを管理しているルータ (WN-AC1600DGR3) において、導入しているOpenWrtファームウェアがビルドから1年以上経過していた為、新規にビルドしたものを別のルータ (WRC-2533GST2) に投入の上置き換えを実施。
前回設置してからOpenWrtにおいてfirewallがiptablesからnftablesに変更された関係か、大半の一般的なファイアウォール設定では問題無かったもののmwan3の仕様が少し変更されており、複数の回線に対するトラフィック振り分けルールで若干の書き換えが必要となった。
置き換え後は特に問題無く稼働中。
ビルド鯖のCPUをRyzen 5 5600Gへ更新
ビルド鯖のCPUを、Amazonのセールの際衝動的に購入したRyzen 5 5600Gに更新した。それまではRyzen 5 3400Gを使用していたものの、使用開始から数年経過したこと、MB等大規模な変更無しにCPUのみの変更で性能向上が見込めることから、多少悩んだ末に購入を決めた。
結果として。ほぼ同じ条件でのビルドに要する時間が半分近くになるなど、大幅な性能向上が見られた。
なお、同時にWebサーバ他を抱える大破鯖やメイン機のCPUクーラー交換も行っていたりする。

ThinkPad E15 Gen4 (Intel)を購入
これまで数年前に中古で確保したX250を使い続けていたものの、さすがにCPUやストレージの性能面で難が出始めていたこと、CPUなどの仕様上Windows 11には対応しないことなどから、思い切って新品で購入してしまうことにした。
元々はThinkPad E14など14インチ機で考えていたものの、コロナの関係などから外出機会が大きく減少し、出先で使う機会もほぼ無くなっていた為、どうせなら画面は大きい方が良いと判断してE15 Gen4 (Intel)を選定した。CPUとNVMe SSDは構成変更の上、RAMは自前で別途調達したものを増設して多少強化した。また、セカンダリのM.2スロット (2242)にも、データ用として自前調達のSSDを搭載した。モノは “SABRENT SSD 512GB“。
この機種に問題があるわけではないものの、Windows 11においてIntelがVLANのサポートを止めてしまった点について、どうしようかと思案中。ノートはOpenWrt作業中の機種でVLANのテストをする際重宝していた為、VLANが使えないとなると多少支障が出てしまう。
自室のモニタを更新
どうにもデスクのサブモニタとして使用していたI-O DATA KH2750V-UHDの遅延がわずかに大きく、メインのDELL P2720Dとの差が目立つこと、特定用途のサブPCで使用する際、KH2750V-UHD側の解像度を4KからWQHDに落としている関係かブラウザのクラッシュが頻発する為、置き換えを目的としてDELL S2721DGFを購入。
S2721DGFをデスクのメインとし、P2720Dをサブ、KH2750V-UHDをサーバ管理用としてそれなりの規模で入れ替えを実施。元々サーバ管理用で、購入から12年ほど経過していたiiyama PLE2008HDSはこれを以て使用終了となった。

2022年は、前年に引き続きコロナの関係で出掛ける機会がかなり少なく、必然的に自宅での話題ばかりとなりました。
mstdn.maud.io Advent Calendar 2022、明日14日は やさい 氏です。

WN-AG300DGR/WN-AC1xxxDGRx NVMEM MAC addressメモ

現状、OpenWrtにおけるNVMEMフレームワークを通したテキストベースなMACの取得はPlatform Deviceに限定されており、PCI(e)デバイスにおいてはテキスト絡みの処理が実装されておらず利用不可。

WN-AG300DGR

  • 5GHz (AR9382) calibrationデータはFlash内に無し

[   10.383090] of_get_mac_addr_nvmem: pdev is not null, call nvmem_get_mac_address
[   10.415812] ieee80211 phy0: Atheros AR9340 Rev:1 mem=0xb8100000, irq=12
[   10.423397] ath9k 0000:00:00.0: enabling device (0000 -> 0002)
[   10.429785] of_get_mac_addr_nvmem: pdev is null, continue...
[   10.550322] ieee80211 phy1: Atheros AR9300 Rev:3 mem=0xb0000000, irq=20

WN-AC1600DGR

  • 5GHz (QCA9880) calibrationデータはFlash内に無し

[    8.580881] ath10k 5.15 driver, optimized for CT firmware, probing pci device: 0x3c.
[    8.590211] ath10k_pci 0000:00:00.0: enabling device (0000 -> 0002)
[    8.598866] ath10k_pci 0000:00:00.0: pci irq legacy oper_irq_mode 1 irq_mode 0 reset_mode 0
[   12.366974] ath10k_pci 0000:00:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 0000:0000
[   12.376403] ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   12.388332] ath10k_pci 0000:00:00.0: firmware ver 10.1-ct-8x-__fW-022-ecad3248 api 2 features wmi-10.x,has-wmi-mgmt-tx,mfp,txstatus-noack,wmi-10.x-CT,ratemask-CT,txrate-CT,get-temp-CT,tx-rc-CT,cust-stats-CT,retry-gt2-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT crc32 3e4cf97f
[   12.505983] ath10k_pci 0000:00:00.0: Loading BDF type 0
[   13.263138] ath10k_pci 0000:00:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
[   13.270638] of_get_mac_addr_nvmem: pdev is null, continue...
[   14.279870] ath10k_pci 0000:00:00.0: 10.1 wmi init: vdevs: 16  peers: 127  tid: 256
[   14.303277] ath10k_pci 0000:00:00.0: wmi print 'P 128 V 8 T 410'
[   14.309630] ath10k_pci 0000:00:00.0: wmi print 'msdu-desc: 1424  sw-crypt: 0 ct-sta: 0'
[   14.317793] ath10k_pci 0000:00:00.0: wmi print 'alloc rem: 24984 iram: 38672'
[   14.371650] ath10k_pci 0000:00:00.0: htt-ver 2.1 wmi-op 2 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1
[   14.385926] ath10k_pci 0000:00:00.0: NOTE:  Firmware DBGLOG output disabled in debug_mask: 0x10000000
[   14.584075] of_get_mac_addr_nvmem: pdev is not null, call nvmem_get_mac_address
[   14.628351] ieee80211 phy1: Atheros AR9550 Rev:0 mem=0xb8100000, irq=12

WN-AC1167DGR

  • 5GHz (QCA9880) calibrationデータはFlash内に有り

[    8.579403] ath10k 5.15 driver, optimized for CT firmware, probing pci device: 0x3c.
[    8.588739] ath10k_pci 0000:00:00.0: enabling device (0000 -> 0002)
[    8.597395] ath10k_pci 0000:00:00.0: pci irq legacy oper_irq_mode 1 irq_mode 0 reset_mode 0
[   12.367619] ath10k_pci 0000:00:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043222ff sub 0000:0000
[   12.377043] ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   12.388961] ath10k_pci 0000:00:00.0: firmware ver 10.1-ct-8x-__fW-022-ecad3248 api 2 features wmi-10.x,has-wmi-mgmt-tx,mfp,txstatus-noack,wmi-10.x-CT,ratemask-CT,txrate-CT,get-temp-CT,tx-rc-CT,cust-stats-CT,retry-gt2-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT crc32 3e4cf97f
[   12.507894] ath10k_pci 0000:00:00.0: Loading BDF type 0
[   13.262655] ath10k_pci 0000:00:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
[   13.270150] of_get_mac_addr_nvmem: pdev is null, continue...
[   14.248471] ath10k_pci 0000:00:00.0: 10.1 wmi init: vdevs: 16  peers: 127  tid: 256
[   14.272380] ath10k_pci 0000:00:00.0: wmi print 'P 128 V 8 T 410'
[   14.278730] ath10k_pci 0000:00:00.0: wmi print 'msdu-desc: 1424  sw-crypt: 0 ct-sta: 0'
[   14.286887] ath10k_pci 0000:00:00.0: wmi print 'alloc rem: 24984 iram: 38672'
[   14.343799] ath10k_pci 0000:00:00.0: htt-ver 2.1 wmi-op 2 htt-op 2 cal nvmem max-sta 128 raw 0 hwcrypto 1
[   14.359062] ath10k_pci 0000:00:00.0: NOTE:  Firmware DBGLOG output disabled in debug_mask: 0x10000000
[   14.564635] of_get_mac_addr_nvmem: pdev is not null, call nvmem_get_mac_address
[   14.608367] ieee80211 phy1: Atheros AR9550 Rev:0 mem=0xb8100000, irq=12

WN-DEAX1800GR stock -> OpenWrt

頑張ってヘッダを組んだ
とりあえずここまで到達したので記録として
一部OpenWrtで抱えているドライバを追加で弄っており、他機種にも関わる変更である為WN-DEAX1800GRを投げ込むのはまだ先の予定
(本機種はOSイメージを2つ持つ構成であり、従来通りであればOpenWrt導入の際2段階イメージの投入が必要となるものの、それを1回のみで済ませられるようにする為のもの)

Signal 15 received - terminating
miniupnpd[1088]: shutting down MiniUPnPd
[  335.864966] reboot: Restarting system

U-Boot SPL 2018.09-svn1712 (Aug 27 2019 - 15:48:56 +0800)
Trying to boot from NAND


U-Boot 2018.09v1.00.02 (Oct 22 2020 - 11:05:33 +0800)

CPU:   MediaTek MT7621AT ver 1, eco 3
Clocks: CPU: 880MHz, DDR: 1200MHz, Bus: 220MHz, XTAL: 40MHz
Model: MediaTek MT7621 reference board (NAND)
DRAM:  256 MiB
NAND:  128 MiB

Initializing NMBM ...
Signature found at block 1023 [0x07fe0000]
First info table with writecount 0 found in block 960
Second info table with writecount 0 found in block 963
NMBM has been successfully attached

Loading Environment from NMBM... *** Warning - bad CRC, using default environment

In:    uartlite0@1e000c00
Out:   uartlite0@1e000c00
Err:   uartlite0@1e000c00
Net:   
Warning: eth@1e100000 (eth0) using random MAC address - 16:29:bd:47:91:f4
eth0: eth@1e100000

  *** U-Boot Boot Menu ***
  Press UP/DOWN to move, ENTER to select
     1. Startup system (Default)
     2. Upgrade firmware
     3. Upgrade bootloader
     4. Upgrade bootloader (advanced mode)
     5. Load image
     0. U-Boot console


** Boot system from firmware **
Loading FIT image at offset 0x180000 to memory 0x80010000, size 0x29f400 ...
Automatic boot of image at addr 0x80010000 ...
## Loading kernel from FIT Image at 80010000 ...
   Using 'config-1' configuration
   Trying 'kernel-1' kernel subimage
     Description:  MIPS OpenWrt Linux-5.10.147
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x800100e4
     Data Size:    2735676 Bytes = 2.6 MiB
     Architecture: MIPS
     OS:           Linux
     Load Address: 0x82000000
     Entry Point:  0x82000000
     Hash algo:    crc32
     Hash value:   3ff47c7b
     Hash algo:    sha1
     Hash value:   b909b708b80ea3b0aa039346c1a1f1b2ce503cb0
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 80010000 ...
   Using 'config-1' configuration
   Trying 'fdt-1' fdt subimage
     Description:  MIPS OpenWrt iodata_wn-deax1800gr device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x802ac064
     Data Size:    11853 Bytes = 11.6 KiB
     Architecture: MIPS
     Hash algo:    crc32
     Hash value:   eccf8ba4
     Hash algo:    sha1
     Hash value:   803f6e712175d7ce5e7757b91dc19ff9c5cdc9f6
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x802ac064
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 8fe77000, end 8fe7ce4c ... OK
[    0.000000] Linux version 5.10.147 ([email protected]) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 11.3.0 r20886-5b4a1b7176) 11.3.0, GNU 
ld (GNU Binutils) 2.37) #0 SMP Sat Oct 15 18:21:51 2022
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is I-O DATA WN-DEAX1800GR
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] percpu: Embedded 15 pages/cpu s30224 r8192 d23024 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Writing ErrCtl register=00020000
[    0.000000] Readback ErrCtl register=00020000
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 249096K/262144K available (6740K kernel code, 622K rwdata, 1368K rodata, 1240K init, 235K bss, 13048K reserved, 0K cma-res
erved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 880MHz
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000012] sched_clock: 64 bits at 880MHz, resolution 1ns, wraps every 4398046511103ns
[    0.007952] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.016988] Calibrating delay loop... 586.13 BogoMIPS (lpj=2930688)
[    0.083163] pid_max: default: 32768 minimum: 301
[    0.087938] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.095142] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.105885] rcu: Hierarchical SRCU implementation.
[    0.110940] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.119101] smp: Bringing up secondary CPUs ...
[    0.124410] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.124421] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.124433] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.124512] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.178855] Synchronize counters for CPU 1: done.
[    0.211362] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.211374] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.211384] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.211439] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.270336] Synchronize counters for CPU 2: done.
[    0.301008] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.301019] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.301029] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.301089] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.355553] Synchronize counters for CPU 3: done.
[    0.385441] smp: Brought up 1 node, 4 CPUs
[    0.394204] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.404035] futex hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.411041] pinctrl core: initialized pinctrl subsystem
[    0.418764] NET: Registered protocol family 16
[    0.424436] thermal_sys: Registered thermal governor 'step_wise'
[    0.425568] cpuidle: using governor teo
[    0.482738] clocksource: Switched to clocksource GIC
[    0.489912] NET: Registered protocol family 2
[    0.494658] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.502869] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.511194] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.518796] TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.525883] TCP: Hash tables configured (established 2048 bind 2048)
[    0.532303] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.538807] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.546037] NET: Registered protocol family 1
[    0.550337] PCI: CLS 0 bytes, default 32
[    0.557031] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.567750] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.573542] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.585937] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.591824] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.597856] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.604506] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.612798] printk: console [ttyS0] disabled
[    0.617127] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 19, base_baud = 3125000) is a 16550A
[    0.626134] printk: console [ttyS0] enabled
[    0.626134] printk: console [ttyS0] enabled
[    0.634402] printk: bootconsole [early0] disabled
[    0.634402] printk: bootconsole [early0] disabled
[    0.646647] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xf1
[    0.653145] nand: Winbond W29N01HV
[    0.656539] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.664132] mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits
[    0.672007] Signature found at block 1023 [0x07fe0000]
[    0.677153] NMBM management region starts at block 960 [0x07800000]
[    0.686678] First info table with writecount 0 found in block 960
[    0.702280] Second info table with writecount 0 found in block 963
[    0.708548] NMBM has been successfully attached
[    0.713214] 8 fixed-partitions partitions found on MTD device mt7621-nand
[    0.721730] Creating 8 MTD partitions on "mt7621-nand":
[    0.727024] 0x000000000000-0x000000080000 : "u-boot"
[    0.735631] 0x000000080000-0x000000100000 : "u-boot-env"
[    0.744579] 0x000000100000-0x000000180000 : "factory"
[    0.753341] 0x000000180000-0x000002f80000 : "firmware"
[    0.990961] 0x000002f80000-0x000005d80000 : "firmware2"
[    1.229233] 0x000005d80000-0x000006380000 : "storage"
[    1.265919] 0x000006380000-0x000006480000 : "idmkey"
[    1.277061] 0x000006480000-0x000006500000 : "working"
[    1.291983] Concatenating MTD devices:
[    1.295808] (0): "firmware"
[    1.298600] into device "mtd-firmware"
[    1.322013] 2 fit-fw partitions found on MTD device mtd-firmware
[    1.328020] Creating 2 MTD partitions on "mtd-firmware":
[    1.333337] 0x000000000000-0x0000002a0000 : "kernel"
[    1.352619] 0x000000600000-0x000002e00000 : "ubi"
[    1.561792] Concatenating MTD devices:
[    1.565656] (0): "firmware2"
[    1.568540] into device "mtd-firmware2"
[    1.613958] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    1.625586] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20
[    1.634899] mtk_soc_eth 1e100000.ethernet wan: mediatek frame engine at 0xbe100000, irq 20
[    1.644687] i2c /dev entries driver
[    1.650734] mt7621-pci 1e140000.pcie: host bridge /pcie@1e140000 ranges:
[    1.657546] mt7621-pci 1e140000.pcie:   No bus range found for /pcie@1e140000, using [bus 00-ff]
[    1.666393] mt7621-pci 1e140000.pcie:      MEM 0x0060000000..0x006fffffff -> 0x0000000000
[    1.674583] mt7621-pci 1e140000.pcie:       IO 0x001e160000..0x001e16ffff -> 0x0000000000
[    1.682857] mt7621-pci 1e140000.pcie: Parsing DT failed
[    1.690208] NET: Registered protocol family 10
[    1.696713] Segment Routing with IPv6
[    1.700485] NET: Registered protocol family 17
[    1.705482] 8021q: 802.1Q VLAN Support v1.8
[    1.713243] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    1.734942] mt7530 mdio-bus:1f lan2 (uninitialized): PHY [mt7530-0:01] driver [MediaTek MT7530 PHY] (irq=25)
[    1.747422] mt7530 mdio-bus:1f lan1 (uninitialized): PHY [mt7530-0:02] driver [MediaTek MT7530 PHY] (irq=26)
[    1.761240] mt7530 mdio-bus:1f: configuring for fixed/rgmii link mode
[    1.771728] DSA: tree 0 setup
[    1.775140] rt2880-pinmux pinctrl: pcie is already enabled
[    1.780705] mt7621-pci 1e140000.pcie: host bridge /pcie@1e140000 ranges:
[    1.787443] mt7621-pci 1e140000.pcie:   No bus range found for /pcie@1e140000, using [bus 00-ff]
[    1.796244] mt7621-pci 1e140000.pcie:      MEM 0x0060000000..0x006fffffff -> 0x0000000000
[    1.804427] mt7621-pci 1e140000.pcie:       IO 0x001e160000..0x001e16ffff -> 0x0000000000
[    1.812715] mt7621-pci-phy 1e149000.pcie-phy: PHY for 0xbe149000 (dual port = 1)
[    1.820549] mt7621-pci-phy 1e14a000.pcie-phy: PHY for 0xbe14a000 (dual port = 0)
[    1.828310] mt7621-pci 1e140000.pcie: failed to parse bus ranges property: -22
[    1.935805] mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz
[    1.941378] mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz
[    2.047189] mt7621-pci 1e140000.pcie: pcie2 no card, disable it (RST & CLK)
[    2.054147] mt7621-pci 1e140000.pcie: PCIE0 enabled
[    2.059003] mt7621-pci 1e140000.pcie: PCIE1 enabled
[    2.063885] mt7621-pci 1e140000.pcie: PCI coherence region base: 0x60000000, mask/settings: 0xf0000002
[    2.073371] mt7621-pci 1e140000.pcie: PCI host bridge to bus 0000:00
[    2.079740] pci_bus 0000:00: root bus resource [io  0x1e160000-0x1e16ffff]
[    2.086642] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff]
[    2.093514] pci_bus 0000:00: root bus resource [bus 00-ff]
[    2.098980] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff] (bus address [0x00000000-0x0fffffff])
[    2.109187] pci 0000:00:00.0: [0e8d:0801] type 01 class 0x060400
[    2.115211] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x7fffffff]
[    2.121455] pci 0000:00:00.0: reg 0x14: [mem 0x60400000-0x6040ffff]
[    2.127785] pci 0000:00:00.0: supports D1
[    2.131779] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[    2.138052] pci 0000:00:01.0: [0e8d:0801] type 01 class 0x060400
[    2.144127] pci 0000:00:01.0: reg 0x10: [mem 0x00000000-0x7fffffff]
[    2.150377] pci 0000:00:01.0: reg 0x14: [mem 0x60410000-0x6041ffff]
[    2.156714] pci 0000:00:01.0: supports D1
[    2.160710] pci 0000:00:01.0: PME# supported from D0 D1 D3hot
[    2.168289] pci 0000:01:00.0: [14c3:7916] type 00 class 0x000280
[    2.174374] pci 0000:01:00.0: reg 0x10: initial BAR value 0x00000000 invalid
[    2.181407] pci 0000:01:00.0: reg 0x10: [mem size 0x00100000 64bit pref]
[    2.188121] pci 0000:01:00.0: reg 0x18: initial BAR value 0x00000000 invalid
[    2.195162] pci 0000:01:00.0: reg 0x18: [mem size 0x00004000 64bit pref]
[    2.201849] pci 0000:01:00.0: reg 0x20: initial BAR value 0x00000000 invalid
[    2.208903] pci 0000:01:00.0: reg 0x20: [mem size 0x00001000 64bit pref]
[    2.215724] pci 0000:01:00.0: supports D1 D2
[    2.219977] pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.226625] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x1 link at 0000:00:00.0 (capable of 4.000 Gb/s wit
h 5.0 GT/s PCIe x1 link)
[    2.243012] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    2.248242] pci 0000:00:00.0:   bridge window [io  0x0000-0x0fff]
[    2.254334] pci 0000:00:00.0:   bridge window [mem 0x60000000-0x601fffff pref]
[    2.261532] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    2.268456] pci 0000:02:00.0: [14c3:7915] type 00 class 0x000280
[    2.274528] pci 0000:02:00.0: reg 0x10: initial BAR value 0x00000000 invalid
[    2.281558] pci 0000:02:00.0: reg 0x10: [mem size 0x00100000 64bit pref]
[    2.288271] pci 0000:02:00.0: reg 0x18: initial BAR value 0x00000000 invalid
[    2.295312] pci 0000:02:00.0: reg 0x18: [mem size 0x00004000 64bit pref]
[    2.301999] pci 0000:02:00.0: reg 0x20: initial BAR value 0x00000000 invalid
[    2.309039] pci 0000:02:00.0: reg 0x20: [mem size 0x00001000 64bit pref]
[    2.315856] pci 0000:02:00.0: supports D1 D2
[    2.320110] pci 0000:02:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.326774] pci 0000:02:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x1 link at 0000:00:01.0 (capable of 4.000 Gb/s wit
h 5.0 GT/s PCIe x1 link)
[    2.343212] pci 0000:00:01.0: PCI bridge to [bus 02-ff]
[    2.348443] pci 0000:00:01.0:   bridge window [io  0x0000-0x0fff]
[    2.354542] pci 0000:00:01.0:   bridge window [mem 0x60200000-0x603fffff pref]
[    2.361741] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 02
[    2.368403] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    2.375021] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    2.381956] pci 0000:00:01.0: BAR 0: no space for [mem size 0x80000000]
[    2.388574] pci 0000:00:01.0: BAR 0: failed to assign [mem size 0x80000000]
[    2.395530] pci 0000:00:00.0: BAR 9: assigned [mem 0x60000000-0x601fffff pref]
[    2.402755] pci 0000:00:01.0: BAR 9: assigned [mem 0x60200000-0x603fffff pref]
[    2.409947] pci 0000:00:00.0: BAR 1: assigned [mem 0x60400000-0x6040ffff]
[    2.416731] pci 0000:00:01.0: BAR 1: assigned [mem 0x60410000-0x6041ffff]
[    2.423520] pci 0000:00:00.0: BAR 7: assigned [io  0x1e160000-0x1e160fff]
[    2.430279] pci 0000:00:01.0: BAR 7: assigned [io  0x1e161000-0x1e161fff]
[    2.437068] pci 0000:01:00.0: BAR 0: assigned [mem 0x60000000-0x600fffff 64bit pref]
[    2.444830] pci 0000:01:00.0: BAR 2: assigned [mem 0x60100000-0x60103fff 64bit pref]
[    2.452552] pci 0000:01:00.0: BAR 4: assigned [mem 0x60104000-0x60104fff 64bit pref]
[    2.460290] pci 0000:00:00.0: PCI bridge to [bus 01]
[    2.465261] pci 0000:00:00.0:   bridge window [io  0x1e160000-0x1e160fff]
[    2.472025] pci 0000:00:00.0:   bridge window [mem 0x60000000-0x601fffff pref]
[    2.479250] pci 0000:02:00.0: BAR 0: assigned [mem 0x60200000-0x602fffff 64bit pref]
[    2.487005] pci 0000:02:00.0: BAR 2: assigned [mem 0x60300000-0x60303fff 64bit pref]
[    2.494750] pci 0000:02:00.0: BAR 4: assigned [mem 0x60304000-0x60304fff 64bit pref]
[    2.502470] pci 0000:00:01.0: PCI bridge to [bus 02]
[    2.507446] pci 0000:00:01.0:   bridge window [io  0x1e161000-0x1e161fff]
[    2.514228] pci 0000:00:01.0:   bridge window [mem 0x60200000-0x603fffff pref]
[    2.524905] UBI: auto-attach mtd9
[    2.528248] ubi0: attaching mtd9
[    2.533386] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control rx/tx
[    2.601529] UBI: EOF marker found, PEBs from 32 will be erased
[    2.788424] ubi0: scanning is finished
[    2.833112] ubi0: volume 1 ("rootfs_data") re-sized from 9 to 278 LEBs
[    2.840788] ubi0: attached mtd9 (name "ubi", size 40 MiB)
[    2.846310] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    2.853197] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    2.859956] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    2.866906] ubi0: good PEBs: 320, bad PEBs: 0, corrupted PEBs: 0
[    2.872915] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    2.880107] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1665858111
[    2.889216] ubi0: available PEBs: 0, total reserved PEBs: 320, PEBs reserved for bad PEB handling: 8
[    2.898372] ubi0: background thread "ubi_bgt0d" started, PID 445
[    2.900759] block ubiblock0_0: created from ubi0:0(rootfs)
[    2.909981] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[    2.946606] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    2.959391] Freeing unused kernel memory: 1240K
[    2.964026] This architecture does not have kernel memory protection.
[    2.970480] Run /sbin/init as init process
[    3.671575] init: Console is alive
[    3.675576] init: - watchdog -
[    4.494613] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.587664] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.613176] init: - preinit -
[    5.564470] random: jshn: uninitialized urandom read (4 bytes read)
[    5.647426] random: jshn: uninitialized urandom read (4 bytes read)
[    5.686205] random: jshn: uninitialized urandom read (4 bytes read)
[    5.971943] mtk_soc_eth 1e100000.ethernet eth0: configuring for fixed/rgmii link mode
[    5.980394] mtk_soc_eth 1e100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[    5.983295] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode
[    5.995815] 8021q: adding VLAN 0 to HW filter on device lan1
[    6.004159] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    8.248737] UBIFS (ubi0:1): default file-system created
[    8.255367] UBIFS (ubi0:1): Mounting in unauthenticated mode
[    8.261369] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 569
[    8.385527] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[    8.393444] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    8.403374] UBIFS (ubi0:1): FS size: 34029568 bytes (32 MiB, 268 LEBs), journal size 1650688 bytes (1 MiB, 13 LEBs)
[    8.413787] UBIFS (ubi0:1): reserved for root: 1607300 bytes (1569 KiB)
[    8.420377] UBIFS (ubi0:1): media format: w5/r0 (latest is w5/r0), UUID F0CEFC72-3D87-4BC4-9168-2BBACB0C7139, small LPT model
[    8.435212] mount_root: overlay filesystem has not been fully initialized yet
[    8.443513] mount_root: switching to ubifs overlay
[    8.457426] urandom-seed: Seed file not found (/etc/urandom.seed)
[    8.646750] procd: - early -
[    8.649920] procd: - watchdog -
[    9.302887] procd: - watchdog -
[    9.306736] procd: - ubus -
[    9.372807] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.381351] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.388457] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.402070] procd: - init -
Please press Enter to activate this console.
[   10.106425] kmodloader: loading kernel modules from /etc/modules.d/*
[   10.316565] Loading modules backported from Linux version v5.15.58-0-g7d8048d4e064
[   10.324238] Backport generated by backports.git v5.15.58-1-0-g42a95ce7
[   10.403622] urngd: v1.0.2 started.
[   10.536991] mt7621-pci 1e140000.pcie: bus=1 slot=0 irq=21
[   10.542419] pci 0000:00:00.0: enabling device (0006 -> 0007)
[   10.548114] mt7915e_hif 0000:01:00.0: enabling device (0000 -> 0002)
[   10.555003] mt7621-pci 1e140000.pcie: bus=2 slot=1 irq=22
[   10.560478] pci 0000:00:01.0: enabling device (0006 -> 0007)
[   10.566203] mt7915e 0000:02:00.0: enabling device (0000 -> 0002)
[   10.581355] random: crng init done
[   10.584805] random: 30 urandom warning(s) missed due to ratelimiting
[   10.831914] mt7915e 0000:02:00.0: HW/SW Version: 0x8a108a10, Build Time: 20211222184017a
[   10.831914] 
[   11.166079] mt7915e 0000:02:00.0: WM Firmware Version: ____000000, Build Time: 20211222184052
[   11.205272] mt7915e 0000:02:00.0: WA Firmware Version: DEV_000000, Build Time: 20211222184111
[   16.712209] PPP generic driver version 2.4.2
[   16.718509] NET: Registered protocol family 24
[   16.731966] kmodloader: done loading kernel modules from /etc/modules.d/*
[   47.317675] mtk_soc_eth 1e100000.ethernet eth0: Link is Down
[   47.333480] mtk_soc_eth 1e100000.ethernet eth0: configuring for fixed/rgmii link mode
[   47.341672] mtk_soc_eth 1e100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   47.345592] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode
[   47.357236] 8021q: adding VLAN 0 to HW filter on device lan1
[   47.365861] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   47.373384] br-lan: port 1(lan1) entered blocking state
[   47.378893] br-lan: port 1(lan1) entered disabled state
[   47.385637] device lan1 entered promiscuous mode
[   47.390306] device eth0 entered promiscuous mode
[   47.428815] mt7530 mdio-bus:1f lan2: configuring for phy/gmii link mode
[   47.436079] 8021q: adding VLAN 0 to HW filter on device lan2
[   47.445885] br-lan: port 2(lan2) entered blocking state
[   47.451130] br-lan: port 2(lan2) entered disabled state
[   47.458036] device lan2 entered promiscuous mode
[   47.483096] mtk_soc_eth 1e100000.ethernet wan: PHY [mdio-bus:00] driver [MediaTek MT7530 PHY] (irq=POLL)
[   47.492579] mtk_soc_eth 1e100000.ethernet wan: configuring for phy/rgmii link mode
[   50.771381] mt7530 mdio-bus:1f lan2: Link is Up - 1Gbps/Full - flow control off
[   50.778783] br-lan: port 2(lan2) entered blocking state
[   50.784041] br-lan: port 2(lan2) entered forwarding state
[   50.792063] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready



BusyBox v1.35.0 (2022-10-15 18:21:51 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r20945+24-85ae64bb27
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# ubus call system board
{
        "kernel": "5.10.147",
        "hostname": "OpenWrt",
        "system": "MediaTek MT7621 ver:1 eco:3",
        "model": "I-O DATA WN-DEAX1800GR",
        "board_name": "iodata,wn-deax1800gr",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "revision": "r20945+24-85ae64bb27",
                "target": "ramips/mt7621",
                "description": "OpenWrt SNAPSHOT r20945+24-85ae64bb27"
        }
}
root@OpenWrt:/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "u-boot"
mtd1: 00080000 00020000 "u-boot-env"
mtd2: 00080000 00020000 "factory"
mtd3: 02e00000 00020000 "firmware"
mtd4: 02e00000 00020000 "firmware2"
mtd5: 00600000 00020000 "storage"
mtd6: 00100000 00020000 "idmkey"
mtd7: 00080000 00020000 "working"
mtd8: 002a0000 00020000 "kernel"
mtd9: 02800000 00020000 "ubi"
mtd10: 02e00000 00020000 "mtd-firmware2"
root@OpenWrt:/# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_1 on /overlay type ubifs (rw,noatime,assert=read-only,ubi=0,vol=1)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,noexec,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.8M      3.8M         0 100% /rom
tmpfs                   122.2M     68.0K    122.2M   0% /tmp
/dev/ubi0_1              29.3M     36.0K     27.8M   0% /overlay
overlayfs:/overlay       29.3M     36.0K     27.8M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:/# 

kirkwoodはLinux Kernel 5.13までrestart_handlerを使えない

OpenWrtにおける “kirkwood” targetのデバイスにおいて、Linux Kernelは再起動 (reboot) を以下の通り実行する。
表題の件に関係しない呼び出しは省く。また以下でのリンクは5.10のものを使用する

  1. kernel/reboot.ckernel_restart を呼び出し(ここ
  2. arch/arm/kernel/reboot.cmachine_restart を呼び出し(ここ
  3. 上から呼ばれた machine_restart において、ARM特有の arm_pm_restart が登録されて(nullでない)いれば arm_pm_restart を呼び出し、未登録なら kernel/reboot.cdo_kernel_restart を呼び出し(ここ

ここで問題となるのが上記最後のステップにおける arm_pm_restart であり、これはブート時に arch/arm/kernel/setup.csetup_arch 内において、 mdesc->restart が登録されて(nullでない)いる場合それを arm_pm_restart に登録する(ここ)。
mdescarch/arm/ 内に存在する各プラットフォーム(mach-*)毎またはその中での系統毎に定義されるものをDeviceTreeと一致を取るなどして取り出したものであり(ここ)、OpenWrtにおける “kirkwood” target用のものは ここ で定義されている。
kirkwoodのデバイスではその中の .restart が登録されている為にそれが arm_pm_restart にも適用されてしまい、別途登録した restart_handler が使用できなくなってしまう。

なお、本来であればkirkwoodデバイスにおいてはこのrestartで足りるはずであるものの、I-O DATA HDL-AやHDL2-Aにおいてはreset周りをR8C/25マイコンが担当しており、それに対してコマンドを送らなければ正しく再起動を行えず、停止してしまう。

ちなみに、Linux Kernel 5.14以降では上記の arm_pm_restart が削除され、各プラットフォームまたは系統毎に定義されるrestartは restart_handler の一つとして登録するよう変更されている。この為、もし別途 restart_handler を使用したい場合、ARM側のハンドラよりも高い優先度(数字を大きくする)でハンドラを登録すれば、そちらが先に使用される。

HDL2-A OpenWrtブートログメモ

現時点でのOpenWrtのブートログ

  • ファン制御
  • LED制御
  • スイッチ類
  • ビープスピーカー

は現状GPIO等不明の為未対応。フロントのSTATUS LEDは緑で点滅し続ける。
SATAやUSBに接続されたデバイスの取り扱いやそこからのブート、ネットワーク周りは動作。
SSDを使用したこととOpenWrtである故に軽量であることから、メーカーファームウェアよりも恐らくブート完了は早い。PCで廃した低用量SSDの活用手段として良いかもしれない。


============================================================
  HDL2-A series Initial boot loader

  Copyright (C) 2008-2011 I-O DATA DEVICE, INC.
============================================================
 ** LOADER **
 ** MARVELL BOARD: HDL2A LE 

U-Boot 1.1.4 (Aug 27 2011 - 16:33:44) MV : 3.5.9 I-O : 1.03

U-Boot code: 00600000 -> 0066FFF0  BSS: -> 006BDAE0

Soc: 88F6282 A1CPU running @ 1600Mhz L2 running @ 533Mhz
SysClock = 533Mhz , TClock = 200Mhz 

DRAM (DDR3) CAS Latency = 7 tRP = 7 tRAS = 20 tRCD=7
DRAM CS[0] base 0x00000000   size 256MB 
DRAM Total size 256MB  16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
[512kB@f8000000] Flash: 512 kB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled 
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
PEX 1: interface detected no Link.
Net:   egiga0 [PRIME]

Reset IDE: 
Marvell Serial ATA Adapter
Integrated Sata device found
[0 0 0]: Enable DMA mode (6)
  Device 0 @ 0 0:
            Model: KLEVV SSD NEO N500 120GB                
            Firm: R1001C0 
            Ser#: E201904120051356    
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 114473.4 MB = 111.7 GB (0x000000000DF94BB0 x 512)


2746315 bytes read

65536 bytes read
## Starting secure boot ...
## Starting application at 0x00100000 ...
## Application terminated, rc = 0x0
................
## Booting image at 00800000 ...
   Image Name:   ARM OpenWrt Linux-5.10.100
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2746251 Bytes =  2.6 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.10.100 ([email protected]) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 11.2.0 r18802-83c6e7a3a6) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 Mon Feb 14 11:07:21 2022
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: I-O DATA HDL2-A (2.0/4.0/6.0)
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: console=ttyS0,115200 mtdparts=spi_flash:448k(u-boot),64k@448k(env) root=/dev/md2 initrd=0x2000040,16M rw model=HDL2-A console=ttyS0,115200 root=PARTLABEL=rootfs fstools_use_partlabel=1
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 233136K/262144K available (5756K kernel code, 591K rwdata, 1492K rodata, 1024K init, 204K bss, 29008K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] random: get_random_bytes called from start_kernel+0x330/0x560 with crng_init=0
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000007] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.000032] Switching to timer-based delay loop, resolution 5ns
[    0.000090] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=2000000)
[    0.000110] pid_max: default: 32768 minimum: 301
[    0.000249] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000268] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000969] CPU: Testing write buffer coherency: ok
[    0.001666] Setting up static identity map for 0x100000 - 0x10003c
[    0.001848] mvebu-soc-id: MVEBU SoC ID=0x6282, Rev=0x1
[    0.001993] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.004351] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.004377] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.004474] pinctrl core: initialized pinctrl subsystem
[    0.005232] NET: Registered protocol family 16
[    0.005597] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.006380] thermal_sys: Registered thermal governor 'step_wise'
[    0.006444] cpuidle: using governor ladder
[    0.006739] Feroceon L2: Enabling L2
[    0.006776] Feroceon L2: Cache support initialised.
[    0.012503] No ATAGs?
[    0.045377] SCSI subsystem initialized
[    0.046469] usbcore: registered new interface driver usbfs
[    0.046512] usbcore: registered new interface driver hub
[    0.046555] usbcore: registered new device driver usb
[    0.050768] clocksource: Switched to clocksource orion_clocksource
[    0.051443] NET: Registered protocol family 2
[    0.051550] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.052001] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.052039] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.052071] TCP bind hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.052100] TCP: Hash tables configured (established 2048 bind 2048)
[    0.052166] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.052189] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.052299] NET: Registered protocol family 1
[    0.052324] PCI: CLS 0 bytes, default 32
[    0.052848] Unpacking initramfs...
[    0.052866] Initramfs unpacking failed: invalid magic at start of compressed archive
[    0.099658] Freeing initrd memory: 16388K
[    0.103235] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.106154] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.106169] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.107948] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    0.109067] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.109504] printk: console [ttyS0] disabled
[    0.109575] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 27, base_baud = 12500000) is a 16550A
[    0.557719] printk: console [ttyS0] enabled
[    0.562850] sata_mv f1080000.sata: slots 32 ports 2
[    0.572499] scsi host0: sata_mv
[    0.576568] scsi host1: sata_mv
[    0.579851] ata1: SATA max UDMA/133 irq 33
[    0.583995] ata2: SATA max UDMA/133 irq 33
[    0.591794] spi-nor spi0.0: w25x40 (512 Kbytes)
[    0.596373] 2 fixed-partitions partitions found on MTD device spi0.0
[    0.602783] Creating 2 MTD partitions on "spi0.0":
[    0.607597] 0x000000000000-0x000000070000 : "u-boot"
[    0.613678] 0x000000070000-0x000000080000 : "u-boot-env"
[    0.627639] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[    0.637419] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 00:a0:b0:ca:71:c7
[    0.646367] i2c /dev entries driver
[    0.650969] orion_wdt: Initial timeout 21 sec
[    0.661488] marvell-cesa f1030000.crypto: CESA device successfully registered
[    0.669251] NET: Registered protocol family 10
[    0.675103] Segment Routing with IPv6
[    0.678837] NET: Registered protocol family 17
[    0.683461] 8021q: 802.1Q VLAN Support v1.8
[    1.080789] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[    1.113059] ata1.00: ATA-9: KLEVV SSD NEO N500 120GB, R1001C0, max UDMA/133
[    1.120054] ata1.00: 234441648 sectors, multi 1: LBA48 NCQ (depth 31/32)
[    1.163044] ata1.00: configured for UDMA/133
[    1.167599] scsi 0:0:0:0: Direct-Access     ATA      KLEVV SSD NEO N5 1C0  PQ: 0 ANSI: 5
[    1.176644] sd 0:0:0:0: [sda] 234441648 512-byte logical blocks: (120 GB/112 GiB)
[    1.184968] sd 0:0:0:0: [sda] Write Protect is off
[    1.189864] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.201290]  sda: sda1 sda2 sda3
[    1.205490] sd 0:0:0:0: [sda] Attached SCSI disk
[    1.511994] ata2: SATA link down (SStatus 0 SControl F300)
[    1.519616] VFS: Mounted root (squashfs filesystem) readonly on device 8:2.
[    1.529588] Freeing unused kernel memory: 1024K
[    1.534176] Run /sbin/init as init process
[    1.640791] random: fast init done
[    1.686667] init: Console is alive
[    1.690252] init: - watchdog -
[    1.883525] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    1.941132] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.950197] ehci-fsl: Freescale EHCI Host controller driver
[    1.958667] ehci-orion: EHCI orion driver
[    1.962856] orion-ehci f1050000.ehci: EHCI Host Controller
[    1.968397] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[    1.976213] orion-ehci f1050000.ehci: irq 31, io mem 0xf1050000
[    2.010786] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[    2.017269] hub 1-0:1.0: USB hub found
[    2.021546] hub 1-0:1.0: 1 port detected
[    2.028338] ehci-platform: EHCI generic platform driver
[    2.041668] rtc-rs5c372 0-0032: rs5c372a found, 24hr
[    2.053814] rtc-rs5c372 0-0032: registered as rtc0
[    2.060424] rtc-rs5c372 0-0032: setting system clock to 2022-02-15T01:42:53 UTC (1644889373)
[    2.072652] usbcore: registered new interface driver usb-storage
[    2.081453] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.091066] init: - preinit -
[    2.330819] usb 1-1: new high-speed USB device number 2 using orion-ehci
[    2.560533] random: jshn: uninitialized urandom read (4 bytes read)
[    2.567916] hub 1-1:1.0: USB hub found
[    2.602432] hub 1-1:1.0: 2 ports detected
[    2.633329] random: procd: uninitialized urandom read (4 bytes read)
[    2.645499] random: jshn: uninitialized urandom read (4 bytes read)
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    6.904894] mount_root: loading kmods from internal overlay
[    6.918571] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[    6.926639] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
[    7.305673] block: attempting to load /etc/config/fstab
[    7.311148] block: unable to load configuration (fstab: Entry not found)
[    7.317957] block: no usable configuration
[    7.345971] EXT4-fs (sda3): recovery complete
[    7.352683] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
[    7.656448] block: attempting to load /etc/config/fstab
[    7.661870] block: unable to load configuration (fstab: Entry not found)
[    7.668674] block: no usable configuration
[    7.673486] mount_root: switching to ext4 overlay
[    7.681825] urandom-seed: Seeding with /etc/urandom.seed
[    7.737676] procd: - early -
[    7.740678] procd: - watchdog -
[    8.305800] procd: - watchdog -
[    8.309498] procd: - ubus -
[    8.379630] procd: - init -
Please press Enter to activate this console.
[    9.026246] kmodloader: loading kernel modules from /etc/modules.d/*
[    9.228383] PPP generic driver version 2.4.2
[    9.242748] NET: Registered protocol family 24
[    9.257928] urngd: v1.0.2 started.
[    9.281833] kmodloader: done loading kernel modules from /etc/modules.d/*
[    9.390311] random: crng init done
[    9.393761] random: 7 urandom warning(s) missed due to ratelimiting
[   14.840964] br-lan: port 1(eth0) entered blocking state
[   14.846224] br-lan: port 1(eth0) entered disabled state
[   14.851680] device eth0 entered promiscuous mode



BusyBox v1.35.0 (2022-02-13 13:45:08 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r18812-7cb70170c4
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# ubus call system board
{
        "kernel": "5.10.100",
        "hostname": "OpenWrt",
        "system": "Feroceon 88FR131 rev 1 (v5l)",
        "model": "I-O DATA HDL2-A (2.0/4.0/6.0)",
        "board_name": "iodata,hdl2-a",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "revision": "r18812-7cb70170c4",
                "target": "kirkwood/generic",
                "description": "OpenWrt SNAPSHOT r18812-7cb70170c4"
        }
}
root@OpenWrt:/# ubus call system info
{
        "localtime": 1644889400,
        "uptime": 30,
        "load": [
                26688,
                6336,
                2080
        ],
        "memory": {
                "total": 256561152,
                "free": 234778624,
                "shared": 57344,
                "buffered": 2064384,
                "available": 214593536,
                "cached": 6520832
        },
        "root": {
                "total": 40973536,
                "free": 40973448,
                "used": 88,
                "avail": 38859912
        },
        "tmp": {
                "total": 125272,
                "free": 125216,
                "used": 56,
                "avail": 125216
        },
        "swap": {
                "total": 0,
                "free": 0
        }
}
root@OpenWrt:/# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/sda3 on /overlay type ext4 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,noexec,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.5M      3.5M         0 100% /rom
tmpfs                   122.3M     56.0K    122.3M   0% /tmp
/dev/sda3                39.1G     88.0K     37.1G   0% /overlay
overlayfs:/overlay       39.1G     88.0K     37.1G   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:/# fdisk -l -o +Name /dev/sda
Disk /dev/sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: KLEVV SSD NEO N5
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1ADF7A04-3FA4-E744-BB96-5CAAA7727197

Device       Start      End  Sectors  Size Type             Name
/dev/sda1     2048   206847   204800  100M Linux filesystem kernel
/dev/sda2   206848  2303999  2097152    1G Linux filesystem rootfs
/dev/sda3  2304000 86190079 83886080   40G Linux filesystem rootfs_data
OpenWrtのrealtek targetについて

OpenWrtのrealtek targetについて

これは A:don:vent Calender こと「mstdn.maud.io Advent Calender 2021」11日目の記事です。
先週土曜日くらいまで危うく忘れかけてた

前回2020年はその年に買ったものを挙げましたが、今回は趣向を変えてOpenWrtにおける realtek target” について書いてみることにします。
前置きが長いので、本題から入りたい人は飛ばしてください

そのスイッチングハブ、何のチップが入っているかご存じですか

まず、ざっくりとスイッチングハブがどういう構成になっているかだけ書いておく。
世の中には

  • アンマネージド(ノンインテリジェント)
  • マネージド(インテリジェント)

の2つに大別されるスイッチングハブがあり、他にアンマネージドプラスとかあったりもするが、ここではマネージドにざっくり分類することとする。

アンマネージドスイッチ

ざっくりと言ってしまえば、管理機能が無く、ユーザーによる詳細な設定が不要な(できない)スイッチングハブ。
基板上の回路構成によりハードウェアの設定が自動的に行われるほか、ポートの取り扱いなどの構成情報も内部に存在するスイッチングハブチップが外部フラッシュメモリから直接読み出してそのまま適用する為、ユーザーが設定する余地は(ほぼ)無し。
できるとすれば、ループ検出機能のON/OFFくらい。

マネージドスイッチ

これもざっくり言ってしまえば、管理機能が付いていて、特に設定しなくても(大抵は)単純なスイッチングハブとして使えるものの、追加で設定することにより様々な機能が利用できるもの。
こちらの場合、大抵はスイッチングハブのチップに加えてSoCが搭載されたり、あるいはスイッチングハブ機能を持ったSoCを搭載している。
ハードウェアの構成を行うのは比較的SoCの割合が高く、また、CPUが存在することからユーザーの設定を受け付けてそれをポートの取り扱いに反映させることが可能となっている。

スイッチングハブに使われるチップ類

機種によって千差万別。ただし、上に挙げたマネージドスイッチの場合において、SoCとスイッチングハブチップの両方を搭載する場合は、SoCのベンダがスイッチングハブチップを作っていれば同じベンダで組み合わせるのが一般的。
主に(筆者が把握している範囲では)

  • Broadcom
  • Marvell
  • Realtek
  • Vitesse

などがスイッチングハブ向けSoCやスイッチングハブチップを製造している。スイッチングハブチップに限ればAtheros (Qualcomm Atheros)もあったりするが、Atherosは製品としてのスイッチングハブでの採用例は把握していないのでここでは除外。

余談: アンマネージドスイッチングハブに使用されるチップもそれ自体はVLAN等をサポートしていることが多く、海外にはアンマネージドスイッチングハブで制御用の信号線にアクセスして、VLANなどの設定を流し込めるようにしてしまった猛者もいる模様。

各スイッチングハブでの搭載チップベンダ

把握している中での例を挙げていく。ひとまずSoCを。

  • Allied Telesis x510シリーズ: Broadcom BCM53003系列 (ARM)
  • FXC FXC5010B: Vitesse VSC7390 (?)
  • FXC FXC5126: Broadcom BCM5621x系列 (MIPS)
  • Panasonic Switch-M24eG PN28240K: Realtek RTL8382M (MIPS)
  • Panasonic ZEQUO 4500DL: Marvell AlleyCat3系列 (ARM)

例 (Panasonic Switch-M24eG PN28240K):

  • RTL8382M: SoC, CPU -> MIPS 4KEc 500MHz, TP 8ポート
  • RTL8218B: SWハブ, TP 8ポート
  • RTL8218FB: SWハブ, TP 4ポート + TP/SFP 4ポート(コンボ)
    (Switch-M24eGでは2ポートのみTP/SFPで共用)

その他は wiki.taiha.net を参照。海外機については、realtek機中心であるものの models [Switches] や、全般的にはWikiDevi系サイトにいくつか掲載されている。

前置きが長くなったが、上に挙げた中でSwitch-M24eG PN28240Kの搭載するRealtek SoCが今回の主役(であるRealtek系機種)。

OpenWrtにおけるrealtek target

OpenWrtではベンダやSoCの系統で分類したものを “target” と称しており、今現在OpenWrtのmasterに存在する “realtek” targetは源流を “rtl838x” targetとするもので、早い話スイッチングハブ向けSoC用のtargetということ。
無線機向けのRealtek SoCにも今後このtargetで動かせる可能性が無いことも無いモノは存在しているものの、現時点では入ってくる予定などは無し。

realtek targetにのめり込むまでの経緯

OpenWrt Forumに突如「スイッチングハブでOpenWrt動かしてみた」が降ってくる
面白すぎるでしょ
Support for RTL838x based managed switches – For Developers – OpenWrt Forum
突如としてOpenWrt Forumに立てられたトピック。それまでRealtek SoCを搭載する無線機で動かしてみたというものはたまに立てられたり浮上してきたりということはあったものの、スイッチングハブは完全に意識の外だった。引き寄せられないはずが無かった
ベースにしているコードもOpenWrtの最新に近く、DeviceTreeでおおよそ構成できるようになっており、プラットフォームのサポートとしても、それまでたまに出てくることがあった無線機向けRealtek SoCのサポートと比べて上々。
短期間一緒にコードの改善作業をする
偶然にも、それ以前にrtl838xとは全く別件でハードオフで確保していたAML2-17GPがこれに該当するプラットフォームであることに気付き、早速トピックを立てた方のコードを利用してビルド。無事ブートして動作した。
「AML2-17GPで動かしてみたよ」というのを投稿した後、色々あって少しの間一緒にコードの改善作業をすることになり、大体以下のようなことをした。

  • Linux Kernelにおける変更をファイルの上書きからpatchへの変換
  • Kernelのオプションが多重になっていて冗長な個所をシンプル化
  • OpenWrt内でLinux Kernel 4.19から5.4への移行が進んでいた為、4.19をベースにしていたrtl838x targetのコードを5.4へ移行
トピックの様子を静観
諸事情があって一緒のコード改善作業を終わりにした後は、しばらくトピックの様子を静観していた。
それまでの無線機向けサポートと比べてコードの状態は上々ではあるものの、Linux Kernelにはサポートが無いSoCであり、OpenWrt側でプラットフォームサポートのコードを全て抱えることから、OpenWrtにマージされるかは正直わからなかった。その為、この時期はAML2-17GPもしっかりした調整は手を止めていた。
rtl838x target、マージされる
そんなこんなで若干不安視していたのは杞憂に終わり、rtl838x targetはめでたくOpenWrtにマージ。OpenWrtチームメンバーも何人かはだいぶ興味を持っているようで、PoE制御の為のユーティリティがMLに投稿されるなどしている。
マージされたことでデバイスサポートもOpenWrt公式でマージされるようになったため、ここで一気にモチベーションが爆上がりした。
この後、OpenWrt内でドライバ類が書き直されたり、最初にトピックを立てた方やその他の方などによってついにはOpenWrtの上流に位置するLinux KernelにもSoCサポートやいくつかのドライバが投げ込まれ、マージされている。
その間、個人的には中断したAML2-17GPのサポート作業を進めたり、このtargetでサポートできるスイッチングハブを探し始めたりした。

なお、rtl838x targetは後に “realtek” targetへと改名された。

これまでにrealtek targetで私がやったこと

記事執筆時点で、以下をやった。

  • INABA Abaniact AML2-17GPのサポート追加
  • realtek targetへのLinux Kernel 5.10サポート追加

AML2-17GPについては、上で書いた通りごく初期にコードを書いてしばらく中断していたため、最新のコードに合わせ調整して投げ込んでマージ。
Kernel 5.10のサポート追加については、OpenWrtに全体として5.10サポートが追加された少し後に個人的なものとして始め、Forumの上で挙げたトピックに進捗を書いたり、あるいは躓いたところを聞いてみるなどして進め、一点気になる箇所はあったものの無事マージ。その後しばらくしてtargetのKernelバージョンも5.10へ切り替えられた。

現在realtek targetでやっていること

これも記事執筆時点。

  • 機種サポート追加
    • APRESIA ApresiaLightGS120GT-SS
    • I-O DATA BSH-G24MB
    • Panasonic Switch-M8eG PN28080K
      Switch-M24eG PN28240K
      Switch-M48eG PN28480K
  • realtek targetへのLinux Kernel 5.15サポート追加

機種サポートについては、ぶっちゃけ興味があまりにも先走りすぎてしまい、ヤフオクで落札したりメルカリで確保したり、APRESIA機に至っては中古でほとんど出てこないので、新品を購入。
Switch-M24eG PN28240KとSwitch-M48eG PN28480KはSFPポートの為にRTL8218FBを搭載するものの、現在OpenWrt内に存在するドライバではサポートされておらずTPポートしか機能しない状態の為、チップのサポート追加を試行中。TP/SFPを切り替えて大体問題無く通信できる状態まで到達した。Switch-M16eG PN28160Kは中古価格が高くなりがちなので見送り中。

Linux Kernel 5.10のサポート追加が完了して一息ついていたら、あまり経たずにOpenWrt全体へ5.15サポートを追加するPRがオープンされた。プロジェクトとしては、次のリリースに5.10を使用することは決定事項であることからそのPRは次期メジャーバージョンがリリースされるまでマージされないものの、興味があったのでそのPRを利用してrealtek targetへの5.15サポート追加にトライ中。
ネットワーク周りの変更が(特にDSAサブシステム)5.10から5.15の間で大きい為、現状そこが上手く動かないほか、Switch-M8eGで不可解なトラブルが起きることを確認。


上から

  • AML2-17GP
  • BSH-G24MB
  • Switch-M8eG PN28080K
  • Switch-M24eG PN28240K
  • Switch-M48eG PN28480K

  • ApresiaLightGS120GT-SS

今後realtek targetでやること/やりそうなこと/やりたいこと

  • SoCとしてRTL839xを搭載する機種のCPUにおけるマルチスレッディング周り
  • Kernel 5.15サポート追加に際してのネットワーク周り修正
  • 国内メーカーPoE機のサポート追加

現在realtek targetに存在する機種は全てがRTL838x SoCを搭載するもののみで、マルチスレッディングに対応し見かけ上2コアを使用できるRTL839xを搭載するものや、10Gbps対応機に使用されるRTL93xxを搭載するものはまだ無い。
その為、今後上のトピックを立てた人を中心にRTL839xやRTL93xxでのマルチスレッディング対応が進められるが、それについても個人的に学習も兼ねて探ってみたい。
ちなみに、Panasonic Switch-M48eG PN28480KにはRTL839xファミリーのRTL8393Mが搭載されている。

Kernel 5.15についてはまだ猶予が十分すぎるほど存在するので、ひとまずゆっくりとDSAやドライバのコードを読み込みつつ、問題を洗い出し必要なら詳しい方に聞いて修正を進める。

既に非PoE機は複数所有しているもののPoE機は一台も無く、Kernel 5.10へのバージョン引き上げの際PoEに関連する点に気付かず、PRでコメントを受けて確認して不足に気付くなどした。もし今後可能なら、PoE機も確保することを思案中。

まとめ

とにもかくにも、スイッチングハブでOpenWrtが動くというのがあまりにも新鮮で、なおかつMediaTekやQualcomm AtherosなどのSoCとは異なり現在進行形でプラットフォームサポートの構築が進んでいる状況なので、組込ハードとLinux Kernelの両面について理解を深めるのに丁度良く、楽しみながら参加中。
スイッチングハブ内部でどのチップがどう接続されているかというのを探ったり、Kernelバージョンの引き上げ作業を通して実際に知識が付いてきているのは実感していて、以前できなかったことが時間を経てできるようになったり、多少のヒントがあれば筋道を思いつくようになるなどしていて、とても楽しい。
まだまだ興味冷めやらず、時間を作りながら参加していきたいところ。

「mstdn.maud.io Advent Calender 2021」、次の12日目は kozue 氏です。