Skip to content

Instantly share code, notes, and snippets.

@changtimwu
Last active February 27, 2016 07:53
Show Gist options
  • Save changtimwu/2e96aa66a69e66512979 to your computer and use it in GitHub Desktop.
Save changtimwu/2e96aa66a69e66512979 to your computer and use it in GitHub Desktop.
ARX-3303 renew procedure

Board 1.0

from top to bottom

*Serial

  • Debug
  • A
  • B
  • I For digging data, you should try Debug port first.

Check files

  • have /etc/config/sysbase.cfg
  • have /usr/sbin/sysbase.sh
#!/bin/sh
cat /etc/sysbase.cfg
  • modify /etc/init.d/frsinit.sh
. /etc/sysbase.cfg
ip link set eth1 address $hwaddr
  • update /usr/sbin/flxredsv
  • have /etc/init.d/shelld
cd /etc/rcS.d
ln -s ../init.d/shelld S41shelld

In /home/root

  • install redcor
  • install webdist
  • install arxcli

Others:

  • have /etc/init.d/mmsd
  • copy /usr/local/sbin/mmsd
  • copy /usr/bin/socat
  • copy /usr/sbin/sysbase.sh
  • copy /etc/init.d/networking (ensure interface lo is there)
  • rm -rf /home/root/altera
  • copy /usr/sbin/flxredsv
  • copy phyrw and ensure it can write phy
phyrw 0 16 3
phyrw 0 16
@changtimwu
Copy link
Author

  • edit ~/config.json ensure it's network settings is identical /etc/init.d/frsinit.sh
set phyaddrs '0 1 2 3'
set phyinit 'for addr in $phyaddrs;do mdio write mii0 $addr 22 3;mdio write mii0 $addr 16 217;mdio write mii0 $addr 22 8000;done'
set phymode 'for addr in $phyaddrs;do mdio write mii0 $addr 22 2;mdio write mii0 $addr 16 588;mdio write mii0 $addr 22 8000;done'
set bootcmd 'run phyinit;run phymode;run bootqspi'
save

for 1548p

set iphyaddrs '2 0x12 0x10';
for addr in $iphyaddrs;
do
  mdio write $addr 0x16 0x12;
  mdio write $addr 0x14 0x8205;
  mdio write $addr 0x16 0x1;
  mdio write $addr 0x4 0x60;
  mdio write $addr 0x16 0x4;
  mdio write $addr 27 0x7f83;
done
set ephyaddrs '3 0x13 0x11';
for addr in $eaddrs; 
do
  mdio write $addr 0x16 0x12;
  mdio write $addr 0x14 0x8207;
  mdio write $addr 0x16 0x3;
  mdio write $addr 0x10 0x1717;
done
set iphyaddrs '2 0x12 0x10'
set initiports 'for addr in $iphyaddrs;do  mdio write $addr 0x16 0x12;  mdio write $addr 0x14 0x8205;  mdio write $addr 0x16 0x1;  mdio write $addr 0x4 0x60;  mdio write $addr 0x16 0x4;  mdio write $addr 27 0x7f83;done'
set ephyaddrs '3 0x13 0x11'
set initeports 'for addr in $ephyaddrs; do  mdio write $addr 0x16 0x12;  mdio write $addr 0x14 0x8207;  mdio write $addr 0x16 0x3;  mdio write $addr 0x10 0x1717;done'
set initports 'run initiports;run initeports'

@changtimwu
Copy link
Author

  • copy webdist
  • update /etc/sysbase.cfg
hwmodel=DG-3C-R
hwaddr=E8:DE:D6:00:00:01

@changtimwu
Copy link
Author

update kernel under linux

flashcp -v /tmp/zImage /dev/mtd4

at bootloader. set bootimagesize to image length in hex

 set bootimagesize 2ec1d8
  • have /usr/sbin/writek.sh
#!/bin/sh
flashcp -v $1 /dev/mtd4
fsize=`wc -c $1 | awk '{print $1}'`
printf -v hexsize "%x" "$fsize"       
echo "remember set bootimagesize to $hexsize"

@changtimwu
Copy link
Author

devel mode

console=ttyS0,115200 debug

@changtimwu
Copy link
Author

  • got 1 with reddot
U-Boot SPL 2013.01.01 (Nov 03 2014 - 18:13:20)
BOARD : Altera SOCFPGA Cyclone V Board
SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SF: Read data capture delay calibrated to 3 (0 - 6)
SF: Detected MX66L51235L with page size 65536, total: 16777216


U-Boot 2013.01.01 (Nov 28 2014 - 13:54:23)

CPU   : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone V Board
DRAM:  1 GiB
MMC:   ALTERA DWMMC: 0
SF: Read data capture delay calibrated to 3 (0 - 6)
SF: Detected MX66L51235L with page size 65536, total: 67108864
In:    serial
Out:   serial
Err:   serial
Net:   mii0
Hit any key to stop autoboot:  0
SF: Detected MX66L51235L with page size 65536, total: 67108864
altera_load: Failed with error code -4
## Starting application at 0x3FF861BC ...
## Application terminated, rc = 0xA
fpgaintf
ffd08028: 00000000    ....
fpga2sdram
ffc25080: 00000000    ....
axibridge
ffd0501c: 00000000    ....
SF: Detected MX66L51235L with page size 65536, total: 67108864
Bad Linux ARM zImage magic!
SOCFPGA_CYCLONE5 #

I got newer from archiver2

U-Boot SPL 2013.01.01 (Apr 23 2015 - 09:20:36)
BOARD : Altera SOCFPGA Cyclone V Board
CLOCK: EOSC1 clock 25000 KHz
CLOCK: EOSC2 clock 25000 KHz
CLOCK: F2S_SDR_REF clock 0 KHz
CLOCK: F2S_PER_REF clock 0 KHz
CLOCK: MPU clock 925 MHz
CLOCK: DDR clock 400 MHz
CLOCK: UART clock 100000 KHz
CLOCK: MMC clock 50000 KHz
CLOCK: QSPI clock 370000 KHz
RESET: COLD
SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SDRAM: 1024 MiB
SDRAM: Scrubbing 0x01000000 - 0x02000000
SDRAM: Scrubbing success with 24 ms
SDRAM: Scrubbing 0x00000000 - 0x01000000
SDRAM: Scrubbing 0x02000000 - 0x40000000
SDRAM: ECC Enabled
ALTERA DWMMC: 0

U-Boot SPL 2013.01.01 (Mar 05 2015 - 11:10:37)
BOARD : Altera SOCFPGA Cyclone V Board
SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SF: Read data capture delay calibrated to 3 (0 - 6)
SF: Detected MX66L51235L with page size 65536, total: 16777216


U-Boot 2013.01.01 (Nov 28 2014 - 13:54:23)

CPU   : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone V Board
DRAM:  1 GiB
MMC:   ALTERA DWMMC: 0
SF: Read data capture delay calibrated to 3 (0 - 6)
SF: Detected MX66L51235L with page size 65536, total: 67108864
In:    serial
Out:   serial
Err:   serial
Net:   mii0
Hit any key to stop autoboot:  0
SF: Detected MX66L51235L with page size 65536, total: 67108864
altera_load: Failed with error code -4
## Starting application at 0x3FF861BC ...
## Application terminated, rc = 0xA
fpgaintf
ffd08028: 00000004    ....
fpga2sdram
ffc25080: 00000000    ....
axibridge
ffd0501c: 00000000    ....
SF: Detected MX66L51235L with page size 65536, total: 67108864
Bad Linux ARM zImage magic!

the message Bad Linux ARM zImage magic! is due to incorrect kernel image length

@changtimwu
Copy link
Author

partition images in archive2 look ok but the flash write script

timwu@timwu-vbox:/var/lib/tftpboot/altera/archive2$ more writeall.sh
#!/bin/sh
echo "writing preloader"
flashcp preloader-mkpimage.bin  /dev/mtd0
echo "writing ubootenv"
flashcp ubootenv.dat   /dev/mtd1
echo "writing DTD"
flashcp irx3303.dtb   /dev/mtd2
echo "writing uboot"
flashcp ubootok.bin   /dev/mtd3
echo "writing kernel"
flashcp zImage /dev/mtd4
echo "writing RBF"
flashcp frsrefc5.rbf /dev/mtd5
echo "writing File system"
flashcp fsmtd6.dat /dev/mtd6
sync;sync;sync
echo "done"

it's single partitioned.

root@cyclone5:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 04000000 00010000 "Partition_000"

find offset options of mtdrw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment