Friday, 15 February 2013

I.MX6 GK802/Hi802 - A working Kernel with Ubuntu

The Hi802/GK802 mini-pcs are interesting devices because of the vast reference documentation available for the IMX6Q processor. Freescale are also providing a HDMI TV Dongle reference design complete with source code, the Hi802/GK802 are partially based on this design. With this is mind and after spending many hours decoding the pcb layout coupled with bouts of head scratching, I finally got a kernel booting ubuntu. This is a work in progress but hopefully will kick start further development by community see here. Considering this is work in progress you definitely require serial console access if booting fails. Furthermore I'm testing on a GK802 with 1.2 CPU version therefore no guarantee on a 1.1 CPU which I think are GEN 1 or for Hi802 devices.

1. Kernel Boots from SD card.
2. USB port functions with USB hub (for me works with keyboard and mouse).
3. Serial console shell active.
4. HDMI output is set to 1280x720@60.
5. Ubuntu Desktop launches but freezes randomly :(. Not that use-able in its current state.
6. No wifi or bluetooth. Wifi shouldn't be too hard to add.

So if your keen or want to help out, instructions below, I assuming you know how to use git and have armel compiler (I use arm-linux-gnueabi-) :

1. Check out the Freescale imx6 kernel tree and checkout imx_3.0.35_1.1.0. I found 1.1.0 to be more stabe than the 2012-09-01 branch.

    cd linux-2.6-imx
    git checkout imx_3.0.35_1.1.0
2. Down this tar file containing patches and kernel config (thanks to for provding hosting). Extract and apply patches

    git apply gk802_patch_1.patch
    git apply gk802_patch_2.patch

3. Make kernel config

    make ARCH=arm imx6_defconfig
    make ARCH=arm menuconfig
4. Copy the file kernel_config to .config 

    cp kernel_config .config

5. Build the kernel and modules

    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=output      modules     
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=output modules_install

6. Download the rootfs L3.0.35_1.1.0_UBUNTU_RFS from the freescale website. You may need to create an account to access to the files.

7. To create a bootable SD card, I took the bare ubuntu image from here (thanks and   dylandn ) and dd'd this to the card. I then reformated the ext4 partition and untar'd the rootfs 
L3.0.35_1.1.0_UBUNTU_RFS to it.

8. Next step is to copy the new kernel and modules over:

    sudo dd if=arch/arm/boot/uImage of=/dev/<device> bs=1048576 seek=1 && sudo sync

    sudo cp -r output/lib/modules/3.0.35-05236-gc9dfae3-dirty /media/ubuntu/lib/modules

9. Now try to boot, fingers crossed you should see the kernel trace output appearing and finally a command shell in the serial console.

generic-usb 0003:413C:2107.0002: input,hidraw1: USB HID v1.10 Keyboard [Dell Dell USB Entry Keyboard] on usb-fsl-ehci.0-1.4/input0
EXT4-fs (mmcblk0p1): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (mmcblk0p1): couldn't mount as ext2 due to feature incompatibilities
EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:1.
Freeing init memory: 184K
 * Starting mDNS/DNS-SD daemon[ OK ]
 * Starting load fallback graphics devices[ OK ]
 * Starting Userspace bootsplash[ OK ]
 * Stopping load fallback graphics devices[ OK ]
 * Starting configure network device security[ OK ]
 * Starting Mount network filesystems[ OK ]
 * Starting Upstart job to start rpcbind on boot only[ OK ]
 * Stopping Upstart job to start rpcbind on boot only[ OK ]
 * Starting network connection manager[ OK ]
 * Stopping Mount network filesystems[ OK ]
 * Starting Failsafe Boot Delay[ OK ]
 * Stopping Failsafe Boot Delay[ OK ]
 * Starting System V initialisation compatibility[ OK ]
 * Starting configure network device[ OK ]
 * Starting Bridge socket events into upstart[ OK ]
 * Starting RPC portmapper replacement[ OK ]
 * Starting Start this job to wait until rpcbind is started or fails to start[ OK ]
 * Stopping rpcsec_gss daemon[ OK ]
 * Stopping Start this job to wait until rpcbind is started or fails to start[ OK ]

[ OK ]rting Advanced Power Management daemon...        
Last login: Thu Jan  1 00:00:41 UTC 1970 on tty1
speech-dispatcher disabled; edit /etc/default/speech-dispatcher
Checking for running unattended-upgrades: 
[ OK ]rting bluetooth        
 * PulseAudio configured for per-user sessions
saned disabled; edit /etc/default/saned
 1 Jan 01:36:59 ntpdate[5241]: no servers can be used, exiting
Welcome to Linaro 11.10 (development branch) (GNU/Linux 3.0.35-02666-gc27cb38-dirty armv7l)

 * Documentation:

301 packages can be updated.
53 updates are security updates.

New release '12.04 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


10. Your HDMI display should show a Ubuntu desktop after a while. If the desktop appears then try launching a terminal window which should appear without it freezing. Once the deskop freezes it can be recovered in the serial console shell by:

    service lightdm stop
    service lightdm start

Xorg is reporting the following error when frozen:

[    71.433] (II) XKB: reuse xkmfile /var/lib/xkb/server-A77BBE312A49C9FE89948D38B2A8CB84C3CBB410.xkm
[   101.398] (II) XKB: reuse xkmfile /var/lib/xkb/server-A77BBE312A49C9FE89948D38B2A8CB84C3CBB410.xkm
[   181.556] [mi] EQ overflowing. The server is probably stuck in an infinite loop.


  1. Works fine, thanks a bunch. There is just one detail missing: file board-mx6dl_hdmidongle.h is not available, I copied it from a different kernel tree.

    1. Thanks for testing and spotting the missing file. Hopefully we can make more progress now!

      By the way great work on RK3066!

  2. :) Thanks!
    I am testing a GK802 these days. I think you are the first in the world to get a not-factory-compiled Linux kernel to boot on it. There are still a few issues to solve (for example the internal wifi does not seem to get detected), but it really was the fundamental step to get some development started on this thing. I'll have a XFCE-Ubuntu 12.10 image ready later, I'll post a link to it.

  3. I have made a dd image of my 4GB ubuntu image based on your build description. I don't have the xorg problem.

    1. This comment has been removed by the author.

  4. Can someone make a photo of the connection between PC and Hackberry 10 for debug purpose (see boot messages, kernel messages etc).
    I don't know how to connect my H10 to my PC :(

  5. Very good work ...
    Do you think that it could be work on :

    1. Probably not because the hardware is most likely different. With your tablet, the first thing that would need to be done is to get serial port access so that uboot and kernel output can be captured. After that it would be case of working out the hardware configuration and mapping this in custom code. So not impossible!

  6. Just out of curiousity, has anyone had any luck with something other than ubuntu? I am thinking of the mini-distros like slitaz, dsl, puppy, etc that are natively light-weight and small enough to run in ram. Ubuntu is pretty heavy in comparison...

    1. You may be better off building your own kernel with initramfs if you want to run from RAM. You can do this easily with buildroot.

      Or.. if you need a whole system and want to go FULL-custom my recommendation would be building you own system from scratch (either cross-lfs or gentoo embedded).
      All pre-compiled images i found have a lot of stuff on them that i'm never going to use, so getting on from zero is the approach I end up using. It may take a little more time but it's well worth it :).

      Btw: to answer your question, I did kernel + buildroot initramfs + (optional) gentoo base system on two kinds of boxes like this (allwinner a10 and rockchip rk3066), it's great and the footprint is very small (gentoo with all common stuff and squid, nginx, php, perl and all that common stuff, on a squashfs, takes only 140MB).

  7. How in the world do you get the internal microSD out? there is a small component in the way on my GK802.

    Thank in advance.


    1. The internal microSD housing has a slide catch, you need to slide it up for the cover to open. Similar to what you see on some phones for housing a sim card.

  8. Jasbir, good night. Do you still have the gk802 images for sd card. I lost mine and after upgrade it keeps booting. do you think if you have them you could send it to my. Thank you very much.