Booting Android from SD Card on the A13 Micro

Started by jasonjf, April 07, 2013, 01:54:29 AM

Previous topic - Next topic

jasonjf

Hi Everybody,
Has anybody had any success here lately? I read the other posts that reference instructions in Chinese, but I was kinda hoping for english. Also I believe this is important enough to warrant its own topic.

Please guys if you're getting anywhere with this please share.
Thanks!
Jason

klotzmando

The pcDuino community has some information, in english, on now to use the phoenixCard in its installation instructions. https://s3.amazonaws.com/pcduino/User+Guide/pcDuino+OS+Installation+Guide.pdf.

jasonjf

Hi Guys,
I ran google translate on the Chinese document and came up with this below... maybe somebody can make some sense of it..
Jason

____________________________________________________________________________________-----------

Add for of android4 V1.5 card Start Programme
Summary: This article introduces to modify in nand programs on the basis of a card startup programs.

1, add a new program
1) First, find the the original nand program directory, place a copy, and rename.
For example: the the Crane-EVB directory situ copy is a copy and rename Crane-evb_mmc (must be "_mmc suffixes)
2) Then, rename the directory <program name> the mk, vendorsetup.sh, AndroidProducts.mk package.sh, BoardConfig.mk, and recovery / Android.mk 6 file and program names of characters for the characters of the same name as the name of the program. (Pay attention to - and _)
Example: crane_evb.mk, AndroidProducts.mk, vendorsetup, recovery / Android.mk, package.sh file (including the file name) crane-EVB changed the the crane-evb_mmc and crane_evb changed crane_evb_mmc
--- Simple practice: reference EVB_MMC programs compared to modify.
After completing the second step in the android directory
souce build / envsetup.sh
lunch
You can see the programs add their own.

2, modify the program card-activated
1) First to modify init.sunXi.rc and ueventd.sunXi.rc file, which nand partition is replaced mmc partition.
Partition table
Nanda - mmcblk0p2
nandb - mmcblk0p5
nandc - mmcblk0p6
nandd - mmcblk0p7
nande - mmcblk0p8
nandf - mmcblk0p9
. . . . . . (Since then both sides are added in increments of 1)

Then init.sunXi.rc
format_userdata / dev / block / nand ........
Delete or comment out this line.
Then add
exec / system / bin / busybox mount-t vfat / dev/block/mmcblk0p1 / mnt / sdcard
2) then modify vold.fstab file
Changes to the file are as follows
Before:

dev_mount sdcard / mnt / sdcard auto / devices / virtual / block / nandi
dev_mount extsd / mnt / extsd auto / devices/platform/sunxi-mmc.1/mmc_host / devices/platform/sunxi-mmc.0/mmc_host

Modified;
dev_mount sdcard / mnt / sdcard auto / devices/platform/sunxi-mmc.0/mmc_host
dev_mount extsd / mnt / extsd auto / devices/platform/sunxi-mmc.1/mmc_host

Here sunxi the-mmc behind the figures are based on specific values ​​(card 2 start needs to be changed to the following
dev_mount sdcard / mnt / sdcard auto / devices/platform/sunxi-mmc.2/mmc_host
dev_mount extsd / mnt / extsd auto / devices/platform/sunxi-mmc.1/mmc_host / devices/platform/sunxi-mmc.0/mmc_host

If the card is not enough controller 3, please contact technical support staff to be modified.
Note: This modified error may lead to failure of an external card mount has a small machine and the PC do not usb connection or connection failure.

--- Simple approach: simply conducted init.sun4i.rc ueventd.sun4i.rc vold.fstab comparison, can be replaced. Than the file on the FTP download.

3) If the firmware needs to support firmware modification tools, need to create a file called preinstall.sh.
Write the following in the file:
#! / System / bin / busybox sh

echo "do preinstall job"
BUSYBOX = "/ system / bin / busybox"
BOOT_MEDIA = "nanda"
if [!-e / data / system.notfirstrun]; then
/ System / bin / sh / system / bin / pm preinstall / system / preinstall
# Copy android modify tool files
mkdir / mnt / Nanda
if [-e / dev/block/mmcblk0p2]; then
BOOT_MEDIA = "mmcblk0p2"
fi
mount-t vfat / dev / block / $ BOOT_MEDIA / mnt / nanda
# $ BUSYBOX cp / mnt / nanda / vendor / initlogo.rle /
$ BUSYBOX cp / mnt / nanda / vendor / system / build.prop / system /
$ BUSYBOX cp / mnt / nanda / vendor / system / media / bootanimation.zip / system / media /
$ Cp / mnt / nanda / vendor / system / usr / keylayout / *. Kl / system / usr / keylayout /
sync
umount / mnt / Nanda
rmdir / mnt / nanda
$ BUSYBOX touch / data / system.notfirstrun
fi
echo "preinstall ok"

Add uboot configuration file
1) lichee / tools / pack / chips / sunXi / configs / crane original nand programs of copy and rename
Example: EVB copy and rename evb_mmc
2) Lichee / tools / pack / chips / sunXi / configs / the crane / the default directory env.cfg copy to a new directory,
Make the following modifications
Before:
setargs = setenv bootargs console = $ {console} root = $ {nand_root} init = $ {init} loglevel = $ {loglevel}
boot_normal = nand read 40007800 boot; boota 40007800
boot_recovery = nand read 40007800 recovery; boota 40007800
Modified:
setargs = setenv bootargs console = $ {console} root = $ {mmc_root} init = $ {init} loglevel = $ {loglevel}
boot_normal = mmc read 40007800 13800 10000; boota 40007800
boot_recovery = mmc read 40007800 recovery; boota 40007800
Medium --- simple practices directly copy env.cfg file to / tools / Pack / chips / sunXi the / conifgs / crane / the program name _mmc directory. The file can Env.cfg FTP download.

The 3) the new directory sysconfig1.fex file, corresponding to the start card card controller detmode with 3
Such as:
[Mmc0_para]
sdc_used = 1
sdc_detmode = 3
This ensures that the the start card system is mounted.
4) the new directory sysconfig1.fex file storage format changed to 1 or 2 (0 for nand start 1 represents card0 starts, 2 on behalf of card2 start)
 storage_type = 1

5) the Z: \ workspace \ atest \ Lichee \ u-boot \ include \ card in configs in sun5i.a13.h file to start defined # define CONFIG_MMC_SUNXI_SLOT modify, for example,
# Define CONFIG_MMC_SUNXI_SLOT 0 / * which mmc slot to use, could be 0,1,2,3 * /
Where 0 corresponds to card0 corresponding card1, such as similar analogy.

4, the compiler Linux BSP

Current UBOOT Adaptive NAND and MMC start, the customer V1.5 version can be updated to Android 4.0.
5 through PhoenixCard burn pluggable start card
The pluggable card to the PC USB port can be used PhoenixCard burn sdmmc of card start card.
Burn operation
The firmware burning use PhoenixCard tools, compressed package of the tool can be used without having to install, unzip lichee / tools / tools / tools_win directory (green version).

After decompression PhoenixCard.exe, you can see the following chart user interface

(for figures look at the actual document on github)

Figure 2.1
Click image file button, select the card you want to burn to firmware
 
Figure 2.2
Click on the card to start in front of a small circle
 
Figure 2.3
Insert the boot card (This step can be at any time before clicking the Burn operation)
 
Figure 2.4
Click to burn all buttons are virtual not operate to know the burn is complete
 
Figure 2.5
Burning is complete, click Exit
 
Figure 2.6
Will start the card into the card slot, to re-start the small, small machine can operate correctly.

aauer1

Hi all,

I'm currently working on the same thing: booting Android from SD card. But I ignored the Chinese document and tried to do it my way. Furthermore, I advanced from the A13 jelly bean Olimex Android image to a standard CM10 working copy with some extensions from allwinner-dev-team repository.
The result is, that I'm able to boot Android 4.1 from SD card (on a A13 board with 512 MB RAM) without the need of LiveSuit or some other tools. That's much more convenient than flashing an Android image every time for only small changes.
The only problem on my board is, that it is a bit unstable. But I think this is a problem of my power supply.

I haven't published anything yet, but I will make a repository on github.

Cheers,
Andreas

mb

Sounds awesome Andreas, looking forward to having a look at what you've accomplished.

/Martin

aauer1

Hello,

I published all of my files to github (I hope I haven't forgotten anything): https://github.com/aauer1
I have to say, that I haven't tested if the local manifest file and checking out from my personal github repository is really working. So, this is all in a very unstable state (you should take this warning seriously :) ).
But I would appreciate if anybody wants to give it a try. And everyone who wants to report a problem is very welcome!

So far, so good... I haven't written a detailed howto until now. So, I will add some notes here.

First of all, I found the instructions on http://linux-sunxi.org/Starting_a_CyanogenMod_device_tree very helpful. For Jelly Bean, you have to install the additional libraries specified on the wiki page. Next, you shoud get the repo tool and initialize your local JB repository.

After that, get the local_manifest.xml file from my github repository and start syncing:

wget https://raw.github.com/aauer1/manifest/master/local_manifest.xml -O .repo/local_manifest.xml
repo sync -j16


If everything is working - as mentioned earlier, I haven't tested it yet - you should have everything on your disk to build Jelly Bean for A13.

The next steps are sourcing the "envsetup" script, selecting the target and compiling the source:

. build/envsetup.sh
lunch full_socialnode-userdebug
make -j8


Now, you should get some coffee, this will take some time!

If "make" returns without errors it is time to make a bootable SD card. You should make at least two partitions on your SD card.
- The first one should be formated with FAT32 (e.g. 1GB in size). It is the boot partition where your script.bin file and the kernel uImage file should be located.
- The second partition is the root filesystem for Android (I used ext4 for this partition and reserved about 2GB for it).

The kernel uImage file is in out/target/product/socialnode/obj/KERNEL_OBJ/arch/arm/boot/uImage. Copy that file to the FAT32 partition.

To create the root filesystem you should copy
out/target/product/socialnode/root/* to <sd_card_partition2>/
and
out/target/product/socialnode/system/* to <sd_card_partition2>/system/

The last step is to get u-boot and install it on the SD card. I used the instructions from https://github.com/androportal/uboot-allwinner to do that.

Now, you can boot with the SD card but you have to do one more thing. Interrupt the u-boot boot process and do the following:

setenv extraargs init=/init
setenv root /dev/mmcblk0p2 rw rootwait
saveenv
reset

This is important to tell the kernel we want to use /init as init processs and to use the second partition of the SD card as root filesystem (the "rw" parameter was very important because without it, I got strange permission errors).

So, that's it. I hope this instructions are useful for someone. I hope I will find the time to write a detailed howto soon.

Cheers,
Andreas

drspastic

im looking forward to seeing an sd card android image posted!

Lasse

#7
Hi Andreas,
I used your little How-To to compile my android. But I had the problem with the DisplayDispatcher.h which could not be found. Thats why I googled for it and found one from allwinner but its the ics version and not jb. You also need the Input.h and the InputTransport.h which must be all located in the frameworks/native/include/ui folder in the checked out code from your repository. My compiling isnt finished yet, so I will write again when i can provide some news.

EDIT: Well I needed a fourth file in the same ui folder: DisplaySemaphore.h

And you need to install uboot-mkimage which could be found in the Ubuntu 12.04 Repository.

EDIT2: I extendet the current.txt in frameworks/base/api to do the @hide to three Fields (DisplayManager.EXTRA_TVSTATUS, DisplayManager.DISPLAY_OUTPUT_TYPE_TV, DisplayManager.DISPLAY_OUTPUT_TYPE_VGA)
make update-api did the trick.

EDIT3: Everything went fine but when I plug my Olimex in simply nothing happens. No Led is flashing and no output on Monitor or LCD.
regards
Lasse

aauer1

Hi,

I'm currently testing the build process I described in my post because I hadn't this issues with the four missing files. So, I hope I can tell you more in some hours ;-).

In the meanwhile, I made a SD card image, which I was using to boot Android on my own board. I think the image will only work on the A13 Olinuxino board with 512 MB of RAM (this is because of the mali kernel driver).

The included script.bin file specifies an attached 4.3 inch LCD (480 x 272px) for video output. So, this might be different on your board. If this is the case you have to use your own script.bin file. Simply copy it to the first partition of the SD card.

The image is about 2GB in size. I don't know if it will really fit on a 2 GB SD card. I copied it to an 8 GB card and it was working.

The link to the image: http://emicrotec.at/public/images/android_4.1_sd.img.gz

Unzip the image file and copy it to the SD card with dd:

gunzip android_4.1_sd.img.gz
dd if=android_4.1_sd.img of=/dev/mmcblk0


Cheers,
Andreas

jasonjf

Hi,

in that case, quick question. Has ANYBODY been successful in running Android on the A13 Micro (256 mb ram)? @ aauer1, do you know for a fact your image wont work on 256 mb ram?  Im ok with using ICS- I dont need Jellybean

Next, does anybody have any recommendations for SD cards that will work with the A13? Ie what brand/class/capacity is recomended? Some embedded systems are very prickly about the brands/classes that will work, I noticed this with the Raspberry Pi

Any info would be appreciated,
Thanks!
Jason

aauer1

Quote from: jasonjf on April 15, 2013, 11:24:22 PM
in that case, quick question. Has ANYBODY been successful in running Android on the A13 Micro (256 mb ram)? @ aauer1, do you know for a fact your image wont work on 256 mb ram?  Im ok with using ICS- I dont need Jellybean

I'm pretty sure that my Android image will not run on the A13 Micro. The location of the memory reservation for the mali kernel module is at 0x5C000000 which means that the memory above 448MB is reserved for mali. That's the reason why the image will not work (I think).
But if we move the reserved memory below 256 MB, I think it could be possible to run it on the A13 Micro board (supposed the Mali libs doesn't reference the hardcoded memory location directly. But I think this isn't the case!).

Cheers,
Andreas

Lasse

Quote from: jasonjf on April 15, 2013, 11:24:22 PM
Next, does anybody have any recommendations for SD cards that will work with the A13? Ie what brand/class/capacity is recomended? Some embedded systems are very prickly about the brands/classes that will work, I noticed this with the Raspberry Pi

I suggest that the same cards are working like with the Pi. I would prefer a class 10 card, because of the Speed. Remember that you dont have native NAND and you could speed up the booting with a fast SDCard. If I can get mine up with my sdcard i will try a sandisk 32gb class 10.

jasonjf

Thanks Lasse. aauer1, I appreciate the help

@lasse - Point noted regarding the fact that without NAND, the class 10 would be useful to speed up the boot process. On the Raspberry Pi wiki theres a list of cards classes and brands that work and another of those that dont, these things are notoriously picky- so I guess I will try and find one that works with the Pi and use that for the A13 Micro..

@aauer1, I'm sorry I know very little about this at the technical level you're speaking from. Could you (or anyone reading this post) point me to any resources that would give me more information on how one may move the reserve memory below 256mb?

Has anybody got an Android ROM that boots on the A13 Micro? It seems like the whole point of getting Android to boot on an SD card was for this purpose in the first place. The official documentation says that the Micro cant run android because it has no NAND memory, so I figured once we overcame that we'd be home free- but I guess thats not the case. I did read somewhere that 256 mb was too low to run Android but I guess I may have overlooked that in my enthusiasm.

Lasse

#13
Hi,
I think it must be possible to run Android on a 256mb Device. But I do not know whether Android 4.X is supported, because there are no mobile devices which only have 256mb. The minimum I have seen is 512mb.

Maybe we should move to another topic because we currently talk about the A13 without Nand and not the Micro.

Andreas, could you provide a fex file for the 7" TS? I have tried to change the parameters with the bin2hex and hex2bin converter but not successful until now. But the debian image is running fine. Could I use the same fex file from that image? I havent found anything well explained about that topic.

EDIT: Short after my post I found this Link: http://linux-sunxi.org/Fex_Guide

soorajkumar

Good evening everyone,

Can anyone reading this post suggest me some methods of accessing GPIO pins through Android library?

Does any specific android library exist for accessing the GPIO pins for A13 olinuxino micro board?