On Sep 8, 4:04 am, Amir K <[email protected]> wrote:
> Hi,
> I have determined (or so I hope) how to add a new shared library to
> the external part of Android image:
> 1. Add a directory called "foobar", under <root>/external
> 2. In that folder put my source files
> 3. Create Android.mk file
> 4. Update the file <root>/build/core/prelink-linux-arm.map and add my
> library there, in the last section (titled "libraries for specific
> apps..."), choosing a free memory area
> 5. Use the 'mm' shell function to build the library.
>
> The output is (between dashed lines):
> --------------------------
> make: Entering directory `/media/disk-1/development/Donut/donut'
> target thumb C: libfoobar <= external/foobar/src/foobar_01.c
> target thumb C: libfoobar <= external/foobar/src/foobar_02.c
> target SharedLib: libfoobar (out/target/product/generic/obj/
> SHARED_LIBRARIES/libfoobar_intermediates/LINKED/libfoobar.so)
> target Prelink: libfoobar (out/target/product/generic/symbols/system/
> lib/libfoobar/libfoobar.so)
> target Strip: libfoobar (out/target/product/generic/obj/lib/
> libfoobar.so)
> Install: out/target/product/generic/system/lib/libfoobar.so
> make: Leaving directory `/media/disk-1/development/Donut/donut'
> --------------------------
>
> So far, so good.
>
> My questions are:
> 1. Is the process above correct? If not, where did I go wrong?
Looks correct. Only point to note, if this library will not be a part
of Android opensource project, I would suggest moving it to <root>/
vendor/Amir/ This is just a good place to keep. That being said, if
this is is something that you are trying out for fun, any place is
good.
> 2. Is this process documented and if so, where?
I am not sure about the documentation. You might want to look at the
NDK group to see if there is some mention. However, this process (or
very similar) has been discussed in the forums many-a-times.
> 3. How do I prevent the library from being stripped?
The following line to your Android.mk should achieve that.
LOCAL_STRIP_MODULE := false
> 4. Alternatively, can I tell the make process to preserve certain
> symbols and strip all others?
You may read about __attribute__ ((visibility("default"))) and the
compiler flag "-fvisibility=hidden". In short, adding the compiler
flag "-fvisibility=hidden" hides all symbols by default, except for
those that have the attribute (visibility("default")) set.
> 5. If I want the foobar library to be built from objects and
> libraries, located elsewhere, without any C compilations, how do I do
> it by tweaking the Android.mk file?
To create a shared library from prebuilt static libraries, you can use
the BUILD_MULTI_PREBUILT template. I am not sure how to use
precompiled object files.
>
> Thanks,
> Amir
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---