Re: Ralink RT3050F

From: Archimedes Gaviola <archimedes.gaviola_at_gmail.com>
Date: Mon, 29 Aug 2022 02:15:13 UTC
On Sun, Aug 28, 2022 at 4:15 PM Archimedes Gaviola <
archimedes.gaviola@gmail.com> wrote:

> Hi,
>
> After I successfully accessed the serial console, I proceeded to load the
> kernel image (this is an old D-link DIR-600 (B2) Wi-Fi device) and
> encountered this error ->
>
> Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover.
>
> Any idea what have I missed? After this failure, it booted to the default
> image of the Linux system. Haven't flashed the image yet when this error
> occurred.
>
> TFTP from server 192.168.1.209; our IP address is 192.168.1.188
> Filename 'dlink/kernel.bin.lzma.uboot'.
>
>  TIMEOUT_COUNT=10,Load address: 0x80800000
> Loading: Got ARP REQUEST, return our IP
>
> ArpTimeoutCheck
> Got ARP REPLY, set server/gtwy eth addr (b8:27:eb:64:8b:57)
> Got it
> #################################################################
>          #################################################################
>          #################################################################
>          ################################################
> done
> Bytes transferred = 1243362 (12f8e2 hex)
> NetBootFileXferSize= 0012f8e2
>
> RT3052 # bootm 0x80800000
> ## Booting image at 80800000 ...
>    Image Name:   FreeBSD Kernel Image
>    Created:      2022-08-18   5:51:56 UTC
>    Image Type:   MIPS Linux Kernel Image (lzma compressed)
>    Data Size:    1243298 Bytes =  1.2 MB
>    Load Address: 80001100
>    Entry Point:  80001100
>    Verifying Checksum ... OK
>    Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to
> recover
>
>
> U-Boot 1.1.3 (Jan 12 2011 - 21:35:28) (ALPHA)
>
> SVN revision: 482
> Target board: WRG-N23
>
> Board: Ralink APSoC DRAM:  32 MB
> config usb..*** Error: D+/D- is 1/1, config usb failed.
> ..*** Error: D+/D- is 1/1, config usb failed.
>
> ******************************
> Software System Reset Occurred
> ******************************
>
>  Set info->start[0]=BF000000
> ============================================
> Ralink UBoot Version: 3.5.1.0
> --------------------------------------------
> ASIC 3052_MP2 (Port5<->None)
> DRAM component: 256 Mbits SDR
> DRAM bus: 16 bit
> Total memory: 32 MBytes
> Flash component: NOR Flash
> Date:Jan 12 2011  Time:21:35:28
> ============================================
> icache: sets:256, ways:4, linesz:32 ,total:32768
> dcache: sets:128, ways:4, linesz:32 ,total:16384
> ## Powering down port 0 ~ 3.
>
> 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.
>    7: Load Boot Loader code then write to Flash via Serial.
>    9: Load Boot Loader code then write to Flash via TFTP.
>                                                            0
>
> 3: System Boot system code via Flash.
> ## Booting image at bf050000 ...
> addr:bf050000
> We have SEAMA, Image Size = 3506208
> Verifying Checksum ...
> Uncompressing SEAMA linux.lzma ... OK
> ## Transferring control to Linux (at address 81f46ec0) ...
> ## Giving linux memsize in MB, 32
>
> Starting kernel ...
>
> LINUX started...
>
>  THIS IS ASIC
> is_RT3052 = 0, is_RT3352 = 0
> is_RT3350 = 1, is_RT5350 = 0
> Linux version 2.6.33.2 (kwest@enzo) (gcc version 4.3.3 (GCC) ) #1 Fri Dec
> 10 17:24:50 CST 2010
> ...
>
> Thanks and best regards,
> Archimedes
>

Hi,

Alright I made some progress, I used gzip compression instead of LZMA and
the kernel image is now booting.

U-Boot 1.1.3 (Jan 12 2011 - 21:35:28) (ALPHA)

SVN revision: 482
Target board: WRG-N23

Board: Ralink APSoC DRAM:  32 MB
config usb..*** Error: D+/D- is 1/1, config usb failed.
..*** Error: D+/D- is 1/1, config usb failed.

******************************
Software System Reset Occurred
******************************

 Set info->start[0]=BF000000
============================================
Ralink UBoot Version: 3.5.1.0
--------------------------------------------
ASIC 3052_MP2 (Port5<->None)
DRAM component: 256 Mbits SDR
DRAM bus: 16 bit
Total memory: 32 MBytes
Flash component: NOR Flash
Date:Jan 12 2011  Time:21:35:28
============================================
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:128, ways:4, linesz:32 ,total:16384
## Powering down port 0 ~ 3.

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.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.
                                                         0

3: System Boot system code via Flash.
## Booting image at bf050000 ...
   Image Name:   FreeBSD Kernel Image
   Created:      2022-08-29   1:55:22 UTC
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    1724519 Bytes =  1.6 MB
   Load Address: 80001100
   Entry Point:  80001100
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

U-Boot args (from 0 args):
        None
Environment:
entry: mips_init()
Cache info:
  picache_stride    = 4096
  picache_loopcount = 8
  pdcache_stride    = 4096
  pdcache_loopcount = 4
cpu0: MIPS Technologies processor v76.150
  MMU: Standard TLB, 32 entries (4K 16K 64K 256K 1M 16M 64M 256M pg sizes)
  L1 i-cache: 4 ways of 256 sets, 32 bytes per line
  L1 d-cache: 4 ways of 128 sets, 32 bytes per line
  L2 cache: disabled
  Config1=0xbea3319e<PerfCount,WatchRegs,MIPS16,EJTAG>
  Config2=0x80000000
  Config3=0x420
Physical memory chunk(s):
0x438000 - 0x1ffffff, 29130752 bytes (7112 pages)
Maxmem is 0x2000000
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2020 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.4-RELEASE #1: Sun Aug 28 18:35:56 UTC 2022
    root@:/usr/obj/mips.mipsel/usr/src/sys/RT305X mips
gcc version 4.2.1 20070831 patched [FreeBSD]
Preloaded elf kernel "kernel" at 0x804323d0.
real memory  = 33554432 (32768K bytes)
Physical memory chunk(s):
0x004c4000 - 0x01f46fff, 27799552 bytes (6787 pages)
avail memory = 27365376 (26MB)
ULE: setup cpu 0
wlan: <802.11 Link Layer>
random: entropy device external interface
mem: <memory>
null: <full device, null device, zero device>
nfslock: pseudo-device
nexus0: <MIPS32 root nexus>
random: harvesting attach, 8 bytes (4 bits) from nexus0
nvram2env0: base=0x1f030000 sig=0xe5e60a74 maxsize=0x00002000
flags=0x00000003
nvram2env1: base=0x1f032000 sig=0x5a045e94 maxsize=0x00004000
flags=0x00000003
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 192000000 Hz quality 800
Event timer "MIPS32" frequency 192000000 Hz quality 800
random: harvesting attach, 8 bytes (4 bits) from clock0
obio0 at mem 0x10000000-0x1fffffff on nexus0
rt305x_sysctl0: <RT305X System Control driver> at mem 0x10000000-0x100000ff
irq 0 on obio0
        Chip ID: "RT3350  "
    SYSCTL_SYSCFG=0x3400000
        GE0 mode 3
        Boot from 0x1f000000
        Boot from 0
        Bootstrap test code 0
        SRAM_CS mode 0
        8mA SDRAM_CLK driving
    SYSCTL_CLKCFG0=0x40000000
        SDRAM_CLK_SKEW 1ns
    SYSCTL_CLKCFG1=0x04283c
        USB OTG clock is enabled
        I2S clock is internal 15.625MHz
        I2S clock divider 40
        PCM clock is internal 15.625MHz
        PCM clock divider 60
    SYSCTL_GPIOMODE=0x00039c
random: harvesting attach, 8 bytes (4 bits) from rt305x_sysctl0
rt305x_ic0: <RT305X Interrupt Controller driver> at mem
0x10000200-0x100002ff on obio0
random: harvesting attach, 8 bytes (4 bits) from rt305x_ic0
uart0: <rt305x_uart> at mem 0x10000500-0x100005ff irq 5 on obio0
uart0: fast interrupt
uart0: PPS capture mode: DCDinvalid
random: harvesting attach, 8 bytes (4 bits) from uart0
gpio0: <RT305X GPIO driver> at mem 0x10000600-0x100006ff irq 6 on obio0
gpio0:  Use reset_gpio 10
gpiobus0: <GPIO bus> on gpio0
gpiobus0: <unknown device> at pin 0
gpiobus0: <unknown device> at pin 7
gpioled0: <GPIO led> at pin 8 on gpiobus0
random: harvesting attach, 8 bytes (4 bits) from gpioled0
gpioled1: <GPIO led> at pin 9 on gpiobus0
random: harvesting attach, 8 bytes (4 bits) from gpioled1
gpiobus0: <unknown device> at pin 10
gpiobus0: <unknown device> at pin 11
gpioled2: <GPIO led> at pin 14 on gpiobus0
random: harvesting attach, 8 bytes (4 bits) from gpioled2
random: harvesting attach, 8 bytes (4 bits) from gpiobus0
gpioc0: <GPIO controller> on gpio0
random: harvesting attach, 8 bytes (4 bits) from gpioc0
random: harvesting attach, 8 bytes (4 bits) from gpio0
uart1: <rt305x_uart> at mem 0x10000c00-0x10000cff irq 12 on obio0
uart1: console (115200,n,8,1)
uart1: fast interrupt
uart1: PPS capture mode: DCDinvalid
random: harvesting attach, 8 bytes (4 bits) from uart1
random: harvesting attach, 8 bytes (4 bits) from obio0
rt0: <Ralink RT3050 onChip Ethernet driver> at mem 0x10100000-0x1010ffff
irq 3 on nexus0
rt0: RT305XF Ethernet MAC (rev 0x00000000)
rt0: use hardcoded 00:18:e7:d5:83:90 macaddr
rt0: bpf attached
rt0: Ethernet address: 00:18:e7:d5:83:90
random: harvesting attach, 8 bytes (4 bits) from rt0
Device configuration finished.
Timecounters tick every 10.000 msec
vlan: initialized, using hash tables with chaining
lo0: bpf attached
tcp_init: net.inet.tcp.tcbhashsize auto tuned to 512
bootpc_init: wired to interface 'rt0'
Sending DHCP Discover packet from interface rt0 (00:18:e7:d5:83:90)
Received DHCP Offer packet on rt0 from 192.168.1.1 (accepted)
Received DHCP Offer packet on rt0 from 192.168.1.1 (ignored)
Sending DHCP Request packet from interface rt0 (00:18:e7:d5:83:90)
Received DHCP Ack packet on rt0 from 192.168.1.1 (accepted)
rt0 at 192.168.1.225 server 192.168.1.1
subnet mask 255.255.255.0 router 192.168.1.1
Adjusted interface rt0
Trying to mount root from cd9660:/dev/map/rootfs.uzip []...
mountroot: waiting for device /dev/map/rootfs.uzip...
Mounting from cd9660:/dev/map/rootfs.uzip failed with error 19.

Loader variables:

Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.

    eg. ufs:/dev/da0s1a
        zfs:tank
        cd9660:/dev/cd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /)

  ?               List valid disk boot devices
  .               Yield 1 second (for background tasks)
  <empty line>    Abort manual input

mountroot>

Another challenge is this last part on mounting the root filesystem? Any
ideas? I'm almost there.

Thanks and best regards,
Archimedes


>
>
>
> On Fri, Aug 19, 2022 at 8:56 AM Archimedes Gaviola <
> archimedes.gaviola@gmail.com> wrote:
>
>>
>>
>> On Fri, Aug 19, 2022 at 8:33 AM Mori Hiroki <yamori813@yahoo.co.jp>
>> wrote:
>>
>>> Hi.
>>>
>>> 0x80800000  is only u-boot image load offset. You will do bootm command
>>> on u-boot then start at 0x80001100 if you create this address by
>>> uboot_mkimage .
>>>
>>> Hiroki Mori
>>>
>>
>> Hi Hiroki Mori,
>>
>> Oh I see, got it, thanks for the explanation!
>>
>> Best regards,
>> Archimedes
>>
>>
>>>
>>> ----- Original Message -----
>>>
>>> From: "Archimedes Gaviola" <archimedes.gaviola@gmail.com>
>>> To: "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
>>> Date: 2022/08/18 木 21:38
>>> Subject: Ralink RT3050F
>>>
>>>
>>> Hi,
>>>
>>> I have successfully compiled an RT3050F SoC kernel image with FreeBSD
>>> 11.4-RELEASE by following this reference here
>>> https://wiki.freebsd.org/mips/RT3052F. However, I want to know how this
>>> value 0x80800000 is derived for the tftpboot? My generated image entry
>>> point value address is 80001100.
>>>
>>> root@freebsd114:/usr/obj/mips.mipsel/usr/src/sys/RT305X # readelf -h
>>> kernel | grep 'Entry point address:'
>>>  Entry point address:       0x80001100
>>>
>>> Thanks and best regards,
>>> Archimedes
>>>
>>>