I recently installed Ubuntu 15.10 on Odroid-XU4 and set out to run the upstream kernel on it. After several trials and errors and being forced to reference various forums, I now have Odroid running the Linux 4.6 Kernel. In this article, I will share how to quickly get from unboxing to running the latest kernel with a short detour to upgrade to the Ubuntu 16.04 release.
Without further ado, let’s get started. First of all, download the Ubuntu 15.10 image. You can find the release notes and self installing image here:
Prepare the microSD Card
Once you’ve downloaded the image from the 2nd link above, follow the following steps to create a bootable microSD card with the image; I used a 32 GB Samsung microSD card. Insert the microSD card in its SD card adapter case in the SD card slot on your host PC or laptop. Please note that SD card will likely be auto-mounted. Check for the device files and unmount all partitions as needed. If this a brand new SD card you don’t have to worry about this step.
Uncompress the image:
$ tar -unxz ubuntu-15.10-mate-odroid-xu3-20160114.img.xz
Prepare microSD – Insert SD Card and look for auto-mounted partitions:
$ df -h ... /dev/mmcblk0p2 30G 8.3G 21G 29% /media/shuah/rootfs /dev/mmcblk0p1 128M 20M 108M 16% /media/shuah/boot
Check device files
$ ls /dev/mmcblk* /dev/mmcblk0 /dev/mmcblk0p1 /dev/mmcblk0p2
First unmount the auto-mounted partitions:
$ umount /dev/mmcblk0p1 $ umount /dev/mmcblk0p2
Erase microSD card (the following writes ~8192 4M blocks to erase the entire disk):
$ dd if=/dev/zero of=/dev/mmcblk0 count=8192 bs=4M
Copy self installing image to microSD Card:
$ dd if=ubuntu-15.10-mate-odroid-xu3-20160114.img of=/dev/mmcblk0
Get Your ODROID-XU4 Up and Running
Now you are ready to use the microSD to boot the self install image. Insert the microSD card in the microSD slot in the Odroid. Make sure Boot Select Switch is in the correct position to enable microSD as the boot device.
Hopefully you have a the USB-UART Module Kit for the Odroid. If you don’t please get one! It is a must for kernel development. Please refer to the ODroid wiki for instructions on how to connect to Odroid serial console port. An alternative option is to simply connect the device’s HDMI to a monitor and hook up a USB keyboard and mouse.
It is time to give your Odroid boot a try. Power up the Odroid and you should see the ALIVE/Blue Starts LED start out solid while in u-boot and quickly go into flashing mode when kernel starts running. At this point, sit back and relax, the Ubuntu self-install image will boot and complete the instalation. If all goes well, the ALIVE/Blue Status LED continues to flash and you will see boot messages on the console and Odroid login appear on the monitor. During the install, an boot partition will be made with a rootfs being placed on the remaining space. There is ample room in the boot partition for a few kernel images. You will notice that the boot partition is auto-mounted at /media/boot.
The Ubuntu 15.10 image is complete with all the development tools except for the liveboot package. We will talk about this later. Login is odroid and password is odroid. Start the Software Updater and pull in any updates. You will have the opportunity to upgrade to 16.04. If you do upgrade, please keep in mind that you will have to bring in new video driver to get GUI working on 16.04. Please refer to GUI after upgrade to Ubuntu 16.04 on XU4. The following is a distilled list of commands that worked for me.
$ sudo apt-add-repository ppa:canonical-x/x-staging $ sudo apt-get update $ sudo apt-get purge xserver-xorg-video-armsoc* $ sudo apt-get install xserver-xorg-video-armsoc-exynos
Once the above step is done, power down completely (don’t choose restart). Please note that when the HDMI is connected, the HDMI return power supplies enough power for Odroid’s PWR Status LED to stay on. Please disconnect HDMI to ensure the Ordroid is completely powered down before powering it back up. Please don’t insert and/or remove microSD while the PWR Status LED is on. Once the PWR Status is off, it safe to power on the Odroid. At this point with the GUI should be working. Please note: If you have problems with fonts not rendering properly, click “System” in the top left corner of the screen and go to Preferences >> Appearance; then, select the Fonts tab and choose “Subpixel smoothing” in the Rendering section.
Build the Mainline Kernel
Now we are ready to build, install, and boot mainline kernels. The latest linux-next is a good repo to use. I will describe what I needed to do build, install and run kernel based on this repo. I would recommend doing a native build on Odroid as it is fast enough and worked well for me. I built kernels with and without CONFIG_EXYNOS_IOMMU enabled. Contiguous Memory Allocation (CMA) is the default mode for memory allocation. When IOMMU is enabled, non-contiguous memory is allocated using Exynos IOMMU hardware. Both flavors worked for me.
Clone the linux-next git repo (do this on the XU4 if you want to do a native kernel build on the Odroid):
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux_odroid
Move into the new linux_odroid directory, generate the config, prepare modules, and build: (Please note: If you like to enable IOMMU, apply the following patch or edit arch/arm/configs/exynos_defconfig to add the CONFIG_EXYNOS_IOMMU=y , and then run make exynos_defconfig)
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig index daf9762..76127dc 100644 --- a/arch/arm/configs/exynos_defconfig +++ b/arch/arm/configs/exynos_defconfig @@ -218,6 +218,7 @@ CONFIG_CROS_EC_CHARDEV=y CONFIG_COMMON_CLK_MAX77686=y CONFIG_COMMON_CLK_MAX77802=y CONFIG_COMMON_CLK_S2MPS11=y +CONFIG_EXYNOS_IOMMU=y CONFIG_EXTCON=y CONFIG_EXTCON_MAX14577=y CONFIG_EXTCON_MAX77693=y
$ cd linux_odroid $ make exynos_defconfig $ make prepare modules_prepare $ make -j6 bzImage modules dtbs
Copy .dtb to /media/boot – don’t overwrite the old one, if one exists.
sudo cp arch/arm/boot/dts/exynos5422-odroidxu4.dtb /media/boot/exynos5422-odroidxu4_next.dtb
Copy zImage to /media/boot – don’t overwrite the old one.
$ sudo cp arch/arm/boot/zImage /media/boot/zImage_next
Install modules – will be installed under /lib/modules
$ sudo make modules_install
Without live-boot, initramfs will not have live support and kernel won’t boot. You have only once when the first kernel is built.
$ sudo apt-get install live-boot
Backup everything in /media/boot to a back-up directory, just in case you run into problems. All of the remaining steps need to be run with super user privileges. Copy the current .config to /boot, and then run update-initramfs.
Note: you should run cat include/config/kernel.release separately and copy/paste the results where it is used in the next commands.
$ 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`
Copy new uInitrd to /media/boot:
$ cp /boot/uInitrd-`cat include/config/kernel.release` /media/boot/
Now comes the important step to change the boot.ini to boot the new kernel. Edit /media/boot/boot.ini and comment out the following line:
#setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; fatload mmc 0:1 0x44000000 exynos5422-odroidxu3.dtb; bootz 0x40008000 0x42000000 0x44000000"
Past the new bootcmd line point to new zImage, uInitrd, and dtb files after the line you just commented out:
setenv bootcmd "fatload mmc 0:1 0x40008000 zImage_next; fatload mmc 0:1 0x42000000 uInitrd-4.7.0-rc2-next-20160608; fatload mmc 0:1 0x44000000 exynos5422-odroidxu4_next.dtb; bootz 0x40008000 0x42000000 0x44000000"
We are now at the final step. Run sync and then power the device down and power back up. Please remember to disconnect HDMI so it doesn’t continue to supply power.
$ sync; poweroff
You should have the newly built zImage running when Odroid boots up. uname -a should show that the Linux odroid 4.7.0-rc2-next-20160608 is running.
Please watch out for the following in the dmesg:
FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Adding new kernel files (zImage, uInitrd, and exynos5422-odroidxu4.dtb), and changing boot.ini work just fine on the boot partition /dev/mmcblk1p1. If you were to remove files, please make sure to run fsck on this device. Run the following as root, if you don’t the system won’t boot and it will hang, unable to load the uInitrd.
umount /dev/mmcblk1p1 fsck /dev/mmcblk1p1 mount /dev/mmcblk1p1 /media/boot
There are a few issues I’m still working to solve. Chromium included in the Ubuntu 16.04 release doesn’t work and needs to be downgraded to rev 48.0. After the downgrade, Chromium starts, but dies right away. This is a work in progress at the moment. Otherwise, configuring and getting mainline kernel booting on Odroid-xu4 has been fun, and I hope you find this guide to be valuable.