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:


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:


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:


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:


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


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:


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


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.

Support CNX Software - Donate via PayPal or become a Patron on Patreon

42
Leave a Reply

avatar
40 Comment threads
2 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
15 Comment authors
JeffnjasmBobbyBobbyemanuel Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Harley
Guest
Harley

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

dekswizard
Guest
dekswizard

It’s amlogic, what do you expect…

Stane1983
Member

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.

Stane1983
Member

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.

anonymous
Guest
anonymous

No meson3 support?

Stane1983
Member
Stane1983
Member

Kernel mentioned here patched to version 3.10.22 and booting on Visson ATV-102s device: http://pastebin.com/Z1sZv5gk

m][sko
Guest
m][sko

Another news
they also release buildroot
http://openlinux.amlogic.com:8000/download/ARM/filesystem/

m][sko
Guest
m][sko

Stane1983 :
Kernel mentioned here patched to version 3.10.22 and booting on Visson ATV-102s device: http://pastebin.com/Z1sZv5gk

Except two backtraces and we are ready to go 🙂

m][sko
Guest
m][sko

@m][sko
and new kernel

m][sko
Guest
m][sko

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.

m][sko
Guest
m][sko

btw latest kernel from amlogic page is old 3.0.50

trackback

[…] my unboxing post, I mentioned the UART pins were available, and sometimes in March Amlogic released U-boot and Linux source code for M802/S808, so it’s likely some developers will play around, and eventually run Linux (Ubuntu, Debian, […]

SpAiK
Guest
SpAiK

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?

Alain Theriault
Guest
Alain Theriault

How would I get Linux running on my M8 with these files?

Riaqn
Guest

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
Guest

@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
Guest

@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).

Riaqn
Guest

@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!

Riaqn
Guest

@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
Guest

@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!

Riaqn
Guest

@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:
[ [email protected]] 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!

Riaqn
Guest

@cnxsoft
Well, both approach is too hard to me… slim hope, right?

Riaqn
Guest

@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…

trackback

[…] the instructions to get S802 kernel source and setup the source tree until after the step where you […]

trackback

[…] already had the kernel source for Amlogic S802. The previous code found on Amlogic website, and based on Linux 3.10.10. I’ve been informed […]

trackback

[…] está más difícil. Amlogic tiene una web donde publica código GPL de sus SoC y hay páginas con instrucciones para compilarlo pero en cuanto a la parte gráfica, hubo un intento de crear un driver libre de las GPU Mali, […]

Maxx
Guest
Maxx
Guest

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

emanuel
Guest
Bobby
Guest
Bobby

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
Guest
Bobby

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

njasm
Guest

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

Jeff
Guest
Jeff

I am really trying to get this compile, but getting errors during the uboot-custom compiling