タグ: BHR-4GRV2

BHR-4GRV2

既にath79へ移植済みではあるものの、kernelサイズに絡んで重大な変更が必要になったので、念のためメモ。

U-Boot

  • help
    ath> help
    ?       - alias for 'help'
    autoscr - run script from memory
    base    - print or set address offset
    bdinfo  - print Board Info structure
    boot    - boot default, i.e., run 'bootcmd'
    bootd   - boot default, i.e., run 'bootcmd'
    bootelf - Boot from an ELF image in memory
    bootm   - boot application image from memory
    bootp   - boot image via network using BootP/TFTP protocol
    bootvx  - Boot vxWorks from an ELF image
    cmp     - memory compare
    coninfo - print console devices and information
    cp      - memory copy
    crc32   - checksum calculation
    dhcp    - invoke DHCP client to obtain IP/boot params
    download - Download Image or Uboot to flash
    echo    - echo args to console
    erase   - erase FLASH memory
    ethreg    - S26 PHY Reg rd/wr  utility
    exit    - exit script
    flinfo  - print FLASH memory information
    go      - start application at address 'addr'
    help    - print online help
    hwclear - clear hardware variables to persistent storage
    hwcommit - save hardware variables to persistent storage
    hwget   - Hardware variables get
    hwset   - Hardware variables set
    iminfo  - print header information for application image
    itest   - return true/false on integer compare
    loop    - infinite loop on address range
    md      - memory display
    mii     - MII utility commands
    mm      - memory modify (auto-incrementing)
    mtest   - simple RAM test
    mw      - memory write (fill)
    nfs     - boot image via network using NFS protocol
    nm      - memory modify (constant address)
    pci     - list and access PCI Configuration Space
    ping    - send ICMP ECHO_REQUEST to network host
    pll cpu-pll dither ddr-pll dither - Set to change CPU & DDR speed
    pll erase
    pll get
    printenv- print environment variables
    progmac - Set ethernet MAC addresses
    protect - enable or disable FLASH write protection
    rarpboot- boot image via network using RARP/TFTP protocol
    reset   - Perform RESET of the CPU
    run     - run commands in an environment variable
    saveenv - save environment variables to persistent storage
    setenv  - set environment variables
    sleep   - delay execution for some time
    test    - minimal test like /bin/sh
    tftpboot- boot image via network using TFTP protocol
    version - print monitor version
    

  • version
    ath> version
    
    BUFFALO U-Boot Ver 1.06 (Apr  3 2014 - 16:26:57)
    

  • printenv
    メーカーファームではu-boot-envが空であり、u-boot内のデフォルト値が表示される模様。
    ath> printenv
    bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),6336k(rootfs),1408k(uImage),8256k(mib0),64k(ART)
    bootcmd=bootm 0x9fe80000
    bootdelay=2
    baudrate=115200
    ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee
    uu=tftp 0x80060000 bhr4grv2-uboot.bin; erase 0x9f000000 +0x40000; cp.b ${fileaddr} 0x9f000000 ${filesize}
    uk=tftp 0x80060000 bhr4grv2-kernel.bin; erase 0x9fe80000 +0x170000; cp.b ${fileaddr} 0x9fe80000 ${filesize}
    uf=tftp 0x80060000 bhr4grv2-rootfs-squashfs.bin; erase 0x9f050000 +de0000 ; cp.b ${fileaddr} 0x9f050000 ${filesize}
    inspection_env=set bootargs console=ttyS0,115200 rootfstype=ramfs rdinit=/etc/preinit rw board=RUBBERDUCK mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),14528k(rootfs),1472k(kernel),64k(art),16000k@0x50000(firmware) mem=64M 
    ramboot=set bootargs console=ttyS0,115200 rootfstype=ramfs rdinit=/etc/preinit rw root=/dev/ram0 mtdparts=ath-nor0:256k(u-boot)ro,64k(u-boot-env),14528k(rootfs),1472k(kernel),64k(art);tftp 0x81000000 bhr4grv2-uImage-initramfs-gzip.bin;bootm 0x81000000 
    resetenv=protect off 1:4-4;erase 1:4-4 
    dir=
    lu=tftp 0x80060000 ${dir}u-boot.bin&&erase 0x9f000000 +$filesize&&cp.b $fileaddr 0x9f000000 $filesize
    lf=tftp 0x80060000 ${dir}ap135${bc}-jffs2&&erase 0x9f050000 +0x630000&&cp.b $fileaddr 0x9f050000 $filesize
    lk=tftp 0x80060000 ${dir}vmlinux${bc}.lzma.uImage&&erase 0x9f680000 +$filesize&&cp.b $fileaddr 0x9f680000 $filesize
    stdin=serial
    stdout=serial
    stderr=serial
    ethact=eth0
    filesize=2f5ad4
    fileaddr=81000000
    ipaddr=192.168.12.1
    serverip=192.168.12.10
    
    Environment size: 1567/65532 bytes
    

  • mii device
    ath> mii device
    MII devices: 'eth0' 'eth1' 
    Current device: 'eth0'
    

  • md.l 0x18050028 1
    ath> md.l 0x18050028 1
    18050028: 96000000    ....
    

  • md.l 0x18050048 1
    ath> md.l 0x18050048 1
    18050048: 03000101    ....
    

Kernel

OpenWrtインストール済みのため、ひとまず省略

広告

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
  • 完了

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

BHR-4GRV2 stock -> OpenWrt (ath79)

やっとこさここまで到達したので、とりあえずメモ。
現在ath79のBHR-4GRV2にはfactoryファームはありません。そのため、このインストール方法も使用できません。

normalFILE: /tmp/uhttp-upgrade.img is download successfully!
Killed
Monitor.sh starting.......
Start of fw_blink_cnt.sh -------------------------------------------------
End of fw_blink_cnt.sh -------------------------------------------------
handle_request:2838 post request found and fw update
 file is imgupg.cgi
handle_request:2839 path is (null)
handle_request:2851 accept post file is imgupg.cgi
writing uImage            [###                      ]  12%handle_request:2838 post request found and fw update
 file is apply.cgi
handle_request:2839 path is /html/fwupdate_wait_reboot.html
handle_request:2851 accept post file is apply.cgi
post_apply enter len+1 = 53, buffer size=32767
unset apply_running ###########################################
###########################################
writing rootfs            [######################## ]  98%[ 3412.500000] Removing MTD device #3 (rootfs_data) with use count 1
[ 3412.520000] Restarting system.


BUFFALO U-Boot Ver 1.06 (Apr  3 2014 - 16:26:57)

ap135 - CPU :Scorpion 1.0 , CPU:720MHZ, DRAM:300MHZ, ABH:200MHZ
DRAM:  16bit, ddr2 init, 64 MB

Top of RAM usable for U-Boot at: 84000000
Reserving 274k for U-Boot at: 83fb8000
Reserving 192k for malloc() at: 83f88000
Reserving 44 Bytes for Board Info at: 83f87fd4
Reserving 36 Bytes for Global Data at: 83f87fb0
Reserving 128k for boot params() at: 83f67fb0
Stack Pointer at: 83f67f98
Now running in RAM - U-Boot at: 83fb8000
Flash Manuf Id 0xc2, DeviceId0 0x20, DeviceId1 0x18
flash size 16MB, sector count = 256
Flash: 16 MB
*** Warning - bad CRC, using default environment

*** Warning *** : PCIe WLAN Module not found !!!
*** Warning *** : PCIe WLAN Module not found !!!
In:    serial
Out:   serial
Err:   serial
Net:   ath_gmac_enet_initialize...
athrs_sgmii_res_cal: cal value = 0x6
Fetching MAC Address from 0x83fdaca0
Fetching MAC Address from 0x83fdaca0
ath_gmac_enet_initialize: reset mask:c02200 
Scorpion  ----> S17 PHY *
athrs17_reg_init: complete
: cfg1 0x80000000 cfg2 0x7114
eth0: dc:fb:02:6e:68:d0
eth0 up
athrs17_reg_init_wan done
SGMII in forced mode
athr_gmac_sgmii_setup SGMII done
: cfg1 0x800c0000 cfg2 0x7214
eth1: dc:fb:02:6e:68:d1
eth1 up
eth0, eth1
Memory Test Start
Test start(0x80000000) end(83f00000) size(3f00000) 
Pattern: 55555555
Pattern: AAAAAAAA
Pattern: 00000000
Memory Test Pass 

Setting 0x18116290 to 0x4489a14f
Hit any key to stop autoboot:  0 
## Booting image at 9fe80000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.60
   Created:      2018-08-06  15:29:45 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1353942 Bytes =  1.3 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9fe80040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 4.14.60 (musashino205@Taiha.Net) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r0+7766-010a8f4911)) #0 Mon Aug 6 15:29:45 2018
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019750 (MIPS 74Kc)
[    0.000000] MIPS: machine is Buffalo BHR-4GRV2
[    0.000000] SoC: Qualcomm Atheros QCA9558 ver 1 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 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-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from 0x8044372c with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 59108K/65536K available (3380K kernel code, 132K rwdata, 460K rodata, 1204K init, 203K bss, 6428K 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] CPU clock: 720.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5309056796 ns
[    0.000008] sched_clock: 32 bits at 360MHz, resolution 2ns, wraps every 5965232126ns
[    0.008295] Calibrating delay loop... 358.80 BogoMIPS (lpj=1794048)
[    0.074983] pid_max: default: 32768 minimum: 301
[    0.080080] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.087120] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.098281] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.108781] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.115336] pinctrl core: initialized pinctrl subsystem
[    0.121745] NET: Registered protocol family 16
[    0.127142] Can't analyze schedule() prologue at 803a8d74
[    0.149640] clocksource: Switched to clocksource MIPS
[    0.155977] NET: Registered protocol family 2
[    0.161330] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.168755] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.175564] TCP: Hash tables configured (established 1024 bind 1024)
[    0.182458] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.188685] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.195644] NET: Registered protocol family 1
[    0.203915] Crashlog allocated RAM at address 0x3f00000
[    0.210619] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.221743] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.227947] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.246230] io scheduler noop registered
[    0.250441] io scheduler deadline registered (default)
[    0.257780] pinctrl-single 1804002c.pinmux: 512 pins at pa b804002c size 64
[    0.266196] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.273638] console [ttyS0] disabled
[    0.277473] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 8, base_baud = 2500000) is a 16550A
[    0.286690] console [ttyS0] enabled
[    0.286690] console [ttyS0] enabled
[    0.294110] bootconsole [early0] disabled
[    0.294110] bootconsole [early0] disabled
[    0.308076] m25p80 spi0.0: mx25l12805d (16384 Kbytes)
[    0.313291] 6 fixed-partitions partitions found on MTD device spi0.0
[    0.319747] Creating 6 MTD partitions on "spi0.0":
[    0.324610] 0x000000000000-0x000000040000 : "u-boot"
[    0.330379] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.336444] 0x000000050000-0x000000e80000 : "rootfs"
[    0.342196] mtd: device 2 (rootfs) set to be root filesystem
[    0.347996] 1 squashfs-split partitions found on MTD device rootfs
[    0.354308] 0x000000390000-0x000000e80000 : "rootfs_data"
[    0.360443] 0x000000e80000-0x000000ff0000 : "kernel"
[    0.366144] 0x000000ff0000-0x000001000000 : "art"
[    0.371656] 0x000000050000-0x000000ff0000 : "firmware"
[    0.378001] libphy: Fixed MDIO Bus: probed
[    0.720008] libphy: ag71xx_mdio: probed
[    0.726503] switch0: Atheros AR8337 rev. 2 switch registered on mdio-bus.0
[    1.720807] ag71xx 19000000.eth: connected to PHY at mdio-bus.0:00 [uid=004dd036, driver=Atheros AR8216/AR8236/AR8316]
[    1.732250] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:RGMII
[    2.071234] ag71xx 1a000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
[    2.080938] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:SGMII
[    2.089090] NET: Registered protocol family 10
[    2.097921] Segment Routing with IPv6
[    2.101789] NET: Registered protocol family 17
[    2.106337] 8021q: 802.1Q VLAN Support v1.8
[    2.118915] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    2.132577] Freeing unused kernel memory: 1204K
[    2.137171] This architecture does not have kernel memory protection.
[    2.539651] random: fast init done
[    4.476792] init: Console is alive
[    4.480494] init: - watchdog -
[    5.489037] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    5.761730] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    5.779466] init: - preinit -
[    7.439391] random: jshn: uninitialized urandom read (4 bytes read)
[    7.773934] random: jshn: uninitialized urandom read (4 bytes read)
[    7.950682] random: jshn: uninitialized urandom read (4 bytes read)
[    9.558602] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[    9.564644] IPv6: ADDRCONF(NETDEV_UP): eth1.1: link is not 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[    9.628011] urandom_read: 2 callbacks suppressed
 level
[    9.628017] random: procd: uninitialized urandom read (4 bytes read)
[   10.580772] eth1: link up (1000Mbps/Full duplex)
[   10.585483] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[   10.592174] IPv6: ADDRCONF(NETDEV_CHANGE): eth1.1: link becomes ready
[   13.198344] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[   13.227734] urandom-seed: Seed file not found (/etc/urandom.seed)
[   13.278175] procd: - early -
[   13.281976] procd: - watchdog -
[   13.699653] eth1: link down
[   14.084617] procd: - watchdog -
[   14.088050] procd: - ubus -
[   14.605407] random: ubusd: uninitialized urandom read (4 bytes read)
[   14.871764] random: ubusd: uninitialized urandom read (4 bytes read)
[   14.878621] random: ubusd: uninitialized urandom read (4 bytes read)
[   14.885951] procd: - init -
[   15.288694] kmodloader: loading kernel modules from /etc/modules.d/*
Please press Enter to activate this console.
[   15.835292] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   15.856593] Loading modules backported from Linux version wt-2017-11-01-0-gfe248fc2c180
[   15.864765] Backport generated by backports.git v4.14-rc2-1-31-g86cf0e5d
[   15.887829] ip_tables: (C) 2000-2006 Netfilter Core Team
[   15.927851] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[   16.013051] xt_time: kernel timezone is -0000
[   16.062994] PPP generic driver version 2.4.2
[   16.069498] NET: Registered protocol family 24
[   16.112465] kmodloader: done loading kernel modules from /etc/modules.d/*
[   33.465744] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   33.503387] jffs2_build_filesystem(): unlocking the mtd device... 
[   33.503396] done.
[   33.511660] jffs2_build_filesystem(): erasing all blocks after the end marker... 
[   34.841985] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   34.856682] eth1: link up (1000Mbps/Full duplex)
[   34.881224] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[   34.932779] br-lan: port 1(eth1.1) entered blocking state
[   34.938267] br-lan: port 1(eth1.1) entered disabled state
[   34.944072] device eth1.1 entered promiscuous mode
[   34.948938] device eth1 entered promiscuous mode
[   35.058508] br-lan: port 1(eth1.1) entered blocking state
[   35.064038] br-lan: port 1(eth1.1) entered forwarding state
[   35.069854] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   35.157940] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   35.207232] IPv6: ADDRCONF(NETDEV_UP): eth0.2: link is not ready
[   35.859819] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   36.181150] eth0: link up (1000Mbps/Full duplex)
[   36.185905] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   36.244365] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.2: link becomes ready
[   84.283709] done.
[   84.285694] jffs2: notice: (1024) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   84.477909] overlayfs: upper fs does not support tmpfile.
[  120.039890] random: crng init done
[  120.043353] random: 1 urandom warning(s) missed due to ratelimiting



BusyBox v1.29.2 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r0+7766-010a8f4911
 -----------------------------------------------------
=== 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:/#