We can now get some quad core Android mini PCs (e.g. Hi802, GK802) featuring Freescale i.MX6Q processor, Freescale has released full documentation and source code its development platforms, Hi802 / GK802 HDMI TV dongles are easily hackable, and there’s even an Ubuntu image for the devices. So it looks pretty good ,right? Well almost.. there are some patches and config for GK802 that have not been released by Richtechie, so we can’t modify the bootloader and Linux kernel. But this may change, as ARMTvTech forum user hste noticed some Freescale i.MX6 HDMI dongle patches om IMX Community website. Even though I’m not sure those are fully compatible with Hi802 / GK802, this could be a starting point. Today, I’ll provide the instructions to build u-boot, the linux kernel and Android ICS with those patches in a machine running Linux 12.04 64-bit.
Patch Sets Descriptions
There are two set of patches that can be applied to R13.4-GA release:
- hdmidongle_REVB_R13.4_patch-20121115.tgz – Adds HDMI dongle support in U-boot, the Linux kernel and customize Android 4.0.4 for mini PCs.
- hdmidongle_REVB_R13.4_patch-20130201.tgz – Adds support for ldo bypass , uboot fastboot, ntfs, Bluetooth A2DP, fakes an alway full battery, removed the screen locker, and check the video mode. There are also patches for bug fixes for WifiDirect, Wi-Fi performance, uboot mmu, and system stability
A script (revb_dongle_patch_install.sh) is provided to apply 20121115 patches.
Getting Freescale i.MX6 U-boot, Linux kernel and Android source code (R13.4-GA)
Since those patches need to be applied against R13.4-GA, so we need to get the code first. The instructions are explained in section 5 “Get Android Source Code (Android/Kernel/U-Boot)” of R13.4-GA.01_Android_User_Guide.pdf.
First download IMX6_R13.4_ANDROID_SOURCE_CODE (171 MB). After download, you should get a file named imx-android-r13.4-ga.01.tar.gz that includes the documentation, patches, and Mfgtool for Android 4.0.4.
Let’s extract it, extract the (default) patches:
1 2 3 4 |
mkdir -p ~/edev/Freescale tar xzvf imx-android-r13.4-ga.01.tar.gz cd imx-android-r13.4-ga/code tar xzvf r13.4-ga.tar.gz |
If you don’t have it the repo tool yet download it, and add it to your path:
1 2 3 |
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo chmod 755 ~/bin/repo export PATH=$PATH:~/bin |
Now let’s create a working directory (myandroid) and get Android 4.0.4 r1.1 AOSP source code:
1 2 3 |
cd ~/edev/Freescale/imx-android-r13.4-ga mkdir myandroid cd myandroid |
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.4_r1.1
cp ../code/r13.4-ga/default.xml .repo/manifests/default.xml
repo sync
This will take a little while, after or while it’s progressing you can (also) get imx kernel and U-boot source code:
1 2 3 4 5 6 7 8 9 10 |
git clone git://git.freescale.com/imx/linux-2.6-imx.git kernel_imx cd kernel_imx git checkout imx-android-r13.4-ga cd ../bootable/ mkdir bootloader cd bootloader git clone git://git.freescale.com/imx/uboot-imx.git uboot-imx cd uboot-imx git checkout imx-android-r13.4-ga cd ../.. |
When checking out imx-android-r13.4 branch for the kernel and U-boot, you’ll get messages like:
HEAD is now at c9dfae3… ENGR00224938 HDMI audio: clear HDMI dma done bit before start
HEAD is now at 097643f… ENGR00224313:i.MX6 general:enable CONFIG_CMD_IMXOTP to fix the build error
It just shows the latest commit, so there’s no issue here.
After repo sync is complete, you’ll also need to get some more code:
1 2 3 4 5 6 |
cd external git clone git://android.git.linaro.org/platform/external/alsa-lib.git git clone git://android.git.linaro.org/platform/external/alsa-utils.git cd ../hardware git clone git://android.git.linaro.org/platform/hardware/alsa_sound.git cd .. |
Now patch all those with R13.4-GA patches:
1 2 |
source ../code/r13.4-ga/and_patch.sh c_patch ../code/r13.4-ga imx_r13.4-ga |
After a lot of debug output (and warnings), you should see the following message to indicate patching was successful:
**************************************************************
Success: Now you can build the Android code for FSL i.MX platform
**************************************************************
We’re done for this part we now have all source for R13.4-GA release.
Patching R13.4-GA with HDMI dongle patches
We can now patch the code to add HDMI dongle support. I’ll assume you’ve downloaded all 3 files describe at the top of this post to ~/edev/Freescale/imx-android-r13.4-ga directory:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
chmod a+x revb_dongle_patch_install.sh tar xzvf hdmidongle_REVB_R13.4_patch-20121115.tgz cd hdmidongle_REVB_R13.4_patch ../revb_dongle_patch_install.sh ~/edev/Freescale/imx-android-r13.4-ga/myandroid cd .. tar xzvf hdmidongle_REVB_R13.4_patch-20130131.tgz cd ../myandroid git apply ../hdmidongle_REVB_R13.4_patch-20130131/0001-uboot_fastboot.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0002-LDOBYPASS.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0003-WifiDirect.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0004-ntfs_support.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0005-BT_enable.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0006-1G_boot_stable.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0007-battery_always_full.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0009-uboot-enable-mmu-fix.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0010-boot_disable_screenlocker.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0011-wm8326-DC_CONTROL_RATE.patch --verbose git apply ../hdmidongle_REVB_R13.4_patch-20130131/0012-Added-default-video-mode-check-make-sur.patch --verbose rm -rf kernel_imx/drivers/net/wireless/rtl8192ce tar xzvf ../hdmidongle_REVB_R13.4_patch-20130131/rtl8192ce_v4.0.0_6239.20121226_TPIOT1.tgz tar xzvf ../hdmidongle_REVB_R13.4_patch-20130131/ntfs-3g.tar.gz -C external |
For the second set of patches, you’ll noticed patches 0001 to 0012 have been applied, except 0008 since it’s not needed anymore.
One more step completed. Have a tea break, or drink a beer, since there’s still a bit more work to do.
Building U-Boot, the kernel and Android for Freescale i.MX6 HDMI TV Dongles
I’m probably missing some per-requisites in this part, and most required dependencies were already installed in my PC. You may want to have a look at the post “How to compile Android on Ubuntu 12.04“, and in particular the part about install Sun Java 6 JDK, where you need to download Sun Java 6 JDK, install it, and run update-alternatives:
1 2 3 4 5 6 7 8 9 |
chmod +x jdk-6u38-linux-x64.bin sudo ./jdk-6u38-linux-x64.bin sudo mv jdk1.6.0_38 /usr/lib/jvm/ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 1 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_38/bin/javac 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 1 sudo update-alternatives --config java sudo update-alternatives --config javac sudo update-alternatives --config javaws |
Now we should be ready to build:
1 2 |
source build/envsetup.sh lunch |
We can select either hdmidongle_6dq-eng or hdmidongle_6dq-user for the build. The “eng(ineering)” build is a debug build, and the “user” build is a release version. I’ve gone with hdmidongle_6dq-user (15) to try it out.
In theory, we now just need to run make:
1 |
make -j8 |
However “in theory, there is no difference between theory and practice; In practice, there is”, and I’ve come across a few issues during the build, and if you build in Ubuntu 12.04 64-bit, you may want to perform the following steps before running make.
Some directories are duplicates in the source tree, and the build ends with error such as:
build/core/base_rules.mk:166: *** external/mtd-utils/mtd-utils/mkfs.ubifs: MODULE.HOST.EXECUTABLES.mkfs.ubifs already defined by external/mtd-utils/mkfs.ubifs. Stop
I fixed it by deleting one of the duplicate in the source:
1 2 3 4 5 6 |
rm -rf bootable/bootloader/uboot-imx/mtd-utils rm -rf external/mtd-utils/mtd-utils/ rm -rf bootable/bootloader/uboot-imx/wpa_supplicant_8_rtl/ rm -rf external/wpa_supplicant_8_rtl/wpa_supplicant_8_rtl/ rm bootable/bootloader/uboot-imx/realtek/wlan/ -rf rm -rf hardware/realtek/realtek/ |
I found some dependencies missing, so you may have to install:
1 |
sudo apt-get install uuid-dev liblzo2-dev lib32ncurses5-dev uuid:i386 liblzo2-2:i386 |
But the build still failed, so here’s an ugly hack:
1 2 3 4 |
pushd /usr/lib sudo ln -s /lib/i386-linux-gnu/libuuid.so.1 libuuid.so sudo ln -s /usr/lib/i386-linux-gnu/liblzo2.so.2 liblzo2.so popd |
Then I got several errors:
error: “_FORTIFY_SOURCE” redefined [-Werror]
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
The solution is to edit vi build/core/combo/HOST_linux-x86.mk and edit the corresponding line as follows:
1 |
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 |
Source: http://code.google.com/p/android/issues/detail?id=20795
External/mesa3d/src/glsl/linker.cpp:1734:59: error: ‘offsetof’ was not declared in this scope make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1
Edit external/mesa3d/src/glsl/linker.cpp and add #include <stddef.h>
Source: http://code.google.com/p/android/issues/detail?id=23206
host C++: liboprofile_pp <= external/oprofile/libpp/arrange_profiles.cpp In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0: external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive] make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1
Edit external/oprofile/libpp/format_output.h and Remove ‘mutable’ from ‘mutable counts_t & counts;’ on line 94 => counts_t & counts;
Source: https://groups.google.com/forum/?fromgroups=#!msg/android-building/2EwtWQTqjdI/eBl1bK-KNM8J
external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: error: ‘ptrdiff_t’ does not name a type
Edit external/gtest/include/gtest/internal/gtest-param-util.h and add one line:
1 2 3 |
#include <vector> +#include <cstddef> #include <gtest/internal/gtest-port.h> |
Source: http://code.google.com/p/android/issues/detail?id=22005
/home/jaufranc/edev/Freescale/imx-android-r13.4-ga/myandroid/external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock’
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] Error 1
Edit vi frameworks/compile/linkloader/Android.mk and rename LOCAL_LDFLAGS to LOCAL_LDLIBS.
Source: https://bugs.launchpad.net/linaro-android/+bug/1018832/comments/6
frameworks/compile/slang/slang_rs_export_foreach.cpp:249:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1
Edit frameworks/compile/slang/Android.mk and remove -Werror
Source: http://code.google.com/p/android/issues/detail?id=22006
After all those changes, I was finally able to complete the build with the output in out/target/product/hdmidongle_6dq including the following directories and files:
- root/ – Root file system (including init, init.rc, etc). Mounted at /
- system/ – Android system binary/libraries. Mounted at /system.
- data/ – Android data area. Mounted at /data.
- recovery/ – Root file system when booting in “recovery” mode.
- boot.img – Image which includes the kernel zImage, ramdisk, and boot parameters.
- ramdisk.img – Ramdisk image generated from “root/”.
- system.img – EXT4 image generated from “system/”. It can be programmed to “SYSTEM” partition on SD/eMMC card with “dd”.
- userdata.img – EXT4 image generated from “data/”.
- recovery.img – EXT4 image generated from “recovery/”. It can be programmed to “RECOVERY” partition on SD/eMMC card with “dd”.
- u-boot-6q.bin – U-Boot image with padding for i.MX 6Quad version of the HDMI dongle.
- u-boot-6dl.bin – U-Boot image with padding for i.MX 6Dual version of the HDMI dongle.
- uImage – Kernel image
If you just want to build U-boot and/or the Kernel follow section 5.3 and 5.4 in R13.4-GA.01_Android_User_Guide.pdf. For the kernel there are 5 configs which all seem quite different from GK802 config:
- imx6_android_defconfig – Android kernel config
- imx6_defconfig – Linux kernel config
- imx6_nand_android_defconfig
- imx6_nand_updater_defconfig
- imx6_updater_defconfig
To build U-boot for Freescale HDMI dongles, there are over 12 config (6 for i.MX6 dual, 6 for i.MX6 Quad), but the most interesting appear to be mx6q_hdmidongle_android_config and mx6q_hdmidongle_nand_android_config.
That’s all for today, I’ll post more if I, or somebody else, make progress trying it or/and building it for GK802 / Hi802 mini PC.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Were you able to put the software on your gk802? And if so, did it boot??
@S
I’ve have tried yet. I have a few other things to first (e.g. reviews), but I may try in one or two weeks.
Do you know if X acceleration is supported or enabled?
@The Cageybee
This build is for Android.
For Linux, Ubuntu 11.10 is supposed to support X acceleration, but there were some issues a few weeks ago. I’m not sure if this is fixed.
Please see this: http://www.armtvtech.com/armtvtechforum/viewtopic.php?f=68&t=1585
@S
That’s great. But the only problem is the download links are telling me to wait 29 days before I’m allowed to download. Hopefully there will be mirrors.
@cnxsoft: You’ll find a dropbox mirror there as well :-)….
@S
I got it, but unfortunately there’s no “CONFIG_MACH_MX6Q_RICHTECHIE”. It does show the same config names as the code above, and there’s very little changes to the imx code compared to the code. It seems the code is just missing the LDO patch.
@cnxsoft
What about this – http://www.armtvtech.com/armtvtechforum/viewtopic.php?f=50&t=1584
Better links on this page – http://www.armtvtech.com/armtvtechforum/viewtopic.php?f=50&t=1584&start=10
Is this the same?
@Fma965
Yes same md5 as the ones “S” showed me the other day.
It looks like Richtechie guys are lying since the provided config does not match the one in the board.
@cnxsoft
Richtechie have create there own BSP that partially implements the HDMI dongle BSP. Anyway I’m making progress in getting the kernel to boot.
@Jasbir
Nice, I haven’t tried anything yet on the device. Let us know your progress.
@Jasbir
Somebody else (rz2k) is also working on this. I’ve seen they’ve talked about it on irc #arm-netbook today. You’ll be able check on http://ibot.rikers.org/%23arm-netbook tomorrow. They posted some logs, and maybe something else (did not see it all).
@cnxsoft
Great 🙁 Why richteechie lying to us for 🙁
@cnxsoft
Finally got a compiled kernel to boot all the way 🙂 , still requires a bit more work….
EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:1.
Freeing init memory: 184K
Last login: Wed Dec 31 16:03:27 PST 1969 on tty1
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.0.35-05236-gc9dfae3-dirty armv7l)
root@linaro-ubuntu-desktop:/# ls /
bin dev home lost+found mnt proc run selinux sys unit_tests var
boot etc lib media opt root sbin srv tmp usr
@Fma965
That does not mean we can’t use it, but there may be a bit more work. I guess they don’t want to release their work, because they don’t want other companies to copy their product.
@Jasbir
Great. Since we don’t have the HDMI part from Richtechie, do you have any video output?
@cnxsoft
Hi, I’m rz2k, I was testing the sources on my hi802 that arrived this week. I want to have both u-boot and kernel loading, it seems like @Jasbir uses richtechie provided u-boot, not the one from sources. Also one of my goals is to disable HDMI I2S audio, without this my DVI monitor locks up really hard.
If there are many guys trying to work this out – maybe we need to set up ML or IRC channel for this? Since i.MX has good support and docs, usage of chinese cheap hw can go really far, might replace A10 one day.
@cnxsoft
I believe richtechie only changed the LDO (hi802 uses couple of DC-DC convertors on board and nothing else, reference design uses maxim PMIC) and DDR memory setup, HDMI drivers are standard from freescale.
Yes video out is working.
Reference design is based on booting from flash memory not SD card. Also the IOMUX pins can be setup differently depending on the perpherials supported.
@Jasbir
Yeah, I get it now. The HDMI dongle board is another reference design upon what hi802 is based. They replaced Wolfson PMIC with couple of passive regulators + internal imx6q LDO, replaced NAND with SD and that should be it.
I’ve placed a github repo with all patches that I’ve found applied. https://github.com/rzk/linux-imx/commits/imx-android-r13.4-ga-hdmidongle
Any help is welcome.
@Dmitriy Beykun
Great! Do you also plan to do this with uboot-imx?
Last time we also discussed about setting up Google Group and irc. What names should we go with?
Some ideas:
GG: Freescale i.MX6 HDMI dongle Development. GK802/Hi802 Development
IRC: imx6-minipc or imx6-dongle ?
Other ideas are welcome.
@Dmitriy Beykun
Yep, we can’t use HDMI reference design code out of the box. I started with the kernel because it is easier to test out the hardware differences. Once those difference are known then uboot will be easier to implement.
Finally got a kernel working that boots up Ubuntu oneiric, desktop appears ok but requires more work but making steady progress.
@cnxsoft
IRC channel would be useful, imx6-minipc sounds good.
@cnxsoft
yes, I just had bad import/mirror if uboot-imx, many tags disappeared, will try again asap, also since this u-boot needs a lot of work to be useful, I didnt prioritize it against the kernel, that was confirmed working with default shipped u-boot.
GG name sound good, for IRC, imx6-dongle sound good.
uboot-imx is up https://github.com/rzk/uboot-imx/commits/imx-android-r13.4-ga-hdmidongle
@Jasbir
@Dmitriy Beykun
Since Freescale uses the term “HDMI dongle”, I think I’ll go with #imx6-dongle for IRC, and “Freescale i.MX6 HDMI Dongle Development (GK802/Hi802)” for Google Group. I’ll setup this soon, and post about it.
@Jasbir
I’ve setup IRC and Google Group mailing list.
http://www.cnx-software.com/2013/02/13/developer-community-for-freescale-i-mx6-hdmi-dongles/
That’s funny – it looks like the R13.4-GA release is not available for download anymore?
The Freescale web site isn’t easy to navigate, but:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMXANDROID&fpsp=1&tab=Design_Tools_Tab
Shows that IMX6_R13.41_ANDROID_SOURCE_CODE is the only version available.
Similarly on the community web site,
There *is* a R13.4-GA.03 general patchset – https://community.freescale.com/docs/DOC-94597
But the GA code itself is inaccessible.
There is a R13.4.1.04 general patchset as well – https://community.freescale.com/docs/DOC-94596
Am I missing something? Is there a big difference between R13.4-GA and R13.4.1?
Will the HDMI Dongle patches work for that? Si
@hroth
I’m not sure if the patch would work against this new version.
Since you just want to build s module, you just need the kernel, and you can get R13.4-GA version here: https://github.com/boundarydevices/linux-imx6/tree/boundary-imx-android-r13.4-ga
Then just apply the kernel patches. Actually it may not even be necessary to apply the patches.
@cnxsoft
Thanks for your rescue again! I went to the website you mentioned and downloaded the repository as a Zip file… Seems a little small (127 MB). But here goes! If I get somewhere I’ll be sure to give a blow-by-blow so your other readers will have a reference.
@cnxsoft
I downloaded the R13.4-GA from the Boundary Devices git but went ‘off the rails’ on your step-by-step instructions since the directory structure was different. I did try the R13.4.1 from Freescale but the patches definitely do not work.
I did download Richtechie’s so-called released source code since it seems to have the R13.4-GA kernel source, which includes the hid-quanta.c that I’m after. Again, I’m still learning – so I can’t map Richtechie’s release into your step-by-step instructions above.
But taking a step back, how about another dumb question:
To just get to a kernel module (instead of bootstrapping the entire kernel) is there a simple way to either:
a) Get i.mx6 Android binaries for kernel development (compiler, menuconfig, etc) within Android so I can just build the kernel module within the i.mx6?
b) Set up a Ubuntu 10.04 VM to simply cross-compile the kernel module and insert the module? I guess I have to assume the Richtechie source-code ‘release’ is close enough for the 1.65.4 firmware available.
@hroth
For your purpose, I think it’s easier to just build the kernel with the method (5 lines) provided at http://www.cnx-software.com/2013/02/13/developer-community-for-freescale-i-mx6-hdmi-dongles/
Just enable your modules with make menuconfig.
I should have pointed you to this post earlier, instead of making you build the full Android release…
Hello,
unfortunately the link to the IMX6_R13.4_ANDROID_SOURCE_CODE is not working. Do you have alternatives to get the R13.4 Android sources for the iMX6?
Many thanks and best regards,
Michael
@Michael
Freescale released a new version, so if you want to get R13.4, you may want to have a look at https://github.com/boundarydevices/linux-imx6
Sorry, I am a bit confused. The link only shows the kernel sources. I think I need the whole Android sources. I do not mind if it is 4.2.2 or 4.0.something. I only need to add a new HDMI/DVI mode to my GK802 that is not supported by default. If there is a set of u-boot/kernel/Android sources that can be compiled for a GK802 out of the box tis would be great.
Best regards, Michael
@Michael
There is some newer Android source code on Freescale i.MX6 page: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6Q&nodeId=018rH3ZrDRB24A&fpsp=1&tab=Design_Tools_Tab&uc=true&lang_cd=en
It might be challenging to port this to GK802 though.