Forum: Mikrocontroller und Digitale Elektronik Switch Upgrade XGS1010-12 nach XGS1210-12


von Franz (Gast)


Lesenswert?

Hallo

Ich habe die beiden im Titel angegebenen Switches:
XGS1010-12 und
XGS1210-12.
Leztere ist managebar, der erst nicht.
Bei beiden ist die Hardware identisch und der Debug UART ist von aussen 
erreichbar.

Somit ist meine Neugierde geweckt, ob man den XGS1010-12 auf einen 
XGS1210-12 upgraden kann.

Auf beiden System ist jeweils ein UBoot und ein Linux drauf. Beides ist 
jedoch nicht identisch. So fehlt dem 1010-12er im uboot die 
Ethernet-Unterstützung. bootp/tftpboot geht z.B. nicht, obwohl der 
Befehl angezeigt wird:
1
U-Boot 2011.12.(TRUNK_CURRENT)-svn99721 (Oct 24 2019 - 09:15:40)
2
3
Board: RTL9300 CPU:800MHz LX:175MHz DDR:600MHz
4
DRAM:  128 MB
5
SPI-F: MXIC/C22018/MMIO16-1/ModeC 1x16 MB (plr_flash_info @ 83f831e4)
6
Loading 65536B env. variables from offset 0xe0000
7
Net:   Net Initialization Skipped
8
No ethernet found.
9
Hit Esc key to stop autoboot:  0
10
RTL9300# # help
11
?       - alias for 'help'
12
base    - print or set address offset
13
boota   - boota  - boot application image from one of dual images partition automatically
14
bootm   - boot application image from memory
15
bootp   - boot image via network using BOOTP/TFTP protocol
16
cmp     - memory compare
17
cp      - memory copy
18
crc32   - checksum calculation
19
env     - environment handling commands
20
erase   - erase FLASH memory
21
flerase - Erase flash partition
22
flinfo  - print FLASH memory information
23
flshow  - Show flash partition layout
24
go      - start application at address 'addr'
25
help    - print command description/usage
26
iminfo  - print header information for application image
27
loadb   - load binary file over serial line (kermit mode)
28
loads   - load S-Record file over serial line
29
loady   - load binary file over serial line (ymodem mode)
30
loop    - infinite loop on address range
31
md      - memory display
32
mm      - memory modify (auto-incrementing address)
33
mtest   - simple RAM read/write test
34
mw      - memory write (fill)
35
nm      - memory modify (constant address)
36
ping    - send ICMP ECHO_REQUEST to network host
37
printenv- print environment variables
38
printsys- printsys - print system information variables
39
40
protect - enable or disable FLASH write protection
41
reset   - Perform RESET of the CPU
42
reset_all- Perform whole chip RESET of the CPU
43
rtk     - rtk     - Realtek commands
44
45
run     - run commands in an environment variable
46
saveenv - save environment variables to persistent storage
47
savesys - savesys - save system information variables to persistent storage
48
49
setenv  - set environment variables
50
setsys  - setsys  - set system information variables
51
52
sf      - SPI flash sub-system
53
sleep   - delay execution for some time
54
sys     - sys     - Realtek HTP test commands
55
56
tftpboot- boot image via network using TFTP protocol
57
upgrade - Upgrade loader or runtime image
58
version - print monitor, compiler and linker version

Vom 12010-12er gibts ein Firmware-Update-Datei. Die größe entsprich in 
etwa die des Linux-Systems. Die Dateienden ist jedoch .bix. Davon hab 
ich noch nie was gehört. Ich hab einfach mal blind versucht, die mittels 
loady hochzuladen. Die Datei wurde an Adresse 0x80000000 kopiert.

Der Versuch das Image auszuführen schlägt jedoch fehl:
1
RTL9300# # go 0x80000000
2
## Starting application at 0x80000000 ...
3
## Application terminated, rc = 0x2A

Ich hätte erwartet, dass bootm auch von dieser Adresse startet, tut es 
aber leider nicht:
1
RTL9300# # bootm
2
## Booting kernel from Legacy Image at 34000000 ...

Mit fehlt leider mit uboot die Erfahrung. Meine Idee war, die Firmware 
ins Ram zu kopieren, den Flash erstmal in Ruhe zu lassen  und schauen, 
wie weit ich komme.

Hat jemand eine Idee, wie man weiter machen könnte?

Vermutlich wäre es für mich einfacher, die beiden 16MB SPI-Flashs 
auszulöten und einfach den Inhalt zu kopieren. Das zerlegen würde ich 
mir aber gerne ersparen.

Vielen Dank,

Franz

von Franz (Gast)


Lesenswert?

Kernel Log beim Booten:
1
U-Boot 2011.12.(TRUNK_CURRENT)-svn99721 (Oct 24 2019 - 09:15:40)
2
3
Board: RTL9300 CPU:800MHz LX:175MHz DDR:600MHz
4
DRAM:  128 MB
5
SPI-F: MXIC/C22018/MMIO16-1/ModeC 1x16 MB (plr_flash_info @ 83f831e4)
6
Loading 65536B env. variables from offset 0xe0000
7
Net:   Net Initialization Skipped
8
No ethernet found.
9
Hit Esc key to stop autoboot:  0
10
## Booting image from partition ... 0
11
## Booting kernel from Legacy Image at 81000000 ...
12
   Image Name:   RTK_SDK
13
   Created:      2019-10-24   9:16:10 UTC
14
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
15
   Data Size:    4577343 Bytes = 4.4 MB
16
   Load Address: 80000000
17
   Entry Point:  80283510
18
   Verifying Checksum ... OK
19
   Uncompressing Kernel Image ... OK
20
21
Starting kernel ...
22
23
console [ttyS0] enabled
24
bootconsole [early0] disabled
25
Calibrating delay loop... 531.66 BogoMIPS (lpj=2658304)
26
pid_max: default: 32768 minimum: 301
27
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
28
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
29
NET: Registered protocol family 16
30
SCSI subsystem initialized
31
usbcore: registered new interface driver usbfs
32
usbcore: registered new interface driver hub
33
usbcore: registered new device driver usb
34
NET: Registered protocol family 2
35
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
36
TCP bind hash table entries: 1024 (order: 2, 20480 bytes)
37
TCP: Hash tables configured (established 1024 bind 1024)
38
TCP: reno registered
39
UDP hash table entries: 256 (order: 1, 12288 bytes)
40
UDP-Lite hash table entries: 256 (order: 1, 12288 bytes)
41
NET: Registered protocol family 1
42
futex hash table entries: 256 (order: 0, 7168 bytes)
43
msgmni has been set to 239
44
random: modprobe urandom read with 0 bits of entropy available
45
io scheduler noop registered
46
io scheduler deadline registered
47
io scheduler cfq registered (default)
48
Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
49
serial8250: ttyS0 at MMIO 0x0 (irq = 39, base_baud = 10764700) is a 16550A
50
RTK_SPI_FLASH_MIO driver is bypassed
51
RTK_NORSFG3 driver is used
52
=================================================================
53
init_luna_nor_spi_map: flash map at 0xb4000000
54
SPI NOR driver probe...
55
MXIC/C22018/MMIO16-1/ModeC add SPI NOR partition
56
MTD partitions obtained from built-in array
57
Creating 7 MTD partitions on "rtk_norsf_g3":
58
0x000000000000-0x0000000e0000 : "LOADER"
59
0x0000000e0000-0x0000000f0000 : "BDINFO"
60
0x0000000f0000-0x000000100000 : "SYSINFO"
61
0x000000100000-0x000000200000 : "JFFS2 CFG"
62
0x000000200000-0x000000300000 : "JFFS2 LOG"
63
0x000000300000-0x000000980000 : "RUNTIME"
64
0x000000980000-0x000001000000 : "RUNTIME2"
65
=================================================================
66
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
67
rtk_gen1_hcd_cs_init: rtk_gen1_hcd_cs_init()!
68
rtk_gen1_hcd_cs_init: register rtk_gen1_ehci ok!
69
usb_phy_configure_process: usb_phy_configure_process()!
70
rtk_gen1-ehci rtk_gen1-ehci: Realtek On-Chip EHCI Host Controller
71
rtk_gen1-ehci rtk_gen1-ehci: new USB bus registered, assigned bus number 1
72
rtk_gen1-ehci rtk_gen1-ehci: irq 20, io mem 0x18021000
73
rtk_gen1-ehci rtk_gen1-ehci: USB 2.0 started, EHCI 1.00
74
hub 1-0:1.0: USB hub found
75
hub 1-0:1.0: 1 port detected
76
usbcore: registered new interface driver usbtmc
77
usbcore: registered new interface driver usb-storage
78
TCP: cubic registered
79
NET: Registered protocol family 17
80
Freeing unused kernel memory: 3316K (803a3000 - 806e0000)
81
init started:  BusyBox v1.00 (2019.10.23-06:17+0000) multi-call binary
82
Starting pid 25, console : '/etc/rc'
83
RTCORE LKM Insert...
84
85
allocate mem to rtcore_devices[0].rt_data=0x87c8f000
86
RTCORE Driver Module Initialize
87
  IOAL init
88
  Log init
89
  Hardware-profile probe    (Forced profile: RTL9302B_8218D_2x8226_2xGE)
90
 (RTL9302B_8218D_2x8226_2xGE)
91
  Hardware-profile init
92
  GPIO probe (unit 0): (found)
93
  GPIO Init
94
Reset PHY gpio OK!
95
  SPI init (unit 0) (type3)
96
    SPI Master init
97
  TC probe (unit 0): (found)
98
  TC init (unit 0)
99
    TC util init (unit 0)
100
    TC util init (isr)
101
  Watchdog probe (unit 0): (found)
102
  Watchdog init (unit 0)
103
  I2C probe (unit 0)
104
  I2C init (unit 0)
105
  RTL8231 probe (unit 0): (found)
106
  RTL8231 init (unit 0)
107
  NIC probe (unit 0)
108
  IOAL init
109
  L2Ntfy probe (unit 0): (found)
110
RTK Driver Module Initialize
111
  MAC probe (unit 0)
112
    Chip 9302 (found)
113
  MAC init (unit 0)
114
  SMI protocol probe (unit 0)
115
  PHY probe (unit 0)
116
  Chip Construct (unit 0)
117
    Chip Construct
118
    Disable PHY Polling
119
    PHY Reset
120
    MAC Construct
121
    Turn Off Serdes
122
    Serdes Construct
123
    PHY Construct
124
    Turn On Serdes
125
    Enable PHY Polling
126
    Misc
127
  PHY init (unit 0)
128
  Mgmt_dev init (unit 0)
129
  I2C device init (unit 0)
130
  I2C device init (unit 0)
131
RTNIC Driver Module Initialize
132
RTDRV Driver Module Initialize
133
route: not found
134
RTK.0>

von Axel S. (a-za-z0-9)


Lesenswert?

Franz schrieb:
> Ich habe die beiden im Titel angegebenen Switches

Schön.

Wenn du jetzt noch erklären könntest, was das im Forum
"Mikrocontroller und Digitale Elektronik" zu suchen hat?

von Franz (Gast)


Lesenswert?

Uboot und Low Level gehört wohl eher zu "Microcontroller und Digitale 
Elektronik" als in die anderen Bereiche oder?

Spätestens, wenn es auf SPI-Flash kopieren raus läuft, passt es 100%.

von Viktor P. (lordnitro)


Lesenswert?

Hi,
I also have the XGS1010-12 and find your post here interesting. Any 
progress on this? Do you have a description how to connect to the debug 
UART on the switch?

The *.bix firmware file is LZMA compressed.

You can uncompress the file using "binwalk -y 'lzma compressed data' -re 
XGS1210-12_V1.00(ABTY.3)C0.bix". That will give you an uncompressed 
file.

The you could use, binwalk --extract  40. Looks like there is two 
different the linux filesystem is under 350A20 & 3C21D0. You can extract 
them using cpio -i -F  350A20.

I havnt had time to dig around any more, but by the looks of it 
everything you need should be in this firmware file.

BR
Viktor

von Franz (Gast)


Lesenswert?

Hello Viktor

Thank you for your response.
I didn’t continue because it was not very important for me.
You information sounds very useful.
Unfortunately I have to move and all my tools are already packed.
I will continue after it.


Best regards, Franz

von Franz (Gast)


Lesenswert?

About the description:
There is a 4 pin header which is reachable without opening the device. 
It carries a standard 3.3V Uart with 115200 bps and 8N1 coding.

von Gregory Popp (Gast)


Lesenswert?

Vorab eine Frage. Lässt sich das Netzwerk in u-boot eventuell durch 
folgenden Befehl "beleben"?
1
rtk network on

Das Image des XGS1210 hat einen 40 Byte uImage Header mit einer nicht 
Standard Magic Number (0x93001210). Anschließend folgt der LZMA 
komprimierte Linux Kernel.

XGS1210-12; V1.00(ABTY.3)C0; July 06, 2020
1
93 00 12 10  // Image Header Magic Number
2
0C 2B 26 FD  // Image Header CRC Checksum [crc32 of header with this field masked to all 0x0 == 0x0C2B26FD]
3
5E DE 38 AF  // Image Creation Timestamp [Monday, 8. June 2020 13:10:07 UTC]
4
00 55 74 4C  // Image Data Size [0x40 to 0x557488B == 0x55744C]
5
80 00 00 00  // Data   Load  Address
6
80 2B 73 80  // Entry Point Address
7
08 B1 6B AC  // Image Data CRC Checksum [crc32 of 0x40 to 0x557488B == 0x08B16BAC]
8
05    // Operating System [0x05 == IH_OS_LINUX]
9
05    // CPU architecture [0x05 == IH_ARCH_MIPS]
10
02    // Image Type [0x02 == IH_TYPE_KERNEL]
11
03    // Compression Type [0x03 == IH_COMP_LZMA]
12
56 31 2E 30 30 28 41 42 54 59 2E 33 29 43 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // Image Name == 32V1.00(ABTY.3)C0

Franz schrieb:
> Vom 12010-12er gibts ein Firmware-Update-Datei. Die größe entsprich in
> etwa die des Linux-Systems. Die Dateienden ist jedoch .bix. Davon hab
> ich noch nie was gehört. Ich hab einfach mal blind versucht, die mittels
> loady hochzuladen. Die Datei wurde an Adresse 0x80000000 kopiert.

An der Adresse wird der dekomprimierte Kernel erwartet.

> Der Versuch das Image auszuführen schlägt jedoch fehl:RTL9300# # go
> 0x80000000
> ## Starting application at 0x80000000 ...
> ## Application terminated, rc = 0x2A
>
> Ich hätte erwartet, dass bootm auch von dieser Adresse startet, tut es
> aber leider nicht:RTL9300# # bootm
> ## Booting kernel from Legacy Image at 34000000 ...

bootm kann ein Image von einer anderen Adresse laden, man muss es dem 
Befehl aber mitgeben.

Folgendes sollte funktionieren:
1
# per uart zu ladendes LZMA komprimiertes Image (XGS1210-12_V1.00(ABTY.3)C0.bix)
2
# an RAM Position 64MByte speichern
3
loady 0x84000000
4
5
# bootm mitteilen wo uimage header + lzma komprimierter kernel im RAM zu finden
6
# ist, damit bootm den Kernel nach 0x80000000 (Data Load Address) entpackt, zur
7
# "Entry Point Address" springt und den dort zu findenden Code startet
8
bootm 0x84000000

Franz schrieb:
> Befehl angezeigt wird:U-Boot 2011.12.(TRUNK_CURRENT)-svn99721 (Oct 24
> 2019 - 09:15:40)
> Board: RTL9300 CPU:800MHz LX:175MHz DDR:600MHz
> DRAM:  128 MB
> SPI-F: MXIC/C22018/MMIO16-1/ModeC 1x16 MB (plr_flash_info @ 83f831e4)
> Loading 65536B env. variables from offset 0xe0000
> Net:   Net Initialization Skipped
> No ethernet found.
> Hit Esc key to stop autoboot:  0
> RTL9300# # help
> ...
> sf      - SPI flash sub-system

Die Befehle zum schreiben eines in den RAM geladenen Images auf den 
Flash scheinen im u-boot zu sein. 'printenv' sollte Auskunft geben wo 
auf dem Flash das Image erwartet wird.

Das ganze sollte grob wie folgend ablaufen:
1
# per uart zu ladendes LZMA komprimiertes Image (XGS1210-12_V1.00(ABTY.3)C0.bix)
2
# an RAM Position 64MByte speichern
3
loady 0x84000000
4
5
# start: 0x300000, Anzahl: 0xd00000; von 0x300000 bis zum Ende des 16MByte Flashchip
6
sf erase 0x300000 0xd00000
7
8
# lese 0x55748C Byte ab Speicheraddresse 0x84000000 und schreibe sie an Position
9
# 0x300000 des Flashchip
10
#
11
# die genau Anzahl der empfangenen/zu schriebenden Bytes sollte loady ausgeben
12
#
13
# wenn der u-boot nicht kaputt gepatched ist, sollte loady eine variable mit der
14
# Dateigröße anlegen, dann geht auch 'sf write 0x84000000 0x300000 ${filesize}'
15
sf write 0x84000000 0x300000 0x55748C

Alles komplett ungetestet! Spätestens wenn es an das schreiben des Flash 
geht, empfiehlt sich ein Backup des Flashchip.

von muetzekoeln (Gast)


Lesenswert?

Hello,

any news on this? I'm also interested in upgrading xgs1210 to xgs1210 by 
firmware-upgrade. Does it work by starting the network (rtk network on) 
followed by starting upgrade web-service ("httpd" command)?

Is there a way to save original flash image with on board commands (e.g. 
"cp")?

Where can I find "rtk" commands documentation?

regards,
Christoph

von WRT54G (Gast)


Lesenswert?

muetzekoeln schrieb:

> any news on this?

Compile openwrt yourself, or wait for a release - its wip:

https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/1170

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.