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.

Partitioning
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.

Boot the current distro
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)

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

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

Copy X11 configuration files
Just in case...

chroot to the new environment
Once extracted, go to the / directory then chroot into the partition

Get a portage snapshot
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)

Set up make.config
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.

Update the system
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=”-j3”, as bigger values tend to saturate memory), be sure that the date was set correctly before running emerge:

Build the kernel
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.

For future updates on the git tree:

Set up the boot loader
Modify boot loader to boot new kernel and filesystem

Below is the original boot.ini from the latest Ubuntu image, adjust the line with

to

Reboot
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 !

X11
Willing for a graphical environment, X11 is a classical - although there is a pretty interesting article in a recent Odroid Magazine about Wayland - so there is the need for the specific driver. Emerge layman and add the hossie overlay:

Emerge the exynos armsoc X11 driver:

Emerge all xorg/X11 stuff according to the usual Gentoo_Handbook at https://wiki.gentoo.org/wiki/Handbook:Main_Page

The original Ubuntu image has a "xorg.conf" configuration file and "xorg.conf.d" directory for extra configurations in /etc/X11, that has already both been copied to Gentoo in an earlier step. Then, it should be possible to get a graphical desktop like fluxbox or WindowMaker, for instance.

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

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

SSH for remote access
Adding SSHD as a default service

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

Name server
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