Armbian (EOS) - Make it boot

Post Reply
joerg
Posts: 942
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 13 times
Been thanked: 39 times
Contact:

Armbian (EOS) - Make it boot

Unread post by joerg » Fri Feb 21, 2020 3:58 am

***DISCLAIMER***
The text below is intellectual property. Odroid Magazine editors, you must not copy this text into magazine without explicit permission of OP. Respect it.

Since on Armbian the support for Odroid C1 was dropped, I was not able to boot a nightly build.
There are still nightly builds. You can download, extract and flash it, eg.:

Code: Select all

wget https://dl.armbian.com/odroidc1/nightly/Armbian_20.05.0-trunk.034_Odroidc1_bionic_current_5.4.17_minimal.7z
7za x Armbian_20.05.0-trunk.034_Odroidc1_bionic_current_5.4.17_minimal.7z
sudo dd if=Armbian_20.05.0-trunk.034_Odroidc1_bionic_current_5.4.17_minimal.img of=/dev/sdg bs=32M
Here is how I made it boot.
Armbian doesn't ship the uImage, instead it ships a zImage. Stock U-Boot can't boot zImage, convert it to uImage:
(You are still on your host pc and the flashed sdcard is mounted!)
-Open a shell in /boot of sdcard

Code: Select all

sudo mkimage -A arm -O linux -T kernel -C none -a 0x00208000 -e 0x00208000 -n "Linux kernel" -d zImage uImage
-When you boot with this, you still will get an error:

Code: Select all

bootm 0x21000000 0x22000000 0x21800000
## Booting kernel from Legacy Image at 21000000 ...
   Image Name:   Linux kernel
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8405504 Bytes = 8 MiB
   Load Address: 00208000
   Entry Point:  00208000
   Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
-The only thing that is wrong with your kernel image, it is to big (8405504).
-Change boot.ini

Code: Select all

ext4load mmc 0:1 0x21800000 /boot/dtb/meson8b-odroidc1.dtb
fdt addr 21800000

if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi
if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi

bootm 0x21000000 0x22000000 0x21800000
to

Code: Select all

ext4load mmc 0:1 0x21A00000 /boot/dtb/meson8b-odroidc1.dtb
fdt addr 21A00000

if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi
if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi

bootm 0x21000000 0x22000000 0x21A00000
-The loading address of 0x21A00000 for dtb makes place for bigger kernel image (>8M).

Now your C1 should boot.

But...
you will find very poor ethernet transfer rates!

Code: Select all

joerg@odroidc1-test2:~$ iperf3 -c 192.168.1.18
Connecting to host 192.168.1.18, port 5201
[  4] local 192.168.1.62 port 60322 connected to 192.168.1.18 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  27.0 MBytes   227 Mbits/sec  183   19.8 KBytes       
[  4]   1.00-2.00   sec  26.4 MBytes   221 Mbits/sec  176   12.7 KBytes       
[  4]   2.00-3.04   sec  15.7 MBytes   126 Mbits/sec   97   19.8 KBytes       
[  4]   3.04-4.00   sec  26.3 MBytes   230 Mbits/sec  178   35.4 KBytes       
[  4]   4.00-5.05   sec  10.7 MBytes  85.1 Mbits/sec   57   15.6 KBytes       
[  4]   5.05-6.00   sec  29.1 MBytes   258 Mbits/sec  209   17.0 KBytes       
[  4]   6.00-7.00   sec  30.4 MBytes   255 Mbits/sec  208   14.1 KBytes       
[  4]   7.00-8.00   sec  32.8 MBytes   275 Mbits/sec  219   18.4 KBytes       
[  4]   8.00-9.00   sec  31.9 MBytes   268 Mbits/sec  245   22.6 KBytes       
[  4]   9.00-10.00  sec  29.8 MBytes   250 Mbits/sec  200   15.6 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   260 MBytes   218 Mbits/sec  1772             sender
[  4]   0.00-10.00  sec   259 MBytes   218 Mbits/sec                  receiver
-This is an Odroid C1+, on an Odroid C1 the transfer rates have been worse!
-I found on the linux mailing lists, that short time ago some patches were applied and also that tx-delay-ns of ethmac should be 2ns, not 4ns.
-With a newer kernel (5.5.5) and patched meson8b_odroidc1.dts, I get now:

Code: Select all

iperf3 -c 192.168.1.18
Connecting to host 192.168.1.18, port 5201
[  4] local 192.168.1.62 port 36668 connected to 192.168.1.18 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.12   sec  96.1 MBytes   722 Mbits/sec    0    499 KBytes       
[  4]   1.12-2.00   sec  61.9 MBytes   587 Mbits/sec    0    619 KBytes       
[  4]   2.00-3.00   sec   111 MBytes   932 Mbits/sec    0    648 KBytes       
[  4]   3.00-4.00   sec   111 MBytes   932 Mbits/sec   45    745 KBytes       
[  4]   4.00-5.00   sec   110 MBytes   925 Mbits/sec    0    745 KBytes       
[  4]   5.00-6.00   sec   111 MBytes   931 Mbits/sec    0    745 KBytes       
[  4]   6.00-7.01   sec   111 MBytes   930 Mbits/sec    0    745 KBytes       
[  4]   7.01-8.00   sec   111 MBytes   932 Mbits/sec    0    745 KBytes       
[  4]   8.00-9.01   sec  70.7 MBytes   590 Mbits/sec    0    745 KBytes       
[  4]   9.01-10.00  sec   111 MBytes   934 Mbits/sec    0    745 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  1005 MBytes   843 Mbits/sec   45             sender
[  4]   0.00-10.00  sec  1003 MBytes   841 Mbits/sec                  receiver
You can see my other thread of how to compile the mainline kernel:
viewtopic.php?f=114&t=35474#p260341

You can compile your own Armbian! Even on not supported OS!
-The basic steps are well documented on Armbian website.
-Here you see that I edited the general.sh, where it checks the OS I added 'sonya'

Code: Select all

if [[ -z $codename || "xenial bionic eoan focal sonya" != *"$codename"* ]]; then
-I had to install some libraries and to configure:

Code: Select all

 sudo apt-get install aria2 
 sudo apt-get install debootstrap
 sudo apt-get install qemu-user-static
 sudo update-binfmts --enable qemu-arm
-There might be more to install on your distribution!
-I had to download some toolchains and to extract them:

Code: Select all

 cd cache/toolchains
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi.tar.xz 
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-5.5.0-2017.10-x86_64_aarch64-linux-gnu.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-6.4.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-7.4.1-2019.02-x86_64_arm-eabi.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz
 sudo wget https://dl.armbian.com/_toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
-In every toolchainfolder must be created an empty file: .download-complete.
-Also the root-fs must be downloaded:

Code: Select all

cd cache/rootfs
sudo wget https://dl.armbian.com/_rootfs/bionic-minimal-armhf.9a469cbd29aedadc981d1a9a8f5746e9.tar.lz4
-Which file exactly, you will see, if go through the ./compile.sh. An error message will point to it:

Code: Select all

[ warn ] Failed to download control file 
[ .... ] downloading using torrent network [ bionic-minimal-armhf.9a469cbd29aedadc981d1a9a8f5746e9.tar.lz4 ]
-You don't need to extract it, but to create a folder with same name and place a .download-complete in it.
-The compilation should run now without error.
-You will get an image file, return to top to flash and to make it boot.

-Right now it compiles kernel 5.4.21. There should be included all new ethmac patches.
-For correction of tx_delay-ns, you can insert an user patch into Armbian, at userpatches/kernel/meson-current as 001-tx_delay.patch :

Code: Select all

diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
index bc9f11b..69141c8 100644
--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
+++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
@@ -208,7 +208,7 @@
 
 	phy-mode = "rgmii";
 	phy-handle = <&eth_phy>;
-	amlogic,tx-delay-ns = <4>;
+	amlogic,tx-delay-ns = <2>;
 
 	nvmem-cells = <&ethernet_mac_address>;
 	nvmem-cell-names = "mac-address";
These users thanked the author joerg for the post:
igorpec (Fri Feb 21, 2020 5:01 am)

User avatar
odroid
Site Admin
Posts: 33698
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 515 times
Been thanked: 507 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by odroid » Fri Feb 21, 2020 10:58 am

Very nice tutorial.

In fact, I've designed a small embedded Linux board with Kicad by myself as a weekend hobby from the last October.
The CPU is an old and poor Allwinner S3 which has only 128MiB DDR3 internally (SiP).
I spent over several weekends to learn the PCB design skill with the KiCad and it was very fun.

I ordered a few PCB(4-layers) samples to JLCPCB (very cheap sample pcb fab in China) and soldered a couple of samples manually in early January.
I've used BuildRoot to test the board functionality(bring-up) and finally I could run Kernel 5.5 + Qt 5.12 nicely last weekend after fixing some hw/sw bugs.

But I wanted to run a minimal/trial Focal Ubuntu image for easier and quick development for a while since the Buildroot requires a full clean build (it needed ~2 hours at least) from time to time.
After various tests with Ubuntu, I'll go back to the Buildroot which gave me 2~3 seconds of super fast booting speed.
So I had a plan to build my own Armbian based focal image for my private hobby and your detail instruction seems to be very good starting point.

I have a couple of questions.
Did you really need to install around 15 different cross toolchains into your host computer?
How long did you take to build a bootable image? My home PC has an AMD 2700x CPU with 16GB RAM.
Should I post my questions on Armbian forum? ;)

joerg
Posts: 942
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 13 times
Been thanked: 39 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by joerg » Fri Feb 21, 2020 2:15 pm

No, you don't need to download all toolchains. But during compilation it checks if they are downloaded and uses at the end the newest version. So it may be enough to have the folder and the .download-complete. I havn't tried this.
My host pc has a ryzen7 1700 8 core cpu with 16GB ram. I takes < 1 hour to build. But note, it does not compile the rootfs, this is downloaded precompiled.
When I'm back home I can measure the time.

BTW, very interesting your project. I myself have made only small projects with KiCad. And how do you managed to solder the cpu?

User avatar
odroid
Site Admin
Posts: 33698
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 515 times
Been thanked: 507 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by odroid » Fri Feb 21, 2020 2:56 pm

Understood. I need to make all the folders and create ".download-complete" files.
One hour of building time is much shorter than my expectation. :o
It seems to be a compositing of pre-built packages with minimum compiling.
Anyway I will try it on Sunday.

I could solder the BGA type CPU with this low cost soldering station.
https://www.aliexpress.com/item/32796500232.html
But only 3 of 5 boards were working fine because I had no experience of BGA soldering.
My skill was getting better and my target yield rate is over 80% in the next time. :D

joerg
Posts: 942
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 13 times
Been thanked: 39 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by joerg » Fri Feb 21, 2020 11:36 pm

Ok, it's much faster than 1h :

Code: Select all

[ o.k. ] Writing U-boot bootloader [ /dev/loop0 ]
[ .... ] Fingerprinting 
[ o.k. ] Done building [ /home/joerg/Development/odroid_c1/armbian/build/output/images/Armbian_19.11.9_Odroidc1_bionic_current_5.4.21_minimal.img ]
[ o.k. ] Runtime [ 15 min ]
[ o.k. ] Repeat Build Options [ ./compile.sh  BOARD=odroidc1 BRANCH=current RELEASE=bionic BUILD_MINIMAL=yes BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no  ]

real	16m3.652s
user	16m53.712s
sys	2m41.802s

User avatar
odroid
Site Admin
Posts: 33698
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 515 times
Been thanked: 507 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by odroid » Mon Feb 24, 2020 10:22 am

Thanks,
I could make it within 20 minutes too. :)

joerg
Posts: 942
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 13 times
Been thanked: 39 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by joerg » Mon Mar 02, 2020 3:38 am

Now, after testing a little bit, i must say it is very experimental.
I can't use usb devices as my Edimax EW7811 (RTL8192cu) or an usb sound card. The systems becomes immediately unresponsive and I have to power cycle.
This happens when I start speaker test for the sound device or the same happens when the kernel module for the usb wifi stick is loaded. I tried the rtl8xxxu and also the rtl8192cu.

Code: Select all

[  378.897727] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm systemd-udevd: reading directory lblock 0
[  378.905715] EXT4-fs (mmcblk0p1): Remounting filesystem read-only
[  378.916209] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #1017: comm systemd-udevd: reading directory lblock 0
[  378.925414] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #3815: comm systemd-udevd: reading directory lblock 0
[  378.937072] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #3815: comm systemd-udevd: reading directory lblock 0
[  378.948425] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm systemd-udevd: reading directory lblock 0
[  378.960247] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm systemd-udevd: reading directory lblock 0
[  378.972262] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #3805: comm systemd-udevd: reading directory lblock 0
[  378.983006] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #3805: comm systemd-udevd: reading directory lblock 0
[  378.991269] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm cron: reading directory lblock 0
[  379.005939] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm cron: reading directory lblock 0
[  384.013565] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm gmain: reading directory lblock 0
[  388.012353] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm gmain: reading directory lblock 0
[  392.012230] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm gmain: reading directory lblock 0
[  396.012853] EXT4-fs error (device mmcblk0p1): __ext4_find_entry:1532: inode #8067: comm gmain: reading directory lblock 0
Anyway, to get the usb hub working I had to remove the gpio hog entry in the device tree. This usb hub reset function is setting the gpio high to early in the boot process, right before the usb core is initialized. I don't see a way to include this reset function in to the usb drivers as this need of usb hub reset is very specific to the C1. So I compiled the libgpiod 1.4.1 (1.4.2 and 1.5 do have compile errors) to set this gpio from user land.

Code: Select all

#!/bin/bash
gpioset gpiochip1 4=0
sleep 1
gpioset gpiochip1 4=1
The usb dongle must be connected at this time. Hotplug is not working and I don't see that ever will be working
These users thanked the author joerg for the post:
odroid (Mon Mar 02, 2020 9:45 am)

joerg
Posts: 942
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 13 times
Been thanked: 39 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by joerg » Wed Mar 04, 2020 12:38 am

Someone here who can try this?
I wonder what has changed between now and the kernel I used to write the thread viewtopic.php?f=114&t=35474#p260341 last year. I remember that I also to had to write a reset script to make the usb hub recognized from the system. But then I could use a bluetooth dongle and also my Behringer UCA222. They had to be plugged in at the moment of reset.
Now I tried again the Behringer, and after about 20sec with speaker-test, there is a flood of EXT4-fs errors. I have to power cycle.

User avatar
odroid
Site Admin
Posts: 33698
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 515 times
Been thanked: 507 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by odroid » Wed Mar 04, 2020 10:51 am

Do you use an eMMC? or SD card?
I think you might need to lower the SD/eMMC clock frequency just in case.

joerg
Posts: 942
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 13 times
Been thanked: 39 times
Contact:

Re: Armbian (EOS) - Make it boot

Unread post by joerg » Thu Mar 05, 2020 1:09 am

I don't know where to find this. If someone could point me to the right direction?

Post Reply

Return to “Other OS”

Who is online

Users browsing this forum: No registered users and 4 guests