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

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
cd ../../broadcom/drivers
tar xvf ../../../../brcmap6xxx-2014-03-06-302aca1a31.tar.gz
mv brcmap6xxx-ap6xxx ap6xxx
cd ../../../arm
tar xvf ../../gpu-2014-03-06-0425a1f681.tar.gz
mv gpu-r3p2-01rel3 gpu
cd ..
tar xvf ../../aml_tvin-2014-03-06-fb3ba6b1c8.tar.gz 
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.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

Radxa ROCK 5C (Lite) SBC with Rockchip RK3588 / RK3582 SoC

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

  1. Harley :
    Nothing about Android 4.4 (KitKat) SDK, kernel, or other source code yet?

    Aml never released any of its full sources, you have to sign SLA with them for that. However, on their openlinux they claim kitkat and its kernel (3.10) also supports MX g18ref board, but I cant confirm that, these files still downloading (poor speed) and dont have yet access to kitkat repository. 4.3 didn’t have MX support.

  2. @Harley
    The kernel I’ve built in this post is for Android. (CONFIG_ANDROID=y).
    I doubt they release the Android SDK, because they don’t have to (Apache license).
    But as far I can see they’ve released pretty much everything, except the Android SDK. We have to see if it can work on actual hardware. Their code will only work on their development kit, which we can’t buy, so people will still have to modify the code themselves, unless the manufacturers release the code for their devices.

  3. Github mirror, except for wifi-fw – https://github.com/Stane1983/amlogic-mx-m8

    As mentioned, these sources are taken from full droid source tree. everything in kernel/hardware folder should be outside of kernel folder or Kconfig and Makefiles have to be modified. There is good chance that kernel will work with MX also as it has meson6_defconfig and device tree files for g18, g24, g33 and g35 boards.

  4. There is mali r4p0-01 driver in buildroot
    but they have two separate r3p2-01re3 drivers for mali 400 and 450
    and some driver called r3p2-EAC

    there is also amlogic all player 🙂 libplayer for m3,m6, m8

    and they made gstreamer 0.10/0.11 plugins.

  5. Hi people! I’m new to Android source and I was investigating on compiling the source for my tvbox (AML8726-MX based, Gbox Midnight MX2). I see Amlogic’s Openlinux website has Kitkat available for this, but as mentioned I need to be granted access to it. Isn’t there any other way to get it?

  6. Thanks for your work! I have compile the kernel, but found two thing:

    1.The 3.10.10 kernel doesn’t support sd cardreader at present? There was cardreader support in 3.0.50. But one line (related to cardreader) was commented out in drivers/amlogic/Kconfig. I tried to uncomment it, but get error when compiling.

    2.I turn on the CONFIG_AMLOGIC_USB, but still get no usb support.(that means, when I plug a usbstick, there is no message in dmesg, and no device such as /dev/sda).

    Thanks for your time!

  7. @Riaqn
    Forget to mention, the usb support problem is in 3.0.50 as well. But since with 3.0.50 kernel I can use sd card as rootfs, that’s not a big problem. But as in 3.10.10, there is no sd card support as well as usb support, I can boot from nowhere.

  8. @Riaqn
    I’ve just tried a USB flash drive, and I can mount it. (/dev/sda1)
    Same for the micro SD card (/dev/mmcblk0p1).

    Are you sure you’ve got the right DTD file?

  9. @cnxsoft
    Ok, by googling I found this page http://superuser.com/questions/736500/what-is-a-u-boot-dtb-file-and-how-do-i-use-it-beagleboard-xm . So I think dtd(dtb?)file is the file from uboot to tell the kernel “where to communicate with hardware”. Am I wrong?

    Now the problem is, I compile the kernel by a script (mk_m6.sh), and it read:

    make meson6_skt.dtd
    make meson6_skt.dtb

    #cd ../root/g18
    #find .| cpio -o -H newc | gzip -9 > ../ramdisk.img

    #rootfs.cpio — original buildroot rootfs, busybox
    #m8rootfs.cpio — build from buildroot
    ROOTFS=”rootfs.cpio”

    #cd ..
    ./mkbootimg –kernel ./arch/arm/boot/uImage –ramdisk ./${ROOTFS} –second ./arch/arm/boot/dts/amlogic/meson6_skt.dtb –output ./m6boot.img
    ls -l ./m6boot.img
    echo “m6boot.img done”

    Is this right? Do I have to modify something?

    Thanks for your time!

  10. @cnxsoft
    Thanks for your reply! I ‘ve tried your method, but get sad result:

    ➜ MBX ../split_bootimg.pl boot.img
    Page size: 2048 (0x00000800)
    Kernel size: 3407417 (0x0033fe39)
    Ramdisk size: 1050638 (0x0010080e)
    Second size: 0 (0x00000000)
    Board name:
    Command line:
    Writing boot.img-kernel … complete.
    Writing boot.img-ramdisk.gz … complete.

    There ‘s only two files, no “second file”……

  11. @Riaqn
    That’s because the firmware is using 3.0.50, right?
    So there’s no device tree file. By the way DTS/DTD are text files, and DTB is the compiled binary. I’m not 100% sure of the difference between DTS and DTD. I guess DTS and DTSI define different subset, and DTD defines all that in one and only file.

    Anyway, back to your issue. I guess your USB ports and SD card are not working because the pin assignment are wrong. If you don’t have firmware with kernel 3.10 and the device tree file, it’s a bit more complicated as you need to reverse engineer the DTD file in the source tree. Start with a similar hardware (meson6_something.dtd), look at the kernel log of a working Android firmware, and try to find which pins are used. If you may also need to check the board to find out where the right pins are with multimeter / oscilloscope…

  12. @cnxsoft
    Yes, the firmware is 3.0.x. I also found a page related to my issue http://superuser.com/questions/740322/how-do-i-get-usb-devices-working-with-beagleboard-xm-and-yocto-project-linux
    This guy ‘s problem is just the same as mine. But he solved the problem by just deleting the ‘second file’, and I failed. I tried to generate a boot.img without a ‘second file’:
    ./mkbootimg –kernel ./arch/arm/boot/uImage –ramdisk ./rootfs.cpio –output ./m6boot.img
    but this img cannot be booted. It will hang on ‘starting kernel…’ after u-boot tried to boot it.
    And I even have tried to boot the uImage directly, and it hangs as well.

    BTW, is the ‘ramdisk’ that used to generate the boot.img related to the rootfs that I try to boot in? Since I found two lines in mk_m6.sh:

    #rootfs.cpio — original buildroot rootfs, busybox
    #m8rootfs.cpio — build from buildroot

    But I ‘m not using ‘busybox’, I ‘m using a complete rootfs(gentoo stage3, in fact), is that related to my issue?

    Thanks for your time!

  13. @Riaqn
    My guess is that:
    With Linux 3.0.5, the board file does not correspond to your hardware.
    With Linux 3.10, the device tree file does not correspond to your hardware.

    So funny things happen. So you may have to modifies the source code with 3.0.5, or modify a DTD fie with 3.10.

  14. @cnxsoft
    I did some work and found some interesting things.
    I boot the official android firmware(boot.img), and capture the kernel log: http://bpaste.net/show/275140/
    Note the 5th line:
    [ 0.000000@0] Machine: Amlogic Meson6 g02 customer platform

    It give me some information, so I do a find in the kernel source directory

    find . -name “*meson6_g02*”

    and it gives:
    ./customer/configs/meson6_g02_d9_usb_burning_defconfig
    ./customer/configs/meson6_g02_d7is_ap6330_defconfig
    ./customer/configs/meson6_g02_d7_defconfig
    ./customer/configs/meson6_g02_d8_defconfig
    ./customer/configs/meson6_g02_d7i2_defconfig
    ./customer/configs/meson6_g02_d7is_defconfig
    ./customer/configs/meson6_g02_defconfig
    ./customer/configs/meson6_g02_826ds_defconfig
    ./customer/configs/meson6_g02_usb_burning_defconfig
    ./customer/configs/meson6_g02_d9_gps_defconfig
    ./customer/configs/meson6_g02_dongle_defconfig
    ./customer/configs/meson6_g02_jb42_defconfig
    ./customer/configs/meson6_g02_d9_defconfig
    ./customer/configs/meson6_g02_dongle_usb_burning_defconfig
    ./customer/configs/meson6_g02_recovery_defconfig

    so it isn’t ‘meson6_defconfig’, it should be:

    make ARCH=arm meson6_g02_defconfig

    but then it tells me ‘no rules to make the target’, since the config files is not included(sourced) by any other file. Then what should I did?

    Thanks for your patience!

  15. @Riaqn
    Or try to find if your hardware is already supported by XBMC Linux, then somebody must already have done the hard part. Actually if you don’t need to modify the kernel, you could always try with the boot.img from your Android firmware. Some permissions issues (e.g. network) may occur, but solutions can probably be found on the net.

  16. @cnxsoft
    I need to modify the kernel since I need the “nfs server” feature, I even want it to be up-to-date, since the nfsv4 support is experimental in 3.0.50, but stable in 3.10.10…
    There ‘s a XMBC for aml8726-mx (http://forum.xda-developers.com/showthread.php?t=2418029) but I haven’t tried it yet, and as I say above, I need to modify the kernel anyway…

    Maybe I should buy a atom board and play, and throw all these arm sh*t away…

  17. I’m trying to compile the latest release (2015-01-15) on Ubuntu 14.04.2 for S805. The extraction of archives seem to be the same as described here, but I get a number of compilation errors that do not seem related to problems with the directory structure (errors with regards to code loops and optimization – -Werror=aggressive-loop-optimizations, e.g. in the 8188eu). I’m using the Ubuntu repo version of arm-linux-gnueabihf-gcc (version 4.8.2). Is this the correct compiler to use for this kernel release?

  18. @Bobby
    Thought I’d reply to my own comment: You have to use the old gnueabihf-gcc from the amlogic website (The 4.7.3 Linaro prerelease version). Then the kernel and modules compile.

  19. @Bobby any luck with that.. i’m cross-compiling the kernel for the S802 with the rlease_default settings from AMLogic buildroot settings …

Leave a Reply

Your email address will not be published. Required fields are marked *

Boardcon Rockchip and Allwinner SoM and SBC products
Boardcon Rockchip and Allwinner SoM and SBC products