Odroid-C2
Introduction
The Odroid-C2 single board computer is now well supported by Alpine/Linux and the "Generic U-Boot (aarch64)" build contains everything we need !
What about the hardware side ?
- Odroid-C2
- Official PSU or just a micro-SD cable (notes : the barrel plug (inner(positive) diameter 0.8mm and outer(negative) diameter 2.5mm) is recommended, without the J1 jumper)
- micro-SD (or eMMC)
- Debug only : USB to TTL (official or CP2102 chipset or an old rpi)
Prepare the micro-SD card
With a blank SD card, we can now format-it using the vfat file system.
WARNING : DOUBLE-CHECK /dev/sda1 is indeed your SD card ! Or you'll loose all your data ! You have been warned !
For this, it's preferable to run dmesg -We to check for the name, for example:
[ +0,004725] ums-realtek 1-1:1.0: USB Mass Storage device detected [ +0,002985] scsi host0: usb-storage 1-1:1.0 [ +1,020024] scsi 0:0:0:0: Direct-Access Generic- SD/MMC/MS PRO 1.00 PQ: 0 ANSI: 4 [ +0,000591] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ +1,314707] sd 0:0:0:0: [sda] 15269888 512-byte logical blocks: (7.82 GB/7.28 GiB) [ +0,000352] sd 0:0:0:0: [sda] Write Protect is off [ +0,000008] sd 0:0:0:0: [sda] Mode Sense: 2f 00 00 00 [ +0,000408] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [ +0,062938] sda: sda1 [ +0,000238] sd 0:0:0:0: [sda] Attached SCSI removable disk
And also verify with fdisk -l
Disk /dev/sda: 7.28 GiB, 7818182656 bytes, 15269888 sectors Disk model: SD/MMC/MS PRO Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 15269887 15267840 7.3G b W95 FAT32
Now we are sure that /dev/sda is really our SD card device and we can format our SD card using mkfs.vfat /dev/sda1
Extract Alpine Linux
Then mount and extract the Alpine Linux archive, for example if you do everything as root:
mount /dev/sda1 /mnt/sd tar xvzfp /home/user/Downloads/alpine-uboot-3.23.2-aarch64.tar.gz -C /mnt/sd
Then, don't forget to flush changes before unmounting the device. Note that it can be a little slow depending of the speed of your device.
sync && umount /mnt/sd
Sign u-boot
We don't need to build u-boot from source as the version provided does autoboot properly:
git clone --depth 1 https://github.com/LibreELEC/amlogic-boot-fip.git
Copy the u-boot.bin from your sd card to the git repository, and sign Amlogic u-boot binaries:
cd amlogic-boot-fip/ /mnt/sd/u-boot/odroid-c2/u-boot.bin alpine.u-boot.bin ./build-fip.sh odroid-c2 alpine.u-boot.bin my-output-dir
u-boot flashing
WARNING : Make sure your device is /dev/sda !
Also, check that the device is un-mouted using umount /dev/sda1, then use dd to write u-boot
For example, using /dev/sda from previous commands and the signed u-boot (u-boot.bin.sd.bin) from amlogic-boot-fip tool.
dd if=./amlogic-boot-fip/my-output-dir/u-boot.bin.sd.bin of=/dev/sda conv=fsync,notrunc bs=512 skip=1 seek=1 dd if=./amlogic-boot-fip/my-output-dir/u-boot.bin.sd.bin of=/dev/sda conv=fsync,notrunc bs=1 count=444
Booting
Connect at least your USB keyboard and your HDMI monitor to check the boot and all should work nicely :) If not, check the Debugging part of this wiki.
Debugging
Connect your USB to TTL converter on your board : I noticed that you don't need to connect all wires, pin 1 don't seems to be is not mandatory at all.
_____UART____ |Pin 4 - GND| |Pin 3 - RXD| |Pin 2 - TXD| |Pin 1 - VCC| \___________|
All details are available on the odroid wiki : https://wiki.odroid.com/accessory/development/usb_uart_kit
I use minicom for this:
TERM=linux minicom -b 115200 -D /dev/ttyUSB0