CentOS Userland armv7hl on the ODROID-HC2

Table of Contents

The following post is heavily based on Fedora on the ODROID-HC2

It is is about installing CentOS Userland armv7hl on an ODROID-HC2 (from a Fedora 31 x86_64 workstation).

The aim is to get the ODROID in a state where one can ssh as root to the host.

Both initial setup over serial and installing without using a serial console are described.

Ansible and further uses will be described in separate posts.

Note on Other OS Images

Images for the ODROID-XU4 are fully compatible with the HC2 (source: manual from Pollin, the German shop I bought mine from). So you are definitely not limited to running Fedora on the ODROID-HC2 Single Board Computer (SBC).

NOTE

These are not the official install steps, those are here and you should read them!

Overview of Steps

  1. install needed software
  2. obtain CentOS Userland for armv7hl
  3. write CentOS Userland image with fedora-arm-image-installer
  4. FIXME fuse signed blobs from ODROID into SD card
  5. FIXME symlink for uboot
  6. boot ODROD-HC2 from prepared card

Install Needed Software

On your workstation

sudo dnf install arm-image-installer uboot-images-armv7

I used

  • arm-image-installer-2.13-2.fc31.noarch
  • uboot-images-armv7-2019.10-2.fc31.noarch

Download Fedora for ARMv7

Get the armhfp image CentOS-Userland-7-armv7hl-generic-Minimal-1908-sda.raw.xz I chose the generic Minimal version (and it’s checksum file) since I plan to add what’s missing with Ansible.

Verify the file with

On your workstation

sha256sum -c sha256sum.txt

Write CentOS7 Image to µSD card

Attach a µSD card to your workstation and check with lsblk what the name is. In the following examples I’ll be using /dev/sdi.

Change to the directory where you downloaded the Minimal image for ARM Servers.

Obviously adjust the path to your ssh pubkey.

Also I immediately inject my ssh key. For initial bringup, I’ll be using --norootpass.

On your workstation

sudo fedora-arm-image-installer \
  --target=none \
  --image=CentOS-Userland-7-armv7hl-generic-Minimal-1908-sda.raw.xz \
  --addkey=/home/pcfe/.ssh/id_USBkey.pub \
  --norootpass \
  --resizefs \
  --args "console=ttySAC2,115200n8 cpuidle.off=1 rd.driver.pre=ledtrig-heartbeat,xhci-plat-hcd no_bL_switcher" \
  --media=/dev/sdi

FIXME: resizefs resized the partition but not the filesystem!

If you use --resizefs, the whole remaining space on your µSD card should be used to grow /. Alternatively you can drop that parameter and comfortably resize partition 3 on the card on your linux workstation with gnome-disks. Remember to re-plug the card if told to do so by a script.

[root@odroid-hc2-00 ~]# /usr/bin/rootfs-expand                                                                    [1/1]
/dev/mmcblk1p4 /dev/mmcblk1 4
Extending partition 4 to max size ....
NOCHANGE: partition 4 could only be grown by -33 [fudge=2048]
Resizing ext4 filesystem ...
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mmcblk1p4 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/mmcblk1p4 is now 7487616 blocks long.

Done.
/dev/mmcblk1p4   29G  1.3G   27G   5% /

Comments on the Used kernel cmdline Parameters

FIXME, these all need verifying.

Fuse SD card

Why this is needed is well explained in the following two

Preparation; download signed blobs and tool

A big thank you to Chris for this blogpost. That gives straightforward commands one can copypasta.

Download the required files from Hardkernel.

On your workstation

mkdir hardkernel ; cd hardkernel

wget https://raw.githubusercontent.com/hardkernel/u-boot/odroidxu4-v2017.05/sd_fuse/sd_fusing.sh \
https://raw.githubusercontent.com/hardkernel/u-boot/odroidxu4-v2017.05/sd_fuse/bl1.bin.hardkernel \
https://raw.githubusercontent.com/hardkernel/u-boot/odroidxu4-v2017.05/sd_fuse/bl2.bin.hardkernel.720k_uboot \
https://raw.githubusercontent.com/hardkernel/u-boot/odroidxu4-v2017.05/sd_fuse/tzsw.bin.hardkernel

chmod a+x sd_fusing.sh

Use U-Boot files provided by Fedora (since they are more modern)

Copy the Fedora U-Boot files into the local dir.

On your workstation

cp /usr/share/uboot/odroid-xu3/u-boot.bin .

Fuse your SD card

Finally, run the fusing script to embed the files onto the SD card, passing in the device for your SD card.

On your workstation

sudo ./sd_fusing.sh /dev/sdi

Again, be sure to write to the correct device (my setup uses /dev/sdi)

It should end with

[...]
U-boot image is fused successfully.
Eject /dev/sdi and insert it again.

Do as instructed, re-plug the µSD card.

Mount partition 3 of the card (/), for the next steps.

FIXME: odd, this is fixed in Fedora

FIXME: as root on your Workstation:

pushd /run/media/pcfe/__boot/dtb-4.19.72-300.el7.armv7hl/
ln -s exynos5422-odroidxu4.dtb exynos5422-odroid.dtb
popd

Fix for heartbeat LED

FIXME: double check if this f29 adjustment works on el7.

When Dracut makes the initramfs, it must find instructions to load ledtrig-heartbeat, in addition to the rd.driver.pre=ledtrig-heartbeat

Create the file while you have / mounted anyway

On your workstation, as root

cat <<EOF >/run/media/pcfe/__/etc/dracut.conf.d/ledtrig-heartbeat.conf
add_drivers+=" ledtrig-heartbeat "
EOF

Do not forget to umount the card

unmount all partitions from the µSD card, remove from your workstation, insert into ODROID. Do not apply power yet.

Boot

Transfer card to ODROID-HC2 (not powered, all LEDs off) and apply power to boot.

Expect it to

  1. grab an IP via DHCP
  2. respond to ping after less than a minute
  3. respond to ssh -v root@<IP> after less than two minutes

If these do not happen you will want to connect a serial console.

Enable heartbeat LED for kernel from image

Either re-do the initramfs once your ODROID has booted or just wait for dracut to automatically trigger on a kernel update.

On the ODROID, as root

dracut --force --verbose

On next reboot your heartbeat LED should be working.

You can enable it for the current boot by loading the module.

modprobe ledtrig-heartbeat

To Fix

FIXME: grub uses rhgb and quiet, remove those

[root@odroid-hc2-00 ~]# vim /boot/extlinux/extlinux.conf

Enable EPEL

Proceed as per https://wiki.centos.org/SpecialInterestGroup/AltArch/armhfp

All done

You should now be able to log in via ssh to your ODROID-HC2 running CentOS 7 Userland for armv7hl.

Patrick C. F. Ernzer avatar
Patrick C. F. Ernzer