Fedora on ODROID-HC1 mini NAS (ARMv7)

Hardkernel is a Korean company that makes various embedded ARM based systems, which it calls ODROID.

One of their products is the ODROID-HC1, a mini NAS designed to take a single 2.5″ SATA drive (HC stands for “Home Cloud”) which comes with 2GB RAM and a Gigabit Ethernet port. There is also a 3.5″ model called the HC2. Both of these are based on the ODROID-XU4, which itself is based on the previous iteration ODROID-XU3. All of these are based on the Samsung Exynos5422 SOC and should work with the following steps.

The Exynos SOC needs proprietary first stage bootloaders which are embedded in the first 1.4MB or so at the beginning of the SD card in order to load U-Boot. As these binary blobs are not re-distributable, Fedora cannot support these devices out of the box, however all the other bits are available including the kernel, device tree and U-Boot. So, we just need to piece it all together and the result is a stock Fedora system!

To do this you’ll need the ODROID device, a power supply (5V/4A for HC1, 12V/2A for HC2), one of their UART adapters, an SD card (UHS-I) and probably a hard drive if you want to use it as a NAS (you may also want a battery for the RTC and a case).

ODROID-HC1 with UART, RTC battery, SD card and 2.5″ drive.

Note that the default Fedora 27 ARM image does not support the Realtek RTL8153 Ethernet adapter out of the box (it does after a kernel upgrade) so if you don’t have a USB Ethernet dongle handy we’ll download the kernel packages on our host, save them to the SD card and install them on first boot. The Fedora 28 image works out of the box, so if you’re installing 28 you can skip that step.

Download the Fedora Minimal ARM server image and save it in your home dir.

Install the Fedora ARM installer and U-Boot bootloader files for the device on your host PC.

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

Insert your SD card into your computer and note the device (mine is /dev/mmcblk0) using dmesg or df commands. Once you know that, open a terminal and let’s write the Fedora image to the SD card! Note that we are using none as the target because it’s not a supported board and we will configure the bootloader manually.

sudo fedora-arm-image-installer \
--target=none \
--image=Fedora-Minimal-armhfp-27-1.6-sda.raw.xz \
--resizefs \
--norootpass \
--media=/dev/mmcblk0

First things first, we need to enable the serial console, turn off cpuidle else it won’t boot, and fix a bug where USB doesn’t load in the right order. We do this by mounting the boot partition on the SD card and modifying the extlinux bootloader configuration.

sudo mount /dev/mmcblk0p2 /mnt
 
sudo sed -i "s|append|& cpuidle.off=1 \
console=tty1 console=ttySAC2,115200n8 \
rd.driver.pre=ledtrig-heartbeat,xhci-plat-hcd no_bL_switcher|" \
/mnt/extlinux/extlinux.conf

As mentioned, the kernel that comes with Fedora 27 image doesn’t support the Ethernet adapter, so if you don’t have a spare USB Ethernet dongle, let’s download the updates now. If you’re using Fedora 28 this is not necessary.

cd /mnt
 
sudo wget http://dl.fedoraproject.org/pub/fedora/linux/updates/27/armhfp/Packages/k/kernel-4.16.3-200.fc27.armv7hl.rpm \
http://dl.fedoraproject.org/pub/fedora/linux/updates/27/armhfp/Packages/k/kernel-core-4.16.3-200.fc27.armv7hl.rpm \
http://dl.fedoraproject.org/pub/fedora/linux/updates/27/armhfp/Packages/k/kernel-modules-4.16.3-200.fc27.armv7hl.rpm
 
cd ~/

Now continue with the process, unmount the boot partition.

sudo umount /mnt

Now, we can embed U-Boot and the required bootloaders into the SD card. To do this we need to download the files from Hardkernel along with their script which writes the blobs (note that we are downloading the files for the XU4, not HC1, as they are compatible). We will tell the script to use the U-Boot image we installed earlier, this way we are using Fedora’s U-Boot not the one from Hardkernel.

Download the required files from Hardkernel.

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

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

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

Finally, run the fusing script to embed the files onto the SD card, passing in the device for your SD card.
sudo ./sd_fusing.sh /dev/mmcblk0

That’s it! Remove your SD card and insert it into your ODROID, then plug the UART adapter into a USB port on your computer and connect to it with screen (check dmesg for the port number, generally ttyUSB0).

sudo screen /dev/ttyUSB0

Now power on your ODROID. If all goes well you should see the SOC initialise, load Fedora’s U-Boot and boot Fedora to the welcome setup screen. Complete this and then log in as root or your user you have just set up.

Welcome configuration screen for Fedora ARM.

If you’re running Fedora 27 image, install the kernel updates, remove the RPMs and reboot the device (skip this if you’re running Fedora 28).
sudo dnf install --disablerepo=* /boot/*rpm
 
sudo rm /boot/*rpm
 
sudo reboot

Fedora login over serial connection.

Once you have rebooted, the Ethernet adapter should work and you can do your regular updates

sudo dnf update

You can find your SATA drive at /dev/sda where you should be able to partition, format, mount it, share it and well, do whatever you want with the box.

You may wish to take note of the IP address and/or configure static networking so that you can SSH in once you unplug the UART.

Enjoy your native Fedora embedded ARM Mini NAS 🙂

25 thoughts on “Fedora on ODROID-HC1 mini NAS (ARMv7)

  1. Great tutorial!

    I also have a HC1 and use Fedora Server. I started with a setup similar to what you describe but then went ahead and moved the Fedora system over to the SSD. This works fine, but now I wonder if it is also possible to move /boot partition over to the SSD. Do you have any experience with this?

    I also noticed that grubby (?) is generating incorrect extlinux.conf entries when updated kernels are installed, for example I see “Ignoring unknown command: default=Fedora” on boot because there should be no equals sign behind default. I guess this is actually a Fedora bug?

  2. Hey Michael, I see those errors too, I just assume it wasn’t compatible with the version of U-Boot or something.. might look into that more later.

    As for /boot partition being on the SSD I’m not sure that will work as the SOC only boots off the SD or EMMC. The SSD is connected to a JMicron USB-SATA controller which has no U-Boot support, AFAIK. You could netboot it instead, probably, and skip the SD card, but then you’re reliant on the network. I think /boot on the SD card is probably as good as you’ll be able to get, unfortunately.

    Can I ask you a question now? I am having problems with stock Fedora 27 and 28 kernels not always detecting the SSD. Doesn’t seem to be related to cold, warm or hot boots. When it doesn’t work I get “bad usb cable” errors from the kernel.

    I compiled upstream 4.16 kernel and it works flawlessly every time. Have you noticed anything similar? Thanks!

  3. Nice tutorial!

    Does somebody know why only 4 cores will be used by fedora?
    Are there settings to activate all 8 cores?

  4. The tutorial is great, and thank you for writing it!

    I tried to follow with my HC2 and fedora 28 but it fails to boot with the error

    Retrieving file: /dtb-4.18.5-300.fc29.armv7hl/exynos5422-odroidunknown.dtb
    ** File not found /dtb-4.18.5-300.fc29.armv7hl/exynos5422-odroidunknown.dtb **
    Skipping Fedora-Server-armhfp-29_Beta-1.5 (4.18.5-300.fc29.armv7hl) for failure retrieving fdt
    SCRIPT FAILED: continuing…

    I was eventually able to fix this with running `sudo cp /mnt/exynos5422-odroidhc1.dtb /mnt/exynos5422-odroidunknown.dtb` while /dev/mmcblk0p2 was still mounted to /mnt.

    I hope this helps others trying to run the HC2

  5. It is easy to boot with rootfs on your sata drive. I did this with F29.

    Build your uSD card as above, but delete the rootfs partition, rather than grow it.

    Just run the installer script onto your sata drive (attached to your computer with a usb/sata adapter). Delete the boot partition and grow the rootfs partition (I am lazy and use gparted). Do not bother installing the bootloader or uboot on the sata drive.

    Insert the uSD card and sata drive and boot. This works because both media are created with dd so the uuids are the same.

    Simple.

    I am working on also running boot from the sata like I do on my Cubieboards (and some other Allwinner SOC), but so far I cannot get it to work. If anyone else has run with all partitions on the sata drive, please share what you did.

  6. How do I turn off the flashing blue LED?

    I tried removing ledtrig-heartbeat, from the append. This did not stop the LED from flashing away…

    That blue light is really annoying. Perhaps a solid blue might be OK, but flashing is too distraction.

    thanks

  7. Another item I learned…

    The Hardkernel bootloader and current uboot seem to be bigger than the 2048KB allot in the Fedora image.

    Delete the Raspberry Pi fw partition (partition #1) FIRST before installing the bootloader, or you may not be able to get it mounted on your workstation again. I have had problems with this.

    Also remember to remove the /boot/fw partition from /etc/fstab

  8. Just finished installing F29 on a HC2 everything worked as described here in the post with the addition of creating the exynos5422-odroidunknown.dtb file as mentioned by Derek. Many thanks!

  9. This post has been very helpful, and from it, I created a shell script that seems to automate most of the process for getting a microSD card installed with fedora and bootable on my ODROID-X4U

    While I can use this script to get my odroid bootable with fedora 30, and I can immediately ssh to it, something seems to go wrong after the first reboot, with the primary problem being that the eth0 adapter disappears.

    Any chance you might be able to shed some light on this?

  10. I haven’t noticed this, but I did have a unit which didn’t always detect the ethernet, I thought it was faulty because another one I had worked fine. If you power off the unit instead of reboot, does the ethernet come back? Do you have the serial cable you can see what’s going on or any errors?

  11. sudo fedora-arm-image-installer –target=none –image=Fedora-Minimal-armhfp-31-1.9-sda.raw.xz –resizefs –norootpass –relabel –media=/dev/mmcblk0 –args “append ro rd.driver.pre=ledtrig-heartbeat,xhci-plat-hcd cpuidle.off=1 no_bL_switcher console=tty1 console=ttySAC2,115200n8”

  12. sudo fedora-arm-image-installer –target=none –image=Fedora-Minimal-armhfp-31-1.9-sda.raw.xz –resizefs –norootpass –media=/dev/mmcblk0 –args ” rd.driver.pre=ledtrig-heartbeat,xhci-plat-hcd cpuidle.off=1 no_bL_switcher console=tty1 console=ttySAC2,115200n8″

  13. Thanks for this post, it helped me get fedora 31 installed on my odroid XU4. It mostly works well. I have noticed one small issue and wondered whether you encountered it and if so whether you found a work around. If I do a reboot using shutdown -r now then the network controller is not available, it does not show in lsusb or ifconfig. This does not happen if I do shutdown -h now and then power on with the power button, networking in this case works normally.

  14. I didn’t see that, only had issues with the SATA drive… sounds like a hardware fault or firmware bug. Hopefully someone else has had a similar problem and knows of a fix. Sorry! Good luck and please let us know if you find anything..

  15. I tried these steps to the T and it fails to boot. I never get the blue light. What am I doing wrong?

Leave a Reply

Your email address will not be published. Required fields are marked *