Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: dave-at-axon on January 22, 2014, 05:41:54 AM

Title: How to Build Android 4.2.2 for A20-OLinuXino-MICRO
Post by: dave-at-axon on January 22, 2014, 05:41:54 AM
If these designs are truly open source, I find it hard to believe that we don't have access to the Android JB 4.2 source for the A20? Olimex have been great in regards to the open hardware side, but we really seem to be up against it when it comes to the Android source.

All I can find is the 4.0 source.

Where is the JB 4.2 source for the A20 as I want to be able to build a custom ROM for this that includes the additional UARTS that I am trying to add to it.

Title: Re: Open source or not????
Post by: ph.fouquet on January 22, 2014, 09:25:26 AM
One More

I don't understand how to use the sources for build from scratch
Title: Re: Open source or not????
Post by: JohnS on January 22, 2014, 10:06:31 AM
Are the sources not the same as the ones for any other similar ARM cpu?

I'm unclear whose sources they are - google's?

John
Title: Re: Open source or not????
Post by: ph.fouquet on January 22, 2014, 10:25:32 AM
that true the bigest part of the soures are on kernel or google git
but for don't lost must time it was better that board manufacturer that give

The prebuild image work why they don't publish a tutorial for building from scratch?

Philippe
Title: Re: Open source or not????
Post by: dave-at-axon on January 22, 2014, 11:00:21 AM
Quote from: JohnS on January 22, 2014, 10:06:31 AM
Are the sources not the same as the ones for any other similar ARM cpu?

Mostly yes, but things like closed drivers need to be included. If you look at the likes of Samsung, they tell you to repo the Google repository and then dump their files into this, overwriting where required.

The directory layout is not clear with the Olimex source.

A bit more detail of the build and once we know we can build the source as supplied and run it, we can start to tinker with it and make changes etc. Without a working build, you have no idea what went wrong. :)
Title: Re: Open source or not????
Post by: dave-at-axon on January 22, 2014, 11:01:10 AM
Quote from: ph.fouquet on January 22, 2014, 09:25:26 AM
One More

I don't understand how to use the sources for build from scratch

I have to agree. I have found limited information to build the source but no information on what the final output file is called or where it is located. Nothing on how to create the image for SD or NAND.

There needs to be a detailed wiki page somewhere on what is needed.

The FriendlyArm boards I was using have a nice set of source along with all the information to build and I have managed to create a custom Android build for that. I want to do the same for the Olimex boards.  :(
Title: Re: Open source or not????
Post by: JohnS on January 22, 2014, 01:16:05 PM
Quote from: dave-at-axon on January 22, 2014, 11:00:21 AM
Quote from: JohnS on January 22, 2014, 10:06:31 AM
Are the sources not the same as the ones for any other similar ARM cpu?

Mostly yes, but things like closed drivers need to be included. If you look at the likes of Samsung, they tell you to repo the Google repository and then dump their files into this, overwriting where required.

So isn't it Allwinner you should be asking?

John
Title: Re: Open source or not????
Post by: ludo on January 22, 2014, 05:51:40 PM
One More

I don't understand how to use the sources for build from scratch.

I have tried every possible way to create a custom rom but no ones works.

i need a tutorial.

Ludo
Title: Re: Open source or not????
Post by: JohnS on January 22, 2014, 06:14:19 PM
I think the boards are OSHW.  Linux is Open Source.  Android from Allwinner?  Partly.  At hte least you won't get GPU and similar sources.

But you probably? can get what you want.  Only Allwinner will have the sources for their variant of Android.  They may have passed them on to others.  You've checked the net I expect...

A tutorial - someone may know one, again are they not on the net?  (I don't myself have your exact wants.)

John

Title: Re: Open source or not????
Post by: dave-at-axon on January 23, 2014, 04:04:04 AM
Thanks John,

I'll get in touch with Allwinner and find out about it.

I've no issues with having some parts as binary only as this seems to be the case with Android. Samsung for instance only provide the graphics drivers as binary.

It would just be nice to have source that we can build and create our own Android image. There are a few applications in there that I don't need for my final design. :)

If I can get this and get it working, and the source is free for all to use, then I'll post up a webpage on the build process.
Title: Re: Open source or not????
Post by: JohnS on January 23, 2014, 10:16:06 AM
I expect that would help others.  Although aimed at Linux the linux-sunxi wiki can be useful for data.

Allwinner tend to just hand out a multi-GB drop of code with a "there it is" mentality so expect a bit of grief.

John
Title: Re: Open source or not????
Post by: olimex on January 23, 2014, 12:30:34 PM
Quote from: ph.fouquet on January 22, 2014, 10:25:32 AM
that true the bigest part of the soures are on kernel or google git
but for don't lost must time it was better that board manufacturer that give

  • patch and defconfig for the kernel
  • patch and device config for android
  • for this case flex file for packing and loading the board

The prebuild image work why they don't publish a tutorial for building from scratch?

Philippe

the problem is ... lazy developers!

Android is not GPL and although it's named Open Source we all know that it's not real Open Source - Google develops all things behind closed doors and do not accept contributions.
So the subject is a bit misleading. Allwinner Android is full with binary blobs and no sources, but this is in compliance with Android, so if you want open sources use Linux, the sources for Android image generations are linked on the Wiki.

What I understand from Dimitar is that he helped you on IRC to build Android image, now the ball is in your field :)

Will you document your steps in tutorial? Or you will do as everyone else - once complete the job you are so busy and your time is so valuable that you will not waste it to help others?
Title: Re: Open source or not????
Post by: dave-at-axon on January 24, 2014, 05:05:27 AM
Quote from: olimex on January 23, 2014, 12:30:34 PM
What I understand from Dimitar is that he helped you on IRC to build Android image, now the ball is in your field :)

Will you document your steps in tutorial? Or you will do as everyone else - once complete the job you are so busy and your time is so valuable that you will not waste it to help others?

If you are referring to me, then I don't use IRC so there has been no help with this.

If I can get the source (as much as I can with binary blobs) and I can get it to build and I can load the image and run it on the A20, I will take the time to create a webpage and link it here.

I've had many people in the past help me so I am happy to help back.
Title: Re: Open source or not????
Post by: ph.fouquet on January 24, 2014, 09:18:44 AM
Hi

For compiling a Android 4.2 image from scratch (thank for HeHoPMaJIeH to help me) :
Download the tow file at http://bundie.neterra.net:8080/index.php?path=last/

befor all configure your environnement see : http://source.android.com/source/initializing.html


For compiliing:

1. uncompress file (on same dir)
   $ tar zxvf lichee-v3.0.tar.gz
   $ tar zxvf android4.2-v3.0.tar.gz
   
2. kernel compilation (defconfig : sun7ismp_android_defconfig)
   $ cd lichee
   $ ./build.sh -p sun7i_android -b wing-nck70 -k 3.4

2. android compilation
   $ cd ../android4.2
   $ source build/envsetup.sh
   $ lunch (choose wing_nck70-eng)
   $ extract-bsp
   $ make -j8

3. Packing
   $ pack

If you don't have any error you must have image that can use with PhoenixSuite (the path will give to the last red ligne for pack command)

Philippe

Title: Re: Open source or not????
Post by: dave-at-axon on January 24, 2014, 01:14:31 PM
Quote from: ph.fouquet on January 24, 2014, 09:18:44 AM
   $ tar zxvf lichee-v3.0.tar.gz
   $ tar zxvf android4.2-v3.0.tar.gz

Thanks Philippe but where can we download these files? I've searched and I can't locate them anywhere that Olimex says the sources file are.
Title: Re: Open source or not????
Post by: ph.fouquet on January 24, 2014, 02:44:39 PM
I din't see that files are get out from http://bundie.neterra.net:8080/index.php?path=last
I try to upload to google drive.
It could be take some time because my internet line are not very fast.
I give you the link when the downloads are complited

Philippe
Title: Re: Open source or not????
Post by: dave-at-axon on January 24, 2014, 03:11:18 PM
Thanks Philippe, it would be much appreciated.

Title: Re: Open source or not????
Post by: ph.fouquet on January 24, 2014, 06:22:52 PM
For downloading the files https://drive.google.com/folderview?id=0BzB_M_u_IizEemJzSmpBdmpVbWs&usp=sharing

I add a defconfig (lichee/linux-3.4/arch/arm/configs/) for enabeled ehternet

Philippe
Title: Re: Open source or not????
Post by: dave-at-axon on January 26, 2014, 05:07:59 AM
Thanks Philippe,

I've downloaded all the files now. If you are OK with it, would you mind if I uploaded the files to another location and then create a website based on what you have provided along with additional information that I will add?

This will aid new users to find the information and build it too, as there are a lot of questions on how to do this.

Title: Re: Open source or not????
Post by: ph.fouquet on January 26, 2014, 06:12:45 PM
I have not problem with that. If I have some additional information I post it on the forum.

Philippe
Title: Re: Open source or not????
Post by: dave-at-axon on January 27, 2014, 12:33:53 PM
I can build lichee and Android and then create the image with pack but it won't run from nand so I suspect the image was build to write to SD.

Working my way through it to figure out how to build for nand as it's a good learning exercise.
Title: Re: Open source or not????
Post by: ph.fouquet on January 27, 2014, 01:23:27 PM
I work with nand device for loading the image I used PhoenixSuit that you can find in lichee/tools/tools_win/USB_update_and_produce

Philippe
Title: Re: Open source or not????
Post by: ph.fouquet on January 27, 2014, 01:28:11 PM
Start PhoenixSuit

Philippe
Title: Re: Open source or not????
Post by: dave-at-axon on January 27, 2014, 01:58:04 PM
I've got 1.08 installed. It detects the board and installs to the nand but fails to boot fully into Android.

This is the output from the debug port

[Fet]:-------------------------------------------------
[Fet]:            Succeed in Updating boot0.
[Fet]:-------------------------------------------------
FES:INFO : run addr = 0x401a87cc , type = 1437204481
start watchdog
HELLO! BOOT0 is starting!
boot0 version : 2.0.0˜
read dram para.
dram driver version: 1.15
dram size =1024MB
0x08002000
super_standby_flag = 0
Succeed in opening nand flash.
block from 2 to 6
deal block 2
Succeed in reading Boot1 file head.
The size of Boot1 is 0x00068000.
The file stored in 0x00000000 of block 2 is perfect.
Check is correct.
Ready to disable icache.
Succeed in loading Boot1.
Jump to Boot1.
[       0.158] boot1 version : 2.0.0
[       0.158] script installed early ok
[       0.159] pmu type = 3
[       0.263] bat vol = 4040 mv
[       0.278] axi:ahb:apb=4:2:2
[       0.278] set dcdc2=1400mv, clock=912M successed
[       0.281] key
[       0.293] no key found
[       0.293] flash init start
[       0.293] NB1 : enter NFB_Init
[       0.296] NB1 : enter phy init
[       0.299] [NAND] nand driver(A20) version: 0x0x00000002, 0x0x00000012, data
: 0x426fff64 1111692733
[       0.308] set retry default value: [       0.311]  0x00000021[       0.314]
  0x00000021[       0.316]  0x00000072[       0.318]  0x000000be[       0.321]
[       0.322] get the good blk ratio from hwscan : 870
[       0.327] NB1 : nand phy init ok
[       0.377] NB1 : init ok
[       0.377] flash init finish
[       0.378] fs init ok
[       0.380] fattype FAT16
[       0.382] fs mount ok
[       0.385] nand good_block_ratio=870
[       0.388] storage_type=0
[       0.400] 0
[       0.400] set pc
[       0.400] usbdc_vol = 4000, usbdc_cur = 0
[       0.402] usbpc_vol = 4400, usbpc_cur = 0
[       0.406] init to usb pc
[       0.409] set pc
[       0.491] battery enough
[       0.492] power_start=0x00000000
[       0.492] pre sys mode
[       0.495] key value = 0
[       0.497] recovery key high 40, low 4
[       0.518] show pic finish
[       0.518] load kernel start
[       0.538] load kernel successed
[       0.538] start address = 0x4a000000
[       1.049] power exit detect
[       1.049] usb exit detect
[       1.049] jump to
[       1.051] set retry default value: [       1.055]  0x00000021[       1.057]
  0x00000021[       1.059]  0x00000072[       1.061]  0x000000be[       1

U-Boot 2011.09-rc1 (Jan 26 2014 - 22:05:45) Allwinner Technology

CPU:   SUNXI Family
Board: SUN7I-EVB
DRAM:  1 GiB
NAND:  NB1 : enter NFB_Init
[NAND] nand driver(A20) version: 0x2, 0x12, data: 12 1610225348
set retry default value:  21 21 72 be
[NAND] set nand_good_block_ratio 870
NB1 : nand phy init ok
NB1 : init ok
3480 MiB
In:    serial
Out:   serial
Err:   serial
--------fastboot partitions--------
-total partitions:11-
-name-        -start-       -size-
bootloader  : 8000          8000
env         : 10000         8000
boot        : 18000         8000
system      : 20000         140000
data        : 160000        100000
misc        : 260000        8000
recovery    : 268000        10000
cache       : 278000        140000
databk      : 3b8000        80000
private     : 438000        8000
UDISK       : 440000        28c000
-----------------------------------
bootcmd set setargs_nand
Hit any key to stop autoboot:  0
set retry default value:  21 21 72 be
[NAND]dumy read,chip 0

Starting kernel ...

[    2.556027] init: width = 800
[    2.559374] init: height = 480
[    2.562888] init: s.st_size = 1536000
[    2.595302] EXT4-fs (nande): VFS: Can't find ext4 filesystem
[    2.652029] init: buffer : /dev/block/nande
[    4.107876] init: do_umount: /data
[    4.111883] init: do_umount error = Invalid argument
[    4.292716] EXT4-fs (nandh): VFS: Can't find ext4 filesystem
[    4.341994] init: buffer : /dev/block/nandh
[    6.045679] init: do_umount: /cache
[    6.049760] init: do_umount error = Invalid argument
[    6.102837] init: start format /dev/block/UDISK
[    6.108156] init: wait for format /dev/block/UDISK
[    6.108377] init: fork to format /dev/block/UDISK
[    7.631323] init: format /dev/block/UDISK ok
[    7.638519] EXT4-fs (nandi): VFS: Can't find ext4 filesystem
[    7.692011] init: buffer : /dev/block/nandi
[    8.551501] init: do_umount: /databk
[    8.555661] init: do_umount error = Invalid argument
[    8.594805] init: cannot find '/system/etc/install-recovery.sh', disabling 'f
lash_recovery'
[    9.319950] i2c i2c-1: Invalid 7-bit I2C address 0x00
[    9.576863] android_usb: already disabled
[    9.581755] init: using deprecated syntax for specifying property 'sys.usb.co
nfig', use ${name} instead
[    9.598445] init: using deprecated syntax for specifying property 'sys.usb.co
nfig', use ${name} instead
shell@android:/ $
                                   
At this point, I get the Allwindder Android 4.2.2 graphic on the LCD which after a little time appears to crash. Nothing after this.                         

I suspect my image is the issue as I can flash the default image from Olimex for NAND and that works. I just built it without any changes from the source you provided a link to. There must be a different PACK for SD and NAND as Olimex have 2 different files for download. I can't find anything on how to create either of them.

Title: Re: Open source or not????
Post by: ph.fouquet on January 27, 2014, 02:43:23 PM
I had seen some time the kernel faillure but I don't where could be come from.
I work on this probleme this week.

But in many case android start correctly (without modification for kernel and android source).
Have you something to connect to your board?

For the first time try to start it whitout any thing connected.

Philippe
Title: Re: Open source or not????
Post by: dave-at-axon on January 27, 2014, 03:12:51 PM
No, nothing connected. Just the bare system out of the box. No WiFi, no GSM etc.

I've tried it again and this time the image boots into Android. It has crashed part through the setup process.

I'll keep playing with it! It's encouraging though to get this far in just a few hours.! :)
Title: Re: Open source or not????
Post by: dave-at-axon on January 27, 2014, 03:38:59 PM
OK. I've gotten it to boot this time and I have the main screen and apps etc but it is missing a lot of stuff that came with the prebuilt image.

There is no touch capability. Only USB mouse. There is not even the calibrate function.

The lower USB socket does not work. If I plug in the mouse to it, nothing. Only the top one appears to work for now.

The GSM modem crashes the system when plugged in.

I re-installed the default image and it runs fine. Even the lower USB works.

I suspect this is not the Allwinner source that is used to create the same default image on the Olimex website???
Title: Re: Open source or not????
Post by: ph.fouquet on January 28, 2014, 09:19:24 AM
Quote from: dave-at-axon on January 27, 2014, 03:38:59 PM
There is no touch capability. Only USB mouse. There is not even the calibrate function.

Ok for that if you are in resitive touche  screen you must modiffy the fex file for activate the module in bios for that add (refer to http://linux-sunxi.org/Fex_Guide#.5Brtp_para.5D):


[rtp_para]
rtp_used = 1
rtp_screen_size = 7
rtp_regidity_level = 7
rtp_press_threshold_enable = 0
rtp_press_threshold = 0x1f40
rtp_sensitive_level = 0xf
rtp_exchange_x_y_flag = 0


after you must run the kernel module with command line

insmod /system/vendor/module/sunix-ts.ko

I didn't find any mort how to run at startup (finaly I must used capacitive touch) but I think if you configure the sunix-ts in kernel and not as modul it cuold be run automaticaty (drive->input->sw_device I think)

Quote from: dave-at-axon on January 27, 2014, 03:38:59 PM
I suspect this is not the Allwinner source that is used to create the same default image on the Olimex website???

It's probably true.
Title: Re: Open source or not????
Post by: dave-at-axon on January 29, 2014, 07:20:10 AM
Hi Philippe,

Are you running this code on an A20?

I can't get it to run reliably each time. The stock image I can download from Olimex is stable and boots every time, even if there is nothing on the LCD until it shows the Android main screen.

With the download you provided, I get lots of SDRAM errors. I am wondering if the timing for this is wrong but I have nothing to compare it with?

I've emailed Allwinner to see if I can get the source that was used for the image on Olimex but they have not responded as yet. Maybe because of the Chinese new year delays, who knows.

I am trying to develop a system that I hope to move to being commercial and lack of source code is making it difficult. If only I knew Linux development I would switch to that but I prefer Android as it gives me the ability to do updates over the air, Google Cloud Messaging etc.

The reason for the source is that I need 2 additional serial ports and the stock image only has UART 6 and 7 enabled. I need to add 3 and 4 to the kernel. These are present on the GPIO connector so physically available.

I also need to add my Real Time Clock (DS1338) to the kernel so that I can keep time without a network connection.
Title: Re: Open source or not????
Post by: olimex on January 29, 2014, 08:12:40 AM
Quote from: dave-at-axon on January 29, 2014, 07:20:10 AM
I've emailed Allwinner to see if I can get the source that was used for the image on Olimex but they have not responded as yet. Maybe because of the Chinese new year delays, who knows.

The reason for the source is that I need 2 additional serial ports and the stock image only has UART 6 and 7 enabled. I need to add 3 and 4 to the kernel. These are present on the GPIO connector so physically available.

I must have written several times here on the forum that the SDK used to generate our image is the one linked on the Wiki, but I'm still puzzled when I read something like this above? What exactly do you expect to receive from Allwinner? special SDK for each of their customers? The SDK is one, then it's up to the customers to enable or disable this or that module and drivers, all of them are inside the SDK.

to enable UARTs you do not need sources at all, the drivers for UARTs are already inside the kernel image, all you have to do is to learn how to configure your FEX and to enable the UARTs you want to use with their corresponding multiplexing function and to make sure there are no collisions with other peripherals

same is for the DDR settings they are all defined in the FEX (SCRIPT.BIN) no need to re-compile anything just set them in the FEX
Title: How to Build Android 4.2.2 for A20-OLinuXino-MICRO
Post by: dave-at-axon on January 29, 2014, 08:45:51 AM
Quote from: olimex on January 29, 2014, 08:12:40 AM
I must have written several times here on the forum that the SDK used to generate our image is the one linked on the Wiki, but I'm still puzzled when I read something like this above?

Sorry, I didn't mean to sound so negative. I love the boards and what you offer. I've already purchased a few now and more to come.! :)

You need to download the SDK yourself and check. The one linked on the website "aw.tar.bz2" contains android 4.03 and yet the image to download on your webpage is 4.2.2 when installed and yet it states it was created from the SDK2.0 which is clearly not the case.

Something is clearly not the same?


Thanks for the fex information. I'll see what I can do with that. There doesn't appear to be any conflict as the pins go straight to the GPIO connections. If that works, I'll run the image as is. :)


EDITED: The kernel in the image at this link is 3.4.39 but the kernel in the SDK2.0 is only 3.0

https://docs.google.com/file/d/0B-bAEPML8fwlUjRLUmRydENZMXc/edit
Title: Re: Open source or not????
Post by: ph.fouquet on January 29, 2014, 09:50:04 AM
That true I'm agree with dave-at-axon check you SDK!


It could be very good if you give us a SDK with :

dave-at-axon : for the SDRAM error I see that in fex file the speed DRAM at set to 432 but in all other file for sun7i it set to 384. I chage it to 384 and I don't have any erro yet. You can try thit configuation and give me back if it have resolve your problem (becarfull you will not put any value that you want check http://linux-sunxi.org/Fex_Guide#SDRAM).
Title: Re: Open source or not????
Post by: olimex on January 29, 2014, 10:09:37 AM
on the wiki I put what I get from Dimitar, who obviously is too busy to notify me when he changes something

I will try to sort this out
Title: Re: Open source or not????
Post by: ph.fouquet on January 29, 2014, 10:51:04 AM
Thank

It can very help full us

Philippe
Title: Re: Open source or not????
Post by: gvi70000 on January 29, 2014, 11:06:14 PM
Can any of those who manage to compile Android can make a post and describe the steps to compile android
- how to set up the repo/git
- what to install/ check (jdk...)
- what/from where to download

I have try to keep track of two post and the links in the post in order to be able to make my own android image but without success. This will help me and for sure others
Title: Re: Open source or not????
Post by: dave-at-axon on January 30, 2014, 03:52:16 AM
Quote from: gvi70000 on January 29, 2014, 11:06:14 PM
Can any of those who manage to compile Android can make a post and describe the steps to compile android
- how to set up the repo/git
- what to install/ check (jdk...)
- what/from where to download

I will do this once I get the actual source used to build the 4.2.2 image. Google's own website has some information on how to setup your machine to build the source but there are a couple of extra steps to take over and above this. I'll document these once I have it working.

The JDK was the worst part of the installation as Sun removed this from the Ubuntu repository so this part alone takes a little bit of work. (Unless of course you are a whiz at Linux. I was a learner at the time 2 years ago) I recommend using 1.6 for Android builds. 1.7+ gave me errors.

I currently use Ubuntu 10.04 64 bit as this was the recommended version for building Android as I tried many times to get 12.x to work without success. I now run Ubuntu on a virtual machine until such time as I get a laptop with enough oomph to run it for Android building. My desktop here is Hex Core 3.2Ghz so builds Android in about 4-5 hours. My old machine was single core and took around 24+ hours to do the same build. This is just the initial build as subsequent builds are quicker. The kernel is about 20 mins for a full build.

I'll post all this up once I get the source from Olimex and have it working.
Title: How to Build Android 4.2.2 for A20-OLinuXino-MICRO
Post by: olimex on January 30, 2014, 08:58:05 AM
ok, the information is on the Wiki https://www.olimex.com/wiki/A20-OLinuXino-MICRO#How_to_build_the_Android_4.2.2_image_for_A20-OLinuXino-MICRO.3F
Title: Re: How to Build Android 4.2.2 for A20-OLinuXino-MICRO
Post by: LubOlimex on November 23, 2015, 08:24:54 AM
For the Android configuration for the A20 boards please also check this repository:

https://github.com/hehopmajieh/olinuxino_configs

Best regards,
Lub/OLIMEX