The Odroid XU4 with a new OS

Figure: The Odroid XU4 compiling and surfing at the same time

Here is a short video of my Odroid XU4 “desktop” – a sort of light desktop which is surprisingly quick for its power draw. In the video it’s seen to be running Firefox with only a little lag, while simultaneously compiling (firefox itself) – on seven cores. Note the old hub below the Odroid, much bigger AND much older than the diminutive SoC/SBC. I purchased the hub in 1992 and it’s still working fine, albeit at 10 mb/s (LOL).

OK, so I’d really like to run FreeBSD on the XU4.  That would make my day today, and probably tomorrow too!  Alas, there’re still working on it (I hear, at NetBSD, which I could tolerate).  In the meantime I didn’t want a heavy distribution, but instead something light and airy.

So, in the short term I knew it was going to be Linux, and I ended up selecting Gentoo for the job. The youtube video (shown above) is showing the XU4 with Gentoo. It’s a distro that requires, pretty much, a total build from scratch on the XU4.  I spend so much time on the BSD side of the *nix/*nux world, such that my Linux experiences are the lesser tale. Fortunately, the kernel build is very well documented on the Gentoo wiki, and the whole operation was pretty much a snap:

There were some issues to work out, but most of those were later on, when I wanted to add a WiFi dongle (successfully done BTW).   I’m not going to reiterate the details of the Wiki, except to add that the kernel can be built two different ways: 1) via the traditional Linux kernel build procedure, or 2) by using the genkernel utility.  The Wiki alludes to the two different means to the desired end, but (as far as I can tell) has left out the emerges necessary to use genkernel, and a couple other packages:

  • emerge -a sys-devel/bc
  • emerge -a u-boot-tools
  • emerge -a sys-kernel/genkernel
  • emerge -a gentoolkit

Basically, the Wiki describes a method of building the XU4 image that relies on a piggy-back of an existing XU4 capable Linux uSD, that is booted and running. It shouldn’t matter too much which distro is chosen to be the piggybacked (bootstrapping) OS. I just used the one I happened to be running.  Theoretically, you take a 16GB uSD, and divide it up so that it has three partitions:

  • Boot partition (partition 1: FAT)
  • Piggy-backed OS (partition 2: ext4)
  • Piggy-back to-be-Gentoo (partition 3: ext4)

After the procedure (described in the Wiki), you have a new Gentoo user-land in partition 3, and a new kernel in the boot directory.  At that point, one can delete everything in the second partition (the piggybacked OS) – as it’s no longer needed.  After the conversion, I used partition number two as a “packages and storage” partition, but the whole uSD could be rearranged to make for a cleaner image.

The Wiki does not mention the details about the use of emerge *very* much (I guess they figure you can discover that information on another Wiki entry or by looking at the regular docs).  Emerge is the package manager for Gentoo, but it really deals primarily with “source packages” – as opposed to (for instance) FreeBSD’s pkg package manager.  You can build binaries on Gentoo, but you use the “quickpkg” utility for that.

Emerge works with the ACCEPT_KEYWORDS=”” and USE=”” variables, which are prefixed to the command line, put into /etc/portage/make.conf (or any of a number of other files), or configured on the fly with a special emerge command line option.  For the Odroid XU4 compilations, you could use something like this (as a for-instance):

ACCEPT_KEYWORDS=”~arm” USE=”pulseaudio” emerge -1 firefox

The keywords and use strings can be put into /etc/portage/make.conf to save typing.  If there are any missing keywords or use entries, emerge will tell you about it.  In such a case, one can add the entries automatically with a couple additional commands:

ACCEPT_KEYWORDS="~arm" USE="somedependency1 somedependency2" emerge --autounmask-write packagetobuild

AFAIK, the autounmask-write option writes the change list to a queue, and the dispatch-conf command lists the changes, and accepts (U) use, or (Z) zap, or (M) merge, etc. This is my understanding ATM.  Of course one should not blindly accept the suggested items, but should instead think about whether or not they’re reasonable choices. Don’t count me as an expert on emerge, as the XU4 build that’s the topic of this post represents the first time I’ve ever touched Gentoo. BTW, emerge is a part of the overall package/port building machinery for Gentoo, all referenced under the umbrella term “portage.”

After the dispatch-conf util has been successfully executed and answered, one can continue with the build as before:

ACCEPT_KEYWORDS=”~arm” USE=”somedependency1 somedependency2″ emerge -1 packagetobuild

Occasionally, one will find need of some other emerge command lines, for syncing with the main repository, or cleaning up deps, etc:

  • emerge –update –new-use –deep @world
  • emerge -av –depclean
  • emerge -a –sync

If one wants to see what packages would be installed, without actually installing anything, something like this can help:

emerge -pv www-client/whateverpackageitis

To search for a package,

emerge –search nameofpackage

Again, this is my first shot at Gentoo, so take it all as a horse-shoes approximation, and then consult 🙂

I don’t intend to replicate the actual documentation, but this might be a jump-start on enough info to get through the XU4 image build, although I’m not presenting this as advice to anyone (because a first-time guy is not going to have all the t’s crossed).  Mainly, my point here is to get people interested in using Gentoo on the XU4.  For people who like to be in control, it’s great, and I prefer it immensely over the canned images that are available for other distros on the platform.

Once I had installed my favorite packages, I was ready to hook up to the internet. Just as a side note, when building Firefox on the XU4 with Gentoo, one must use USE=”pulseaudio” on the command line. I omitted it the first time, and ended up with a FF that had no audio. Since Firefox takes about six hours to build on an XU4 with a slow uSD (yeah – I wonder why I do that too) – this is a big thing to overlook. Each portage package has a build spec file in the port directory for the package to be built (/usr/portage/www-client/firefox) – for instance. This can be modified, or the command line can be used, or the /etc/portage/make.conf file can be used AFAIK. First-timer, remember.

For networking with a wired ethernet, there are really two main files to worry about (from the perspective of the user, assuming the userland is up to snuff). The two files are /etc/conf.d/net and /etc/init.d/net.eth0 (or eth1, etc). The latter file can simply be copied from local:

cp /etc/init.d/net.lo /etc/init.d/net.eth0

Read More …

Note: Gentoo is a product of the Gentoo people at, and this author and site has no affiliation with them.  Odroid is a project of hardkernel at, and this author and site has no affiliation with them.