Builing Android from Scratch

Started by vince747, September 11, 2013, 09:20:30 PM

Previous topic - Next topic

vince747

I disliked the startup screen on supplied Android in NAND and some of the built-in apps.  To change them, I like to re-build the Android image.  I am following the instructions in A10S wiki under "A10S Android 4.2.2 SDK used to generate the Android image" section.  (I can read Chinese  ;D) and encountered some discrepancies.

To make certain that all USB settings matched the schematics, I examined the "sys_config1.fex" under directory lichee\tools\pack\chips\sun5i\configs\android\XXX\.  None of them matched the schematics.

"Section 23 SPDIF support", however, A10S datasheet never mentioned SPDIF and the pins that were supposedly designated as SPDIF IN/OUT were marked as "/".

Has anyone tried to customize the android and succeed?

vince747

More discrepancies, in BoardConfig.mk under android\device\softwinner\elite-evb, the "# Wifi chipset select", I think it shall be "SW_BOARD_USR_WIFI := rtl8188eu" instead it is "SW_BOARD_USR_WIFI := usibm01a".

Does anyone know how to contact the author of A10S android image? 

yoann_q

Next week I ll try to generates an android custom image on linux mint 13
After reading the instruction i customize my linux mint and install sun jdk1.6 and gcc 4.4. Otherwise it will fail ... did you try to generates a nand image ?

vince747

Yes.  I tried to generate a custom Android image.  One of the reason for this customer image is current image doesn't support USB wifi with RTL8191 chipset.

yoann_q

#4
ok, i tried to generate image this night  i've 2 questions
- the extract-bsp command generates some error concerning bImage files , is it normal ?
my bad , i forgot to install mkimage
- which plateform to use with lunch command ? (A10S board)
regards

vince747

I have the A10S-OLinuXino-MICRO-4GB board.  If you can share the configuration files that you used to generate the Android image that will be highly appreciated.

yoann_q

i bought the same card, so of course , i'll try and share result, using this thread , should be a good way
i'll try tomorow

vince747

I found the system configuration file for A10S-OLinXino-Micro at https://github.com/linux-sunxi/sunxi-boards/blob/master/sys_config/a10s/a10s-olinuxino-m.fex.  Will try to build the image this weekend.

yoann_q

#8
Quote from: vince747 on September 19, 2013, 02:58:02 AM
I found the system configuration file for A10S-OLinXino-Micro at https://github.com/linux-sunxi/sunxi-boards/blob/master/sys_config/a10s/a10s-olinuxino-m.fex.  Will try to build the image this weekend.
i finished the android compilation , flash then try to boot and i get internal error on debug console during boot, so i'm interrest with your compilation result !

[    1.578331] [wifi]: Select sdio wifi: usi-bm01a !!
[    1.583346] [usi_bm01a]: usi_bm01a_power_onoff
[    1.587792] [usi_bm01a]: first time
[    1.591318] Unable to handle kernel NULL pointer dereference at virtual address 00000019
[    1.599401] pgd = c0004000
[    1.602128] [00000019] *pgd=00000000
[    1.605713] Internal error: Oops: 5 [#1] PREEMPT
[    1.610327] Modules linked in:
[    1.612115] CPU: 0    Not tainted  (3.0.8 #3)
[    1.612115] PC is at regulator_force_disable+0x8/0xd8
[    1.612115] LR is at usi_bm01a_power_onoff+0xa8/0xc4
[    1.612115] pc : [<c02ffd20>]    lr : [<c0439fd8>]    psr: 40000013
[    1.612115] sp : df83bee0  ip : 00000000  fp : 00000000
[    1.612115] r10: 00000000  r9 : 00000000  r8 : c00251e4
[    1.612115] r7 : c091942c  r6 : ffffffed  r5 : 00000000  r4 : ffffffed
[    1.612115] r3 : df83a000  r2 : 00000001  r1 : 00000000  r0 : ffffffed
[    1.612115] Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[    1.612115] Control: 10c5387d  Table: 40004019  DAC: 00000015
[    1.612115]
[    1.612115] PC: 0xc02ffca0:
[    1.612115] fca0  e1a03005 e2447001 eb0b6e9e e3770001 0afffff4 e0864184 e207a001 e2448008
[    1.612115] fcc0  e5140004 ebffff5d e2577001 4affffed e35a0000 0a000004 e5180004 e2488008
[    1.612115] fce0  ebffff56 e2577001 4affffe6 e5180004 e2477001 ebffff51 e518000c ebffff4f
[    1.612115] fd00  e2577001 e2484008 e2488010 5afffff6 eaffffdc c0671efc e92d40f8 e1a06000
[    1.612115] fd20  e590402c e3a07000 e2845040 e1a00005 eb0b73f2 e586700c e5940000 e590300c
[    1.612115] fd40  e5936020 e1560007 0a000007 e1a00004 e12fff36 e2506000 ba00000f e1a00004
[    1.612115] fd60  e3a010a0 e1a02007 ebfffafe e5947114 e3a02000 e1a00005 e5842008 eb0b738d
[    1.612115] fd80  e3570000 0a000002 e2870050 ebfffa7e ebffff2a e1a00006 e8bd80f8 e5943110
[    1.612115]

vince747

You went farther than me.  I did "make -j8", got quite a few error message.

make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Package.o] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/CrunchCache.o] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Command.o] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/XMLNode.o] Error 1

Do you know why?  I was not modify anything here, just tried the build process. 

My process for getting to "make -j8" is as follows

------------------

1. Install compilation tools (Ubuntu 13.04 64 bits only)

$ sudo apt-get purge openjdk*
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java6-installer

$ sudo apt-get install u-boot-tools liballegro4.2-dev

$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python

$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

2. Change mod for all .sh files

$ find . -iname \*.sh | xargs chmod u+x

3. Linux kernel complilation

$ cd lichee
$ ./build.sh -p sun5i_elite -k 3.0

4. Android compilation

$ cd ../android
$ source build/envsetup.sh
$ lunch
             "Pick a combo from pop-up screen, I pick 17 = elite-evb"
$ extract-bsp
$ make -j8


yoann_q

i use make -i -j8 to generate android , -i ignore error , not sure it's good idea  :P

vince747

I repeat the build process on a fresh lubuntu 13.04.  Got the same error message.   :'(  Strange!

vince747

OK.  I found the problems.

The kernel built was successful.  I could find bImage, uImage and zImage under lichee/android/out.

The Android built failed.  It seemed the problem was in frameworks/base/tools/aapt.  When compiling, I kept getting this warning message.

<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
frameworks/base/tools/aapt/AaptAssets.cpp:1:0: note: this is the location of the previous definition

then

I got no .o under out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates.

yoann_q

hi
yesterday i've found a solution for my "usi_bm01a" kernel panic , i solve it by modify the *.fex and desactivate the wifi component usi_bm01a and activate usb so now i progress into the linux boot up to what it seems to be a "pmu" kernel panic link to axp152 , i think there is a patch to apply to the kernel.
for your android image problem i use a linux mint 13 into virtual box machine , i downgrade the distro in order to install gcc & g++ and install sun java 6 http://samuelcroset.com/content/how-install-sun-java-6-linux-mint-13-0
it's slow, but it's ok , i obtain a img file compatible with livesuit
i read somwhere that a debian distro is better than ubuntu distro to compile
may be it can help

yoann_q

#14
update , here is my serial log during android boot :
[    1.815486] VFP support v0.3: implementor 41 architecture 3 part 30 variant c
rev 3
[    1.823190] Registering SWP/SWPB emulation handler
[    1.828228] dram_sysdev_init finished!
[    1.832019] Unable to handle kernel NULL pointer dereference at virtual addre
ss 00000019
[    1.840121] pgd = c0004000
[    1.842825] [00000019] *pgd=00000000
[    1.846413] Internal error: Oops: 5 [#1] PREEMPT
[    1.850108] Modules linked in:
[    1.850108] CPU: 0    Not tainted  (3.0.8 #3)
[    1.850108] PC is at regulator_get_voltage+0x8/0x34
[    1.850108] LR is at sun4i_cpufreq_initcall+0xcc/0x34c
[    1.850108] pc : [<c02fe5c4>]    lr : [<c000ee28>]    psr: a0000013
[    1.850108] sp : df83bf70  ip : c0930354  fp : 00000000
[    1.850108] r10: 00000000  r9 : 00000000  r8 : c000ed5c
[    1.850108] r7 : 00000000  r6 : df83a000  r5 : c002cdac  r4 : ffffffed
[    1.850108] r3 : 00000000  r2 : 00000000  r1 : 00000001  r0 : ffffffed
[    1.850108] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kern
el
[    1.850108] Control: 10c5387d  Table: 40004019  DAC: 00000015
[    1.850108]


any idea of the cause ?