Sunday, July 31, 2016

Building a mainline kernel for the odroid

Shuah Khan has a howto on building a 4.x mainline kernel for the odroid XU4.  That was very helpful when I built the mainline kernel for my odroid XU3.  I've also got an odroid U3 that I'll be upgrading soon.

I wrote a little shell script to let me do most things automatically (because I needed to rebuild the kernel a few times, adding features that I needed).

Mainly I needed ecryptfs support, iptables modules and some cgroups options for unprivileged lxc containers.  Also a little modification to set the default cpufreq governor to ondemand instead of performance.  I'll update this post at some point to document which additional options I enabled to get all of those things.

I've seen a few more minor patches elsewhere that I'll want to test out.  In particular I'll look for the Mali GPU driver config fix to set it to either not run at all or to run at its lowest energy level (because I don't use that at all, these odroids run headless).

A list of things that I've needed to enable (I'm adding items as I find missing items and rebuild the kernel iteratively :-):

ecryptfs support

  • CONFIG_OVERLAY_FS
  • CONFIG_ECRYPT_FS


tun device for openvpn

  • CONFIG_TUN

IO accounting stuff for iotop

  • CONFIG_TASKSTATS
  • CONFIG_TASK_DELAY_ACCT
  • CONFIG_TASK_XACCT
  • CONFIG_TASK_IO_ACCOUNTING


netfilter/iptables modules

  • CONFIG_NETFILTER_ADVANCED
  • most things in IP: Netfilter Configuration
  • most things in IPv6: Netfilter Configuration
  • most things in Core Netfilter Configuration


user namespaces for unprivileged lxc

  • CONFIG_USER_NS

  • I forget if anything else was disabled in namespaces support, I just enabled everything under there.

veth support for lxc

  • CONFIG_VETH


#!/bin/bash

# optionally, make menuconfig and set options.
# particularly for the cgroups stuff for unprivileged lxc and ecryptfs

make menuconfig

#make exynos_defconfig

make prepare modules_prepare
time make -j 8 LOCALVERSON="-tiger" bzImage modules dtbs

cp arch/arm/boot/dts/exynos5422-odroidxu3.dtb /media/boot/exynos5422-odroidxu3_next.dtb
cp arch/arm/boot/zImage /media/boot/zImage_next

make modules_install

apt-get install -y live-boot

cp .config /boot/config-`cat include/config/kernel.release`
update-initramfs -c -k `cat include/config/kernel.release`
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n uInitrd -d /boot/initrd.img-`cat include/config/kernel.release` /boot/uInitrd-`cat include/config/kernel.release`
cp /boot/uInitrd-`cat include/config/kernel.release` /media/boot/
cat include/config/kernel.release

echo "edit /media/boot/boot.ini"
echo "comment out the current setenv bootcmd and replace it with"

echo "setenv bootcmd \"fatload mmc 0:1 0x40008000 zImage_next; fatload mmc 0:1 0x42000000 uInitrd-`cat include/config/kernel.release`; fatload mmc 0:1 0x44000000 exynos5422-odroidxu3_next.dtb; bootz 0x40008000 0x42000000 0x44000000\""

No comments: