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…
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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:
1 2 3 |
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:
1 2 |
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:
1 |
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
1 |
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 endCC 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:
1 2 3 4 5 6 |
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:
1 2 |
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.
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
Nothing about Android 4.4 (KitKat) SDK, kernel, or other source code yet?
It’s amlogic, what do you expect…
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.
@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.
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.
No meson3 support?
@anonymous
Nope
Kernel mentioned here patched to version 3.10.22 and booting on Visson ATV-102s device: http://pastebin.com/Z1sZv5gk
Another news
they also release buildroot
http://openlinux.amlogic.com:8000/download/ARM/filesystem/
Except two backtraces and we are ready to go 🙂
@m][sko
and new kernel
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.
btw latest kernel from amlogic page is old 3.0.50
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?
How would I get Linux running on my M8 with these files?
@Alain Theriault
See http://www.cnx-software.com/2014/05/12/how-to-extract-a-device-tree-file-from-android-firmware-files/#comment-191034
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!
@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.
@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?
@Jean-Luc Aufranc (CNXSoft)
Thanks for reply so fast! I ‘m quite new to kernel on arm. What is DTD file?(I ‘m sorry if it sound stupid).
@Jean-Luc Aufranc (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… Read more »
http://www.cnx-software.com/2014/05/12/how-to-extract-a-device-tree-file-from-android-firmware-files/ may help…
@Jean-Luc Aufranc (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”……
@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… Read more »
@Jean-Luc Aufranc (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… Read more »
@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.
@Jean-Luc Aufranc (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… Read more »
@Jean-Luc Aufranc (CNXSoft)
Well, both approach is too hard to me… slim hope, right?
@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.
@Jean-Luc Aufranc (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…
Hi guys,
What’s in this folder actually?
http://openlinux.amlogic.com:8000/download/ARM/kernel/m3-2014-10-24-2df67b532a/
It should be the Linux kernel for AM8726-M3 single core processor.
@Jean-Luc Aufranc (CNXSoft)
That’s what I’m looking for. I wish I could build an image for the AM8726-M3 so I can bring back my old DVBS-2 STB alive.
new AML Kernel Release 2015:
http://openlinux.amlogic.com:8000/download/ARM/kernel/arm-src-kernel-2015-01-15-321cfb5a46.tar.gz
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?
@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.
@Bobby any luck with that.. i’m cross-compiling the kernel for the S802 with the rlease_default settings from AMLogic buildroot settings …
I am really trying to get this compile, but getting errors during the uboot-custom compiling