Odroid-XU4

Installing Gentoo on an Odroid-XU4
This will be a step by step guide on getting a fully functional Gentoo distribution of GNU/Linux onto your Odroid-XU4. It will begin with assuming the user has done nothing to the XU4 and assuming that the XU4 has internet access to it. The guide will walkthrough how to install gentoo from another OS onto another partition, then configuring the bootloader(U-Boot) to boot off of that partition. This guide is based off of https://wiki.gentoo.org/wiki/Installation_alternatives#Installing_Gentoo_from_an_existing_Linux_distribution

Specific hardware needed: A sd-card to USB device.

Steps:

1) Put the sd-card into a sd-card-to-USB device and begin to partition it. If it is a fresh sd-card from hardkernel then there should be plenty of room to split the first partition in 2(my card is 16gb). My favorite way to do this is using Gparted.

2) Boot into the system currently installed onto the XU4, Ubuntu/Debian/other it doesn’t really matter(Does it work?). On the current OS of the XU4, mount the empty partition to /mnt (mine is mmcblk0p2, yours is whatever partition you made)

3) Get the stage3 tarball from www.gentoo.org, you will need the ARMv7a|HardFP and change the filename/date accordingly

4) Extract the tarball, we now have a root file system that we can start working with

5) Once extracted, go to the / directory then chroot into the partition

6) We need to get the portage snapshot, before we can do this we must set the date (emerge-webrsync didn’t work on my machine for some reason)

7) Before we do anything we must alter the make.config file, if we don’t compilations will take a long time on a single arm core. Be sure to add . Use flags are up to you, for the purpose of this guide I kept them as small as possible. Future experimentation would be switching -march=armv7-a to native, though that will cause problems for distcc, but that’s for another guide.

8) Before we compile a kernel we must update the system, note this will take a while(several hours, gcc takes about half of the time, be sure you have makeopts=”-j9”), be sure that the date was set correctly before running emerge:

9) Time to compile the kernel, unfortunately the official gentoo sources do not work for the odroid-xu4 SoC. If one tries to compile with gentoo-sources and configure the XU4 to boot, it will fail. If one tries to boot the XU4 with a non-gentoo kernel/different config, the system will boot however there will be problems(network interfaces not being detected for example). What needs to happen is one must git clone hardkernel’s official kernel and then compile it with any features one might want. There are 2 ways to do this, manual and automatically with genkernel. Below is how to do it with genkernel.

10) Modify boot loader to boot new kernel and filesystem

Below is my boot.ini, adjust the setenv zimage kernel line and setenv bootrootfs line ODROIDXU-UBOOT-CONFIG

11) Set a root password

12) Boot the new kernel and into the new Gentoo environment and that’s it! You should be able to boot without problem! Welcome to Gentoo on the Odroid-XU4 !

Extras)

Create a non-root user https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Finalizing

Networking hasn’t been declared yet, please verify the interfaces have been detected before the below commands are executed

Adding SSHD as a default service

If on a switch it’s necessary to declare a static ip

Since everything is being define manually, resolv.conf must have a nameserver in it

Start installing all necessary software that you need!

Fan/Temperature Control Gentoo puts all of the temperature monitors in the

folder. In order to change the fan settings you must modify the .dtb, these are located in:

One can modify the exynos5422-odroidxu4.dts easily, however notice that exynos5422-odroidxu3-common.dtsi is included, here is where one portion of the fan control:

Where 255 = 100%

To change the CPU states modify the exynos5422-cpu-thermal.dtsi file

The current guide uses the stock initrd, using genkernel to generate a new initrd has not been tested