Jump to content

Did anyone successfully built Android from sources?


Guest Auxx

Recommended Posts

Guest Auxx

I've just ran readelf on my libwebcore.so and libwebcore.so from Acer to find out why my lib crashes. The most important thing I've noticed right at the start is that my lib is for arm5, thumb1 and without fpu optimizations. So now I recompile it from scratch... Oh, well...

So, my questions. Did anyone successfully compiled any system libs for Acer from AOSP sources? If so, what flags did you use? How did you fight reloc issues?

Thanks in advance!

Link to comment
Share on other sites

Guest amdnikos
I've just ran readelf on my libwebcore.so and libwebcore.so from Acer to find out why my lib crashes. The most important thing I've noticed right at the start is that my lib is for arm5, thumb1 and without fpu optimizations. So now I recompile it from scratch... Oh, well...

So, my questions. Did anyone successfully compiled any system libs for Acer from AOSP sources? If so, what flags did you use? How did you fight reloc issues?

Thanks in advance!

afaik noone was able to built an aosp system.tbh i would love it cause it includes all languages even Greek that none acer rom include it.

Link to comment
Share on other sites

Guest Auxx
afaik noone was able to built an aosp system.tbh i would love it cause it includes all languages even Greek that none acer rom include it.

Khm... If you are correct, then it'll take more time then I hoped...

Link to comment
Share on other sites

Guest demolition23
Guess what, guys? I just did it! I have found a reloc issue workaround! I now have custom webkit in my Liquid (:

and thats mean...??

Link to comment
Share on other sites

Guest dguerre
That means we are free to compile any system libs from Android sources and use them on our devices (:

Excellent. Is this for 1.6 or 2.1?

Link to comment
Share on other sites

Guest Auxx
Excellent. Is this for 1.6 or 2.1?

For anything.

does this mean aosp ?

Yes!

I will provide details tomorrow - I want to go to sleep (: It's 1:41 here and I need to wake up at 8:00.

Edited by Auxx
Link to comment
Share on other sites

Guest Auxx

So, technical details.

Google decided to use prelinking technique to speed everything up and to waste as little RAM as possible. Great! So they took prelink utility and modified it to fit their needs. Two tools were born: apriori and soslim. They are run on every build to produce optimized and prelinked system libs. Almost every .so file you see in /system/lib is prelinked via soslim/apriori.

Prelinking works by loading libs at known base addresses which are defined in a special file called prelink-linux-arm.map. This file contains a list of libs with their predefined base addresses. What Acer did is that they modified this file and did not share it with us. So every AOSP attemp failed. If you compile any lib from Android sources and put it on your Liquid boom happens and nothing works. Studying Android sources I've found a small utility which is called isprelinked. It checks binary library if it is prelinked and if it is, then base address is shown.

So yesterday I ran isprelinked on Acer libs and recreated prelink-linux-arm.map for Liquid. Then I built test version of webkit (libwebcore.so), put it into /system/lib replacing version from Acer and rebooted the phone - it worked! I can not share prelink map at the moment - it is at my home PC and I don't have remote access. I will share this file in the evening, but you can make it yourself, actually.

How to make prelink map? Quite simple. First of all you need to create isprelinked binary. cd to your Android source (cd ~/mydroid as in docs) and run "make isprelinked" (without quotes, of course). You will get app binary in a while, it will be somewhere in ~/mydroid/out/host/bla-bla-bla. The correct path will be shown in console once compilation is done.

Next step is run isprelinked over Acer binaries. It is quite simple, but will take some time. Copy all libs from your Liquid to some folder, for example to ~/acer-libs. Now open original prelink map (make a backup!), copy its contents to empty text file, in this new text file remove comments and base addresses, leave only lib names. Put a new line at top with full path to isprelinked and merge all lib names into single line with spaces between. You should have text file with one line looking like this:

~/mydroid/out/host/tools/isprelinked libdl.so libc.so libstdc++.so
This line will be very long (: Now go back into console, cd ~/acer-libs and run this BIG line. It will fail (: Because this list has some libs which Acer does not have. It will fail WITHOUT telling which lib is missing. But you will see base addr of previous lib. So find all unneeded libs and remove them from command line. Hell of a work, actually. But once again - I'm not at home, I can not paste correct line at the moment. Sorry. Once isprelinked runs clean without errors you will see a list of all libs and their base addresses. Remove ":" character between lib name and address, paste it into prelink-linux-arm.map replacing all previous contents (you made a backup, right?) and this part is finished - now you have all base addresses needed for successful compilation of system binaries. But if you run compilation now it will fail - apriori will tell you that lib addresses are out of bound. You need to modify prelinkmap.c. There is a line:
#define PRELINK_MIN 0x90000000
Change it to:
#define PRELINK_MIN 0x50000000

And recompile apriori tool with "make apriori" from your ~/mydroid. Now you have a 100% Acer compatible build environment!

Now if you wish to compile any component just run "make SOMETHING" where SOMETHING is what you need to compile. For example, "make libwebcore" compiles WebKit (: This is the simplest way of compilation, but you also want to make Snapdragon optimizations generated. So you need to compile with additional option TARGET_ARCH_VARIANT to target Snapdragon. SD has armv7-a CPU inside. So final string for WebKit is "make TARGET_ARCH_VARIANT=armv7-a libwebcore". That will make default WebKit with all CPU dependent optimizations. Compilation result can be found in ~/mydroid/out/target/system/lib - full and correct path will be shown in console after compilation.

What does it all mean? Well, AOSP is finally possible! This will also be helpful for porting binaries from other non-acer ROMs - now you can easily rebase libs to Acer standard and everything will work.

Today I will put map file I've generated from Acer libs and will continue working on Flash support for 2.1. I also think I will compile Flash supporting WebKit with V8 JavaScript engine (like in Froyo), SVG support and I will look into animated GIFs issue. There will be two libwebcores from me: stock with Flash and full-blown (which may eat your RAM and kill CPU).

Link to comment
Share on other sites

Guest Charlton22
So, technical details.

Google decided to use prelinking technique to speed everything up and to waste as little RAM as possible. Great! So they took prelink utility and modified it to fit their needs. Two tools were born: apriori and soslim. They are run on every build to produce optimized and prelinked system libs. Almost every .so file you see in /system/lib is prelinked via soslim/apriori.

Prelinking works by loading libs at known base addresses which are defined in a special file called prelink-linux-arm.map. This file contains a list of libs with their predefined base addresses. What Acer did is that they modified this file and did not share it with us. So every AOSP attemp failed. If you compile any lib from Android sources and put it on your Liquid boom happens and nothing works. Studying Android sources I've found a small utility which is called isprelinked. It checks binary library if it is prelinked and if it is, then base address is shown.

So yesterday I ran isprelinked on Acer libs and recreated prelink-linux-arm.map for Liquid. Then I built test version of webkit (libwebcore.so), put it into /system/lib replacing version from Acer and rebooted the phone - it worked! I can not share prelink map at the moment - it is at my home PC and I don't have remote access. I will share this file in the evening, but you can make it yourself, actually.

How to make prelink map? Quite simple. First of all you need to create isprelinked binary. cd to your Android source (cd ~/mydroid as in docs) and run "make isprelinked" (without quotes, of course). You will get app binary in a while, it will be somewhere in ~/mydroid/out/host/bla-bla-bla. The correct path will be shown in console once compilation is done.

Next step is run isprelinked over Acer binaries. It is quite simple, but will take some time. Copy all libs from your Liquid to some folder, for example to ~/acer-libs. Now open original prelink map (make a backup!), copy its contents to empty text file, in this new text file remove comments and base addresses, leave only lib names. Put a new line at top with full path to isprelinked and merge all lib names into single line with spaces between. You should have text file with one line looking like this:

~/mydroid/out/host/tools/isprelinked libdl.so libc.so libstdc++.so
This line will be very long (: Now go back into console, cd ~/acer-libs and run this BIG line. It will fail (: Because this list has some libs which Acer does not have. It will fail WITHOUT telling which lib is missing. But you will see base addr of previous lib. So find all unneeded libs and remove them from command line. Hell of a work, actually. But once again - I'm not at home, I can not paste correct line at the moment. Sorry. Once isprelinked runs clean without errors you will see a list of all libs and their base addresses. Remove ":" character between lib name and address, paste it into prelink-linux-arm.map replacing all previous contents (you made a backup, right?) and this part is finished - now you have all base addresses needed for successful compilation of system binaries. But if you run compilation now it will fail - apriori will tell you that lib addresses are out of bound. You need to modify prelinkmap.c. There is a line:
#define PRELINK_MIN 0x90000000
Change it to:
#define PRELINK_MIN 0x50000000

And recompile apriori tool with "make apriori" from your ~/mydroid. Now you have a 100% Acer compatible build environment!

Now if you wish to compile any component just run "make SOMETHING" where SOMETHING is what you need to compile. For example, "make libwebcore" compiles WebKit (: This is the simplest way of compilation, but you also want to make Snapdragon optimizations generated. So you need to compile with additional option TARGET_ARCH_VARIANT to target Snapdragon. SD has armv7-a CPU inside. So final string for WebKit is "make TARGET_ARCH_VARIANT=armv7-a libwebcore". That will make default WebKit with all CPU dependent optimizations. Compilation result can be found in ~/mydroid/out/target/system/lib - full and correct path will be shown in console after compilation.

What does it all mean? Well, AOSP is finally possible! This will also be helpful for porting binaries from other non-acer ROMs - now you can easily rebase libs to Acer standard and everything will work.

Today I will put map file I've generated from Acer libs and will continue working on Flash support for 2.1. I also think I will compile Flash supporting WebKit with V8 JavaScript engine (like in Froyo), SVG support and I will look into animated GIFs issue. There will be two libwebcores from me: stock with Flash and full-blown (which may eat your RAM and kill CPU).

And what is this for? Sorry.. noob..

Link to comment
Share on other sites

Guest Auxx
And what is this for? Sorry.. noob..

What does it all mean? Well, AOSP is finally possible! This will also be helpful for porting binaries from other non-acer ROMs - now you can easily rebase libs to Acer standard and everything will work.

Basically, if you are not ROM creator/hacker, then it has nothing to do with you (:

Link to comment
Share on other sites

Guest mirox3m
.....Today I will put map file I've generated from Acer libs and will continue working on Flash support for 2.1. I also think I will compile Flash supporting WebKit with V8 JavaScript engine (like in Froyo), SVG support and I will look into animated GIFs issue. There will be two libwebcores from me: stock with Flash and full-blown (which may eat your RAM and kill CPU).

Congrats and thanks for your work!!! :(

Isn't it easier to port Froyo than enabling Flash on 2.1?

Edited by mirox3m
Link to comment
Share on other sites

Guest liquid_it

Great job Auxx, thanks for sharing tech details, this is what I call a Community!

(not everyone on android scene is smart enough to understand that sharing knowledge is the best choice..)

I think I'll spend my night messing with aosp code.. :(

Link to comment
Share on other sites

Guest Auxx
Congrats and thanks for your work!!! :(

Isn't it easier to port Froyo than enabling Flash on 2.1?

Of course it is! But many people are stuck with 2.1 (: Even with earlier versions. So my work will help them.

Link to comment
Share on other sites

Guest Mr.r9

Maybe you can contact Malez since he is working on Froyo?

I've no idea if either of you will benefit since Idon't develop but maybe something good might come out of it.

Link to comment
Share on other sites

Guest koudelka
Congrats and thanks for your work!!! :(

Isn't it easier to port Froyo than enabling Flash on 2.1?

Have they published the Froyo sources yet?

Edit* Btw, GREAT JOB Auxx!

Edited by koudelka
Link to comment
Share on other sites

Guest Auxx
Maybe you can contact Malez since he is working on Froyo?

I've no idea if either of you will benefit since Idon't develop but maybe something good might come out of it.

I'm already sharing info with Froyo team (malez, vache, phh).

Link to comment
Share on other sites

Guest drigerott

Auxx why don't try to buil an AOSP from cyanogenmod surce? ^^ and then port flash player :( lol would be fantastic ihhihihihi

anyway...you are great...

great work... ^^

Link to comment
Share on other sites

Guest wytek
Auxx why don't try to buil an AOSP from cyanogenmod surce? ^^ and then port flash player :( lol would be fantastic ihhihihihi

anyway...you are great...

great work... ^^

QUOTE!!! :(

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.