FORUMS

Analysis & Opinion

Top Forum Discussions

[TUTORIAL/DEV]Build AOSP Android 2.3.7 for Allwinner A10 tablets (Teclast P76Ti)

1,060 posts
Thanks Meter: 863
 
Post Reply Subscribe to Thread Email Thread
Hi!

I haven't really found any kind of guides on how to build a complete AOSP android build from source (kernel and software) for Allwinner A10 tablets like the Ainol Novo 7 Advanced or the Teclast P76Ti.

I have a Teclast P76TI (rev4), and the following guide is only tested on such a device. As it's mostly based on the source drop of the Ainol Novo 7 Advanced, it should also work on that too.
The Following 7 Users Say Thank You to sztupy For This Useful Post: [ View ]
 
 
10th February 2012, 09:08 PM |#2  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 863
 
Donate to Me
More
Part 1
Part 1: Preparations

A: Preconditions

For building and creating a LiveSuite flashable package you will need the following:
  • For building the kernel and android you will need a 64 bit Linux machine. Ubuntu 10.04 64 bit is preferred for Gingerbread builds
  • For creating the LiveSuite flashable images, and actually flashing you will need a Windows machine. Windows 7 x64 works fine, as should Windows XP 32 bit too.
  • You will also need a working LiveSuite image file, for your tablet. Make sure that you can flash it to your device without problems!

Virtual machines are fine, if you have enough memory available. To build Android in a VM, you should give it at least 2GB of RAM. Alternatively if you're using Linux, you can create a Windows VM for the image creation or flashing part.

For the rest of the tutorial I will assume you are using a Linux Virtual Machine on a Windows box.

For building the kernel and AOSP you will need at least 35GB of free space in your linux machine (the more the better). To create the images you will need an additional 2GB of space on your Windows machine.

B: Getting the kernel and AOSP sources

First initialize your Linux machine according to this page: http://source.android.com/source/initializing.html

Here are the most important commands:
Code:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
  x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
  libxml2-utils xsltproc
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
// Additonal commands for Ubuntu 10.10:
$ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
// Additonal commands for Ubuntu 11.10:
$ sudo apt-get install libx11-dev:i386
Now create a directory on your linux machine. The path should contain no spaces in it. Inside this directory first pull the kernel source from the allwinner github page:

Code:
$ git clone https://github.com/allwinner/linux-2.6.36 lichee
Make sure that the kernel resides in the lichee directory

Now download AOSP Android. We will use Gingerbread version 2.3.7:

Code:
$ mkdir android
$ cd android
$ repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1
$ repo sync
Allwinner uses a special init, which has a few additional commands that you have to download too:

Code:
$ cd system/core
$ git pull git://github.com/sztupy/allwinner_android_system_core.git
$ cd ../..
You will also need the device descriptors for the tablets:

Code:
$ cd device
$ git clone git://github.com/sztupy/android_device_softwinner.git softwinner
$ cd ..
C: ARM compiler

You might simply use a compiler that is supplied for AOSP, they are inside the android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/ directory. Alternatively you can also download the ARM compiler of CodeSourcery. Get the arm-2009q3 / arm-none-linux-gnueabi version, and unpack it inside a directory.

If ready, go on to next step: building the kernel
Last edited by sztupy; 10th February 2012 at 11:40 PM.
The Following User Says Thank You to sztupy For This Useful Post: [ View ]
10th February 2012, 09:09 PM |#3  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 863
 
Donate to Me
More
Part 2: Building the kernel

Change to the directory of the kernel. Now edit the file scripts/build_sun4i_crane.sh

Change the line "export CROSS_COMPILE=" to point to the ARM compiler. For example if you extracted the CodeSourcery files to /opt then use:

Code:
export CROSS_COMPILE=/opt/arm-2009q3/bin/arm-none-linux-gnueabi-
The default .config file is more or less the same that is supplied with your tablet. On the Teclast P76TI you can actually extract the .config file used from /proc using "adb pull /proc/config.gz" Not sure about other vendors.

Now you have to compile. Issue the command:

Code:
./build.sh -p sun4i_crane
This will build the kernel and modules inside the the "output" directory.

Next step is to compile Android
Last edited by sztupy; 10th February 2012 at 09:35 PM.
The Following 2 Users Say Thank You to sztupy For This Useful Post: [ View ]
10th February 2012, 09:09 PM |#4  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 863
 
Donate to Me
More
Part3
Part 3: Building Android

Go to the android directory. Now setup android using:

Code:
$ source build/envsetup.sh
$ lunch
You will get simething like this:
Code:
You're building on Linux

Lunch menu... pick a combo:
     1. generic-eng
     2. simulator
     3. full_passion-userdebug
     4. full_crespo4g-userdebug
     5. full_crespo-userdebug
     6. crane_Ainol_Novo7A-eng
     7. crane_Teclast_P76TI_REV4-eng

Which would you like? [generic-eng]
Here select your device (option 6 or 7 depending on your tablet)

After you have selected it issue a make command:

Code:
$ make
This will take a while. If you're using ubuntu 11.10 make might fail, but you can fix it using these fixes: http://groups.google.com/group/andro...84e7797909d014

After the building is complete you have to create the image files. Run the following command:

Code:
$ ./device/softwinner/crane-tcp76ti_r4/mkfs.sh
(substitute tcp76ti_r4 with ainovo7a if you're using the other tablet)

The image files will be ready in the directory "out/target/product/crane-tcp76ti_r4/images/" or "out/target/product/crane-ainovo7a/images/"

Copy the three files from here (root.img, recovery.img, system.img), and the "bImage" file from the "output" directory of the kernel to your Windows machine.

The next step is creating the flashable image, and flashing your build
Last edited by sztupy; 10th February 2012 at 09:45 PM.
The Following 2 Users Say Thank You to sztupy For This Useful Post: [ View ]
10th February 2012, 09:09 PM |#5  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 863
 
Donate to Me
More
Part 4: Flashing

A: Initialize kitchen

First download my A10 flash kitchen from this site: http://android.sztupy.hu/dl/a10/a10_...kitchen_v1.zip
This is based on the ainol novo 7 soruce drop, but only contains the nescessary files, and has a few batch scripts to automate the process.
There is also a v2, wich also supports ICS firmwares: http://android.sztupy.hu/dl/a10/a10_...kitchen_v2.zip

First unzip the files to a directory. You will see a few directories and to commands here: extract_image.bat and create_image.bat

First we have to extract an official image for your tablet. Simply comply the image file to this directory, and rename it to "original.img". If done, run extract_image.bat. This command should extract your image to the _extract directory.

Next you need to extract the bootfs inside the _bootfs directory. You have multiple options on how to do this:

1. Get the bootfs from your device on-line using adb:

Code:
> cd _bootfs
> adb shell
$ cd /
$ mount -o remount,rw -t ext4 /dev/root /
$ mkdir bootfs
$ mount -t vfat /dev/block/nanda /bootfs
(Control-C: exit adb shell)
> adb pull /bootfs
2. Get the bootfs from the extracted image file using Linux:

A. Copy the RFSFAT16_BOOTFS_000000000.fex file to linux
B.
Code:
$ mkdir bootfs
$ sudo mount -o loop RFSFAT16_BOOTFS_000000000.fex bootfs
$ cp -a bootfs b2
$ sudo umount bootfs
C. Copy the contents of the b2 directory to Windows, inside the _bootfs directory of the kitchen

B: Create image

If you have initialized the kitchen, you have to copy the four files from linux (system.img, root.img, recovery.img and bImage) inside the _input directory. You will also need to rename the .img files to .fex (so they should be system.fex, root.fex, recovery.fex).

If you are done with this, then run create_image.bat. It will create an output.img file, that can be flashed to the device using LiveSuite.
Last edited by sztupy; 15th February 2012 at 07:06 PM.
The Following 2 Users Say Thank You to sztupy For This Useful Post: [ View ]
10th February 2012, 09:10 PM |#6  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 863
 
Donate to Me
More
Additional information for developers:

1. Difference between AOSP 2.3.4 and Novo7 android 2.3.4

Download the diff file from here: http://android.sztupy.hu/dl/a10/diff_ainovo_aosp.gz

Filelist of differences: http://android.sztupy.hu/dl/a10/diff...p_filelist.txt
Last edited by sztupy; 11th February 2012 at 04:38 PM.
The Following User Says Thank You to sztupy For This Useful Post: [ View ]
10th February 2012, 10:20 PM |#7  
fonix232's Avatar
Senior Member
Flag Budapest
Thanks Meter: 385
 
Donate to Me
More
sztupy, did you figure out why eDragonEx and FSBuild have an apparently unused Lua library next to each? I was interested by it, as it might be possible that some parts of the apps are actually written in Lua (would it be possible? Lua in a native DLL?), what would help reversing it.
10th February 2012, 10:53 PM |#8  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 863
 
Donate to Me
More
Quote:
Originally Posted by fonix232

sztupy, did you figure out why eDragonEx and FSBuild have an apparently unused Lua library next to each? I was interested by it, as it might be possible that some parts of the apps are actually written in Lua (would it be possible? Lua in a native DLL?), what would help reversing it.

Yeah, saw that. Also their build script used "convert" on the image.cfg, but that file wasn't in lua anyway (except for the image parts part which seems to be a lua hash).

There are also a lot of compiled files that are compiled inside the image file and which are neither the bootfs nor android or the kernel. I don't yet know what they are for, but I think they are used by LiveSuite during the flashing.
10th February 2012, 11:05 PM |#9  
fonix232's Avatar
Senior Member
Flag Budapest
Thanks Meter: 385
 
Donate to Me
More
Quote:
Originally Posted by sztupy

Yeah, saw that. Also their build script used "convert" on the image.cfg, but that file wasn't in lua anyway (except for the image parts part which seems to be a lua hash).

There are also a lot of compiled files that are compiled inside the image file and which are neither the bootfs nor android or the kernel. I don't yet know what they are for, but I think they are used by LiveSuite during the flashing.

I know most of the files from the flashing, they are the following:
- SYS_CONFIG is used as a command bunch for LiveSuite. It tells the app how to flash, what to flash, where, and it configures the device too (screen size, ram info, cpu info, etc)
- Boot0 and Boot1 bins are NAND bootloaders
- FED FES and FET tools are NAND flashing utilities, checksums, hardware scanner, and other tools used during flashing.
- '12345678' files are bootloaders, config files, and tools for SDMMC flashing, if there's a device with SDMMC internal instead of NAND, these are used
- Split seems to be some kind of ID string, I had no luck retrieving it's usage and meaning.


So you say, that the actual Lua parts are the image encryption parts of eDragonEx? Interesting, maybe I've missed that spot with my tool...

Might I ask if you have tried disassembling (and decompiling) unimg.exe? I had several problems with it, but that would greatly help understanding how the images are created. I've got a C# framework, with image config parser, etcetera etcetera, to be able to read and create images in a much more advanced environment (filtering user errors, having tools for everything (bootfs modding, script.bin reversal, etcetera), and creating a working image as a final result), and it only needs the image file format (and some of my work, to create a parser).
The problems with unimg were all about positive sp values, and as I'm not a big assembly programmer, I couldn't make out anything from that. Maybe you understand it a bit more


Illetve beszélhetünk egy kicsit magyarul is. Tabletrepublic-on írtam hogy vegyél fel MSNre és részletezem a különböző Crane SDK elemek funkcióit, működését, egyebeket, amit eddig sikerült kiderítenem az egészről.
Sajnos elég zavaros, mivel vagy négyféle csomagoló rendszer készíti a fileokat, és ezek közül csak egy működött rendesen (crane_pack.exe). Jó lenne megérteni ezt a file formátumot, hogy egy kicsit normálisabb módon hozhassam létre, különféle vacakolások nélkül.
10th February 2012, 11:22 PM |#10  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 863
 
Donate to Me
More
Quote:
Originally Posted by fonix232

I know most of the files from the flashing, they are the following:
- SYS_CONFIG is used as a command bunch for LiveSuite. It tells the app how to flash, what to flash, where, and it configures the device too (screen size, ram info, cpu info, etc)
- Boot0 and Boot1 bins are NAND bootloaders
- FED FES and FET tools are NAND flashing utilities, checksums, hardware scanner, and other tools used during flashing.
- '12345678' files are bootloaders, config files, and tools for SDMMC flashing, if there's a device with SDMMC internal instead of NAND, these are used
- Split seems to be some kind of ID string, I had no luck retrieving it's usage and meaning.

Thanks for these. Seems I was mostly right

Quote:

So you say, that the actual Lua parts are the image encryption parts of eDragonEx? Interesting, maybe I've missed that spot with my tool...

I think lua is not really used anymore. It probably had more relevance back in the past.

Quote:

Might I ask if you have tried disassembling (and decompiling) unimg.exe? I had several problems with it, but that would greatly help understanding how the images are created. I've got a C# framework, with image config parser, etcetera etcetera, to be able to read and create images in a much more advanced environment (filtering user errors, having tools for everything (bootfs modding, script.bin reversal, etcetera), and creating a working image as a final result), and it only needs the image file format (and some of my work, to create a parser).
The problems with unimg were all about positive sp values, and as I'm not a big assembly programmer, I couldn't make out anything from that. Maybe you understand it a bit more

No, haven't tried disassembling it yet. I was very glad that it worked, and that I could create a whole working build just from the sources. I know there are a lot of quirks, like if the extension of the file is not .fex, then it will encrypt(?) it, etc. I might try it, but currently I'm more interested in getting a working AOSP ICS on my tablet. Besides for disassembly I need to be in a special mood, which I'm not really in now

Quote:

Illetve beszélhetünk egy kicsit magyarul is. Tabletrepublic-on írtam hogy vegyél fel MSNre és részletezem a különböző Crane SDK elemek funkcióit, működését, egyebeket, amit eddig sikerült kiderítenem az egészről.
Sajnos elég zavaros, mivel vagy négyféle csomagoló rendszer készíti a fileokat, és ezek közül csak egy működött rendesen (crane_pack.exe). Jó lenne megérteni ezt a file formátumot, hogy egy kicsit normálisabb módon hozhassam létre, különféle vacakolások nélkül.

Már egy jó ideje nem használok MSN-t. Skype/GTalk/email viszont van. Ha nem használsz olyanokat, akkor azért majd felrakom.
11th February 2012, 04:40 PM |#11  
sztupy's Avatar
OP Recognized Developer
Flag London
Thanks Meter: 863
 
Donate to Me
More
Made a diff between AOSP android 2.3.4 and the Novo 7 2.3.4 source drop. The list can be found at post 6: http://forum.xda-developers.com/show...84&postcount=6

Read More
Post Reply Subscribe to Thread

Tags
p76ti
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes