カテゴリー: ar71xx

GL-AR750S

偶然某氏より頂いたもの。ath79へサポートを追加するため、調べていく。GL・iNetのリポジトリではar71xxベースのコードが既に存在するため、難易度はそんなに高くは無いかな?というところ。
→ 大嘘。現状OpenWrtにはSPI-NANDドライバが無く、rootfsがubiで格納されているspi-nandチップを検出できない。ドライバをSPI-NANDサポート後のKernelからbackportする必要がある。
頂いてばかりでほんとに申し訳ないところ。何かそのうち返せるものがあれば。。

Switch

zone WAN LAN
port
(GL-AR750S)
WAN LAN2 LAN1
port
(AR8337)
port1 port2 port3

MAC

  • LAN: E4:95:6E:xx:xx:2E (art, 0x0 (hex))
  • WAN: E4:95:6E:xx:xx:2E (同上)
  • 2.4G: E4:95:6E:xx:xx:2E (art, 0x1002 (hex))
  • 5G: E4:95:6E:xx:xx:2F (LAN + 1)

Kernel

stock firmwareの裏側はほぼ素のOpenWrtのため、こちらから調べた。

  • uname -a
    root@GL-AR750S:~# uname -a
    Linux GL-AR750S 4.9.109 #0 Fri Jun 22 10:22:57 2018 mips GNU/Linux
    

  • cat /proc/version
    root@GL-AR750S:~# cat /proc/version
    Linux version 4.9.109 (***@***-*****-***) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r6910-323285a) ) #0 Fri Jun 22 10:22:57 2018
    

  • cat /proc/cpuinfo
    root@GL-AR750S:~# cat /proc/cpuinfo
    system type             : Qualcomm Atheros QCA956X ver 1 rev 0
    machine                 : GL-AR750S
    processor               : 0
    cpu model               : MIPS 74Kc V5.0
    BogoMIPS                : 385.84
    wait instruction        : yes
    microsecond timers      : yes
    tlb_entries             : 32
    extra interrupt vector  : yes
    hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
    isa                     : mips1 mips2 mips32r1 mips32r2
    ASEs implemented        : mips16 dsp dsp2
    shadow register sets    : 1
    kscratch registers      : 0
    package                 : 0
    core                    : 0
    VCED exceptions         : not available
    VCEI exceptions         : not available
    

  • cat /proc/meminfo
    root@GL-AR750S:~# cat /proc/meminfo
    MemTotal:         124608 kB
    MemFree:           73624 kB
    MemAvailable:      64112 kB
    Buffers:            7864 kB
    Cached:            19772 kB
    SwapCached:            0 kB
    Active:            19932 kB
    Inactive:          11192 kB
    Active(anon):       4152 kB
    Inactive(anon):      156 kB
    Active(file):      15780 kB
    Inactive(file):    11036 kB
    Unevictable:           0 kB
    Mlocked:               0 kB
    SwapTotal:             0 kB
    SwapFree:              0 kB
    Dirty:                 0 kB
    Writeback:             0 kB
    AnonPages:          3500 kB
    Mapped:             4228 kB
    Shmem:               820 kB
    Slab:               9372 kB
    SReclaimable:       3312 kB
    SUnreclaim:         6060 kB
    KernelStack:         704 kB
    PageTables:          504 kB
    NFS_Unstable:          0 kB
    Bounce:                0 kB
    WritebackTmp:          0 kB
    CommitLimit:       62304 kB
    Committed_AS:      10872 kB
    VmallocTotal:    1048372 kB
    VmallocUsed:           0 kB
    VmallocChunk:          0 kB
    

  • cat /proc/mtd
    dev:    size   erasesize  name
    mtd0: 00040000 00010000 "u-boot"
    mtd1: 00010000 00010000 "u-boot-env"
    mtd2: 00010000 00010000 "art"
    mtd3: 00200000 00010000 "kernel"
    mtd4: 00cbf000 00010000 "reserved"
    mtd5: 08000000 00020000 "ubi"
    

  • dmesg
    無線は起動後に急いで切った。

    root@GL-AR750S:~# dmesg
    [    0.000000] Linux version 4.9.109 (luo@luo-B250M-D3H) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r6910-323285a) ) #0 Fri Jun 22 10:22:57 2018
    [    0.000000] bootconsole [early0] enabled
    [    0.000000] CPU0 revision is: 00019750 (MIPS 74Kc)
    [    0.000000] SoC: Qualcomm Atheros QCA956X ver 1 rev 0
    [    0.000000] Determined physical RAM map:
    [    0.000000]  memory: 08000000 @ 00000000 (usable)
    [    0.000000] Initrd not found or empty - disabling initrd
    [    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
    [    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
    [    0.000000] Zone ranges:
    [    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
    [    0.000000] Movable zone start for each node
    [    0.000000] Early memory node ranges
    [    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
    [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
    [    0.000000] On node 0 totalpages: 32768
    [    0.000000] free_area_init_node: node 0, pgdat 804ee8a4, node_mem_map 81000020
    [    0.000000]   Normal zone: 256 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 32768 pages, LIFO batch:7
    [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    [    0.000000] pcpu-alloc: [0] 0
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
    [    0.000000] Kernel command line:  board=GL-AR750S console=ttyS0,115200 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(art)ro,2048k(kernel),13052k(reserved);spi0.1:-(ubi) rootfstype=squashfs noinitrd
    [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
    [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    [    0.000000] Writing ErrCtl register=00000000
    [    0.000000] Readback ErrCtl register=00000000
    [    0.000000] Memory: 124420K/131072K available (3652K kernel code, 159K rwdata, 856K rodata, 188K init, 217K bss, 6652K reserved, 0K cma-reserved)
    [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [    0.000000] NR_IRQS:51
    [    0.000000] Clocks: CPU:775.000MHz, DDR:650.000MHz, AHB:258.333MHz, Ref:25.000MHz
    [    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4932285024 ns
    [    0.000007] sched_clock: 32 bits at 387MHz, resolution 2ns, wraps every 5541893118ns
    [    0.008223] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
    [    0.071033] pid_max: default: 32768 minimum: 301
    [    0.075985] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.082956] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.092574] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.102978] futex hash table entries: 256 (order: -1, 3072 bytes)
    [    0.110405] NET: Registered protocol family 16
    [    0.116383] MIPS: machine is GL-AR750S
    [    0.359895] registering PCI controller with io_map_base unset
    [    0.378262] i2c-gpio i2c-gpio.0: using pins 5 (SDA) and 21 (SCL)
    [    0.384805] PCI host bridge to bus 0000:00
    [    0.389162] pci_bus 0000:00: root bus resource [mem 0x12000000-0x13ffffff]
    [    0.396403] pci_bus 0000:00: root bus resource [io  0x0001]
    [    0.402278] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
    [    0.409425] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
    [    0.417803] pci 0000:00:00.0: [168c:0050] type 00 class 0x028000
    [    0.417812] pci 0000:00:00.0: invalid calibration data
    [    0.423243] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x001fffff 64bit]
    [    0.423290] pci 0000:00:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
    [    0.423355] pci 0000:00:00.0: supports D1
    [    0.423363] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
    [    0.423549] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
    [    0.423572] pci 0000:00:00.0: BAR 0: assigned [mem 0x12000000-0x121fffff 64bit]
    [    0.431318] pci 0000:00:00.0: BAR 6: assigned [mem 0x12200000-0x1220ffff pref]
    [    0.438935] pci 0000:00:00.0: using irq 40 for pin 1
    [    0.446715] clocksource: Switched to clocksource MIPS
    [    0.452953] NET: Registered protocol family 2
    [    0.458376] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.465733] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.472476] TCP: Hash tables configured (established 1024 bind 1024)
    [    0.479264] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [    0.485430] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [    0.492293] NET: Registered protocol family 1
    [    0.496950] PCI: CLS 0 bytes, default 32
    [    0.499203] Crashlog allocated RAM at address 0x3f00000
    [    0.505502] workingset: timestamp_bits=30 max_order=15 bucket_order=0
    [    0.518286] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [    0.524428] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
    [    0.542359] io scheduler noop registered
    [    0.546493] io scheduler deadline registered (default)
    [    0.552320] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
    [    0.561227] console [ttyS0] disabled
    [    0.585062] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
    [    0.594159] console [ttyS0] enabled
    [    0.601708] bootconsole [early0] disabled
    [    0.615008] m25p80 spi0.0: found w25q128, expected m25p80
    [    0.629708] m25p80 spi0.0: w25q128 (16384 Kbytes)
    [    0.634589] 5 cmdlinepart partitions found on MTD device spi0.0
    [    0.640712] Creating 5 MTD partitions on "spi0.0":
    [    0.645665] 0x000000000000-0x000000040000 : "u-boot"
    [    0.652005] 0x000000040000-0x000000050000 : "u-boot-env"
    [    0.658861] 0x000000050000-0x000000060000 : "art"
    [    0.665016] 0x000000060000-0x000000260000 : "kernel"
    [    0.671500] 0x000000260000-0x000000f1f000 : "reserved"
    [    0.678665] spi-nand: Giga SPI NAND was found.
    [    0.683266] spi-nand: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
    [    0.691489] 1 cmdlinepart partitions found on MTD device spi0.1
    [    0.697640] Creating 1 MTD partitions on "spi0.1":
    [    0.702589] 0x000000000000-0x000008000000 : "ubi"
    [    1.156400] found bad block 7fe0000
    [    1.160604] libphy: Fixed MDIO Bus: probed
    [    1.173776] switch0: Atheros AR8337 rev. 2 switch registered on ag71xx-mdio.0
    [    1.902060] libphy: ag71xx_mdio: probed
    [    2.528162] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:00 [uid=004dd036, driver=Atheros AR8216/AR8236/AR8316]
    [    2.539704] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:SGMII
    [    2.547589] NET: Registered protocol family 10
    [    2.555277] NET: Registered protocol family 17
    [    2.559973] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
    [    2.573446] 8021q: 802.1Q VLAN Support v1.8
    [    2.582811] UBI: auto-attach mtd5
    [    2.586262] ubi0: attaching mtd5
    [    2.596728] random: fast init done
    [    7.262423] ubi0: scanning is finished
    [    7.317575] ubi0: attached mtd5 (name "ubi", size 128 MiB)
    [    7.323244] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
    [    7.330378] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
    [    7.337390] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
    [    7.344575] ubi0: good PEBs: 1023, bad PEBs: 1, corrupted PEBs: 0
    [    7.350873] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
    [    7.358339] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 344389367
    [    7.367683] ubi0: available PEBs: 0, total reserved PEBs: 1023, PEBs reserved for bad PEB handling: 19
    [    7.377365] ubi0: background thread "ubi_bgt0d" started, PID 320
    [    7.387009] block ubiblock0_0: created from ubi0:0(rootfs)
    [    7.392684] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
    [    7.399896] hctosys: unable to open rtc device (rtc0)
    [    7.426055] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
    [    7.434489] Freeing unused kernel memory: 188K
    [    7.439101] This architecture does not have kernel memory protection.
    [    8.326158] init: Console is alive
    [    8.329962] init: - watchdog -
    [   11.259095] kmodloader: loading kernel modules from /etc/modules-boot.d/*
    [   11.424459] usbcore: registered new interface driver usbfs
    [   11.430247] usbcore: registered new interface driver hub
    [   11.435804] usbcore: registered new device driver usb
    [   11.446145] exFAT: Version 1.2.9
    [   11.479059] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    [   11.494259] SCSI subsystem initialized
    [   11.502408] ehci-platform: EHCI generic platform driver
    [   11.507931] ehci-platform ehci-platform.0: EHCI Host Controller
    [   11.514074] ehci-platform ehci-platform.0: new USB bus registered, assigned bus number 1
    [   11.524523] ehci-platform ehci-platform.0: irq 48, io mem 0x1b000000
    [   11.556751] ehci-platform ehci-platform.0: USB 2.0 started, EHCI 1.00
    [   11.564101] hub 1-0:1.0: USB hub found
    [   11.568276] hub 1-0:1.0: 1 port detected
    [   11.572633] ehci-platform ehci-platform.1: EHCI Host Controller
    [   11.578814] ehci-platform ehci-platform.1: new USB bus registered, assigned bus number 2
    [   11.589290] ehci-platform ehci-platform.1: irq 49, io mem 0x1b400000
    [   11.616735] ehci-platform ehci-platform.1: USB 2.0 started, EHCI 1.00
    [   11.624059] hub 2-0:1.0: USB hub found
    [   11.628269] hub 2-0:1.0: 1 port detected
    [   11.634894] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    [   11.642664] ohci-platform: OHCI generic platform driver
    [   11.650271] uhci_hcd: USB Universal Host Controller Interface driver
    [   11.660623] usbcore: registered new interface driver usb-storage
    [   11.667487] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
    [   11.677595] init: - preinit -
    [   12.278192] usb 2-1: new high-speed USB device number 2 using ehci-platform
    [   12.589604] hub 2-1:1.0: USB hub found
    [   12.609157] hub 2-1:1.0: 4 ports detected
    [   12.945148] random: procd: uninitialized urandom read (4 bytes read)
    [   13.048272] usb 2-1.1: new high-speed USB device number 3 using ehci-platform
    [   13.274144] usb-storage 2-1.1:1.0: USB Mass Storage device detected
    [   13.287920] scsi host0: usb-storage 2-1.1:1.0
    [   13.359842] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [   14.358430] scsi 0:0:0:0: Direct-Access     Generic  STORAGE DEVICE   0233 PQ: 0 ANSI: 0
    [   14.371362] sd 0:0:0:0: [sda] Attached SCSI removable disk
    [   14.438395] eth0: link up (1000Mbps/Full duplex)
    [   14.443377] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    [   16.627648] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 442
    [   16.920834] UBIFS (ubi0:1): recovery needed
    [   17.550131] UBIFS (ubi0:1): recovery completed
    [   17.554805] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
    [   17.562924] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
    [   17.573176] UBIFS (ubi0:1): FS size: 116183040 bytes (110 MiB, 915 LEBs), journal size 5840896 bytes (5 MiB, 46 LEBs)
    [   17.584137] UBIFS (ubi0:1): reserved for root: 4952683 bytes (4836 KiB)
    [   17.590977] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID EB673D7C-E244-4A1A-96AA-6589ADE8527C, small LPT model
    [   17.636116] mount_root: switching to ubifs overlay
    [   17.720883] urandom-seed: Seeding with /etc/urandom.seed
    [   17.908872] eth0: link down
    [   17.922029] procd: - early -
    [   17.925092] procd: - watchdog -
    [   18.521942] random: jshn: uninitialized urandom read (4 bytes read)
    [   18.588667] procd: - watchdog -
    [   18.592132] procd: - ubus -
    [   18.796256] random: ubusd: uninitialized urandom read (4 bytes read)
    [   18.884659] random: ubusd: uninitialized urandom read (4 bytes read)
    [   18.898509] procd: - init -
    [   20.931307] kmodloader: loading kernel modules from /etc/modules.d/*
    [   20.978385] ntfs: driver 2.1.32 [Flags: R/O MODULE].
    [   21.010241] tun: Universal TUN/TAP device driver, 1.6
    [   21.015465] tun: (C) 1999-2004 Max Krasnyansky 
    [   21.049229] ip6_tables: (C) 2000-2006 Netfilter Core Team
    [   21.080802] Netfilter messages via NETLINK v0.30.
    [   21.094517] ip_set: protocol 6
    [   21.163178] fuse init (API version 7.26)
    [   21.198780] usbcore: registered new interface driver cdc_acm
    [   21.204629] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
    [   21.228049] usbcore: registered new interface driver cdc_wdm
    [   21.240382] Loading modules backported from Linux version wt-2017-11-01-0-gfe248fc2c180
    [   21.248704] Backport generated by backports.git v4.14-rc2-1-31-g86cf0e5d
    [   21.277750] ip_tables: (C) 2000-2006 Netfilter Core Team
    [   21.297566] usbcore: registered new interface driver ipheth
    [   21.327962] nf_conntrack version 0.5.0 (2048 buckets, 8192 max)
    [   21.621487] usbcore: registered new interface driver usbserial
    [   21.627650] usbcore: registered new interface driver usbserial_generic
    [   21.634478] usbserial: USB Serial support registered for generic
    [   21.673466] wireguard: WireGuard 0.0.20180620 loaded. See www.wireguard.com for information.
    [   21.682234] wireguard: Copyright (C) 2015-2018 Jason A. Donenfeld . All Rights Reserved.
    [   21.778571] xt_time: kernel timezone is -0000
    [   21.790543] usbcore: registered new interface driver cdc_ether
    [   21.819567] usbcore: registered new interface driver cdc_ncm
    [   22.008228] usbcore: registered new interface driver cp210x
    [   22.014059] usbserial: USB Serial support registered for cp210x
    [   22.038053] usbcore: registered new interface driver huawei_cdc_ncm
    [   22.150154] PPP generic driver version 2.4.2
    [   22.165506] PPP MPPE Compression module registered
    [   22.175685] NET: Registered protocol family 24
    [   22.189316] usbcore: registered new interface driver qmi_wwan
    [   22.219423] usbcore: registered new interface driver rndis_host
    [   22.256774] usbcore: registered new interface driver sierra
    [   22.262642] usbserial: USB Serial support registered for Sierra USB modem
    [   22.290952] usbcore: registered new interface driver sierra_net
    [   22.367606] PCI: Enabling device 0000:00:00.0 (0000 -> 0002)
    [   22.375703] ath10k_pci 0000:00:00.0: pci irq legacy oper_irq_mode 1 irq_mode 0 reset_mode 0
    [   22.691315] ath10k_pci 0000:00:00.0: Direct firmware load for ath10k/pre-cal-pci-0000:00:00.0.bin failed with error -2
    [   22.702403] ath10k_pci 0000:00:00.0: Falling back to user helper
    [   30.939926] firmware ath10k!pre-cal-pci-0000:00:00.0.bin: firmware_loading_store: map pages failed
    [   30.958008] ath10k_pci 0000:00:00.0: Direct firmware load for ath10k/QCA9887/hw1.0/firmware-6.bin failed with error -2
    [   30.969087] ath10k_pci 0000:00:00.0: Falling back to user helper
    [   32.708941] firmware ath10k!QCA9887!hw1.0!firmware-6.bin: firmware_loading_store: map pages failed
    [   33.077190] ath10k_pci 0000:00:00.0: qca9887 hw1.0 target 0x4100016d chip_id 0x004000ff sub 0000:0000
    [   33.086749] ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 1
    [   33.099533] ath10k_pci 0000:00:00.0: firmware ver 10.2.4-1.0-00033 api 5 features no-p2p,ignore-otp,skip-clock-init,mfp,allows-mesh-bcast crc32 c232a0c3
    [   33.268684] ath10k_pci 0000:00:00.0: Direct firmware load for ath10k/QCA9887/hw1.0/board-2.bin failed with error -2
    [   33.279511] ath10k_pci 0000:00:00.0: Falling back to user helper
    [   33.466320] firmware ath10k!QCA9887!hw1.0!board-2.bin: firmware_loading_store: map pages failed
    [   33.486568] ath10k_pci 0000:00:00.0: board_file api 1 bmi_id N/A crc32 546cca0d
    [   34.786047] ath10k_pci 0000:00:00.0: htt-ver 2.1 wmi-op 5 htt-op 2 cal file max-sta 128 raw 0 hwcrypto 1
    [   34.928130] ath: EEPROM regdomain: 0x0
    [   34.928137] ath: EEPROM indicates default country code should be used
    [   34.928140] ath: doing EEPROM country->regdmn map search
    [   34.928151] ath: country maps to regdmn code: 0x3a
    [   34.928155] ath: Country alpha2 being used: US
    [   34.928158] ath: Regpair used: 0x3a
    [   35.007841] usbcore: registered new interface driver option
    [   35.013674] usbserial: USB Serial support registered for GSM modem (1-port)
    [   35.076414] usbcore: registered new interface driver rt2800usb
    [   35.110543] ath: EEPROM regdomain: 0x0
    [   35.110551] ath: EEPROM indicates default country code should be used
    [   35.110554] ath: doing EEPROM country->regdmn map search
    [   35.110566] ath: country maps to regdmn code: 0x3a
    [   35.110570] ath: Country alpha2 being used: US
    [   35.110573] ath: Regpair used: 0x3a
    [   35.120548] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
    [   35.124152] ieee80211 phy1: Atheros AR9561 Rev:0 mem=0xb8100000, irq=47
    [   35.187783] kmodloader: done loading kernel modules from /etc/modules.d/*
    [   45.361749] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [   45.381062] br-lan: port 1(eth0.1) entered blocking state
    [   45.386651] br-lan: port 1(eth0.1) entered disabled state
    [   45.392607] device eth0.1 entered promiscuous mode
    [   45.397595] device eth0 entered promiscuous mode
    [   45.430229] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
    [   45.473702] IPv6: ADDRCONF(NETDEV_UP): eth0.2: link is not ready
    [   46.715529] eth0: link up (1000Mbps/Full duplex)
    [   46.723175] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    [   46.804760] br-lan: port 1(eth0.1) entered blocking state
    [   46.810384] br-lan: port 1(eth0.1) entered forwarding state
    [   46.816287] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.2: link becomes ready
    [   46.968826] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
    [   48.377861] fast-classifier: starting up
    [   48.382072] fast-classifier: registered
    [   55.894385] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [   55.915610] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
    [   55.929752] br-lan: port 2(wlan0) entered blocking state
    [   55.935250] br-lan: port 2(wlan0) entered disabled state
    [   55.941137] device wlan0 entered promiscuous mode
    [   55.962806] br-lan: port 3(wlan1) entered blocking state
    [   55.968347] br-lan: port 3(wlan1) entered disabled state
    [   55.974187] device wlan1 entered promiscuous mode
    [   57.216107] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
    [   57.222873] br-lan: port 3(wlan1) entered blocking state
    [   57.228390] br-lan: port 3(wlan1) entered forwarding state
    [   57.778998] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
    [   57.785725] br-lan: port 2(wlan0) entered blocking state
    [   57.791280] br-lan: port 2(wlan0) entered forwarding state
    [   78.289279] nf_conntrack: default automatic helper assignment has been turned off for security reasons and CT-based  firewall rule not found. Use the iptables CT target to attach helpers instead.
    [   79.816751] random: crng init done
    [   79.820277] random: 6 urandom warning(s) missed due to ratelimiting
    [  130.272445] device wlan0 left promiscuous mode
    [  130.277219] br-lan: port 2(wlan0) entered disabled state
    [  132.255789] device wlan1 left promiscuous mode
    [  132.260560] br-lan: port 3(wlan1) entered disabled state
    [ 2733.302008] ath: EEPROM regdomain: 0x8188
    [ 2733.302016] ath: EEPROM indicates we should expect a country code
    [ 2733.302020] ath: doing EEPROM country->regdmn map search
    [ 2733.302024] ath: country maps to regdmn code: 0x40
    [ 2733.302029] ath: Country alpha2 being used: JP
    [ 2733.302033] ath: Regpair used: 0x40
    [ 2733.302037] ath: regdomain 0x8188 dynamically updated by user
    [ 2733.306445] ath: EEPROM regdomain: 0x8188
    [ 2733.306448] ath: EEPROM indicates we should expect a country code
    [ 2733.306451] ath: doing EEPROM country->regdmn map search
    [ 2733.306455] ath: country maps to regdmn code: 0x40
    [ 2733.306458] ath: Country alpha2 being used: JP
    [ 2733.306461] ath: Regpair used: 0x40
    [ 2733.306464] ath: regdomain 0x8188 dynamically updated by user
    [ 2757.549210] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [ 2757.559092] br-lan: port 2(wlan0) entered blocking state
    [ 2757.564584] br-lan: port 2(wlan0) entered disabled state
    [ 2822.121600] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
    [ 2822.161342] br-lan: port 2(wlan1) entered blocking state
    [ 2822.166923] br-lan: port 2(wlan1) entered disabled state
    

BHR-4GRV2とKernel 4.14

最近BHR-4GRV2が公式のbuildbotにおいてar71xx/tinyをfailさせる一因になっていたので、それに関連するメモ。

どうする

ar71xx/tinyのほうは今から変更するのは厳しいため、諦める。
一方ath79/tinyのほうは、ath79がまだ公式ではビルドされていないこともあって変更の余地はあるため、以下のように変更しようかと思案中。→ 既存のサポートに対する修正としてPRを投げた。
この変更を行うと、ar71xxからのsysupgradeができない*、factoryファームを作れないなどの弊害は出る。
(*: 正確にはar71xxからsysupgradeで書き込むことはできるけど、U-Bootの環境変数を変更してから実行しないと再起動後にath79のKernelを起動できず止まる。危険なのでar71xx -> ath79は不可にしてしまうほうが良さそう。)

rootfs,kernelをfirmwareとして結合
Kernelがサイズ制限を受ける原因となっているmtdパーティションの構成を変更し、生成されたKernelのサイズに従って柔軟にRootfsの位置が変化できる “firmware” パーティションを使用する。
U-BootのKernelオフセットを変更
前項でmtdパーティションの構成を変更しただけではU-Bootが起動時にKernelを見つけられなくなるため、U-Bootの環境変数内に格納されているオフセットを変更する。
メーカーファーム -> OpenWrtインストール方法の変更
mtdパーティションを変更した場合、本来のKernelサイズ制限を超過するKernelが許容されるようになるため、factoryは作成できなくなる。
これに伴い、メーカーファームからOpenWrtへ入れ替える方法を以下の通りに変更する。

  • ECOボタンを押しながらinitramfsファームでブート
  • initramfsファーム上でU-Bootの環境変数を変更
  • squashfs-sysupgradeファームでsysupgrade
  • 完了

ざっくりと日本語で書く分には楽だけれども、英文で詳細に記述するのはしんどい。

Atheros/QCA Ethernet PLLレジスタメモ

Atheros/QCA SoCのEthernet PLLレジスタのアドレスのメモ。

SoC Address (GE0) Address (GE1)
AR7130 0x18050010 0x18050014
AR7141
AR7161
AR7242 0x1805002C
AR9130 0x18050014 0x18050018
AR9132
AR9341 0x1805002C
AR9342
AR9344
QCA9533
QCA9556 0x18050048 (SGMII)
QCA9558
(QCA9557)
0x18050028 (XMII) 0x18050048 (SGMII)
QCA956X
(QCA9561, QCA9563)
0x18050048 (SGMII),
0x1805002C (other)

KSEG1ADDR() メモ

Adding new device support[OpenWrt Wiki]の “KSEG1ADDR() and accessing NOR flash” をざっくり訳したメモ。
自分のわかりやすさ優先で、ところどころ言い回しを置き換えた。上手く訳せなかった個所もあるけれども、大体言おうとしていることはわかるからいいやということで。

  • KSEG1ADDR() と NOR フラッシュのアクセス

    ボードのMACアドレスやEEPROM、その他のキャリブレーションデータを得るには、カーネル上でフラッシュから読み込む必要があるかもしれません。NOR フラッシュを使用しているほとんどのAtheros チップの場合、init 関数内で実行されるプロセスコンテキストのために、フラッシュのハードウェアアドレスを仮想アドレスに変換する KSEG1ADDR() マクロを使用して行われます。
    もしあなたがボード初期化のコードを調査している時に、例えばこの “KSEG1ADDR(0x1fff0000)” を見た際に、この数字は最初魔法のように現れます。しかし、これは2つの点を理解すれば論理的なものです。

    まず最初に、NOR フラッシュを使用しているAtheros SoCのフラッシュは物理アドレス 0x1f000000 へ結線されます(フラッシュがボード上でどこに接続されるかの保証はありません。しかし、これは一般的な場所です)。このアドレスはブートローダへ与えるアドレスとして当てにすることはできず、 0xbf000000 を見る必要がありますが、これは恐らくは仮想アドレスです。
    もしボード上でフラッシュがこれらのメモリーの場所に結線されている場合、 KSEG1ADDR(0x1f000000 + OFFSET_FROM_BEGIN) を使用して確実にフラッシュへアクセスできるでしょう。しかし、フラッシュの終端に非常に近いと想定されるデータにアクセスする必要がある機会には、複数サイズのフラッシュメモリと互換性のあるコードを作るトリックを利用することができます。
    フラッシュは、しばしばそれが 4MB や 8MB 、16MB という実際の容量に関わらず 16MB 一杯のアドレス空間としてマッピングされます。そのため、この場合では KSEG1ADDR(0x20000000 – OFFSET_FROM_END) がフラッシュメモリの終端から特定の距離離れたものへのアクセスとして機能します。
    KSEG1ADDR(0x1fff0000) を見た時、デバイスは 4MB または 8MB のフラッシュを持っており、それはフラッシュ終端から 64KB 戻った地点のフラッシュ(ここには “Atheros Radio Test (ART) データが格納されています)を参照するのにこのトリックを使用しているということを推測するのに理にかなっています。

WHR-G301Nとmtd

メーカーファームに戻したところ、OpenWrtのmtdパーティション定義と異なっていたのでメモ。

  • OpenWrt (ar71xx)

    0x3F0000 - 0x400000 が未定義。ただし、MACアドレスはこの 0x10000 の領域から取得されている。

    0x0 – 0x3E000 0x3E000 – 0x40000 0x40000 – 0x3E0000 0x3E0000 – 0x3F0000 0x3F0000 – 0x400000
    mtd mtd0 mtd1 mtd2 mtd6 (none)
    name u-boot u-boot-env firmware art (none)
    (mtd) mtd3 mtd4 mtd5 (none)
    (name) kernel rootfs rootfs_data (none)
  • stock firmware

    0x3F0000 - 0x400000 が “ART” として定義されている。

    0x0 – 0x3E000 0x3E000 – 0x40000 0x40000 – 0x3E0000 0x3E0000 – 0x3F0000 0x3F0000 – 0x400000
    mtd mtd0 mtd1 mtd6 mtd4 mtd5
    name u-boot u-boot_environ firmware user_property ART
    (mtd) mtd2 mtd3
    (name) kernel rootfs