Welcome! Log In Create A New Profile

Advanced

Debian on Ctera C200 V1 with STOCK bootloader

Posted by chkdsk88 
Debian on Ctera C200 V1 with STOCK bootloader
February 09, 2022 04:03PM
Ctera C200 V1 with bootloader replacement was described here: https://forum.doozan.com/read.php?2,128064

My post is only supplement for complete instruction created by bohdi. It shows how to install Debian on Ctera with original (locked) u-boot. This is solution for people, who want to stay with factory bootloader.

How to install: (example created for Debian-5.13.6-kirkwood-tld-1-rootfs-bodhi, for newer version please adjust numbers)

Steps different than regular procedure are bold.

Quote
bohdi (mostly)
Installation:

Installation can be done on any Linux box, with a fresh USB drive ( HDD would work fine too).

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. If you are running the latest U-Boot for Kirkwood then you can use Ext4. But be aware that Ext4 file system format needs to be "finalized" before it can be used for booting.

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.6-kirkwood-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 V1. 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=6329,filename=kirkwood-c200-v1.dtb,download=1 -O kirkwood-c200-v1.dtb


4. (Stock u-boot only) Create uImage with embedded DTB.

Generate the uImage with DTB embedded inside:
cd /media/sdb1/boot
cp -a zImage-5.13.6-kirkwood-tld-1  zImage.fdt
cat dts/kirkwood-c200-v1.dtb  >> zImage.fdt
mv uImage uImage.orig
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.13.6-kirkwood-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 -v1 -k uImage -i uInitrd -b "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10" -o Linux-5.13.6-kirkwood-tld-1.firm
cp Linux-5.13.6-kirkwood-tld-1.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.

5. Done.

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-5 below from main theard.


It is possible to upgrade kernel and initramfs:
Short example (for 5.15 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.15.5-kirkwood-tld-1-bodhi.tar.bz2
dpkg -i linux-image-5.15.5-kirkwood-tld-1_1.0_armel.deb
mv uImage uImage.orig
mv uInitrd uInitrd.orig
cp -a zImage-5.15.5-kirkwood-tld-1  zImage.fdt
cat dts/kirkwood-c200-v1.dtb  >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.15.5-kirkwood-tld-1 -d zImage.fdt  uImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-5.15.5-kirkwood-tld-1 -d initrd.img-5.15.5-kirkwood-tld-1 uInitrd
ctera-firmware -v1 -k uImage -i uInitrd -b "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10" -o Linux-5.15.5-kirkwood-tld-1.firm
ctera-flash -i Linux-5.15.5-kirkwood-tld-1.firm

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



Edited 1 time(s). Last edit at 02/09/2022 04:07PM by chkdsk88.
Re: Debian on Ctera C200 V1 with STOCK bootloader
February 09, 2022 04:20PM
chkdsk88,

Cool! Thank you for your contribution.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: