Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3247

Ctera C200 V2 (Armada 370) Installation & Kernel Upgrade (Linux-5.10.7) (3 replies)

$
0
0
My post is only supplement for complete instruction created by bohdi.

How to install: (example created for Debian-5.13.6-kirkwood-tld-1-rootfs-bodhi and linux-5.10.7-mvebu-370xp-tld-1-bodhi.tar.bz2, for newer version please adjust numbers)

Steps different than regular procedure are bold.
PLEASE REMEMBER TO USE mvebu-370xp SPECIAL KERNEL VERSION! For install and for update.

Quote
bohdi (mostly)
Installation:

Installation can be done on any Linux box, with a fresh HDD. Installation to USB stick is at this moment impossible!

Note: all steps below must be done while logging in as root user (not sudo). If you are not the root user then don't continue, because the rootfs will not work.

1. Format a new USB drive with a single Ext3 partition, and label it rootfs.

2. Mount the drive on a Linux box. cd to top level directory and extract it. It is assuming the USB drive is mounted at /media/sdb1
cd /media/sdb1 
tar -xjf Debian-5.13.8-mvebu-tld-1-rootfs-bodhi.tar.bz2

3. Adjust fstab (optional).

Edit /media/sdb1/etc/fstab entry for root device to match the rootfstype of your rootfstype if you use Ext4 or Ext2. However, you can keep it as is without problem in booting since the kernel will figure out which file system the rootfs was formatted.

LABEL=rootfs    /               ext3    noatime,errors=remount-ro 0 1

3.5. Download tools, which I prepared for Ctera devices: ctera-firmware and ctera-flash. First is used for firm file creation, second will be used for install firm file from running Debian. Links:

https://raw.githubusercontent.com/CHKDSK88/various-tools/main/ctera-firmware/ctera-firmware
https://raw.githubusercontent.com/CHKDSK88/various-tools/main/ctera-firmware/ctera-flash

Please put in on created rootfs, in usr/local/bin/ forder:

cd /media/sda1/usr/local/bin/
wget https://raw.githubusercontent.com/CHKDSK88/various-tools/main/ctera-firmware/ctera-firmware
wget https://raw.githubusercontent.com/CHKDSK88/various-tools/main/ctera-firmware/ctera-flash
chmod +x ctera-*

3.75. Download dtb file for Ctera C200 V2. You compile it from patch sent upstream or download from forum:
Link

cd /media/sdb1/boot/dts
wget https://forum.doozan.com/file.php?2,file=6499,filename=armada-370-c200-v2.dtb,download=1 -O armada-370-c200-v2.dtb


4. Create uImage with embedded DTB.

Generate the uImage with DTB embedded inside:
cd /media/sdb1/boot
tar -xjf linux-5.10.7-mvebu-370xp-tld-1-bodhi.tar.bz2
cp -a zImage-5.10.7-mvebu-370xp-tld-1 zImage.fdt
cat dts/armada-370-c200-v2.dtb  >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.10.7-mvebu-370xp-tld-1 -d zImage.fdt uImage
sync


If your Linux box does not have mkimage, then install it

apt-get install u-boot-tools

4.5 Prepare firm file for factory software flashing and copy it to linux box (e.g to tmp):

cd /media/sdb1/boot
../usr/local/bin/ctera-firmware -v2 -k uImage -i uInitrd -b "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10" -o Linux-5.10.7-mvebu-370xp-tld-1-install.firm
cp Linux-5.10.7-mvebu-370xp-tld-1-install.firm /tmp/

The only way to change bootargs delivered from stock u-boot is to configure it in image. You can adjust it by change "-b" parameter.

4.7 OPTIONAL (NON FREE FIRMWARE FILE) For (future) proper usb 3.0 controller work please download firmware file:

cd /media/sdb1/lib
mkdir firmware
cd firmware
wget https://github.com/denisandroid/uPD72020x-Firmware/raw/master/UPDATE.mem -o renesas_usb_fw.mem

5. Done. Please install kernel and initramfs in the same way like upgrade.

Take this USB rootfs to your Ctera and cold start. Login to factory web-gui and install firm file saved in /tmp/ folder of your linux box. After booted into Debian, see Note 1-6 below from main theard.

Some infos:

A. At this moment is impossible to use usb 3.0 controller because xhci is built-in and CONFIG_USB_XHCI_PCI_RENESAS is not set. I will update manual if, it will be possible.

B. For proper mac configuration please update script from `/root/set_persistent_mac_address`:

#!/bin/bash
#
# set_persistent_mac_address
#
# Compare the MAC address in ifconfig with u-boot env ethaddr (persistent MAC for eth0) and reconfig MAC address  to ethaddr if necessary.
#
UBOOT_MACADDR=`cat /dev/mtd3 | grep mac  |  cut -c5-21`

if [ "$UBOOT_MACADDR" == "" ]; then
        logger -s -i "Cannot read u-boot env ethaddr"
        exit 0
fi

MY_MACADDR=`x=$(ifconfig eth0) && x=${x#*ether } && echo ${x%% *}`

if [ "${UBOOT_MACADDR^^}" == "${MY_MACADDR^^}" ]; then
        logger -s -i  "Persistent MAC address already set "$UBOOT_MACADDR
        exit 0
fi

echo "Setting Persistent MAC address to "$UBOOT_MACADDR > /dev/kmsg
/usr/bin/logger -s -i "Setting Persistent MAC address to "$UBOOT_MACADDR

ifdown eth0
ifconfig -v eth0 hw ether $UBOOT_MACADDR
ifup eth0

exit 0

C. To proper LED work add following code before 'exit 0' in /etc/rc.local :
DEVICE=$(tr -d '\0' < /sys/firmware/devicetree/base/compatible)

# Ctera C200-V2
if echo "$DEVICE" | grep -q "c200-v2"; then
        echo default-on >  /sys/class/leds/green\:status/trigger
        echo none >  /sys/class/leds/red\:status/trigger
        echo ide-disk1 > /sys/class/leds/green\:disk-1/trigger
        echo ide-disk2 > /sys/class/leds/green\:disk-2/trigger
fi

D. It is possible to upgrade kernel and initramfs:
Short example (for 5.10 kernel):

1. Prepare: Download tar.bz archive with bohdi linux upgrade and put it into boot folder.

2. Instalation:
cd /boot/
tar -xjf linux-5.10.7-mvebu-370xp-tld-1-bodhi.tar.bz2
dpkg -i linux-image-5.10.7-mvebu-370xp-tld-1_1.0_armhf.deb
mv uImage uImage.orig
mv uInitrd uInitrd.orig
cp -a zImage-5.10.7-mvebu-370xp-tld-1  zImage.fdt
cat dts/armada-370-c200-v2.dtb  >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.10.7-mvebu-370xp-tld-1 -d zImage.fdt uImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-5.10.7-mvebu-370xp-tld-1 -d initrd.img-5.10.7-mvebu-370xp-tld-1 uInitrd
ctera-firmware -v2 -k uImage -i uInitrd -b "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10" -o Linux-5.10.7-mvebu-370xp-tld-1.firm
ctera-flash -i Linux-5.10.7-mvebu-370xp-tld-1.firm

Two last commands prepare and flash new ctera image. It was installed in step 3.5 of installation.

Viewing all articles
Browse latest Browse all 3247

Trending Articles