Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A10s => Topic started by: vince747 on September 11, 2013, 09:20:30 PM

Title: Builing Android from Scratch
Post by: vince747 on September 11, 2013, 09:20:30 PM
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?
Title: Re: Builing Android from Scratch
Post by: vince747 on September 16, 2013, 04:44:13 AM
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? 
Title: Re: Builing Android from Scratch
Post by: yoann_q on September 16, 2013, 11:30:34 PM
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 ?
Title: Re: Builing Android from Scratch
Post by: vince747 on September 17, 2013, 12:12:35 AM
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.
Title: Re: Builing Android from Scratch
Post by: yoann_q on September 17, 2013, 06:06:41 AM
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
Title: Re: Builing Android from Scratch
Post by: vince747 on September 17, 2013, 09:24:04 PM
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.
Title: Re: Builing Android from Scratch
Post by: yoann_q on September 18, 2013, 12:18:12 AM
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
Title: Re: Builing Android from Scratch
Post by: 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.
Title: Re: Builing Android from Scratch
Post by: yoann_q on September 20, 2013, 06:55:11 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 !

Code: [Select]
[    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]
Title: Re: Builing Android from Scratch
Post by: vince747 on September 23, 2013, 08:03:14 PM
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

Title: Re: Builing Android from Scratch
Post by: yoann_q on September 23, 2013, 09:59:27 PM
i use make -i -j8 to generate android , -i ignore error , not sure it's good idea  :P
Title: Re: Builing Android from Scratch
Post by: vince747 on September 24, 2013, 12:01:05 AM
I repeat the build process on a fresh lubuntu 13.04.  Got the same error message.   :'(  Strange!
Title: Re: Builing Android from Scratch
Post by: vince747 on September 24, 2013, 09:05:54 PM
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.
Title: Re: Builing Android from Scratch
Post by: yoann_q on September 25, 2013, 12:38:26 AM
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
Title: Re: Builing Android from Scratch
Post by: yoann_q on September 26, 2013, 09:34:12 PM
update , here is my serial log during android boot :
Code: [Select]
[    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 ?
Title: Re: Builing Android from Scratch
Post by: yoann_q on October 15, 2017, 01:27:18 PM
hi,
i'm still use my a10s with linux, i reinstall android but the app data is out of space so i try to modify the partition size
so i try to re compile android , using the last sdk, here is how i do that :
- download / install virtualbox
- install ubuntu 12.04 (it's a 4.x android), recommended here https://source.android.com/source/requirements.html
- install virtualbox guest addons and reboot
- do the things below
Code: [Select]
sudo apt-get upgrade
sudo apt-get install libgl1-mesa-dri:i386
- then follow the final procedure here, https://source.android.com/source/initializing#installing-required-packages-ubuntu-1204
- i need to install java6sdk manually, , download jdk-6u45-linux-x64.bin you'll need to register and then
Code: [Select]
chmod +x ./jdk-6u45-linux-x64.bin
./jdk-6u45-linux-x64.bin
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_34/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_34/bin/javac" 1
sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.6.0_34/bin/jar" 1
- the linux compilation tis ok ,
- the compilation process gives a lot of error

whant's wrong , can you explain the process to generate a android image ?
best regards
Title: Re: Builing Android from Scratch
Post by: yoann_q on October 15, 2017, 09:32:16 PM
last update, i give up!  :-[
i've found the tool imgrepacker to resize the "data" partition see abstract here http://linux-sunxi.org/LiveSuit_images#RedScorpio_tools on windows, the linux version unpack but fail to pack
- first unpack
Code: [Select]
imgRePacker.exe a10s_android_nand_HDMI_en_3.imgin the newly created directory a10s_android_nand_HDMI_en_3.img.dump, you must modify the sys_config.fex size_lo parameter , here the targetted size is 1.5Go
Code: [Select]
;------------------------------>nande, user data
[partition4]
    class_name  = DISK
    name        = data
    size_hi     = 0
    size_lo     = 1572864
    user_type   = 1
    ro          = 0
after that use imgrepacker,
Code: [Select]
imgRePacker.exe a10s_android_nand_HDMI_en_3.img.dumpthe new image is named a10s_android_nand_HDMI_en_3.img the old one is a10s_android_nand_HDMI_en_3.img.bak
flash it using livesuit, that's it