Archive

Posts Tagged ‘cross-compilation’

Mediatek MT6589 Linux Source Code, CyanogenMod 11 Image for Wiko Stairway Smartphone

March 13th, 2014 5 comments

Mediatek and their customers have still not gotten into the habit of complying with the GPL license, and releasing the relevant source code such as the Linux kernel. There appears to be at least one smartphone, Wiko Stairway, where the Linux kernel has been released, and chrmhoffmann, a members of XDA developers forums, has even released on unofficial CyanogenMod 11 ROM (Android 4.4.2 Kit Kat) for the device.

Mediatek_Linux_Kernel_Menuconfig

There are three source repositories for the Linux kernel, “android device“, and Android.

I’ve only looked into the kernel which is version 3.4.5. Mediatek has apparently messed up the Linux kernel quite a bit, and you’ll have to do some funny things to build the kernel, and all Mediatek options in menuconfig are in a sub-section called “Mediatek Properitary Configuration” (sic.), and it’s not possible to simply go to System Type menu to change the processor type for instance.

Let’s get the source first:

git clone https://github.com/chrmhoffmann/android_kernel_wiko_stairway
cd android_kernel_wiko_stairway/
ls
bionic  kernel  mediatek  README

So together with the kernel, we’ve got the bionic library, and the modifications done by Mediatek in the mediatek directory. The Makefile is this Linux kernel is set to use the Android gcc toolchain (arm-linux-androideabi-gcc), but I tried to build the kernel with CROSS_COMPILE=arm-linux-gnueabihf- instead, and it failed along the way with the following error:

fs/file_table.c: In function 'get_empty_filp':
 fs/file_table.c:36:20: error: inlining failed in call to always_inline 'fd_show_open_files': function body not available
 extern inline void fd_show_open_files(pid_t pid, struct files_struct *files, struct fdtable *fdt);
 ^
 fs/file_table.c:160:36: error: called from here
 fd_show_open_files(pid, files, fdt);
 ^
 make[1]: *** [fs/file_table.o] Error 1
 make: *** [fs] Error 2

This is from code added by Mediatek, and at first I just disabled it, but a similar problem occurred in the wlan drivers. Some research indicated in may be a toolchain problem, so I’ve installed the latest Linaro Android toolchain and added it to my path:

wget http://releases.linaro.org/14.02/components/android/toolchain/4.8/android-toolchain-eabi-4.8-2014.02-x86.tar.bz2
tar xvf android-toolchain-eabi-4.8-2014.02-x86.tar.bz2
export PATH=$PATH:~/edev/Mediatek/android-toolchain-eabi/bin/

And started the build:

cd kernel
TARGET_PRODUCT=wiko MTK_ROOT_CUSTOM=../mediatek/custom/ make -j8

Same error. So I gave a last try with an older Linaro Android toolchain using gcc 4.6, and this did the trick:

  LD [M]  mediatek/platform/mt6589/kernel/drivers/devapc/devapc.ko
  LD [M]  mediatek/platform/mt6589/kernel/drivers/dual_ccci/ccci_plat.ko
  LD [M]  mediatek/platform/mt6589/kernel/drivers/devinfo/devinfo.ko
  LD [M]  mediatek/platform/mt6589/kernel/drivers/gpu/pvr/mtklfb.ko
  LD [M]  mediatek/platform/mt6589/kernel/drivers/gpu/pvr/pvrsrvkm.ko
  LD [M]  mediatek/platform/mt6589/kernel/drivers/masp/sec.ko
  LD [M]  mediatek/platform/mt6589/kernel/drivers/videocodec/vcodec_kernel_driver.ko
  AS      arch/arm/boot/compressed/piggy.gzip.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready

As for the current CM11 ROM, phone calls, SMS, data (2G, 3G), Wi-Fi, audio, and most sensors are working fine, but there’s still more work to do as the second SIM card, the camera, hardware video decoding, GPS, Bluetooth, FM radio and some MTK specific features are not supported yet. It may not be wise to try it on MT6589 hardware other than Wiko Stairway, as you may brick your device.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Amlogic GPL Source Code Release – Kernel 3.10, U-Boot, and Drivers (Wi-Fi, NAND, TVIN, Mali GPU)

March 10th, 2014 13 comments

Last month, I noticed Amlogic provided links to the Android SDK for S802 / M802 on their open source website, but the only way to get the source was to share your SSH public with Amlogic, so that they give you access. It did not happen, but the company has released the source for Linux 3.10.10, U-boot 2011.03, Realtek and Broadcom Wi-Fi drivers, NAND drivers, “TVIN”drivers, and kernel space GPU drivers for Mali-400 / 450 GPU. There are also some customer board files for Meson 6 only (AML8726-MX / M6) but they do not seem to match the kernel…

amlogic_kernel_m802_s802

If you want to build the kernel, including the drivers, you’ll need to download a bunch of files:

wget http://openlinux.amlogic.com:8000/download/ARM/kernel/arm-src-kernel-2014-03-06-d5d0557b2b.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/wifi/rtk8192du-2014-03-06-7f70d95d29.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/wifi/rtk8192eu-2014-03-06-9766866350.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/wifi/rtk8192cu-2014-03-06-54bde7d73d.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/wifi/rtk8188eu-2014-03-06-2462231f02.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/wifi/brcmap6xxx-2014-03-06-302aca1a31.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/wifi/wifi-fw-2014-03-06-d3b2263640.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/modules/aml_tvin-2014-03-06-fb3ba6b1c8.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/modules/aml_nand-2014-03-06-39095c4296.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/customer/aml_customer-2014-03-06-76ce689191.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/gpu/gpu-2014-03-06-0425a1f681.tar.gz

You’ll need to extract these tarballs in specific directories:

tar xvf arm-src-kernel-2014-03-06-d5d0557b2b.tar.gz
mkdir -p hardware/amlogic/
mkdir -p hardware/wifi/realtek/drivers
mkdir -p hardware/wifi/broadcom/drivers
mkdir -p hardware/arm/
cd hardware/amlogic
tar xvf aml_nand-2014-03-06-39095c4296.tar.gz
mv aml_nand-amlogic-nand nand
cd ../wifi/realtek/drivers
tar xvf ../../../../rtk8192du-2014-03-06-7f70d95d29.tar.gz
tar xvf ../../../../rtk8192eu-2014-03-06-9766866350.tar.gz
tar xvf ../../../../rtk8192cu-2014-03-06-54bde7d73d.tar.gz 
tar xvf ../../../../rtk8188eu-2014-03-06-2462231f02.tar.gz
mv rtk8188eu-8188eu 8188eu
mv rtk8192du-8192du 8192du
mv rtk8192cu-8192cu 8192cu
mv rtk8192eu-8192eu 8192eu
tar xvf ../../../../brcmap6xxx-2014-03-06-302aca1a31.tar.gz
cd ../../broadcom/drivers
mv brcmap6xxx-ap6xxx ap6xxx
cd ../../../arm
tar xvf ../../gpu-2014-03-06-0425a1f681.tar.gz
mv gpu-r3p2-01rel3 gpu
cd ..
mv aml_tvin-amlogic-3.10-bringup tvin

You can also extract the customer file into the kernel directory to add some drivers. As I said above I’m not sure the source code inside matches the Linux kernel 3.10.10, because there’s now device tree file for the boards. In arch/arm/plat-meson/Kconfig, there are (commented out) references to customer/meson/dt/Kconfig and customer/drivers/Kconfig. The device tree is not available, but the drivers is, so you could give a try in order to build the touchscreen and sensors drivers available in the customer tarball:

cd ../linux-amlogic-3.10-bringup
tar xvf ../aml_customer-2014-03-06-76ce689191.tar.gz 
mv aml_customer-master customer

Finally, the development tree is ready to build the kernel. There must surely be a script somewhere to do that… I haven’t used the file wifi-fw-2014-03-06-d3b2263640.tar.gz, as the kernel did not complain about it, and it looks like it’s just for Android Kit Kat. There are four scripts to build the kernel: mk_m6.sh, mk_m6tv, mk_m6_tvd.sh, and mk_m8.sh. The first three are for meson6 (dual core processor), and the last one meson8 (quad core S802/M802).

Let’s go with M8 build:

make ARCH=arm meson8_defconfig
./mk_m8.sh

Please not that I had to change mk_m8.sh, as it should just make computer hand requiring a hard reset. The culprity was the line:

make uImage -j

The manpage indicates “If the -j option is given without an argument, make  will  not  limit  the number of jobs that can run simultaneously”.  It does not seem like a good idea… ,s so I changed that to

make uImage -j8

Upon successful build, the end of log you look like:

UIMAGE arch/arm/boot/uImage
Image Name: Linux-3.10.10
Created: Mon Mar 10 11:48:52 2014
Image Type: ARM Linux Kernel Image (lzo compressed)
Data Size: 7099978 Bytes = 6933.57 kB = 6.77 MB
Load Address: 00008000
Entry Point: 00008000
Image arch/arm/boot/uImage is ready
/home/jaufranc/edev/AMLogic/s802/linux-amlogic-3.10-bringup/scripts/amlogic/aml2dtb.sh /home/jaufranc/edev/AMLogic/s802/linux-amlogic-3.10-bringup/arch/arm/boot/dts/amlogic/meson8_skt.dtd
DTD_FILE: /home/jaufranc/edev/AMLogic/s802/linux-amlogic-3.10-bringup/arch/arm/boot/dts/amlogic/meson8_skt.dtd
the middle dts file: /home/jaufranc/edev/AMLogic/s802/linux-amlogic-3.10-bringup/arch/arm/boot/dts/amlogic/meson8_skt.dts
process file /home/jaufranc/edev/AMLogic/s802/linux-amlogic-3.10-bringup/arch/arm/boot/dts/amlogic/meson8_skt.dts start
processing... please wait...
process file /home/jaufranc/edev/AMLogic/s802/linux-amlogic-3.10-bringup/arch/arm/boot/dts/amlogic/meson8_skt.dts end

CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTLD scripts/mod/modpost
DTC arch/arm/boot/dts/amlogic/meson8_skt.dtb
rm /home/jaufranc/edev/AMLogic/s802/linux-amlogic-3.10-bringup/arch/arm/boot/dts/amlogic/meson8_skt.dts
-rw-r–r– 1 jaufranc jaufranc 11244948 Mar 10 11:48 ./m8boot.img
m8boot.img done

If you want to get U-boot code it’s not quite as messy, you jut need to download and extract two files:

wget http://openlinux.amlogic.com:8000/download/ARM/u-boot/uboot-2014-03-06-323515c056.tar.gz
wget http://openlinux.amlogic.com:8000/download/ARM/u-boot/aml_uboot_customer-2014-03-06-09887e87b4.tar.gz
tar xvf uboot-2014-03-06-323515c056.tar.gz
cd uboot-next
tar xvf ../aml_uboot_customer-2014-03-06-09887e87b4.tar.gz
mv aml_uboot_customer-next/ customer

Then just select a board in customer/board/ to build U-boot for your hardware. For example:

make m8_k03_M102_v1_config CROSS_COMPILE=arm-linux-gnueabihf-
make CROSS_COMPILE=arm-linux-gnueabihf- -j8

The build failed for me, but it might be I may need to use another compiler, e.g. arm-none-eabi-gcc.

[Update: arm-none-eabi-gcc does seem to go further, but you'll also need an arc compiler as shown in my previous Amlogic U-boot build instructions].

Thanks to M][sko for the tip.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Getting Started with Raxda Rock – How to Generate and Flash Ubuntu Saucy Server and Desktop Images

January 27th, 2014 33 comments

I’ve already written a guide showing how to build and install Android in Radxa Rock. Today I’m going to build the Linux kernel, generate a Ubuntu server images based latest Ubuntu Linaro server release, flash the image to the NAND flash, and show how to install LXDE or XFCE desktop environment. If you are just interested in installing one of the latest supported images, you can download Android, dual boot (Android/Ubuntu), Ubuntu ALIP, and Router images for Radxa Rock @ http://dl.radxa.com/rock/images/, and skip “build” and “generate” instructions, and just follow the flashing instructions below. All steps in this tutorial will be done in Ubuntu 13.10, and lots of the instructions below follow hwswbits blog and Ubuntu Radxa Wiki.

Build the Linux kernel

Let’s start by building the Linux kernel. I’m assuming you’ve already install development tools in Ubuntu (e.g. apt-get install build-essentials). You can refer to the list at the beginning of the Radxa Rock Android post for packages to install with apt-get.

Let’s create a working directory, get the code, and build the kernel.

mkdir radxa_ubuntu
cd radxa_ubuntu

git clone -b wip/rockchip-3.0-radxa-rock https://github.com/linux-rockchip/rockchip-3.0.git
cd rockchip-3.0
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
make rk3188_radxa_rock_defconfig
make -j8

At this stage, we’ve build the kernel. However, if we use it as is, DNS and some other network functions will not work because CONFIG_ANDROID_PARANOID is enabled in the default config file. Run make arch=ARM menuconfig, and go to Networking support -> Networking options to disable Only allow certain groups to create sockets. Run make again:

make -j8

Let’s complete this section, by building the kernel modules:

mkdir modules
export INSTALL_MOD_PATH=./modules
make modules && make modules_install
cd ..

Generate Initrd

The initrd is used at boot time to speed up boot among other things.

git clone https://github.com/radxa/initrd.git
cd initrd
find . ! -path "./.git*"  | cpio -H newc  -ov > ../initrd.img
cd ..

Generate Boot.img

In order to create boot.img which will be flashed in the boot partition, we need to download mkbootimg tool, and run the following commands:

wget http://dl.radxa.com/rock/tools/linux/mkbootimg 
sudo apt-get install lib32stdc++6 
chmod +x mkbootimg 
./mkbootimg --kernel rockchip-3.0/arch/arm/boot/Image --ramdisk initrd.img -o boot.img

That’s all good as we should now have a working boot.img. I’ll upload my boot.img soon. You  can download boot-radxa-20140127.img.xz.

Generate Ubuntu (Linaro) Server Rootfs

We will first create an empty 1GB file (rock_rootfs.img), format it to EXT-4, and mount it as a loop device:

dd if=/dev/zero of=rock_rootfs.img bs=1M count=1024
mkfs.ext4 -F -L linuxroot rock_rootfs.img 
mkdir mnt
sudo mount -o loop rock_rootfs.img ./mnt

I’ll download and extract the latest Ubuntu Saucy server image from Linaro available as today:

wget https://releases.linaro.org/13.12/ubuntu/saucy-images/server/linaro-saucy-server-20131216-586.tar.gz
sudo tar zxvf linaro-saucy-server-20131216-586.tar.gz -C ./mnt
cd ./mnt
sudo mv binary/* .
sudo rm binary -fr
cd ..

Now we need to copy the kernel modules and firmware to our rootfs:

sudo mkdir ./mnt/lib/firmware
sudo cp -r rockchip-3.0/modules/lib/modules/3.0.36+/ ./mnt/lib/modules
sudo mkdir ./mnt/lib/firmware
sudo cp -r rockchip-3.0/firmware/* ./mnt/lib/firmware/

I’d like Ethernet to work at boot time with DHCP so I edit the relevant file:

sudo vi ./mnt/etc/network/interfaces

and add the two lines:

auto eth0
iface eth0 inet dhcp

If you’ve already referred to Radxa Rock Ubuntu wiki, at this stage they use qemu and chroot to install extra package, I’ll skip that part, because it can be done inside the board instead, and I came across some error with qemu when accessing the network:

apt-get update
0% [Working]
qemu: Unsupported syscall: 374
qemu: Unsupported syscall: 374
Err http://ports.ubuntu.com saucy

We still have one more step to create and enable a script to automatically detect the rootfs partition at boot time.

sudo vi ./mnt/usr/local/bin/mtd-by-name.sh

And copy the following to the file:

#!/bin/sh -e
# mtd-by-name link the mtdblock to name
# radxa.com, thanks to naobsd
rm -rf /dev/block/mtd/by-name/
mkdir -p /dev/block/mtd/by-name
for i in `ls -d /sys/class/mtd/mtd*[0-9]`; do
    name=`cat $i/name`
    tmp="`echo $i | sed -e 's/mtd/mtdblock/g'`"
    dev="`echo $tmp |sed -e 's/\/sys\/class\/mtdblock/\/dev/g'`"
    ln -s $dev /dev/block/mtd/by-name/$name
done

Make sure the script is executable and edit one of the startup script:

sudo chmod +x ./mnt/usr/local/bin/mtd-by-name.shsudo 
sudo vi ./mnt/etc/rc.local

And add the line below before exit 0:

/usr/local/bin/mtd-by-name.sh

We are done, let’s umount the rootfs:

sudo umount ./mnt/

I’ll upload my Ubuntu Saucy Server rootfs soon.  Download link for Ubuntu Saucy server rootfs: radxa_rock_ubuntu_server_saucy_20140127.img.xz (95.4 MB)

Flashing Ubuntu to Radxa Rock

Now that we’ve got boot.img and rock_rootfs.img, we are ready to flash Ubuntu to the board. If you’ve haven’t installed it already, install RKFlashKit, press the recovery button on Radxa Rock, start RkFlashKit, and flash boot.img and rock_rootfs.img respectively to “boot” and “linuxroot” partitions.
Flash_rootfs_radxa_rockClick on Reboot device, and you should be able to access the console via HDMI or the serial console.

Ubuntu Saucy Server Available RAM and storage

SSH is not installed, but you can call install dropbear or ssh if you want to access the board remotely:

apt-get update
apt-get install dropbear

You can now SSH the board with linaro user using the password: linaro.

We’ve got plenty of available RAM:

free -mh
             total       used       free     shared    buffers     cached
Mem:          1.8G       228M       1.6G         0B       7.9M       170M
-/+ buffers/cache:        49M       1.8G
Swap:           0B         0B         0B

But there’s only a 1GB flash partition usable with 409MB available.

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/mtdblock9 1008M  548M  409M  58% /
udev            924M   68K  924M   1% /dev
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            186M  264K  185M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            927M     0  927M   0% /run/shm
none            100M     0  100M   0% /run/user

However, there’s also a 4GB “user” partition:

cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00400000 00004000 "misc"
mtd1: 00800000 00004000 "kernel"
mtd2: 01000000 00004000 "boot"
mtd3: 02000000 00004000 "recovery"
mtd4: 04000000 00004000 "backup"
mtd5: 08000000 00004000 "cache"
mtd6: 40000000 00004000 "userdata"
mtd7: 00400000 00004000 "kpanic"
mtd8: 20000000 00004000 "system"
mtd9: 60000000 00004000 "linuxroot"
mtd10: 10c000000 00004000 "user"

We can mount it as follows:

sudo mkdir /mnt/user
sudo mount /dev/mtdblock10 /mnt/user

And get some extra space:

df -h
Filesystem       Size  Used Avail Use% Mounted on
/dev/mtdblock9  1008M  548M  409M  58% /
...
/dev/mtdblock10  4.2G  8.0K  4.2G   1% /mnt/user

But we’d still only get 5GB out of a 8GB NAND flash, and there’s not enough space on the rootfs to install a desktop environment.

Increasing Radxa Rock Ubuntu Rootfs Partition Size

Let’s see what can be done to get rid off useless Android partition, and get a 7GB rootfs.

First we need to modify the Android parameter file to change the MTD layout for linux (parameter-linux). Refer to the Android post to get the parameter files in rockdev directory.

cp ../radxa_rock_android/rockdev/parameter parameter-linux
vi parameter-linux

Edit parameter-linux as follow with only 2 partitions for boot.img and rock_rootfs.img (linuxroot):

FIRMWARE_VER:4.2.2
MACHINE_MODEL:radxa_rock
MACHINE_ID:007
MANUFACTURER:RADXA
MAGIC: 0x5041524B
ATAG: 0x60000800
MACHINE: 3066
CHECK_MASK: 0x80
KERNEL_IMG: 0x60408000
#RECOVER_KEY: 1,1,0,20,0
CMDLINE:console=ttyFIQ0 console=tty0 root=/dev/block/mtd/by-name/linuxroot rw rootfstype=ext4 init=/sbin/init initrd=0x62000000,0x00800000 mtdparts=rk29xxnand:0x00008000@0x00002000(boot),0x00E00000@0x00A000(linuxroot)

Now get the upgrade_tool (download link), enter recovery mode and flash the parameter file:

./upgrade_tool di -p parameter-linux

Start RkFlashKit again to flash boot.img and rock_rootfs.img again. This time, you should only see two partitions in the tools: boot and linuxroot.

However, the first time I tried to flash rock_rootfs.img, I got the following error message in RkFlashKit:

"Flash memory at 0x0000a000 is differnt from file!"

And after reboot, in the serial console, I got quite a few error message similar to:

FlashReadRetry error!!,row = 0

A low level format, before using RkFlashKit, and flashing the parameter file fixed the issue:

./upgrade_tool lf

You may want to run the command above first in any case, because flashing rock_rootfs.img takes nearly 30 minutes… If you do so, the low level format command must be done before flashing all other files in including the parameter, boot, and rootfs files.

After flashing is completed, reboot the board. You’ll notice the rootfs is still 1GB. Simply resize the EXT-4 partition:

resize2fs /dev/block/mtd/by-name/linuxroot

Let’s check:

root@linaro-server:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/mtdblock1  7.3G  546M  6.4G   8% /
udev            924M   84K  924M   1% /dev
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            186M  260K  185M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            927M     0  927M   0% /run/shm
none            100M     0  100M   0% /run/user

Yes! Success! The rootfs partition is 7.3 GB with 6.4GB available.

Installing LXDE or XFCE Desktop Environment

If you just plan to use Radxa Rock as a server, you are done, but if you want to run a desktop environment one more step is needed. Since there are no GPU Linux drivers in RK3188 based devices, installing Unity is probably a very bad idea and would lead to poor performance. Two other lightweight desktop environments are frequently used: LXDE in distributions such as Lubuntu or ALIP, or XFCE in distributions such as Xubuntu.

The good news is that installation is very easy, but it can take a few hours to download and install all required packages. So if you want to skip the part below, you can download the compressed rootfs with Xubuntu-Desktop to flash directly to your board.

Lubuntu (LXDE) requires 378 MB of archives and 1166 MB of additional disk space, and can be installed with the following command:

sudo apt-get install lubuntu-desktop

Xubuntu (XFCE) requires 452 MB of archives and 1370 MB of additional disk space, and can be installed with the following command :

sudo apt-get install xubuntu-desktop

I decided to install Xubuntu desktop, and it took 2 to 3 hours. I’ll upload my Ubuntu Saucy XFCE rootfs soon if you want to skip that part.

Once installation is complete we still have 4.5GB free, but somehow it used nearly 2GB additional space, instead of the 1370 MB promised.

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/mtdblock1  7.3G  2.5G  4.5G  36% /
udev            924M   84K  924M   1% /dev
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            186M  296K  185M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            927M     0  927M   0% /run/shm
none            100M     0  100M   0% /run/user

At boot time, you get the the login screen (use “linaro” user with “linaro” password), and the system is very usable. I’ve opened several programs including Gimp, Firefox, Abiword, a terminal window, a game, a music player, and more (See screenshot below), and  everything runs pretty smoothly. Stability may need to be improved however, since I’ve got one random reboot as I accessed SAMBA shares. I could not reproduce the issue.

Xubuntu in Radxa Rock (Click for Original Size)

Xubuntu in Radxa Rock (Click for Original Size)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

LinuxCon North America 2013 Schedule

August 6th, 2013 1 comment

LinuxCon (North America) 2013 will take place on September 16 – 18, 2013 in New Orleans, LA. The event will be co-located with several other conferences: the Linux Plumbers Conference, the Xen Project User Summit, the OpenDaylight Mini-Summit, the Gluster Workshop 2013, the UEFI Plugfest, the Linux Wireless Summit, the Linux Security Summit, and CloudOpen 2013.

LinuxCon consists of 3 days of keynotes, and legal, operations, and developers related sessions as well as tutorials and workshops. There will be around 150 sessions and keynotes during those 3 days. I’ve gone through developer sessions and selected one for each time period.

Linuxcon_2013

Monday, September 16

UEFI has become ubiquitous on the PC client systems and is coming up on servers and ARM-based systems, it is becoming the converged firmware infrastructure. UEFI Secure Boot feature has attracted a lot of attention from the Linux community. Linux distros and Linux Foundation have found solutions.  This presentation provides a review of the motivations behind the creation of the UEFI technology, the history, the current status, and the future. It provides an update on the new significant developments since the publication of UEFI Spec v2.3.1C last June. It also serves as a venue for Q&A with the Linux community.

The LLVM project is an extensive compiler technology suite which is becoming commonplace in many industries. Technology built with LLVM is already shipped in millions of Linux devices as a part of Android/Renderscript. Increasingly it is becoming a big part of the development process for embedded projects, all the way up through to high performance computing clusters. This session will provide an update on the status of the LLVMLinux project; a project which is cooperating with both the Linux kernel and LLVM communities to build the Linux kernel with Clang/LLVM.

Memory compression has long been a topic confined to academic research and development sandboxes. However, with CPU and memory speed improvements outpacing improvements in I/O speed and latency, memory compression is now being deemed a viable way to increase in-memory data density and delaying or avoiding costly I/O.  Zswap, a feature for compressed swap caching, merged into the kernel in v3.11, is a first step toward deploying this functionality in the Linux kernel.

This presentation targets users who own hardware with maxed-out RAM capacities or pay per-GB for RAM usage (IaaS customers) and would like to determine if memory compression can reduce their costs and extend the useful lifetime of their computing assets.

This presentation will cover a brief introduction on how the Bluetooth Low Energy technology works. Then it will present the current status of its support on Linux, presenting the available APIs and how to interact with Bluetooth Smart devices, including the profiles we’re currently working on, and what can be expected to be finished in the near future. There will be also a few demos of Bluetooth Smart devices working with Linux.

With the Linux kernel now supporting NFC, a natural step forward seems to be enabling mobile payments, either cloud or NFC based. To do so we need to give payment applications access to secure elements, via the kernel. At the moment, both the secure element kernel interface and a generic secure element library are missing from any standard Linux distribution, effectively keeping Linux away from the mobile payments market. We will first go through a brief tour of the mobile payments ecosystem and see how it is actually implemented. Then we will describe the proposed kernel APIs for discovering, enabling and talking to secure elements. Finally we will discuss about the possible options for bringing a hardware agnostic secure element library to standard Linux distributions, and how it could be used to implement payment applications on Linux.

Tuesday, September 17

Linaro’s open source automated validation architecture (LAVA) enables developers to test their software on a broad range of hardware platforms. This presentation will describe to developers how they can utilize LAVA to test and validate kernels on real or emulated hardware. This session will showcase a new lightweight interface for testing kernels efficiently, and displaying test results. The goal being that we as developers can leverage automation to ensure that the Linux kernel is well tested and that each iteration becomes more robust than the last

Mobile processors are at the heart of hundreds of devices built on the Linux kernel, but are also being implemented in other Linux-compatible embedded systems. For the Linux community, it’s inevitable that challenges will arise when developing and pinpointing the origin of issues can be a setback. Leon will talk about tools that enable developers to test and refine systems and applications for these powerful mobile processors so the software runs pristinely when launched.

The target audience for this session is software developers, mobile and beyond. Developers can expect to learn how to test and fine tune applications across embedded systems to be not only be functional and problem free, but also visually enticing, battery efficient and packed with cutting-edge features.

With raising popularity of Linux on mobile devices the shortcomings of the default kernel memory management policies become more and more visible. The combination of limited physical memory and lack of swap device brings a challenge in the most efficient use of the available resources. This presentation will give an overview of the current state of improvements (i.e. memory control groups, per-process/group reclaim, memory compression) to the Linux memory management subsystem that together with the cooperating user-space components allow more custom control of the memory available in the system. The usage examples of specific features will be based on Tizen operating system.

This talk is intented mainly at kernel and distribution developers wishing to improve Linux memory management but it may be interesting to whoever would like to know more about the topic.

The Tux3 filesystem project began in 2008 and has now reached a point where it is beginning to show favorable benchmark results compared to other Linux filesystems. Tux3 breaks new ground in Linux filesystem technology with its strong consistency semantics, novel high performance atomic commit and asynchronous frontend/backend design that maps well to the new generation of multi-core CPUs. Tux3 is expected to reach a mergable state in the next few months. Much work remains to be done, including incorporating versioning and replication support, improved filesystem checking and repair facilities, enterprise features such as quotas and end to end checksumming, and availability features such as online checking and repair. In this talk, Daniel Phillips, designer of Tux3, will discuss current implementation status, present benchmark results and lay out plans for kernel merge and beyond.

Software Freedom Conservancy announced last year a renewed effort for cross-project collaborative GPL compliance efforts, including copyright holders from BusyBox, Linux, and Samba. Conservancy uses an internal system of communication and collaboration to take input from stakeholders to discuss and engage in compliance activity to ensure compliance with the GPL throughout the technology industry and particularly in the embedded device market.  Compliance with the GPL is the responsibility of copyright holders of the software, and Conservancy helps those copyright holders pursue the work, so those developers can focus on coding. In this talk, the Executive Director of Conservancy will discuss how Conservancy handles compliance matters, what matters it focuses on, and how the copyright holders that work with Conservancy engage in a collaborative effort to ensure compliance with the GPL.

Wednesday, September 18

The Linux Kernel is currently supported on over 30+ different hardware architectures. This is a huge benefit for Linux adoption on a wide range of deployments. However, the ability to build and test Linux kernels on all possible supported architectures requires having access to such test systems for each of these architectures which is not easy by any means. Therefore, the ability to cross-compile non-native architectures on an architecture that is widely supported such as the x86_64 helps address the building kernels part of the problem.

This talk will present the details of where to find cross-compilers packages for architectures, how to install them, and how to automate compile on each of these architectures on an x86 system. This talk will be of great benefit to any software developer trying to build and test Linux kernel on non-native hardware architecture.

As ARM and ARM64 move out of gadgets and into more PC like hardware, there has been an increasing demand for the same tools to manage these devices as already exists in x86 world. Linaro has been working on UEFI and ACPI on arm/arm64 hardware and this talk is a summary of the current status of the work and the direction that will be taken in the future. We will show the areas of change to the ARM platform boot sequence, change to the ACPI core code, and change to drivers to support ACPI.

The Linux kernel contains multiple energy-saving features. Some of them act on the system as a whole while the others are concerned with individual processors or I/O devices. The majority of them have been developed in isolation and they work reasonably well individually, but that is often insufficient to address problems related to the progressing integration of hardware and growing user expectations. For this reason, it will be necessary to make them work more closely together and he’s going to talk about that in his presentation.  Rafael will describe the current status of the kernel’s energy-saving features, the most important problems they are facing and some possible ways to address those problems

This session is a BoF session organized by LTSI (Long Term Support Initiative) to discuss testing for Linux kernel. Testing is very important when delivering software, validating changes, shipping products and so on but actually each individual is doing its own testing and that are not shared with others. This BoF would like to discuss how to share testing, what is the common testing portion and so on.

Those are just a few choices, and you can check the full schedule to find out which sessions suit you best.

You can register to LinuxCon 2013 and CloudOpen 2013 online for the following fees:

  • US$475 through May 3rd (Early Bird)
  • US$575 May 4th through July 31st (Standard)
  • US$675 thereafter (Late)
  • Student Registration – $150

Fees are up between 11% to 50% compared to last year. Who said there’s no inflation?

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Wandboard Dual Unboxing and Quick Start Guide

February 21st, 2013 19 comments

I’ve just received Wanboard Dual development board together with an enclosure, and Wi-Fi antenna. This board is powered by Freescale i.MX6 Duallite Cortex A9 processor, and comes with 1GB RAM, HDMI output and Ethernet. There’s also a version based on Freescale i.MX6 Solo with 512 MB RAM. You can refer to my earlier post for more detailed specifications. I’ll start by showing some unboxing pictures of the board, and write a quick start guide (casing assembly, Ubuntu & Android boot, and development). I also planned to run some benchmarks and test videos, as according to a poll on Wandboard website many people want to use it as a media player, but I’ll do that a bit later since the current Android image is not up to the task yet.

Wandboard Dual Unboxing

The package I received contained 3 boxes: one for Wandboard Dual board, one for the enclosure, and one for the Antenna. The complete kit below should cost around $120, and Wandboard has distributors worldwide. Prices vary so make sure you shop around.

Wandboard_Dual_Casing_Wi-Fi_Antenna_Packages

Inside those packages, you’ll find the Wandboard Dual board, the casing and screws, and the Wi-Fi antenna with a cable to connect it to the Wandboard Dual SoM.
Wandboard_Dual_Casing_Wifi-Antenna

Let’s have a closer look at the board. The top of the board features all the ports (further described below). A SATA connector is included but none of the Freescale SoM (Solo and Duallite) provided with the Wandboard can support it.

Wandboard Top (Click to Enlarge)

Wandboard Top (Click to Enlarge)

At the bottom of the board, there’s an EDM compatible SoM with the Freescale Processor, the RAM chipsets, an internal microSD slot (for the OS), a camera connector, as well as the Wi-Fi module (Dual version only). There’s also a reset button and 4 expansion pin headers at the bottom of the baseboard.

Wandboard Dual Bottom (Click to Enlarge)

Wandboard Dual Bottom (Click to Enlarge)

I’ve take some pictures on the side of the board to have a close look at the ports accessible on the Wandboard.
Wandboard_Ports

From left to right, top to bottom we’ve got:

  • Serial connector (DB9), digital line OUT, digital line IN, microphone, and S/PDIF
  • HDMI, Gigabit Ethernet, and 5VDC Jack
  • USB OTG, microSD slot (for applications/data) and USB Host (USB 3.0 Connector, but only USB 2.0 is supported by Freescale SoM)

One of the advantage of the Wandboard is that it’s comprised of a baseboard and a system-on-module (SoM) which are based on the EDM standard. This means, at least in theory, that you could remove the SoM, and replace it by another EDM Compact SoM (85x60mm). I’ve seen some people interested in upgrading their board to “Wandboard Quad” by replacing the provided SoM with Technexion EDM1-CF-iMX6 Quad SoM.

Wandboard Baseboard with EDM Connector

Wandboard Baseboard with EDM Connector

I’ve removed the 4 screws to remove the EDM-IMX6 SoM.

Wandboard EDM-IMX6 SoM (Click to Enlarge)

Wandboard EDM-IMX6 SoM (Click to Enlarge)

On the back of the module, you’ve got 2 more RAM Chips, Atheros AR8031 (Gb Ethernet), and lots of markings. If you want to connect the Wi-Fi antenna, the (golden) connector is just on top of the Wi-Fi module, and right of the microSD slot in the picture above.

Wandboard Quick Start Guides

Casing Assembly

Putting the enclosure and the board together, is extremely easy. Align the board with the top of the case, cover it with the bottom, insert and tighten the 4 screws and you’re done.

Wandboard_Casing2
You’ve got yourself a nice looking box. There are 2 issues however. The first and most important is that the connector for the Wi-Fi antenna faced the bottom of the enclosure, so it’s impossible to connect the Wi-Fi antenna and use the enclosure at the same time (Wi-Fi should still work without antenna though), unless you drill a small hole at the bottom of the casing. [Update: Wandboard posted the instructions to assemble the enclosure with the Wi-Fi antenna. This involves using a cutter, but it still looks neat]. The second, which is less a problem, is that the OS is stored in the internal microSD, so each time you need to update the OS, you’ll have to open the casing. It would have been a bit more convenient to be able to use the external microSD as well.
Wandboard_Dual_Casing

Installing and Running Android in Wandboard

I’ll provide the instructions for a Linux PC, but it’s also possible to do with Windows, and Win32DiskImager (Included in the images). First Download and unzip Android Jelly Bean (Early Preview) for the Wandboard Dual in your PC:

wget http://www.wandboard.org/images/downloads/android-4.1.2-wand-dual-20130207.zip
unzip android-4.1.2-wand-dual-20130207.zip

You’ll get three files:

  • android-4.1.2-wand-dual-20130207.img – Android Jelly Bean Image for Wanboard Dual
  • android-4.1.2-wand-dual-20130207.txt – Release notes
  • win32diskimager.zip – Disk imager utility for Windows.

Now insert a 4GB (or more) microSD card into your PC, and copy the image with dd or dd.sh:

sudo dd.sh if=android-4.1.2-wand-dual-20130207.img of=/dev/sdc

You’ll have to replace “/dev/sdc” by your microSD card device. You can check by running  sudo blkid.

Insert the microSD card in the internal microSD slot, connect the HDMI connector to your TV, connect Ethernet, a keyboard and mouse via a USB hub, and power the board with a 5V/2A power adapter. After about 2 minutes the boot should be complete, and you should get to the lock screen.

Wandboard_Android

According to the release notes files, wifi, bluetooth, adb, usb gadget and uvc cam are not working in Android yet. HDMI might fail to setup audio rate, and there’s no Setup menu for Ethernet (only dhcp will work). Ethernet works, but there’s no Google Play or file manager, and copying apks into /system/app did not install them automatically. I’ll do more testing once another Android image is available.

Installing and Running Ubuntu 11.10 in Wandboard

Thep rocedure for Ubuntu is very much similar to the one for Android. Get the image, uncompress it, and copy it to a 4GB (or greater) microSD card.

wget http://www.wandboard.org/images/downloads/ubuntu-11.10-wand-dual-20130208.zip
 unzip ubuntu-11.10-wand-dual-20130208.zip
 sudo dd.sh if=ubuntu-11.10-wand-dual-20130208.img of=/dev/sdc

Insert the microSD in the Wandboard, make sure everything is connected, and power on the board. The boot will take a while, and the screen will stay black for about 1m20, then you’ll see a gray background and the mouse pointer, but it will only become usable after 3 minutes (From power on to Unity desktop).

Ubuntu 11.10 in Wandboard (Click to Enlarge)

Ubuntu 11.10 in Wandboard (Click to Enlarge)

As with most other ARM systems, Ubuntu feels really slow to use, mostly because of the I/O on the microSD card, and I suppose Unity is also part of the sluggishness, so using another desktop environment (e..g LXDE) should help with performance. I’ve also tried es2gears just in case GPU acceleration would magically work, but it’s still using software rendering, which is the same issue as with other Freescale i.MX6 devices at the moment. VPU should work, but since there appears to be a lot of fancy things to do with gstreamer, I’ll write a separate post about video playback on Freescale i.MX6 platforms. If you’re planning to use the board as an embedded platform (e.g. for automation), a Yocto Project build is in the work.

Wandboard SDK and Kernel Build

Wandboard developers eventually intend to release the source code in a public repository, but in the meantime, u-boot and linux source code is available as a tar file, which also contains binaries (precompiled kernel, kernel modules, u-boots and patchram util), firmware (for VPU, Bluetooth and WiFi), tools and documentation like SD card layout.

Download and extract the SDK:

wget http://www.wandboard.org/images/downloads/wandboard-sdk-20130208.tar.xz
tar xvf wandboard-sdk-20130208.tar.xz

You can build the kernel and modules (for Linux/Ubuntu) by following the steps below, assuming the toolchain is already installed:

cd wandboard-sdk-20130208/linux-3.0.35-imx6-wand
cp wandboard_ubuntu_defconfig arch/arm/configs/
make ARCH=arm wandboard_ubuntu_defconfig
make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage
make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=../modules

Now that the build is complete, copy uImage and the modules to the microSD card with

Ubuntu, and umount it: sudo dd if=arch/arm/boot/uImage of=/dev/sdc bs=1M seek=1
cp ../modules/lib/modules/3.0.35/ /media/<rootfs_mount_point>/lib/modules -rf
sudo umount /dev/sdc1

Insert the microSD card in the Wandboard, it should boot Ubuntu, and can verify the kernel is the one just you built by displaying the build date with uname:

linaro@wandboard:~$ uname -a
Linux wandboard 3.0.35 #3 SMP PREEMPT Thu Feb 21 18:41:10 ICT 2013 armv7l armv7l armv7l GNU/Linux

Ideally you should connect a null modem cable or DB9 serial to USB cable to access the serial console for bootloader and kernel debugging, but since I don’t have one of those, I haven’t tried.

If you have any questions or technical issues with the Wandboard, you can get support on Wandboard Google Group. Header pins description and schematics are available in Wandboard User’s Manual.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

U-boot, Linux Kernel, and Android Patches for Freescale i.MX6 HDMI TV Dongles

February 6th, 2013 36 comments

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:

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:

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:

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:

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:

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:

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:

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:

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:

source build/envsetup.sh
lunch

Build Freescale imx6 hdmidongle lunch menu

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:

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:

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:

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:

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:

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:

#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.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Raspberry Pi Now Has Experimental Support for VP6, VP8, MJPEG and Ogg Theora Video Codecs

January 26th, 2013 8 comments

The guys working on the Raspberry Pi (mainly dom) have added preliminary support for VP6, VP8, MJPEG, and Ogg Theora free video codecs, as well as Ogg Vorbis audio codec. Unlike H.264, MPEG-2 and VC1, those are not handled by the hardware video decoder in Broadcom BCM2835 processor, but are accelerated by the Videocore GPU. This means that only SD (and possibly 720p) videos are supported for those codecs.

480p VP8 Video Playback in the Raspberry Pi

480p VP8 Video Playback in the Raspberry Pi

The best way to get support is probably to patiently wait for the Raspberry Pi foundation to release a new Raspbian image, but in case you couldn’t possibly wait, here are the steps to follow:

  1. Download and run Hexxeh’s rpi-update script in the Raspberry Pi in order to get the very latest build:
    wget https://github.com/Hexxeh/rpi-update/raw/master/rpi-update
    chmod 755 rpi-update
    sudo ./rpi-update
  2. Add the following two lines to /boot/config.txt:
    start_file=start_x.elf
    fixup_file=fixup_x.elf
  3. Reboot the Raspberry Pi
  4. The GPU firmware is now updated, but you still need the latest version of omxplayer. You  have two choices:
    1. Wait for the next build to be available on http://omxplayer.sconde.net/ (should be there in a few days).
    2. Build it yourself.
  5. I chose number 2 :). We’ll cross-compile omxplayer since we don’t have all day (and maybe more). First get the Rpi toolchain in a Linux build machine (Ubuntu 12.04 64-bit in my case):

    mkdir -p /usr/local/bcm-gcc
    pushd /usr/local/bcm-gcc
    sudo git clone git://github.com/raspberrypi/tools.git
    export PATH=$PATH:/usr/local/bcm-gcc/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
    popd

  6. We need a root file system for the build. Since we may need to install missing packages, I’ll run an NFS server in the Raspberry Pi and access the rootfs via NFS. So let’s configure the Raspberry Pi as a NFS server first:
    sudo apt-get install nfs-kernel-server nfs-common rpcbind
    sudo dpkg-reconfigure rpcbind
    sudo /etc/init.d/rpcbind restart

    Then edit /etc/exports as root (sudo) and add the line:

    / 192.168.0.0/24(rw,no_root_squash,async,no_subtree_check)

    Then restart the NFS server

    sudo /etc/init.d/nfs-kernel-server restart
    sudo exportfs -a
  7. Now let’s mount the NFS share in the build machine:
    mkdir ~/edev/rpi/nfs
    sudo apt-get install nfs-client
    sudo mount -t nfs 192.168.0.107/ ~/edev/rpi/nfs
  8. Let’s retrieve omxplayer source code:
    git clone git://github.com/huceke/omxplayer.git
    cd omxplayer
  9. Modify Makefile.include as follows:
    USE_NFS=1
    FLOAT=hard
    ifeq ($(USE_NFS), 1)
    NFSROOT :=/home/jaufranc/edev/rpi/nfs
    SDKSTAGE :=$(NFSROOT)
    TARGETFS :=$(NFSROOT)
    TOOLCHAIN :=/usr/local/bcm-gcc/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian
    HOST :=arm-linux-gnueabihf
    SYSROOT :=$(NFSROOT)
    else
    BUILDROOT :=/home/jaufranc/edev/rpi/bcm-rootfs
    SDKSTAGE :=/home/jaufranc/edev/rpi/bcm-rootfs
    TARGETFS :=/home/jaufranc/edev/rpi/bcm-rootfs
    TOOLCHAIN :=/usr/local/bcm-gcc/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi
    HOST :=arm-bcm2708hardfp-linux-gnueabi
    SYSROOT :=$(TOOLCHAIN)/tools/arm-bcm2708hardfp-linux-gnueabi/sysroot/
    endifJOBS=8CFLAGS := -isystem$(PREFIX)/include
    CXXFLAGS := $(CFLAGS)
    CPPFLAGS := $(CFLAGS)
    LDFLAGS := -L$(BUILDROOT)/lib
    LD := $(TOOLCHAIN)/bin/$(HOST)-ld –sysroot=$(SYSROOT)
    CC := $(TOOLCHAIN)/bin/$(HOST)-gcc –sysroot=$(SYSROOT)
    CXX := $(TOOLCHAIN)/bin/$(HOST)-g++ –sysroot=$(SYSROOT)
    OBJDUMP := $(TOOLCHAIN)/bin/$(HOST)-objdump
    RANLIB := $(TOOLCHAIN)/bin/$(HOST)-ranlib
    STRIP := $(TOOLCHAIN)/bin/$(HOST)-strip
    AR := $(TOOLCHAIN)/bin/$(HOST)-ar
    CXXCP := $(CXX) -E

    PATH := $(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(PATH)
    CFLAGS += -pipe -mfloat-abi=$(FLOAT) -mcpu=arm1176jzf-s -fomit-frame-pointer -mabi=aapcs-linux -mtune=arm1176jzf-s -mfpu=vfp -Wno-psabi -mno-apcs-stack-check -O3 -mstructure-size-boundary=32 -mno-sched-prolog
    LDFLAGS += -L$(SDKSTAGE)/lib -L$(SDKSTAGE)/usr/lib -L$(SDKSTAGE)/opt/vc/lib/
    INCLUDES += -isystem$(SDKSTAGE)/usr/include -isystem$(SDKSTAGE)/usr/include/arm-linux-gnueabihf -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SYSROOT)/usr/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads -isystem$(SDKSTAGE)/usr/include/freetype2

    You’ll need to change NFSROOT variable to where you mounted the NFS share.

  10. We’re now ready to cross-compile omxplayer:
    make ffmpeg
    make -j8
    make dist

    This will create a omxplayer-dist.tar.gz that you can copy in the Raspberry Pi:

    sudo cp omxplayer-dist.tar.gz ~/edev/rpi/nfs/

    There may be missing dependencies during the build. If it’s the case, you need to install some development package in the Raspberry Pi. Refer to my “How-to fix common build error tutorials“, if the build fails.

  11. Back to the Raspberry Pi, let’s install it:
    cd /
    tar xzvf omxplayer-dist.tar.gz
    cd omxplayer-dist
    sudo cp * / -rf

That’s all. Now we can try the files tested by dom:

e.g.: omxplayer big_buck_bunny_trailer_480p

The VP8 and Ogg Theora videos played very smoothly, but I just got a black screen for VP6 and MJPEG videos. since it could not detect the video stream. The firmware has been fixed for VP6 support, and omxplayer for MJPEG support, so all 4 files can now play.

If you don’t want to build omxplayer by yourself, you can download the binary I’ve built: omxplayer-dist.tar.gz.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter