タグ: RT3052F

WN-G300DGR

作業した時期が非常に古く、メモを取っていなかったので今更ながら書き出し。なお、既に散々弄った状態であるためオリジナルとは異なっていたり、破損個所が存在する可能性に注意すること。

MAC

  • LAN: 00:A0:B0:xx:xx:AC (u-boot-env, ethaddr (text))
  • WAN: 00:A0:B0:xx:xx:AB (u-boot-env, wanaddr (tex))
  • 2.4G: 00:A0:B0:xx:xx:AC (Factory, 0x4 (hex))

※Flash: Parallel-NOR (CFI) 4MiB (MX29LV320E)

U-Boot

  • help
    RT3052 # help
    rf      - read/write rf register
    ?       - alias for 'help'
    bootm   - boot application image from memory
    cp      - memory copy
    erase   - erase FLASH memory
    go      - start application at address 'addr'
    help    - print online help
    loadb   - load binary file over serial line (kermit mode)
    loopback   - Ralink eth loopback test !!
    md      - memory display
    mdio   - Ralink PHY register R/W command !!
    mm      - memory modify (auto-incrementing)
    mw      - memory write (fill)
    nm      - memory modify (constant address)
    printenv- print environment variables
    protect - enable or disable FLASH write protection
    reset   - Perform RESET of the CPU
    saveenv - save environment variables to persistent storage
    setenv  - set environment variables
    spicmd  - read/write data from/to eeprom or vtss
    tftpboot- boot image via network using TFTP protocol
    version - print monitor version
    

  • version

    RT3052 # version
    
    U-Boot 1.1.3 (Jun  1 2011 - 15:30:20)
    

  • printenv

    RT3052 # printenv
    bootcmd=tftp
    bootdelay=5
    baudrate=57600
    ethaddr="00:A0:B0:**:**:**"
    sn=00024936I
    hw_ver=1.0.0
    pro_id=000
    country=000
    domain=1
    wanaddr=00:A0:B0:**:**:**
    wlanaddr=00:AA:BB:CC:DD:12
    fwaddr=00:AA:BB:CC:DD:13
    eth_en=0
    snextra=00000000000000000000
    preboot=echo;echo
    ramargs=setenv bootargs root=/dev/ram rw
    addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):$(netdev):off
    addmisc=setenv bootargs $(bootargs) console=ttyS0,$(baudrate) ethaddr=$(ethaddr) panic=1
    flash_self=run ramargs addip addmisc;bootm $(kernel_addr) $(ramdisk_addr)
    kernel_addr=BFC40000
    u-boot=u-boot.bin
    load=tftp 8A100000 $(u-boot)
    u_b=protect off 1:0-1;era 1:0-1;cp.b 8A100000 BC400000 $(filesize)
    loadfs=tftp 8A100000 root.cramfs
    u_fs=era bc540000 bc83ffff;cp.b 8A100000 BC540000 $(filesize)
    test_tftp=tftp 8A100000 root.cramfs;run test_tftp
    hw_id=030A003E
    ethact=Eth0 
    filesize=26c36d
    fileaddr=80800000
    ipaddr=192.168.99.9
    serverip=192.168.99.8
    autostart=no
    bootfile=uImageWN-G300DGR
    uboot_ver=1.0.6.20
    op_mode=1
    stdin=serial
    stdout=serial
    stderr=serial
    
    Environment size: 1066/4092 bytes
    

Kernel

  • uname -a

    # uname -a
    Linux WN-G300DGR 2.6.21 #3 Tue Mar 17 09:25:56 CST 2015 mips unknown
    

  • cat /proc/version

    # cat /proc/version
    Linux version 2.6.21 (root@******-******-******-******) (gcc version 3.4.6) #3 Tue Mar 17 09:25:56 CST 2015
    

  • cat /proc/cpuinfo

    # cat /proc/cpuinfo
    system type             : Ralink SoC
    processor               : 0
    cpu model               : MIPS 24K V4.12
    BogoMIPS                : 255.48
    wait instruction        : yes
    microsecond timers      : yes
    tlb_entries             : 32
    extra interrupt vector  : yes
    hardware watchpoint     : yes
    ASEs implemented        : mips16 dsp
    VCED exceptions         : not available
    VCEI exceptions         : not available
    

  • cat /proc/meminfo

    # cat /proc/meminfo
    MemTotal:        29696 kB
    MemFree:         15092 kB
    Buffers:          1096 kB
    Cached:           5616 kB
    SwapCached:          0 kB
    Active:           3860 kB
    Inactive:         4216 kB
    SwapTotal:           0 kB
    SwapFree:            0 kB
    Dirty:               0 kB
    Writeback:           0 kB
    AnonPages:        1372 kB
    Mapped:           1920 kB
    Slab:             3684 kB
    SReclaimable:      464 kB
    SUnreclaim:       3220 kB
    PageTables:        412 kB
    NFS_Unstable:        0 kB
    Bounce:              0 kB
    CommitLimit:     14848 kB
    Committed_AS:     3692 kB
    VmallocTotal:  1048404 kB
    VmallocUsed:     18468 kB
    VmallocChunk:  1029828 kB
    

  • cat /proc/mtd

    # cat /proc/mtd
    dev:    size   erasesize  name
    mtd0: 00020000 00010000 "Bootloader"
    mtd1: 00010000 00010000 "backup"
    mtd2: 00010000 00010000 "Config "
    mtd3: 00010000 00010000 "Factory"
    mtd4: 000b0000 00010000 "Kernel"
    mtd5: 002b0000 00010000 "app"
    mtd6: 001a0000 00010000 "cb-app"
    mtd7: 00040000 00010000 "manufacture"
    mtd8: 00010000 00002000 "storage"
    

  • bootlog

    U-boot Ver:1.0.6.20 2011/06/01
    
    
    Board: Ralink APSoC DRAM:  32 MB  2*16 MB
    ============================================ 
    ASIC 3052_MP2 (Port5GigaSW)
    Product Name: WN-G300DGR
    SDRAM CAS = 3(d1835272) 
    ============================================ 
    
    Please choose the operation: 
       1: Load system code to SDRAM via TFTP. 
    
    LINUX started...
    
     THIS IS ASIC
    init started: BusyBox v1.7.5 (2015-03-17 09:22:54 CST)
    starting pid 151, tty '/dev/console': '/sbin/config_init'
    mknod: /dev/ttyS0: File exists
    mknod: /dev/ttyS1: File exists
    Config Init version: 1.15.000.113 date: 2015/03/17
    Thu Jan  1 00:00:00 UTC 2015
    mount: can't find /sys in /etc/fstab or /etc/mtab
    ln: /lib/./modules: File exists
    switch reg write offset=94, value=7f00
    Could not find Watchdog driver (/apps/lib/modules/2.6.21/kernel/arch/mips/rt2880/rt_timer.ko)
    Application Ver:1.15.000.113             Date:2015/03/17
    
    starting pid 211, tty '/dev/ttyS1': '/sbin/config_term'
    ************************************************************************
    *                               WN-G300DGR                             *
    ************************************************************************
    
    KernelApp/Ramdisk Ver:1.15.000.113                       Date:2015/03/17
    cat: can't open '/apps/lib/modules/2.6.21/modulesApp.dep': No such file or directory
    ln: /sbin/apps_init: File exists
    ln: /sbin/opmode.sh: File exists
    password: createShareMem keyid 7001 shmId 0
    Set Int value 0 but not in rage 1000 to 50000
    checkpApCfg i=746 [wan2_dl_bw]
    Set Int value 0 but not in rage 1000 to 50000
    checkpApCfg i=762 [wan2_ul_bw]
    checkpApCfg error!!
    CTRL_INTERFACE:[/var/sysconfd_if]  CTRL_INTERFACE_IF:[if0]
    
    System Monitoring
    *********************************************************************
    Initializing system environment
    Setting up /tmp directory ...
    Setting up loopback device ...
    ***************************************************
    System is in    AP Router Mode [0]
    ***************************************************
    SEM_GETID got id -1
    Mac: 0, rtcTime:1420070401
    Starting system logging daemon ...OK
    Setting up Ethernet devices ...
    OK
    Configuring Bridge device ...          OK
    Setting the host&domain name ...Finished.
    Configuring net ...          OK
    Configuring LAN device ...          OK
    getRegularDomain,0
    Configuring RT28XX device ...Wlan is in AP Mode
    Using fixWDSLowTP function.
    sh: cannot create /proc/netpktconfig/config_interface: nonexistent directory
    Wan Manager...
    Configuring WAN device[WAN0] ...
    Obtaining IP address from DHCP ... 
    wan is Ready
    Set Domain Routing for FLET'S Square Connection...            
    Starting DNS Proxy ...            FAILED
    Starting DHCP(udhcpd) server ...            OK
    Starting ntpclient ...            
    Setup tc for QoS ... Disabled
    
    SCHEDULE, ServiceWlanLowRateInit ...service_index[0].
    
    SCHEDULE, ServiceWlsRadioOffInit ...service_index[1].
    
    SCHEDULE, ServiceLedOffInit ...service_index[2].
    
    SCHEDULE, ServiceLanOffInit ...service_index[3].
    
    SCHEDULE, ServiceWanOffInit ...service_index[4].
    
    SCHEDULE, ServiceLanLowRateInit ...service_index[5].
    
    SCHEDULE, ServicePowerLedInit ...service_index[6].
    
    
    Schedule starting  [scheduleOpen], ...wait result..
    Schedule result :[Disable (No rules)]. 
    Configuring network routing and filtering ...Iptable restart VPN ACL ...VPN ACL ...
    OK
    Starting SiteBlock server ...            
    Netpacket Filter Open ....              sysGetKernelInfo: netv :1.0
    Kernel netpkt ver netv: 1.0
    OK
    Starting DDNS  ...  Disabled
    Starting UPNPD  ...  WAN Speed = 10 Mbps
    FAILED
    Starting HTTPD server ...           OK
    Staring ALG...           OK
    Starting LLTD ...           OK
    Starting netbios daemon ...  OK
    Initialization has completed
    *We used 6.210000 seconds to initialize all modules*
    pSEM_GETID got id 32769
    [RMGMT DBG] RMGMT_VERSION: 3.42.32
    NewWAN0:[192.168.1.25]  LastWAN0:[0.0.0.0]
    wan0Configuring ...
    Wan IP was changed, Reload related module**
    *** PROCESS MANAGER Starts ***
    Processmanager update modules
    Restarting Iptables ....Clean iptable...OK
    Configuring network routing and filtering ...Iptable restart VPN ACL ...VPN ACL ...
    OK
    OK
    QoS, Stopping
    Setup tc for QoS ... Disabled
    Reloading dnsProxy ...            Stopping DNS Proxy ...            OK
    Set Domain Routing for FLET'S Square Connection...            
    Starting DNS Proxy ...            wan0Configuring ...
    OK
    Stopping igmpProxy ...            OK
    Starting IGMP Proxy ...  OK
    Starting UPNPD  ...  WAN Speed = 1000 Mbps
    OK
    RMMOD ALG H323 [ip_nat_h323]
    RMMOD ALG MMS [ip_nat_mms]
    RMMOD 2nd ALG TFTP [ip_nat_tftp]
    RMMOD ALG TFTP [ip_conntrack_tftp]
    RMMOD ALG Egg [ip_conntrack_egg]
    RMMOD ALG IRC [ip_nat_irc]
    RMMOD ALG Quake3 [ip_nat_quake3]
    RMMOD ALG Talk [ip_nat_talk]
    RMMOD ALG PPTP [ip_nat_pptp]
    RMMOD ALG SNMP [ip_nat_snmp_basic]
    RMMOD ALG FTP [ip_nat_ftp]
    RMMOD 2nd ALG SIP [ip_nat_sip]
    RMMOD ALG SIP [ip_conntrack_sip]
    RMMOD 2nd ALG RTSP [ip_nat_rtsp]
    RMMOD ALG RTSP [ip_conntrack_rtsp]
    Staring ALG...           OK
    Processmanager update modules
    VPN, WAN_IP_CHANGED event received ...Closing ntpclient ...            Starting ntpclient ...            
    Stopping DDNS ...            OK
    Starting DDNS  ...  Disabled
    
    SCHEDULE, ServiceWlanLowRateInit ...service_index[0].
    
    SCHEDULE, ServiceWlsRadioOffInit ...service_index[1].
    
    SCHEDULE, ServiceLedOffInit ...service_index[2].
    
    SCHEDULE, ServiceLanOffInit ...service_index[3].
    
    SCHEDULE, ServiceWanOffInit ...service_index[4].
    
    SCHEDULE, ServiceLanLowRateInit ...service_index[5].
    
    SCHEDULE, ServicePowerLedInit ...service_index[6].
    
    
    Schedule starting  [scheduleOpen], ...wait result..
    Schedule result :[Disable (No rules)]. 
    ==>error
    

広告

CG-WLR300GNE

三郷のハードオフで、USB搭載かつGbE対応ながらジャンク税込540円と安かったので購入。

U-Boot

  • help
    RT3052 # help
    loopback   - Ralink eth loopback test !!
    ?       - alias for 'help'
    boot    - boot default, i.e., run 'bootcmd'
    bootd   - boot default, i.e., run 'bootcmd'
    bootm   - boot application image from memory
    bootp   - boot image via network using BootP/TFTP protocol
    cp      - memory copy
    echo    - echo args to console
    erase   - erase FLASH memory
    go      - start application at address 'addr'
    help    - print online help
    httpd - Gemtek httpd
    loadb   - load binary file over serial line (kermit mode)
    md      - memory display
    mdio   - Ralink PHY register R/W command !!
    mm      - memory modify (auto-incrementing)
    mw      - memory write (fill)
    nm      - memory modify (constant address)
    printenv- print environment variables
    protect - enable or disable FLASH write protection
    reset   - Perform RESET of the CPU
    run     - run commands in an environment variable
    saveenv - save environment variables to persistent storage
    setenv  - set environment variables
    spicmd  - read/write data from/to eeprom or vtss
    tftpboot- boot image via network using TFTP protocol
    version - print monitor version
    

  • version
    RT3052 # version
    
    U-Boot 1.1.3 (Jan 21 2010 - 20:51:46)
    

  • printenv
    RT3052 # printenv
    bootcmd=tftp
    bootdelay=1
    baudrate=57600
    ethaddr="00:AA:BB:CC:DD:10"
    ipaddr=192.168.1.1
    serverip=192.168.1.5
    preboot=echo;echo
    bootfile="uboot.bin"
    ramargs=setenv bootargs root=/dev/ram rw
    addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):$(netdev):off
    addmisc=setenv bootargs $(bootargs) console=ttyS0,$(baudrate) ethaddr=$(ethaddr) panic=1
    flash_self=run ramargs addip addmisc;bootm $(kernel_addr) $(ramdisk_addr)
    kernel_addr=BFC40000
    u-boot=u-boot.bin
    load=tftp 8A100000 $(u-boot)
    u_b=protect off 1:0-1;era 1:0-1;cp.b 8A100000 BC400000 $(filesize)
    loadfs=tftp 8A100000 root.cramfs
    u_fs=era bc540000 bc83ffff;cp.b 8A100000 BC540000 $(filesize)
    test_tftp=tftp 8A100000 root.cramfs;run test_tftp
    stdin=serial
    stdout=serial
    stderr=serial
    ethact=Eth0 (10/100-M)
    
    Environment size: 804/65532 bytes
    

Kernel

  • uname -a
    # uname -a
    Linux CG-WLR300GNE 2.6.21 #30 Thu Mar 3 11:39:19 CST 2011 mips unknown
    

  • cat /proc/version
    # cat /proc/version
    Linux version 2.6.21 (*****_***@cvs4) (gcc version 3.4.2) #30 Thu Mar 3 11:39:19 CST 2011
    

  • cat /proc/cpuinfo
    # cat /proc/cpuinfo
    system type             : Ralink SoC
    processor               : 0
    cpu model               : MIPS 24K V4.12
    BogoMIPS                : 212.99
    wait instruction        : yes
    microsecond timers      : yes
    tlb_entries             : 32
    extra interrupt vector  : yes
    hardware watchpoint     : yes
    ASEs implemented        : mips16 dsp
    VCED exceptions         : not available
    VCEI exceptions         : not available
    

  • cat /proc/meminfo
    # cat /proc/meminfo
    MemTotal:        60764 kB
    MemFree:         45804 kB
    Buffers:          1568 kB
    Cached:           5520 kB
    SwapCached:          0 kB
    Active:           3664 kB
    Inactive:         4888 kB
    SwapTotal:           0 kB
    SwapFree:            0 kB
    Dirty:               0 kB
    Writeback:           0 kB
    AnonPages:        1496 kB
    Mapped:           2084 kB
    Slab:             4876 kB
    SReclaimable:     1100 kB
    SUnreclaim:       3776 kB
    PageTables:        288 kB
    NFS_Unstable:        0 kB
    Bounce:              0 kB
    CommitLimit:     30380 kB
    Committed_AS:     8044 kB
    VmallocTotal:  1048404 kB
    VmallocUsed:     17132 kB
    VmallocChunk:  1031236 kB
    

  • cat /proc/mtd
    # cat /proc/mtd
    dev:    size   erasesize  name
    mtd0: 00060000 00010000 "uBoot"
    mtd1: 00180000 00010000 "Linux Kernel"
    mtd2: 00600000 00010000 "RootFS"
    mtd3: 00010000 00010000 "NVRAM"
    mtd4: 00010000 00010000 "NVRAM_FACTORY"
    

  • bootlog
    U-Boot 1.1.3 (Jan 21 2010 - 20:51:46)
    
    Board: Ralink APSoC DRAM:  64 MB
    relocate_code Pointer at: 83f98000
    board.c->board_init_r(1168),isolate WAN Port traffic from LAN Port
    flash_protect ON: from 0xBF000000 to 0xBF03446B
    protect on 0
    protect on 1
    protect on 2
    protect on 3
    protect on 4
    protect on 5
    protect on 6
    protect on 7
    protect on 8
    protect on 9
    protect on 10
    flash_protect ON: from 0xBF040000 to 0xBF04FFFF
    protect on 11
    *** Warning - bad CRC, using default environment
    
    ============================================ 
    Ralink UBoot Version : 3.3
    UBoot Release Version: 1.0.4_20100121
    -------------------------------------------- 
    ASIC 3052_MP2 (Port5GigaSW)
    DRAM COMPONENT: 256Mbits 
    DRAM BUS: 32BIT 
    Total memory: 64 MBytes
    Date:Jan 21 2010  Time:20:51:46
    ============================================ 
    icache: sets:256, ways:4, linesz:32 ,total:32768
    dcache: sets:128, ways:4, linesz:32 ,total:16384 
    
     ##### The CPU freq = 320 MHZ #### 
    
     SDRAM bus set to 32 bit 
     SDRAM size =64 Mbytes
    
    Please choose the operation: 
       1: Load system code to SDRAM via TFTP. 
       2: Load system code then write to Flash via TFTP. 
       3: Boot system code via Flash (default).
       4: Entr boot command line interface.
       9: Load Boot Loader code then write to Flash via TFTP. 
                                                                                                                               0 
       
    3: System Boot system code via Flash.
    
     eth_register  
    Eth0 (10/100-M)
     enetvar=ethaddr,Eth addr:00:AA:BB:CC:DD:10
     00:AA:BB:CC:DD:10:
    
     eth_current->name = Eth0 (10/100-M)
    
    ## Booting image at bf060000 ...
       Image Name:   Linux Kernel Image
       Created:      2011-03-03   3:43:41 UTC
    
     System Control Status = 0x10400000 
       Image Type:   MIPS Linux Kernel Image (lzma compressed)
       Data Size:    6598592 Bytes =  6.3 MB
       Load Address: 80000000
       Entry Point:  803e1000
       Verifying Checksum ... OK
       Uncompressing Kernel Image ... OK
    No initrd
    ## Transferring control to Linux (at address 803e1000) ...
    ## Giving linux memsize in MB, 64
    
    Starting kernel ...
    
    
    LINUX started...
    
     THIS IS ASIC
    Linux version 2.6.21 (terry_kuo@cvs4) (gcc version 3.4.2) #30 Thu Mar 3 11:39:19 CST 2011
    
     The CPU feqenuce set to 320 MHz
    CPU revision is: 0001964c
    Determined physical RAM map:
     memory: 04000000 @ 00000000 (usable)
    Built 1 zonelists.  Total pages: 16256
    Kernel command line: console=ttyS1,57600n8 root=/dev/mtdblock2
    Primary instruction cache 32kB, physically tagged, 4-way, linesize 32 bytes.
    Primary data cache 16kB, 4-way, linesize 32 bytes.
    Synthesized TLB refill handler (20 instructions).
    Synthesized TLB load handler fastpath (32 instructions).
    Synthesized TLB store handler fastpath (32 instructions).
    Synthesized TLB modify handler fastpath (31 instructions).
    Cache parity protection disabled
    cause = 800000, status = 1100ff00
    PID hash table entries: 256 (order: 8, 1024 bytes)
    calculating r4koff... 00138800(1280000)
    CPU frequency 320.00 MHz
    Using 160.000 MHz high precision timer.
    Console: colour dummy device 80x25
    Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
    Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
    Memory: 60580k/65536k available (3299k kernel code, 4900k reserved, 668k data, 128k init, 0k highmem)
    Mount-cache hash table entries: 512
    NET: Registered protocol family 16
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    NET: Registered protocol family 2
    Time: MIPS clocksource has been installed.
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 2048 (order: 2, 16384 bytes)
    TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
    TCP: Hash tables configured (established 2048 bind 2048)
    TCP reno registered
    squashfs: version 3.2-r2 (2007/01/15) Phillip Lougher
    squashfs: LZMA suppport for slax.org by jro
    NTFS driver 2.1.28 [Flags: R/O].
    fuse init (API version 7.8)
    io scheduler noop registered (default)
    FLASH_API: MAN_ID=C2 DEV_ID=22CB SIZE=8MB
    Ralink gpio driver initialized
    StatusLEDThread pid : 125
    Initialziing the INTERNET LED control module ... successful
    Initialziing the WSC LED control module ... successful
    Initialziing the LED control module ... successful
    Initialziing the USB LED control module ... successful
    Serial: 8250/16550 driver $Revision: 1.3 $ 2 ports, IRQ sharing disabled
    serial8250: ttyS0 at I/O 0xb0000500 (irq = 37) is a 16550A
    serial8250: ttyS1 at I/O 0xb0000c00 (irq = 12) is a 16550A
    loop: loaded (max 8 devices)
    smi_major=249
    0 smi_init check[0x05c]1=0x5937
    rdm_major = 254
    GDMA1_MAC_ADRH -- : 0x00000000
    GDMA1_MAC_ADRL -- : 0x00000000
    Ralink APSoC Ethernet Driver Initilization. v1.60  128 rx/tx descriptors allocated, mtu = 1500!
    NAPI enable, weight = 0, Tx Ring = 128, Rx Ring = 128
    GDMA1_MAC_ADRH -- : 0x0000000c
    GDMA1_MAC_ADRL -- : 0x43305277
    PROC INIT OK!
    PPP generic driver version 2.4.2
    PPP BSD Compression module registered
    NET: Registered protocol family 24
    
    
    === pAd = c0000000, size = 501392 ===
    
    <-- RTMPAllocAdapterBlock, Status=0
    ralink flash device: 0x1000000 at 0xbf000000
    Ralink SoC physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank
     Amd/Fujitsu Extended Query Table at 0x0040
    number of CFI chips: 1
    cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
    Creating 5 MTD partitions on "Ralink SoC physically mapped flash":
    0x00000000-0x00060000 : "uBoot"
    0x00060000-0x001e0000 : "Linux Kernel"
    0x001e0000-0x007e0000 : "RootFS"
    0x007e0000-0x007f0000 : "NVRAM"
    0x007f0000-0x00800000 : "NVRAM_FACTORY"
    block2mtd: version $Revision: 1.1.1.1 $
    usbmon: debugfs is not available
    116x: driver isp116x-hcd, 03 Nov 2005
    sl811: driver sl811-hcd, 19 May 2005
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    usbcore: registered new interface driver usbhid
    drivers/usb/input/hid-core.c: v2.6:USB HID core driver
    dwc_otg: version 2.60a 22-NOV-2006
    DWC_otg: Using DMA mode
    dwc_otg lm0: DWC OTG Controller
    dwc_otg lm0: new USB bus registered, assigned bus number 1
    dwc_otg lm0: irq 18, io mem 0x00000000
    DWC_otg: Init: Port Power? op_state=1
    DWC_otg: Init: Power Port (0)
    usb usb1: configuration #1 chosen from 1 choice
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    nf_conntrack version 0.5.0 (512 buckets, 4096 max)
    GRE over IPv4 tunneling driver
    ip_tables: (C) 2000-2006 Netfilter Core Team, Type=Fully Cone
    ClusterIP Version 0.8 loaded successfully
    arp_tables: (C) 2002 David S. Miller
    TCP cubic registered
    NET: Registered protocol family 1
    NET: Registered protocol family 17
    802.1Q VLAN Support v1.8 Ben Greear 
    All bugs added by David S. Miller 
    VFS: Mounted root (squashfs filesystem) readonly.
    Freeing unused kernel memory: 128k freed
    (main)336
    Algorithmics/MIPS FPU Emulator v1.5
    init: cannot open inittab
    toks= /bin/sh (null) (null) (null)
    tty= console
    termcap= linux
    
    
    BusyBox v1.8.2 (2011-03-03 11:39:42 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.
    
    # #sysinit: [sysinit] 
    ftok: No such file or directory
    msgget: No such file or directory
    [sighandler]: No more events to be processed, quitting.
    [cleanup]: Waiting for children.
    [cleanup]: All children terminated.
    WriteDataIntoFileUnderProc : open file (/proc/LED_Force_Mode) ... failed
    !!!!!!!!!!!! WriteDataIntoFileUnderProc : /proc/LED_Force_Mode ... failed !!!!!!!!!!!!
    # update nvram with default list!
    Fri Jan  1 00:00:00 UTC 2010
    RTL8366 reg 0x5C=[0x5937]
    wan enabled : Init RTL8366RB!!
    switch reg write offset=98, value=7f40
    switch reg write offset=e4, value=20
    rmmod: rtl8366RB
    0 smi_init check[0x0105]=0x0000
    0 smi_init check[0x0105]=0x0000
    0 smi_init check[0x0509]=0x5937
    0 rtl8366rb_initChip
    0 smi_init check[0x0509]1=0x5937
    0 smi_init check[0x050a]1=0x0003
    Gemtek Link status init.
    Gemtek Ethernet Port control init.
    Gemtek LED control init.
    rtl8368s_setAsicMaxLengthInRx(3) SUCCESS!
    RTL_GET_GREEN_ETHERNET Success!!!
    RTL_GET_GREEN_ETHERNET : tx is 0, rx is -2084296544
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.0, enabled : 1 !!!
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.1, enabled : 1 !!!
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.2, enabled : 1 !!!
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.3, enabled : 1 !!!
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.4, enabled : 1 !!!
    rtl:rtl_ge_read : 0
    RTL_SET_GREEN_ETHERNET Success!!!
    RTL_GET_GREEN_ETHERNET Success!!!
    RTL_GET_GREEN_ETHERNET : tx is 1, rx is -2129651776
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.0, enabled : 1 !!!
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.1, enabled : 1 !!!
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.2, enabled : 1 !!!
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.3, enabled : 1 !!!
    RTL_GET_GREEN_ETHERNET : rtl8368s_getAsicPowerSaving is phyNo.4, enabled : 1 !!!
    rtl:rtl_ge_read : 0
    switch reg write offset=94, value=7f00
    switch reg write offset=90, value=f807f7f
    Enter LAN parsing ...
    Set LAN MAC=00:26:87:11:2C:8C
    Setting ra0 ra1 configuration...
    ra0       mac:
    [0x0000102c]:44031e46  
    rt2860apd: no 'radius' string found, no need to start...
    Start cat ====================
    iwpriv ra0 set Debug=0 
    End cat ======================
    wps_utility : init mode
    rmmod: hw_nat
    libupnp: using UDP SSDP_PORT = 1900
    Get Chipset from flash:AR2318
    iptbl: creating tables..
    iptbl: created tables!
    LANPortPriority Disabled
    write_proc_LANPortPriority = 00000
    Start UPnP
    dnsmasq: started, version 2.33 cachesize 150
    dnsmasq: compile time options: IPv6 GNU-getopt no-ISC-leasefile no-DBus no-I18N 
    dnsmasq: read /tmp/CustomerDotHomeIP - 1 addresses
    dlna_autoip_coordinator: failed to locate udhcpc...
    ifconfig: ioctl 0x8914 failed: Cannot assign requested address
    httpd : This is httpd...no SSL support
    mac clone is disabled, mac_clone_mac=00:26:87:11:2C:8D
    killall: DMS: no process killed
    off
    AP/Router DIP Switch : on
    on
    

WHR-G300N TFTPによるOpenWrt化

少し前にWHR-G300Nのイメージ生成コードを修正してopenwrt/openwrtに投げてマージされたものの、それについて特に書いてなかったのでメモ。この修正により、コードは存在するのに生成されなくなっていたTFTP用イメージが生成されるようになった。

基本的には、WHR-G301NのTFTPによるOpenWrt化と同様。ただし、デバッグ用のWebUI等でU-Bootの環境変数は特に設定する必要無し。
Windows環境で行う場合、パブリックのファイアウォールは一旦停止しておく。

試したときから時間が経ってしまったため、少し曖昧になっている箇所がいくらか。そのうち確認します。確認できたら、記事を書き直してメインのブログに移すかも。

手順

OS: Windows 10, WHR-G300Nとは直結で実施

  • PCのNICを 192.168.11.0/24 のいずれかに設定
  • WHR-G300Nをブート
  • ブート後、1秒程度おいてから
    tftp -i 192.168.11.1 put firmware.bin
    

    を実行してtftpイメージを投げつけ

  • WHR-G300Nがうまく受け付ければFlashに書き込まれる
  • しばらくして完了

ログ

U-Boot 1.1.3 for BUFFALO AIRSTATION (Aug 26 2008 - 13:08:44)

Board: Ralink APSoC DRAM:  32 MB
Top of RAM usable for U-Boot at: 82000000
Stack Pointer at: 81f4ff98
relocate_code Pointer at: 81fa0000
Now running in RAM - U-Boot at: 81fa0000

FLASH ID : 00h=[0xc2], 01h=[0x22a8], 0Eh=[0x0], 0Fh=[0x19]

 Set info->start[0]=BF000000
flash_protect ON: from 0xBF000000 to 0xBF02B84F
protect on 0
protect on 1
protect on 2
protect on 3
protect on 4
protect on 5
protect on 6
protect on 7
protect on 8
protect on 9
flash_protect ON: from 0xBF030000 to 0xBF03FFFF
protect on 10
flash_protect ON: from 0xBF040000 to 0xBF04FFFF
protect on 11
uboot use  81F4FFB0 - 82000000
Memory Test start(80000000) end(81F00000) size(01F00000)
Pattern 00000000  Writing...  Reading...
Memory Test OK
### buf_ver=[1.09] U-Boot Ver.=[1.09]
### build_date(env)=[Aug 26 2008 - 13:08:44] build_date(bin)=[Aug 26 2008 - 13:08:44]
============================================ 
Ralink UBoot Version: 3.1
-------------------------------------------- 
ASIC 3052_MP2 (MAC to GigaMAC Mode)
DRAM COMPONENT: 256Mbits 
DRAM BUS: 32BIT 
Total memory: 64 MBytes
Date:Aug 26 2008  Time:13:08:44
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:128, ways:4, linesz:32 ,total:16384 

 ##### The CPU freq = 384 MHZ #### 

 SDRAM bus set to 32 bit 
 SDRAM size =32 Mbytes

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   9: Load Boot Loader code then write to Flash via TFTP. 
                                                                                                                           0 
Net:   
 eth_register  
Eth0 (10/100-M)
 enetvar=ethaddr,Eth addr:00:AA:BB:CC:DD:19
 00:AA:BB:CC:DD:19:

 eth_current->name = Eth0 (10/100-M)

   
6: System Load Linux Kernel then write to Flash via TFTP Server. 

 netboot_common, argc= 2 
 *************buf = 0x81fcb9e0
 **********NexTxPacket = 81fe3ac0

 NetTxPacket = 0x81FE3AC0 

 NetRxPackets[0] = 0x81FE40C0

 NetRxPackets[1] = 0x81FE46C0

 NetRxPackets[2] = 0x81FE4CC0

 NetRxPackets[3] = 0x81FE52C0

 NetRxPackets[4] = 0x81FE58C0

 NetRxPackets[5] = 0x81FE5EC0

 NetRxPackets[6] = 0x81FE64C0

 NetRxPackets[7] = 0x81FE6AC0

 NetRxPackets[8] = 0x81FE70C0

 NetRxPackets[9] = 0x81FE76C0

 NetRxPackets[10] = 0x81FE7CC0

 NetRxPackets[11] = 0x81FE82C0

 NetRxPackets[12] = 0x81FE88C0

 NetRxPackets[13] = 0x81FE8EC0

 NetRxPackets[14] = 0x81FE94C0

 NetRxPackets[15] = 0x81FE9AC0

 NetRxPackets[16] = 0x81FEA0C0

 NetRxPackets[17] = 0x81FEA6C0

 NetRxPackets[18] = 0x81FEACC0

 NetRxPackets[19] = 0x81FEB2C0

 KSEG1ADDR(NetTxPacket) = 0xA1FE3AC0 

 NetLoop,call eth_halt ! 

 NetLoop,call eth_init ! 
Trying Eth0 (10/100-M)

 Waitting for RX_DMA_BUSY status Start... done

 Mac to giga Mac mode  

 rx_ring = A1FCBE00, tx_ring0 = A1FCBCC0

 Header Payload scatter function is Disable !! 

 RT2880_PDMA_GLO_CFG=00000020 

 ************************************************* 

 RX_CALC_IDX0=19 

 RX_DRX_IDX0 = 0 

 ************************************************* 

 ETH_STATE_ACTIVE!! 

tftp server(receive) go, waiting:4[sec]
Trying Eth0 (10/100-M)

 ETH_STATE_ACTIVE!! 
Load address: 0x81000000
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
Got ARP REQUEST, return our IP
Got ARP REPLY, set server/gtwy eth addr (5c:9a:d8:e6:3f:b3)
Got it
checksum bad
checksum bad
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
         $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
tftp server done
Bytes transferred = 3277316 (320204 hex)
NetBootFileXferSize= 00320204
tftp server received buffalo F/W.
buf="# Airstation FirmWare
run u_fw
r"
Encript Airstation FirmWare header
begin commands
cmd:# Airstation FirmWare
cmd:run u_fw

 b_end =BF3FFFFF
Erase Flash from 0xbf050000 to 0xbf3fffff in Bank # 1 

 erase sector  = 12 
sect = 12,s_last = 70,erase poll = 806018

 erase sector  = 13 
sect = 13,s_last = 70,erase poll = 806709

 erase sector  = 14 
*sect = 14,s_last = 70,erase poll = 818244

 erase sector  = 15 
sect = 15,s_last = 70,erase poll = 797581

 erase sector  = 16 
sect = 16,s_last = 70,erase poll = 814609
.
 erase sector  = 17 
sect = 17,s_last = 70,erase poll = 825964

 erase sector  = 18 
sect = 18,s_last = 70,erase poll = 807269

 erase sector  = 19 
*sect = 19,s_last = 70,erase poll = 817820

 erase sector  = 20 
sect = 20,s_last = 70,erase poll = 807149

 erase sector  = 21 
*sect = 21,s_last = 70,erase poll = 817876

 erase sector  = 22 
sect = 22,s_last = 70,erase poll = 824256

 erase sector  = 23 
sect = 23,s_last = 70,erase poll = 822237

 erase sector  = 24 
*sect = 24,s_last = 70,erase poll = 824219

 erase sector  = 25 
sect = 25,s_last = 70,erase poll = 768322

 erase sector  = 26 
sect = 26,s_last = 70,erase poll = 647356

 erase sector  = 27 
*sect = 27,s_last = 70,erase poll = 825006

 erase sector  = 28 
sect = 28,s_last = 70,erase poll = 807684

 erase sector  = 29 
*sect = 29,s_last = 70,erase poll = 818392

 erase sector  = 30 
sect = 30,s_last = 70,erase poll = 835490

 erase sector  = 31 
sect = 31,s_last = 70,erase poll = 822679

 erase sector  = 32 
*sect = 32,s_last = 70,erase poll = 808126

 erase sector  = 33 
sect = 33,s_last = 70,erase poll = 812402

 erase sector  = 34 
*sect = 34,s_last = 70,erase poll = 830256

 erase sector  = 35 
sect = 35,s_last = 70,erase poll = 830251

 erase sector  = 36 
*sect = 36,s_last = 70,erase poll = 819203

 erase sector  = 37 
sect = 37,s_last = 70,erase poll = 818390

 erase sector  = 38 
sect = 38,s_last = 70,erase poll = 821800

 erase sector  = 39 
*sect = 39,s_last = 70,erase poll = 798328

 erase sector  = 40 
sect = 40,s_last = 70,erase poll = 810145

 erase sector  = 41 
*sect = 41,s_last = 70,erase poll = 807579

 erase sector  = 42 
sect = 42,s_last = 70,erase poll = 833192

 erase sector  = 43 
sect = 43,s_last = 70,erase poll = 823897

 erase sector  = 44 
*sect = 44,s_last = 70,erase poll = 822087

 erase sector  = 45 
sect = 45,s_last = 70,erase poll = 805076

 erase sector  = 46 
*sect = 46,s_last = 70,erase poll = 818297

 erase sector  = 47 
sect = 47,s_last = 70,erase poll = 825913

 erase sector  = 48 
sect = 48,s_last = 70,erase poll = 807648

 erase sector  = 49 
*sect = 49,s_last = 70,erase poll = 808872

 erase sector  = 50 
sect = 50,s_last = 70,erase poll = 818297

 erase sector  = 51 
*sect = 51,s_last = 70,erase poll = 818381

 erase sector  = 52 
sect = 52,s_last = 70,erase poll = 818391

 erase sector  = 53 
sect = 53,s_last = 70,erase poll = 827549

 erase sector  = 54 
*sect = 54,s_last = 70,erase poll = 818384

 erase sector  = 55 
sect = 55,s_last = 70,erase poll = 808554

 erase sector  = 56 
*sect = 56,s_last = 70,erase poll = 809249

 erase sector  = 57 
sect = 57,s_last = 70,erase poll = 823322

 erase sector  = 58 
sect = 58,s_last = 70,erase poll = 834501

 erase sector  = 59 
*sect = 59,s_last = 70,erase poll = 832884

 erase sector  = 60 
sect = 60,s_last = 70,erase poll = 659309

 erase sector  = 61 
sect = 61,s_last = 70,erase poll = 669044
.
 erase sector  = 62 
sect = 62,s_last = 70,erase poll = 664953

 erase sector  = 63 
sect = 63,s_last = 70,erase poll = 660409

 erase sector  = 64 
sect = 64,s_last = 70,erase poll = 674214

 erase sector  = 65 
*sect = 65,s_last = 70,erase poll = 662003

 erase sector  = 66 
sect = 66,s_last = 70,erase poll = 661061

 erase sector  = 67 
sect = 67,s_last = 70,erase poll = 704263
.
 erase sector  = 68 
sect = 68,s_last = 70,erase poll = 658360

 erase sector  = 69 
sect = 69,s_last = 70,erase poll = 658304

 erase sector  = 70 
*sect = 70,s_last = 70,erase poll = 818988
 done
Erased 59 sectors

 Copy linux image[3277316 byte] to Flash[0xBF050000].... 
Copy to Flash... 
 Copy 3277316 byte to Flash... 
 addr = 0xBF0A34F8 ,cnt=2936076 
 addr = 0xBF0F69F0 ,cnt=2594836 
 addr = 0xBF149EEA ,cnt=2253594 
 addr = 0xBF19D3E4 ,cnt=1912352 
 addr = 0xBF1F08DE ,cnt=1571110 
 addr = 0xBF243DD8 ,cnt=1229868 
 addr = 0xBF2972D2 ,cnt=888626 
 addr = 0xBF2EA7CA ,cnt=547386 
 addr = 0xBF33DCC4 ,cnt=206144 done
cmd:reset


U-Boot 1.1.3 for BUFFALO AIRSTATION (Aug 26 2008 - 13:08:44)

Board: Ralink APSoC DRAM:  32 MB
Top of RAM usable for U-Boot at: 82000000
Stack Pointer at: 81f4ff98
relocate_code Pointer at: 81fa0000
Now running in RAM - U-Boot at: 81fa0000

FLASH ID : 00h=[0xc2], 01h=[0x22a8], 0Eh=[0x0], 0Fh=[0x19]

 Set info->start[0]=BF000000
flash_protect ON: from 0xBF000000 to 0xBF02B84F
protect on 0
protect on 1
protect on 2
protect on 3
protect on 4
protect on 5
protect on 6
protect on 7
protect on 8
protect on 9
flash_protect ON: from 0xBF030000 to 0xBF03FFFF
protect on 10
flash_protect ON: from 0xBF040000 to 0xBF04FFFF
protect on 11
uboot use  81F4FFB0 - 82000000
Memory Test start(80000000) end(81F00000) size(01F00000)
Pattern 00000000  Writing...  Reading...
Memory Test OK
### buf_ver=[1.09] U-Boot Ver.=[1.09]
### build_date(env)=[Aug 26 2008 - 13:08:44] build_date(bin)=[Aug 26 2008 - 13:08:44]
============================================ 
Ralink UBoot Version: 3.1
-------------------------------------------- 
ASIC 3052_MP2 (MAC to GigaMAC Mode)
DRAM COMPONENT: 256Mbits 
DRAM BUS: 32BIT 
Total memory: 64 MBytes
Date:Aug 26 2008  Time:13:08:44
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:128, ways:4, linesz:32 ,total:16384 

 ##### The CPU freq = 384 MHZ #### 

 SDRAM bus set to 32 bit 
 SDRAM size =32 Mbytes

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   9: Load Boot Loader code then write to Flash via TFTP. 
                                                                                                                           0 
Net:   
 eth_register  
Eth0 (10/100-M)
 enetvar=ethaddr,Eth addr:00:AA:BB:CC:DD:19
 00:AA:BB:CC:DD:19:

 eth_current->name = Eth0 (10/100-M)

   
6: System Load Linux Kernel then write to Flash via TFTP Server. 

 netboot_common, argc= 2 
 *************buf = 0x81fcb9e0
 **********NexTxPacket = 81fe3ac0

 NetTxPacket = 0x81FE3AC0 

 NetRxPackets[0] = 0x81FE40C0

 NetRxPackets[1] = 0x81FE46C0

 NetRxPackets[2] = 0x81FE4CC0

 NetRxPackets[3] = 0x81FE52C0

 NetRxPackets[4] = 0x81FE58C0

 NetRxPackets[5] = 0x81FE5EC0

 NetRxPackets[6] = 0x81FE64C0

 NetRxPackets[7] = 0x81FE6AC0

 NetRxPackets[8] = 0x81FE70C0

 NetRxPackets[9] = 0x81FE76C0

 NetRxPackets[10] = 0x81FE7CC0

 NetRxPackets[11] = 0x81FE82C0

 NetRxPackets[12] = 0x81FE88C0

 NetRxPackets[13] = 0x81FE8EC0

 NetRxPackets[14] = 0x81FE94C0

 NetRxPackets[15] = 0x81FE9AC0

 NetRxPackets[16] = 0x81FEA0C0

 NetRxPackets[17] = 0x81FEA6C0

 NetRxPackets[18] = 0x81FEACC0

 NetRxPackets[19] = 0x81FEB2C0

 KSEG1ADDR(NetTxPacket) = 0xA1FE3AC0 

 NetLoop,call eth_halt ! 

 NetLoop,call eth_init ! 
Trying Eth0 (10/100-M)

 Waitting for RX_DMA_BUSY status Start... done

 Mac to giga Mac mode  

 rx_ring = A1FCBE00, tx_ring0 = A1FCBCC0

 Header Payload scatter function is Disable !! 

 RT2880_PDMA_GLO_CFG=00000020 

 ************************************************* 

 RX_CALC_IDX0=19 

 RX_DRX_IDX0 = 0 

 ************************************************* 

 ETH_STATE_ACTIVE!! 

tftp server(receive) go, waiting:4[sec]
Trying Eth0 (10/100-M)

 ETH_STATE_ACTIVE!! 
Load address: 0x81000000

TftpServer Timeout;
Trying Eth0 (10/100-M)

 ETH_STATE_ACTIVE!! 
no file was loaded.
   
3: System Boot system code via Flash.
## Booting image at bf050000 ...
   Image Name:   MIPS OpenWrt Linux-4.9.77
   Created:      2018-02-12   9:57:22 UTC

 System Control Status = 0x20440000 
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1306525 Bytes =  1.2 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 32

Starting kernel ...

[    0.000000] Linux version 4.9.77 (musashino205@Taiha.Net) (gcc version 5.5.0 (OpenWrt GCC 5.5.0 r0+6059-05677f0) ) #0 Mon Feb 12 09:57:22 2018
[    0.000000] SoC Type: Ralink RT3052 id:1 rev:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001964c (MIPS 24KEc)
[    0.000000] MIPS: machine is Buffalo WHR-G300N
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 02000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000001ffffff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 28092K/32768K available (3051K kernel code, 145K rwdata, 708K rodata, 184K init, 204K bss, 4676K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] CPU Clock: 384MHz
[    0.000000] clocksource_probe: no matching clocksources found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9954481493 ns
[    0.000014] sched_clock: 32 bits at 192MHz, resolution 5ns, wraps every 11184811005ns
[    0.015678] Calibrating delay loop... 255.59 BogoMIPS (lpj=1277952)
[    0.100968] pid_max: default: 32768 minimum: 301
[    0.110378] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.123474] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.144844] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.164410] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.176633] pinctrl core: initialized pinctrl subsystem
[    0.187905] NET: Registered protocol family 16
[    0.228898] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.239995] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.257596] clocksource: Switched to clocksource MIPS
[    0.269288] NET: Registered protocol family 2
[    0.279239] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.293104] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.305721] TCP: Hash tables configured (established 1024 bind 1024)
[    0.318517] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.330101] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.342938] NET: Registered protocol family 1
[    0.355327] rt-timer 10000100.timer: maximum frequency is 3906Hz
[    0.368542] Crashlog allocated RAM at address 0x1f00000
[    0.380952] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.405462] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.417039] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.453168] io scheduler noop registered
[    0.460919] io scheduler deadline registered (default)
[    0.471785] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.485920] console [ttyS0] disabled
[    0.493036] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 8000000) is a Palmchip BK-3103
[    0.512770] console [ttyS0] enabled
[    0.512770] console [ttyS0] enabled
[    0.526712] bootconsole [early0] disabled
[    0.526712] bootconsole [early0] disabled
[    0.544278] 1f000000.cfi: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x0000c2 Chip ID 0x0022a8
[    0.564542] Amd/Fujitsu Extended Query Table at 0x0040
[    0.574936]   Amd/Fujitsu Extended Query version 1.1.
[    0.585144] number of CFI chips: 1
[    0.596235] 5 ofpart partitions found on MTD device 1f000000.cfi
[    0.608416] Creating 5 MTD partitions on "1f000000.cfi":
[    0.619150] 0x000000000000-0x000000030000 : "u-boot"
[    0.631537] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.645139] 0x000000040000-0x000000050000 : "factory"
[    0.658269] 0x000000050000-0x0000003f0000 : "firmware"
[    0.672788] 2 uimage-fw partitions found on MTD device firmware
[    0.684819] 0x000000050000-0x00000018efdd : "kernel"
[    0.697542] 0x00000018efdd-0x0000003f0000 : "rootfs"
[    0.710434] mtd: device 5 (rootfs) set to be root filesystem
[    0.721955] 1 squashfs-split partitions found on MTD device rootfs
[    0.734469] 0x000000370000-0x0000003f0000 : "rootfs_data"
[    0.748343] 0x0000003f0000-0x000000400000 : "user"
[    0.761684] libphy: Fixed MDIO Bus: probed
[    0.773383] rt3050-esw 10110000.esw: link changed 0x18
[    0.786555] mtk_soc_eth 10100000.ethernet: generated random MAC address b2:22:c7:30:4d:55
[    0.804287] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.821766] rt2880_wdt 10000120.watchdog: Initialized
[    0.833520] NET: Registered protocol family 10
[    0.847329] NET: Registered protocol family 17
[    0.856492] 8021q: 802.1Q VLAN Support v1.8
[    0.873605] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    0.889239] Freeing unused kernel memory: 184K
[    0.898254] This architecture does not have kernel memory protection.
[    1.638197] init: Console is alive
[    1.645438] init: - watchdog -
[    2.034199] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    2.186265] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.211564] init: - preinit -
[    2.517612] random: fast init done
[    3.543740] 8021q: adding VLAN 0 to HW filter on device eth0
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.989255] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    7.044167] urandom-seed: Seed file not found (/etc/urandom.seed)
[    7.217139] procd: - early -
[    7.223245] procd: - watchdog -
[    7.924664] procd: - watchdog -
[    7.931652] procd: - ubus -
[    8.077062] procd: - init -
Please press Enter to activate this console.
[    8.681612] kmodloader: loading kernel modules from /etc/modules.d/*
[    8.829515] nat46: module (version 683fbd2b765506332a1af141545652bf58f03166) loaded.
[    8.859243] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    8.903286] u32 classifier
[    8.908836]     input device check on
[    8.916198]     Actions configured
[    8.926855] Mirror/redirect action on
[    8.945238] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[    8.990249] ip_tables: (C) 2000-2006 Netfilter Core Team
[    9.274762] xt_time: kernel timezone is -0000
[    9.318461] PPP generic driver version 2.4.2
[    9.354753] NET: Registered protocol family 24
[    9.395545] kmodloader: done loading kernel modules from /etc/modules.d/*
[   23.202959] 8021q: adding VLAN 0 to HW filter on device eth0
[   23.305109] br-lan: port 1(eth0.1) entered blocking state
[   23.316076] br-lan: port 1(eth0.1) entered disabled state
[   23.327698] device eth0.1 entered promiscuous mode
[   23.337354] device eth0 entered promiscuous mode
[   23.566627] br-lan: port 1(eth0.1) entered blocking state
[   23.577596] br-lan: port 1(eth0.1) entered forwarding state
[   23.589154] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   24.207878] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   34.487979] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   34.544126] jffs2_build_filesystem(): unlocking the mtd device... [   34.556302] done.
[   34.560209] jffs2_build_filesystem(): erasing all blocks after the end marker... [   38.893944] done.
[   38.897962] jffs2: notice: (1516) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.

WN-G300DGRのMTDパーティション

前に書いた WN-G300DGRメモ に関して、Kernelの前に本来存在するらしき0xB0000のパーティションを追加する修正を行い、実機で動作確認した。

が。

どうも再起動すると設定が保存されない。そこでコンソールを確認すると、

jffs2: Too few erase blocks (2)

のログが。これは、Flashに空きスペースが無く、空き領域を確保できない場合に出る。
と、ここで重大なことに気付く。

そりゃ修正前の “firmware” パーティション(Kernel+RootFS)が0x3B0000(≒3,866KB?)で空き領域200KB程度だったのに、Kernelの前に存在するらしきパーティションで0xB0000(≒720KB?)も持っていかれて “firmware” パーティションが0x300000(≒3,145KB?)では全く足りてないよな…

という。
上記の修正を行った場合、ramips + U-BootにおけるLEDE (OpenWrt) ファームのお馴染み “27 05 19 56” が公式ファームと同じ位置に来るためU-BootにBad Magic Numberを出されないほか、公式ファームへ戻す際にも0xB0000分paddingする必要が無く簡単なものの、このままではLEDE (OpenWrt)で設定が保存できない。
そのため、再起動するたびにリセットされ設定し直す羽目になるので、パーティション修正は諦め変更を破棄して元の構成に差し戻した。

やはりFlash 4MBでは厳しい。正直パーティション構成を正確に調べたかったものの、Flashのサイズや筐体の形(湾曲していて扱いづらい)など厳しい点がどうしても多いため追加で購入するのは見送って、この機種に関してはあとUSB周り調べる程度かな、と思う。

WN-G300DGRメモ

弄る中で気付いたことメモ

  • Kernelの前にパーティション有
    • シリアルコンソール用のシェルが存在?
  • GPIO#7はrebootに使用
  • U-Bootの環境変数op_modeをデフォルトの0から1に変更すると、Kernelが起動後詳細なログをコンソールに吐く
  • console pass: admin ?

パーティション構成
現状での予想。これ以外にも存在する可能性あり

パーティション名 領域 (HEX) サイズ (HEX)
u-boot 0x0 – 0x30000 0x30000
u-boot-env 0x30000 – 0x40000 0x10000
factory 0x40000 – 0x50000 0x10000
console? 0x50000 – 0x100000 0xb0000
firmware (Kernel + RootFS) 0x100000 – 0x400000 0x300000
————- ↓firmware ————– ——————————— ———————-
kernel 0x100000 – 0x2c0000 0x1c0000
rootfs 0x2c0000 – 0x400000 0x140000