大破雑記帳

個人用メモな雑記ブログ いろんなことをざっくりと。

Switch-M8eG PN28080K

既に記事を書いたSwitch-M24eG PN28240KがRealtek SoCを搭載していることを知った際、シリーズ内を調べて同様にRealtek SoC搭載機であることを確認していた機種。
既にM24eGがあるわけなのでこちらは躊躇していたが、M24eGのSFPポートを検証するにあたって対向デバイスがどうしても必要であるため、エイヤで購入に至った。今回はM24eGよりも落札価格が2k近く上。ちなみにその後M8eGが今度M24eG落札価格の半分以下で出たりしていた。しゃーない。
おおよそはM24eGからポート数分削り落とした構成と思われるが、SFP周りのぶら下がり方は異なっていた。
弄っていくのでメモ。

U-Boot

  • help

      RTL838x# # help
      ?         - alias for 'help'
      alphachk  - check image header and verify imgae in RAM [srcaddr] [imagetype]
      base      - print or set address offset
      boardid   - boardid  - Get/Set board model id
    
      boota     - boota  - boot application image from one of dual images partition automatically
    
      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
      cp        - memory copy
      crc32     - checksum calculation
      env       - environment handling commands
      erase     - erase FLASH memory
      ffsfmt    - ffs format
      ffsls     - ffs ls
      ffsmount  - mount ffs
      ffsrdm    - read file to memory from ffs
      ffsrm     - FFS rm
      ffsumount - unmount ffs
      ffswrm    - write file from memory to ffs
      flinfo    - print FLASH memory information
      go        - start application at address 'addr'
      help      - print command description/usage
      iminfo    - print header information for application image
      loadb     - load binary file over serial line (kermit mode)
      loady     - load binary file over serial line (ymodem mode)
      loop      - infinite loop on address range
      md        - memory display
      mm        - memory modify (auto-incrementing address)
      mtest     - simple RAM read/write test
      mw        - memory write (fill)
      nm        - memory modify (constant address)
      ping      - send ICMP ECHO_REQUEST to network host
      printenv  - print environment variables
      printsys  - printsys - print system information variables
    
      protect   - enable or disable FLASH write protection
      reset     - Perform RESET of the CPU
      rtk       - rtk     - Realtek commands
    
      run       - run commands in an environment variable
      saveenv   - save environment variables to persistent storage
      savesys   - savesys - save system information variables to persistent storage
    
      setenv    - set environment variables
      setsys    - setsys  - set system information variables
    
      sf        - SPI flash sub-system
      showsub   - show u-boot sub version
      sleep     - delay execution for some time
      tftpboot  - boot image via network using TFTP protocol
      updatert  - update runtime firmware
      updateub  - update u-boot firmware
      version   - print monitor, compiler and linker version
    
  • version

      RTL838x# # version
    
      U-Boot 2011.12.pre45842-1.00.22-svn5720 (Mar 12 2015 - 19:04:09)
      mips-linux-uclibc-gcc (GCC) 3.4.4 mipssde-6.03.00-20051020
      GNU ld version 2.15.94 mipssde-6.03.00-20051020
    
  • printenv

    少々厄介なことに、printenvでのethaddrはFlash内にバイナリとして埋め込まれたMACアドレスが常に表示される。その上、何も触れていない完全な初期状態では、U-Bootの環境変数領域にはSDKデフォルトで個体固有ではないと思われるMACアドレスが格納されている。また、setenvでethaddrを設定した場合、U-Bootの環境変数領域のethaddrに加え、Flash内に埋め込まれているアドレスにも適用され変更される。
    Flash内に埋め込まれたアドレスとU-Boot環境変数内のアドレスが異なる状態でethaddrのsetenvをせずにsaveenvした場合、埋め込まれたアドレスがU-Bootの環境変数におけるethaddrにも書き込まれる。

      RTL838x# # printenv
      baudrate=9600
      boardmodel=RTL8380M_INTPHY_2FIB_1G_DEMO
      bootcmd=bootm 0x81000000
      bootdelay=3
      diagmode=4
      ethact=rtl8380#0
      ethaddr=00:50:40:**:**:0e
      file_linux=vmlinux.bix
      file_linux2=vmlinux.bix
      file_uboot=u-boot.bin
      fileaddr=81000000
      filesize=2C1914
      flashoffset_env=0x80000
      flashoffset_linux=0x5a0000
      flashoffset_linux2=0xc50000
      flashoffset_uboot=0x0
      freemem=0x81000000
      ipaddr=192.168.1.1
      load_addr=0xb4100000
      nuke_env=sf probe 0; sf erase $(flashoffset_env) +$(ssize_env)
      rtkon=rtk network on;ping $(serverip)
      serverip=192.168.1.111
      ssize_env=0x10000
      ssize_linux=0x6b0000
      ssize_linux2=0x6b0000
      ssize_uboot=0x80000
      stderr=serial
      stdin=serial
      stdout=serial
      up_linux=sf probe 0;sf read $(freemem) $(flashoffset_linux) $(ssize_linux);bootm $(freemem)
      update_linux=tftp $(freemem) $(file_linux);sf probe 0;sf erase $(flashoffset_linux) $(ssize_linux);sf write $(fileaddr) $(flashoffset_linux) $(ssize_linux)
      update_linux2=tftp $(freemem) $(file_linux2);sf probe 0;sf erase $(flashoffset_linux2) $(ssize_linux2);sf write $(fileaddr) $(flashoffset_linux2) $(ssize_linux2)
      update_uboot=tftp $(freemem) $(file_uboot);sf probe 0;sf erase $(flashoffset_uboot) $(ssize_uboot);sf write $(fileaddr) $(flashoffset_uboot) $(ssize_uboot)
    
      Environment size: 1287/65532 bytes
    
  • printsys

    stockではbootaを利用していないので、関連する "sys" 領域もたぶん利用されていない

      RTL838x# # printsys
      Invalid system information
    
  • help rtk

      rtk - rtk     - Realtek commands
    
      Usage:
      rtk object action
      - SOC commands.
      rtk network on
      - Enable the networking function
      rtk netowkr off
      - Disable the networking function
      rtk testmode [mode] [port]
      - Set default value for specific testing
      rtk ext-pinGet [pinNum]
      - get external 8231 GPIO pin status
      rtk ext-pinSet [pinNum] [status]
      - set external 8231 GPIO pin status
      rtk smi list
      - list all smi group
      rtk smi init [group_id] [sck_pin] [sda_pin] [8/16/8_0R/16_1R/16_0R access type] [chipid] [delay] [name]
      - create a smi group and init
      rtk smi read [group_id] [reg]
      rtk smi write [group_id] [reg] [data]
      rtk pinGet [pinNum]
      - get internal GPIO pin status
      rtk pinSet [pinNum] [status]
      - set internal GPIO pin status
      rtk poe probe
      - probe poe device
      rtk ledtest [port] [led_index]
      - led test
      rtk loopback ext [port-start] [port-end] [round]
      - port traffic external loopback test
      rtk loopback int [port-start] [port-end] [round]
      - port traffic internal loopback test
    
  • rtk smi list

      RTL838x# # rtk smi list
    
      Index SCK_DEV SCK_PIN SDA_DEV SDA_PIN  TYPE     ID   Delay     Name
      ===========================================================================
      00      00      00      00      01  16_1R    75   04000  PCA9539
      01      00      12      00      13   8_0R    70   04000  PCA9545
      02      00      00      00      01  16_1R    20   04000  PCA9555
      03      00      12      00      13   8_0R    50   04000  GBIC-A0H
      04      00      12      00      13   8_0R    51   04000  GBIC-A2H
    
  • rtk pinGet 0-32

      RTL838x# # rtk pinGet 0
      pin0:   1
    
      RTL838x# # rtk pinGet 1
      pin1:   1
    
      RTL838x# # rtk pinGet 2
      pin2:   1
    
      RTL838x# # rtk pinGet 3
      pin3:   1
    
      RTL838x# # rtk pinGet 4
      pin4:   0
    
      RTL838x# # rtk pinGet 5
      pin5:   0
    
      RTL838x# # rtk pinGet 6
      pin6:   0
    
      RTL838x# # rtk pinGet 7
      pin7:   0
    
      RTL838x# # rtk pinGet 8
      pin8:   0
    
      RTL838x# # rtk pinGet 9
      pin9:   0
    
      RTL838x# # rtk pinGet 10
      pin10:  0
    
      RTL838x# # rtk pinGet 11
      pin11:  1
    
      RTL838x# # rtk pinGet 12
      pin12:  1
    
      RTL838x# # rtk pinGet 13
      pin13:  1
    
      RTL838x# # rtk pinGet 14
      pin14:  0
    
      RTL838x# # rtk pinGet 15
      pin15:  0
    
      RTL838x# # rtk pinGet 16
      pin16:  0
    
      RTL838x# # rtk pinGet 17
      pin17:  0
    
      RTL838x# # rtk pinGet 18
      pin18:  0
    
      RTL838x# # rtk pinGet 19
      pin19:  0
    
      RTL838x# # rtk pinGet 20
      pin20:  0
    
      RTL838x# # rtk pinGet 21
      pin21:  0
    
      RTL838x# # rtk pinGet 22
      pin22:  0
    
      RTL838x# # rtk pinGet 23
      pin23:  0
    
      RTL838x# # rtk pinGet 24
      pin24:  0
    
      RTL838x# # rtk pinGet 25
      pin25:  0
    
      RTL838x# # rtk pinGet 26
      pin26:  0
    
      RTL838x# # rtk pinGet 27
      pin27:  0
    
      RTL838x# # rtk pinGet 28
      pin28:  0
    
      RTL838x# # rtk pinGet 29
      pin29:  0
    
      RTL838x# # rtk pinGet 30
      pin30:  0
    
      RTL838x# # rtk pinGet 31
      pin31:  0
    
      RTL838x# # rtk pinGet 32
      pin32:  0
    
  • rtk ext-pinGet 0

      RTL838x# # rtk ext-pinGet 0
      ext-gpio time out
      ext-gpio time out
      ext-gpio time out
      ext-gpio time out
      ext-gpio time out
      pin0:   0
    
  • tftpboot

      RTL838x# # tftpboot
      *** Warning: no boot file name; using '0101A8C0.img'
      Using rtl8380#0 device
      TFTP from server 192.168.1.111; our IP address is 192.168.1.1
      Filename '0101A8C0.img'.
      Load address: 0xb4100000
      Loading: *
    
  • ffsmount, ffsls

      RTL838x# # ffsmount c:/
      File system initialization done
      RTL838x# # ffsls c:/
      -rw- 2890004  runtime_2.had
      -rw- 2        runtime_2_checksum
      -rw- 839      config.cfg
      -rw- 2        config.cks
      -rw- 839      config_2.cfg
      -rw- 2        config_2.cks
      -rw- 2890004  runtime.had
      -rw- 2        runtime_checksum
    

Kernel

KernelはLinuxではなくVxWorksFlash内にファイルシステムが形成されており、その中にKernelイメージが配置されている。

  • bootlog

    
      U-Boot 2011.12.pre45842-1.00.22-svn5720 (Mar 12 2015 - 19:04:09)
    
      Board: RTL838x CPU:500MHz LXB:200MHz MEM:300MHz
      DRAM:  128 MB
      SPI-F: 1x32 MB
      Loading 65536B env. variables from offset 0x80000
      #### Periphery Devices Init Successfully ####
      Switch Model: RTL8380M_INTPHY_2FIB_1G (Port Count: 9)
      Switch Chip: RTL8380M
      **************************************************
      #### RTL8218B config - MAC ID = 8 ####
      Now Internal PHY
    
      File system initialization done
      Start to check runtime code(1)
    
      ## Booting kernel from Legacy Image
      Verifying Checksum ... OK
      Uncompressing Kernel Image ... OK
      ## Starting program
    
      UART init . ................................................  100 %
      Starting runtime image ....................................      |100 %
    
      Configuration init ........................................      |/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-100 %
    
      [2J[0m[2J[1;1H ==============================================================================
      PN28080K Local Management System Version 2.0.0.01
      MAC Address: 00:50:40:**:**:0E
    
      ==============================================================================
    
      Login Menu
    
      Login: