Using SDL on Android: can't compile because of missing "GLES_CM" - android

I'm trying to use OpenGL on Android using C. I'm following this excellent tutorial, but I've hit a wall.
I'm using an ARM compiler (arm-none-linux-gnueabi-ld) on Linux Mint 7 (Ubuntu 9.04 branch).
I can copy the compiled binary to the Android emulator just fine, it runs. But when I try to make it myself, I get the following error:
knight666#Desktop-Linux ~/Android/Test $ make
( for f in src; do ( cd $f ; make all ) || exit 1 ; done )
make[1]: Map '/home/knight666/Android/Test/src' wordt binnengegaan
arm-none-linux-gnueabi-ld --entry=_start --dynamic-linker ../../system/bin/linker -nostdlib -rpath ../../system/lib -rpath ../../system/lib -L ../../system/lib -lm -lc -lui -lGLES_CM main.o start.o -o ../test1
arm-none-linux-gnueabi-ld: cannot find -lGLES_CM
make[1]: *** [test1] Fout 1
make[1]: Map '/home/knight666/Android/Test/src' wordt verlaten
make: *** [all] Fout 1
It complains it can't find "GLES_CM". I'm at a loss as to what that is and where I can find it. A Google search comes up empty. There is also no man page for arm-none-linux-gnueabi-ld and I can't figure out what the -l flag is or does.
Has anyone done this kind of thing before or can you help me understand what I'm doing wrong?
Thanks in advance.
P.s. here's a small script I wrote to copy and run a compiled binary in the Android emulator:
#!/bin/sh
FILEPATH=`dirname $1`
adb push $FILEPATH/$1 /system/sbin/$1
adb shell chmod 777 /system/sbin/$1
adb shell /system/sbin/$1

GLES_CM is part of OpenGL ES libraries.
If you are working with NDK - OpenGL became available only in 1.6 builds.

Related

ubuntu 15.10 64bit build Android source 5.0 version

How can I fix this problem?When I was building the Android source of 5.0 with
'make -j4', it was causing a problem.
This is the error log:
Install: out/host/linux-x86/bin/acp
Yacc: aidl <= frameworks/base/tools/aidl/aidl_language_y.y
prebuilts/misc/linux-x86/bison/bison -d -o out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/EventLogTags.java <= frameworks/base/core/java/android/content/EventLogTags.logtags
prebuilts/misc/linux-x86/bison/bison: m4 子进程失败
build/core/binary.mk:539: recipe for target 'out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp' failed
make: *** [out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 1
make: *** 正在等待未完成的任务....
frameworks/base/tools/aidl/aidl_language_l.l:55: warning, 无法匹配规则
flex-2.5.39: fatal internal error, exec of /usr/bin/m4 failed
build/core/binary.mk:576: recipe for target 'out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp' failed
make: *** [out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 1
make: *** Deleting file 'out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp'
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/speech/tts/EventLogTags.java <= frameworks/base/core/java/android/speech/tts/EventLogTags.logtags
In my case, I get similar error when build Marshmallow 6.0.1_r1 in Ubuntu 18.04.
If you get similar errors like this:
build/core/binary.mk:646: recipe for target 'out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp' failed
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Aborted (core dumped)
Look at the line carefully, it's a core dumped, so I use coredumpctl list, navigate to the end of list with G, then figure out the core dump executed path (right column) is prebuilts/misc/linux-x86/flex/flex-2.5.39
And the PREBUILT file shows:
xb#dnxb:~/my_android_src/prebuilts/misc/linux-x86/flex$ cat PREBUILT
The objects in this prebuilt directory can be rebuilt
using the source archive hosted at
http://sourceforge.net/projects/flex/files/
Commands:
./configure
make CFLAGS="-static" LDFLAGS="-static"
# (Disregard the errors at the end of the build)
rm flex
make CFLAGS="-static" LDFLAGS="-static" flex
# Copy the linker command line, replace it with static libm.a
gcc -static -static -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o /usr/lib/x86_64-linux-gnu/libm.a
xb#dnxb:~/my_android_src/prebuilts/misc/linux-x86/flex$
That's it, the first 2 lines said that you probably need to rebuild yourself if something went wrong since this flex-2.5.39 binary is prebuilt in another platform.
So simply untar the flex-2.5.39.tar.gz of this directory, go to the extracted flex-2.5.39 directory, then follows the PREBUILT instruction above.
In short, you need to do the following steps:
cd <ANDROID_TREE_DIR>/prebuilts/misc/linux-x86/flex
tar -zxvf flex-2.5.39.tar.gz
cd flex-2.5.39
make CFLAGS="-static" LDFLAGS="-static"
rm flex
make CFLAGS="-static" LDFLAGS="-static" flex
/bin/bash ./libtool --tag=CC --mode=link gcc -static -static -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o lib/libcompat.la /usr/lib/x86_64-linux-gnu/libm.a
cd ..
cp flex-2.5.39/flex .
mv flex flex-2.5.39
ls -la
flex-2.5.39 #### <<- YOUR new generated file
flex-2.5.39.tar.gz
MODULE_LICENSE_BSD_LIKE
NOTICE
PREBUILT
Now try to do make <module> -j4 again, no longer abort on such error.
p/s: Alternative way will be LANG=C make pm -j4 if you see something like LC_* error message.
p/s2: I also need symlink ld as below to fixed 'out/host/linux-x86/obj/lib/libart.so' failed and error: unsupported reloc 42:
xb#dnxb:~/my_android_src$ cp prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8//x86_64-linux/bin/ld ../ld_bk #backup android source's ld first
xb#dnxb:~/my_android_src$ rm prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8//x86_64-linux/bin/ld #remove android source's ld
xb#dnxb:~/my_android_src$ ln -s /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8//x86_64-linux/bin/ld #create symlink for android source's ld to system's ld.gold
Check carefully you have all the required packages installed https://source.android.com/source/initializing.html

Building PJSIP: "Make dep" command giving error on Windows7

I have followed all the steps written in the pjsip-startup guide.
But the last step (make dep && make clean && make) is giving me the following errors. I am on Windows 7.
$ make dep && make clean && make
for dir in pjlib/build pjlib-util/build pjnath/build third_party/build pjmedia/b uild pjsip/build pjsip-apps/build ; do \
if make -C $dir dep; then \
true; \
else \
exit 1; \
fi; \
done
make[1]: Entering directory '/cygdrive/d/android/pjproject-2.2.1/pjlib/build'
make -f /cygdrive/d/android/pjproject-2.2.1/build/rules.mak APP=PJLIB app=pjlib depend
make[2]: Entering directory '/cygdrive/d/android/pjproject-2.2.1/pjlib/build'
.pjlib-arm-unknown-linux-androideabi.depend:1: *** multiple target patterns. St op.
make[2]: Leaving directory '/cygdrive/d/android/pjproject-2.2.1/pjlib/build'
Makefile:88: recipe for target 'depend' failed
make[1]: *** [depend] Error 2
make[1]: Leaving directory '/cygdrive/d/android/pjproject-2.2.1/pjlib/build'
Makefile:14: recipe for target 'dep' failed
make: *** [dep] Error 1
Can someone help me to resolve these errors? Thanks!
After some research I come to know that don't use WINDOWS for building the PJSIP v2.x version. Now I am going to install Ubuntu on my system.
The build system is known to work on the following hosts:
Linux, many types of distributions.
MacOS X 10.2 mingw (Win2K, XP)
FreeBSD (must use gmake instead of make)
Building Win32 applications with Cygwin is currently not supported by the autoconf script (there are some conflicts with Windows headers), but one can still use the old configure script by calling ./configure-legacy. More over, cross-compilations might also work with Cygwin using this build system.
See the link for details.

android ndk-build error on ubuntu 12.10 32 bit

i have downloaded the latest android ndk r8b on my ubuntu 12.10 beta 2 .
i have included the ndk directory in the PATH variable (when i write ndk-b in terminal and hit tab it auto-completes it) .
but when i try :
cd android-ndk/samples/san-angeles/jni
ndk-build
i get this error:
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
Compile thumb : sanangeles <= importgl.c
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
make: *** [/home/mixpro/Android/android-ndk/samples/san-angeles/obj/local/armeabi/objs/sanangeles/importgl.o] Error 127
when checking the /android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin directory using ls i get:
arm-linux-androideabi-addr2line arm-linux-androideabi-g++
arm-linux-androideabi-gdbtui arm-linux-androideabi-size
arm-linux-androideabi-c++filt arm-linux-androideabi-gcc-4.6.x-google
arm-linux-androideabi-gprof arm-linux-androideabi-strings
arm-linux-androideabi-cpp arm-linux-androideabi-gcov
arm-linux-androideabi-readelf arm-linux-androideabi-elfedit
arm-linux-androideabi-gdb arm-linux-androideabi-run
meaning there is no arm-linux-androideabi-gcc in the directory
I am afraid that somehow you got arm-linux-androideabi-addr2line arm-linux-androideabi-gcc deleted. On linux, it is just a symlink to arm-linux-androideabi-gcc-4.6.x-google, so it's very easy to restore it. But maybe, to be on the safe side, it's worthwhile to reinstall NDK.
you should create symbolic link like this : ln -s /usr/bin/arm-linux-gnueabi-gcc-4.7 "/home/sofien/Bureau/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc"

compilation of VLC for Android fail

I'm trying to compile vlc using the following instructions http://wiki.videolan.org/AndroidCompile.
i get the vlc source using git but when i'm doing the next command:
cd extras/contrib
./bootstrap -t arm-eabi -d android
i'm getting this error:
[contrib] No install dir specified, using '/android-sdk-mac_x86/vlc-android/extras/contrib/hosts/arm-eabi'
[contrib] *****************************************************************
[contrib] * If you need contribs with all debug information, run this *
[contrib] * line and compile the libraries on your own. *
[contrib] * CONTRIBS_RELEASE=no ./bootstrap *
[contrib] *****************************************************************
[contrib] Using 1 processor(s)
when i make the next step that is 'make' i got the following failure;
make -C build-src tools
make[1]: Nothing to be done for `tools'.
make -C build-src
(cd zlib; CC="arm-linux-androideabi-gcc --sysroot=/android-ndk-r5b//platforms/android-9/arch-arm" CXX="arm-linux-androideabi-g++ --sysroot=/android-ndk-r5b//platforms/android-9/arch-arm" LD="arm-linux-androideabi-ld" RANLIB="arm-linux-androideabi-ranlib" AR="arm-linux-androideabi-ar" STRIP="arm-linux-androideabi-strip" ./configure --prefix=/android-sdk-mac_x86/vlc-android/extras/contrib/hosts/arm-eabi --static && make install)
Building static library libz.a version 1.2.5 with arm-linux-androideabi-gcc --sysroot=/android-ndk-r5b//platforms/android-9/arch-arm.
Checking for off64_t... No.
Checking for fseeko... No.
Checking for unistd.h... No.
Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf().
Checking for snprintf() in stdio.h... No.
WARNING: snprintf() not found, falling back to sprintf(). zlib
can build but will be open to possible buffer-overflow security
vulnerabilities.
Checking for return value of sprintf()... No.
WARNING: apparently sprintf() does not return a value. zlib
can build but will be open to possible string-format security
vulnerabilities.
arm-linux-androideabi-gcc --sysroot=/android-ndk-r5b//platforms/android-9/arch-arm -I/android-sdk-mac_x86/vlc-android/extras/contrib/hosts/arm-eabi/include -DNDEBUG -D__STDC_VERSION__=199901L -I/android-ndk-r5b//sources/cxx-stl/gnu-libstdc++/include -I/android-ndk-r5b//sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -isystem /android-sdk-mac_x86/vlc-android/extras/contrib/hosts/arm-eabi/include -I/android-ndk-r5b//platforms/android-9/arch-arm/usr/include -DNO_FSEEKO -DNO_snprintf -DHAS_sprintf_void -I/android-sdk-mac_x86/vlc-android/extras/contrib/hosts/arm-eabi/include -DNDEBUG -D__STDC_VERSION__=199901L -I/android-ndk-r5b//sources/cxx-stl/gnu-libstdc++/include -I/android-ndk-r5b//sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -isystem /android-sdk-mac_x86/vlc-android/extras/contrib/hosts/arm-eabi/include -I/android-ndk-r5b//platforms/android-9/arch-arm/usr/include -c -o adler32.o adler32.c
make[2]: arm-linux-androideabi-gcc: No such file or directory
make[2]: *** [adler32.o] Error 1
make[1]: *** [.zlib] Error 2
make: *** [using-src] Error 2
anyone can help? i'm using mac OS X 10.6.6
tnx
Given prior Linux CLI experience, the best I can tell you is that it doesn't look like your tool-chain is fully initialized and needs some setup. Below is a link that documents initialization for a MAC build environment:
http://source.android.com/source/initializing.html
You probably should have set your NDK installation properly.
Download the latest Android NDK.
Unzip and move the extracted “android-ndk-r6″ directory to “/Applications”, so you end up with “/Applications/android-ndk-r6″.
Edit “~/.profile” to add the following:
export ANDROID_NDK=/Applications/android-ndk-r5b
export PATH=$PATH:$ANDROID_NDK:$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin
The PATH was the key to solve this kind of problem to me. Because it makes possible to find and use "arm-linux-androideabi-gcc".
Refer to this web site.
http://www.doitscared.com/632/eclipse-indigo-for-android-development-on-mac-os-x-snow-leopard/

How do you create a loadable kernel module for Android?

I know there a number of walkthroughs and tutorials floating around out there which describe this activity, but after having read many of them I still can't get this working. If anyone has the patience to wade through the steps I've taken (posted below) and suggest where I may have gone off track I'd be very appreciative. I've spent about a day and a half staring at make files and reading walkthroughs so literally any suggestions would be helpful.
Environment:
I'm using an Ubuntu 10.04 32 bit vm.
I'm hosting from a 64 bit windows 7
My Core 2 Duo does not have the hardware support for 64 bit VMs so i'm trying to compile against Android 2.1 kernel
I have installed Java 1.5 from the Dapper repo and removed my 1.6 installation
The rest of the tooling has been acquired according the Android dev documentation...
As per Initializing a Build Environment:
Java:
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper main multiverse"
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper-updates main multiverse"
$ sudo apt-get update
$ sudo apt-get install sun-java5-jdk
Other required:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline5-dev libz-dev libgl1-mesa-dev
$ sudo apt-get install gcc-multilib g++-multilib libc6-i386 libc6-dev-i386
Then from Downloading the Source Tree:
Repo:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ repo init -u https://android.googlesource.com/platform/manifest -b eclair
$ repo sync
$ gpg --import (imported the huge key)
And from Building the System:
Initialize:
$ source build/envsetup.sh
Choose a Target:
$ lunch generic-user
Build the Code:
$ make -j4
Added!
Output of make -j4:
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.1-update1
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ECLAIR
============================================
build/core/copy_headers.mk:15: warning: overriding commands for target `out/target/product/generic/obj/include/libpv/getactualaacconfig.h'
build/core/copy_headers.mk:15: warning: ignoring old commands for target `out/target/product/generic/obj/include/libpv/getactualaacconfig.h'
/bin/bash: line 0: cd: sdk/layoutopt/app/src/resources: No such file or directory
Install: out/host/linux-x86/bin/acp
target Generated: libclearsilver-jni <= out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar
target Generated: libclearsilver-jni <= out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar
host SharedLib: libneo_cs (out/host/linux-x86/obj/lib/libneo_cs.so)
host C++: aapt <= frameworks/base/tools/aapt/AaptAssets.cpp
host C++: aapt <= frameworks/base/tools/aapt/Command.cpp
error: error reading out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar; error in opening zip file
error: error reading out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar; error in opening zip file
error: error reading out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar; cannot read zip file
error: cannot access org.clearsilver.HDF
class file for org.clearsilver.HDF not found
javadoc: error - Class org.clearsilver.HDF not found.
Error: No classes were specified on the command line. Try -help.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/org_clearsilver_HDF.h] Error 15
make: *** Waiting for unfinished jobs....
error: error reading out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar; cannot read zip file
error: cannot access org.clearsilver.CS
class file for org.clearsilver.CS not found
In file included from frameworks/base/tools/aapt/AaptAssets.h:18,
from frameworks/base/tools/aapt/AaptAssets.cpp:5:
frameworks/base/tools/aapt/ZipFile.h:65: warning: ‘typedef’ was ignored in this declaration
javadoc: error - Class org.clearsilver.CS not found.
Error: No classes were specified on the command line. Try -help.
In file included from frameworks/base/tools/aapt/AaptAssets.h:18,
from frameworks/base/tools/aapt/Main.h:14,
from frameworks/base/tools/aapt/Command.cpp:6:
frameworks/base/tools/aapt/ZipFile.h:65: warning: ‘typedef’ was ignored in this declaration
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/org_clearsilver_CS.h] Error 15
Added!
So it turns out i've got some problems here. I assume that once i've overcome these issues, i'll have an environment capable of compiling kernel modules. Please do correct me if I'm wrong.
Next I head into my directory containing my module.c file and it's makefile. Contents of makefile below:
obj-m += mymodule.o
CROSS_COMPILE=~/WORKING_DIRECTORY/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
KERNEL_DIR ?= /home/<myuser>/WORKING_DIRECTORY
VERSION = v1.1
all:
make -C $(KERNEL_DIR) M=$(PWD) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
rm -rf *.c~
rm -rf *.mod*
rm -rf *.o
clean:
make -C $(KERNEL_DIR) M=$(PWD) clean
I have very little experience with make and makefiles, but this looked reasonable to me. My main concern with this file is the KERNEL-DIR variable. I tried a few different values for that variable, but got all sorts of errors where I do not with it's current value. Of course, it could still be wrong, so any comments here are welcome.
So, as far as I know, I should be able to execute make with no args or anything and will figure out what it needs to do. I have tried make, make -f both with and without sudo. All four permutations yield the same results:
make -C /home/<myuser>/WORKING_DIRECTORY M=/home/<myuser>/Desktop/<MyModuleDir> ARCH=arm CROSS_COMPILE=~/WORKING_DIRECTORY/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- modules
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.1-update1
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ECLAIR
============================================
make[1]: Entering directory `/home/<myuser>/WORKING_DIRECTORY'
build/core/copy_headers.mk:15: warning: overriding commands for target `out/target/product/generic/obj/include/libpv/getactualaacconfig.h'
build/core/copy_headers.mk:15: warning: ignoring old commands for target `out/target/product/generic/obj/include/libpv/getactualaacconfig.h'
/bin/bash: line 0: cd: sdk/layoutopt/app/src/resources: No such file or directory
Available sub-modules:
01-test dumpsys libminui LotsOfApps
20-dns.conf dvz libminzip lowstoragetest
95-configured dx libmp4recognizer_utility lsd
aapt dx-tests libmtdutils LunarLander
acc edify libnativehelper LunarLanderTests
AccountAndSyncSettings Email libneo_cgi MagicSmokeWallpapers
accRuntimeTest EmailTests libneo_cs make_cfst
acp emma libneo_util makedict
adb emmalib libnetutils make_g2g
adbd emulator libocr makekeycodes
add-property-tag emulator-arm libomx_aac_component_lib make_ve_grammar
afar emulator-hw libomx_aacdec_sharedlibrary mediaframeworktest
aidl emulator-tcg libomx_amr_component_lib MediaProvider
AlarmClock EnabledTestApp libomx_amrdec_sharedlibrary mediaserver
AliasActivity etc1tool libomx_amrenc_component_lib memtest
am eventanalyzer libomx_amrenc_sharedlibrary minigzip
android event-log-tags libomx_avc_component_lib mkbootfs
android.core.tests.annotation exc_dump libomx_avcdec_sharedlibrary mkbootimg
android.core.tests.archive ext libomx_baseclass_lib mksdcard
android.core.tests.concurrent Fallback libomx_common_lib mkstubs
android.core.tests.crypto fastboot libomx_m4v_component_lib mkyaffs2image
android.core.tests.dom FixedGridLayout libomx_m4vdec_sharedlibrary Mms
android.core.tests.logging flash_image libomx_mastercore_lib MmsTests
android.core.tests.luni.io FontLab libomx_mp3_component_lib monkey
android.core.tests.luni.lang framework libomx_mp3dec_sharedlibrary monkeyrunner
android.core.tests.luni.net FrameworkPermissionTests libomx_queue_lib mtpd
android.core.tests.luni.util framework-res libomx_sharedlibrary MultiResolution
android.core.tests.math FrameworkTest libop Music
android.core.tests.nio framework-tests libopencore_author MusicTests
android.core.tests.nio_char FrameworkTestTests libopencore_common nc
android.core.tests.prefs fsck_msdos libopencore_download netcfg
android.core.tests.regex fs_config libopencore_downloadreg netperf
android.core.tests.runner fs_get_stats libopencore_mp4local netserver
android.core.tests.security Gallery libopencore_mp4localreg ninepatch
android.core.tests.sql Gallery3D libopencore_net_support NinePatchLab
android.core.tests.text GalleryTests libopencore_player NoShareUidApp
android.core.tests.xml gdbserver libopencore_rtsp NotePad
android.core.tests.xnet genext2fs libopencore_rtspreg NotePadTests
android.cts.dpi GestureBuilder libosclbase opcontrol
android.cts.refapp GL2JNI libosclerror openssl
android.policy GLJNI libosclio OpenWnn
android.policy_mid GlobalSearch liboscllib oprofiled
android.policy_phone GlobalSearchBenchmarks libosclmemory org.eclipse.core.commands_3.4.0.I20080509-2000
androidprefs GlobalSearchPermissionTests libosclproc org.eclipse.equinox.common_3.4.0.v20080421-2006
android.test.runner GlobalSearchTests libosclregcli org.eclipse.jface_3.4.2.M20090107-0800
AndroidTests GlobalTime libosclregserv org-netbeans-api-visual
angeles GoogleContactsProvider libosclutil org-openide-util
ant GoogleContactsProviderTests libpagemap osgi
antlr-2.7.7 google-framework libpassthru_oma1 PackageInstaller
anttasks googlelogin-client libpcap parseStringTest
apicheck GoogleSearch libpixelflinger perm_checker
ApiDemos gpustate libpixelflinger_armv6 perm_checker.conf
ApiDemosReferenceTest gralloc.default libpixelflinger_static Phone
ApiDemosTests groovy-all-1.6.5 libplatform_library_jni PicoTts
apkbuilder grxmlcompile libpng ping
ApplicationsProvider gtest-filepath_test libpopt PinyinIME
applypatch gtest-linked_ptr_test libprotocolenginenode_base PlatformLibraryClient
applypatch_static gtest-message_test libprotocolenginenode_common platform.xml
app_process gtest-options_test libprotocolenginenode_download_common pm
AppWidgetHostTest gtest-port_test libprotocolenginenode_pdl post_trace
AppWidgetProvider gtest_pred_impl_unittest libprotocolenginenode_ps pppd
apriori gtest_prod_test libpv_aac_dec preload
archquery gtest-test-part_test libpvaacffparsernode ProcessTests
asm-3.1 gtest-typed-test2_test libpvaacffrecognizer procmem
atree gtest-typed-test_test libpvaacparser procrank
AudioHardwareRecord gtest_unittest libpvamrffparsernode profile_pid
AudioHardwareRecordLoop gzip libpvamrffrecognizer profile_trace
AudioInRecord HelloActivity libpv_amr_nb_common_lib Provision
backup_helper_test HelloActivityTests libpvamrwbdecoder pvplayer
BackupTest hierarchyviewer libpvauthorengine q2dm
BatteryWaster hist_trace libpv_avc_common_lib q2g
bb2sym Home libpvavcdecoder qemud
bb_dump hosttestlib libpvavifileparser qemu-props
bbprof hprof-conv libpv_config_parser qwerty2.kcm
bison HTMLViewer libpvdecoder_gsmamr qwerty.kcm
Bluetooth icache libpvdownloadinterface racoon
BluetoothChat icudata libpvdownloadmanagernode radiooptions
BluetoothDebug idegen libpvdownloadreginterface read_addr
bmgr ime libpvencoder_gsmamr read_method
bookmarks.xml ImfTest libpvfileoutputnode read_pid
bootanimation ImfTestTests libpvfileparserutils read_trace
Browser imgdiff libpvframemetadatautility recovery
BrowserPowerTests init libpvgendatastruct required_hardware.xml
BrowserTestPlugin input libpvgsmamrparser rgb2565
BrowserTests installd libpv_http_parcom rild
bsdiff invoke_mock_media_player libpvid3parcom rsg-generator
bspatch iptables libpvjitterbuffer RSSReader
btool ip-up-vpn libpvjitterbuffernode run-core-tests
bugreport iself libpvjitterbufferrtp run-core-tests-on-ri
BusinessCard isprelinked libpvlatmpayloadparser safe_iop_test
Calculator jarjar libpvmediadatastruct SampleBrowserPlugin
CalculatorTests jarutils libpvmediainputnode schedtest
Calendar jasmin libpvmedialayernode scp
CalendarProvider jasmin.jar libpvmediaoutputnode screenshot2
CalendarProviderTests javax.obex libpvmf sdklib
CalendarTests jcommon-1.0.12 libpvmfrecognizer sdkmanager
Camera jdiff libpvmimeutils SdkSetup
CameraTests jdwpspy libpvmioaviwavfileinput sdkstats
CertInstaller JETBoy libpvmiofileinput sdkuilib
cfassembler jfreechart-1.0.9 libpvmiofileoutput sdutil
check-lost+found jfreechart-1.0.9-swt libpvmp3 SearchableDictionary
check_prereq junit libpvmp3ff sensors.goldfish
check_stack jython libpvmp3ffparsernode service
check_trace kcm libpvmp3ffrecognizer servicemanager
clearsilver keystore libpvmp4decoder services
cmu2nuance keystore_cli libpvmp4ff Settings
com.android.inputmethod.pinyin.lib KeyStoreTests libpvmp4ffcomposer SettingsProvider
com.example.android.platform_library kxml2-2.3.0 libpvmp4ffcomposernode SettingsTests
commons-compress-1.0 latencytop libpvmp4ffparsernode sh
Compass LatinIME libpvmp4ffrecognizer ShareUidApp
ContactManager Launcher libpvmp4interface showlease
Contacts Launcher2 libpvmp4reginterface showmap
ContactsProvider launchperf libpvomxaudiodecnode showslab
ContactsProviderTests layoutlib libpvomxbasedecnode sig
ContactsTests layoutlib_api libpvomxencnode sig-check
core layoutlib_create libpv_omx_interface sig-create
core-tests layoutlib_utils libpvomx_proxy_lib signapk
CoreTests layoutopt libpvomxvideodecnode SignatureTest
coverage libabi libpvplayer_engine SignatureTestTests
cpueater libacc libpvpvxparser signature-tools
cpufeatures libaes libpvrtsp_cli_eng_node SimpleJNI
crasher libandroidpv libpvrtspinterface SkeletonApp
create_test_dmtrace libandroidpvauthor libpv_rtsp_parcom SkeletonAppTests
cts libandroid_runtime libpvrtspreginterface skia_bench
CtsAccessibilityServiceTestCases libandroid_servers libpvsdpparser skia_gm
CtsAccountManagerTestCases libapplypatch libpvsocketnode SlowSuggestions
CtsAppAccessData libarity libpvstreamingmanagernode SmokeTest
CtsAppSecurityTests libastl libpvthreadmessaging SmokeTestApp
CtsAppTestCases libaudioflinger libpvwav Snake
CtsAppWithData libaudiointerface libpvwavffparsernode SnakeTests
CtsBluetoothTestCases libaudiopolicygeneric libpvwavffrecognizer SoftKeyboard
CtsContentTestCases libbinder librank soslim
cts-dalvik-buildutil libbz libreference-cdma-sms sound
CtsDatabaseTestCases libc libreference-ril SoundRecorder
CtsDelegatingAccessibilityService libcameraservice libril SpammySuggestions
CtsDpiTestCases libcamerastub libRS SpareParts
CtsDpiTestCases2 libc_common librs_jni spec-progress
CtsExampleTestCases libc_debug librtppayloadparser sqlite3
CtsGestureTestCases libclearsilver-jni librtprtcp SRecTest
CtsGraphicsTestCases libc_nomalloc libsafe_iop SRecTestAudio
CtsHardwareTestCases libcolorconvert libsampleplugin ssh
CtsInstrumentationAppDiffCert libcpm libSDL SslLoad
CtsJniTestCases libcrypto libSDLmain stack_dump
CtsLocationTestCases libctest libsimplejni StatusBarTest
CtsMediaTestCases libcts_jni libskia Stk
CtsNetTestCases libctspermission_jni libskiagl strace
CtsOsTestCases libcutils libsonivox stringtemplate
CtsPerformance2TestCases libdb libsoundpool su
CtsPerformance3TestCases libdbus libspeex surfaceflinger
CtsPerformance4TestCases libdbus-tools-common libsqlite svc
CtsPerformance5TestCases libdex libsqlite3_android swing-worker-1.1
CtsPerformanceTestCases libdl libsqlite3_phone_number_utils_test swt
CtsPermission2TestCases libdrm1 libsqlite3_phonetic_string_utils_test system_server
CtsPermissionDeclareApp libdrm1_jni libSR_AcousticModels tcpdump
CtsPermissionTestCases libdrm2 libSR_AcousticState TelephonyProvider
CtsProviderTestCases libdvm libSR_AudioIn telephonytest
CtsSharedUidInstall libebl libSR_Core temp_layoutlib
CtsSharedUidInstallDiffCert libebl_arm libsrec_jni Term
CtsSimpleAppInstall libedify libSR_EventLog test_defs.xml
CtsSimpleAppInstallDiffCert libEGL libSR_G2P TestDeviceSetup
CtsSpeechTestCases libelf libSR_Grammar test-fb-refresh
CtsTargetInstrumentationApp libelfcopy libSR_Nametag test-fb-simple
CtsTelephonyTestCases libembunit libSR_Recognizer test_g2g
CtsTestStubs libemoji libSR_Semproc test-mdp
CtsTextTestCases libESR_Portable libSR_Session test-opengl-codegen
CtsUsePermissionDiffCert libESR_Shared libSR_Vocabulary test-opengl-fillrate
CtsUtilTestCases libETC1 libssl test-opengl-filter
CtsViewTestCases libexif libstagefright test-opengl-finish
CtsWebkitTestCases libexpat libstagefright_omx test-opengl-gl2_basic
CtsWidgetTestCases libext libstdc++ test-opengl-gl_basic
CubeLiveWallpapers libfdlibm libsurfaceflinger test-opengl-gralloc
CustomLocale libFFTEm libsvoxpico test-opengl-linetex
daemonize libfst libsystem_server test-opengl-swapinterval
dalvikvm libft2 libsysutils test-opengl-textures
dasm libgetactualaacconfig libterm test-opengl-tritex
dbus-daemon libgif libtestplugin test-progress
dbus-monitor libgl2jni libthread_db test-progress-new
dbus-send libGLES_android libthreadsafe_callback_ao test_swiarb
ddmlib libGLESv1_CM libtinyxml test_zipfile
ddms libGLESv2 libtomcrypt timeinfo
ddmuilib libgljni libtommath timetest
debuggerd libgoogleclient libttspico toolbox
DensityTest libgtest libttssynthproxy traceview
descGen libgtest_main libui TransformTest
DeskClock libhardware libunz TtsService
Development libhardware_legacy libutil tuttle2.kcm
dexdeps libhost libutils uix
dexdump libicudata-default libvorbisidec updater
dexlist libicudata-eu libwbxml UpgradeExample
dexopt libicudata-jp libwbxml_jni usbtest
dexopt-wrapper libicudata-large libwebcore UserDictionaryProvider
dexpreopt libicudata-us libwnndict VisualizationWallpapers
dex-tools libicui18n libWnnEngDic vm-tests
dhcpcd libicuuc libWnnJpnDic VoiceDialer
dhcpcd-run-hooks libiptc libwpa_client Voiper
dictTest libjavacore libxml2 vold
DisabledTestApp libjni_latinime libxml2wbxml VpnServices
dmtracedump libjni_pinyinime libz wbxmltest
DownloadProvider libjnitest libzipfile wdsclient
draw9patch libjpeg LightingTest webkitmerge
DrmProvider liblog line_endings Wiktionary
droiddoc libm linker WiktionarySimple
dumpeventlog libm4v_config LiveWallpapers xmlwriter
dumpkey libmedia LiveWallpapersPicker yuv420sp2rgb
dump_regions libmedia_jni localize zipalign
DumpRenderTree libmediaplayerservice logcat
dumpstate libmincrypt logwrapper
make[1]: Leaving directory `/home/<myuser>/WORKING_DIRECTORY'
rm -rf *.c~
rm -rf *.mod*
rm -rf *.o
You'll notice a few screwy warnings, but as best as I can tell, they are not real problems. If anyone feels differently about these, please say so.
make[1]: Entering directory `/home/<myuser>/WORKING_DIRECTORY'
build/core/copy_headers.mk:15: warning: overriding commands for target `out/target/product/generic/obj/include/libpv/getactualaacconfig.h'
build/core/copy_headers.mk:15: warning: ignoring old commands for target `out/target/product/generic/obj/include/libpv/getactualaacconfig.h'
/bin/bash: line 0: cd: sdk/layoutopt/app/src/resources: No such file or directory
I guess that last line sounds pretty suspicious but I have no idea what to do about it. Apart from the few strange things i've mentioned, it would appear that this all went smoothly. However, after the whole thing completes, I can't find the *.ko file anywere. I did a ls -alRg | grep *.ko on my home directory and it turns up nothing. I'm stumped. If I can provide any more information or run any tests or try anything differently i'll be checking in frequently.
Sorry for being late, but hope it helps:
http://tthtlc.wordpress.com/2011/12/29/how-to-write-a-kernel-module-on-android-sony-ericsson-xperia-arc-s/
I wrote and tested the code on my Sony Ericsson Xperia Arc S and it works (in general in should work for any Android phone).
Connecting via adb and USB, and “su” to root, the “lsmod” listed all the kernel module (in general, the article at
http://web.archive.org/web/20121106004141/http://developer.sonymobile.com/2011/05/06/how-to-build-a-linux-kernel gave a very good coverage of what to do in Linux kernel compilation for SonyEricsson phone):
lsmod
android_module 654 0 - Live 0x7f007000 (P)
sdio 16532 0 - Live 0x7f000000
“android_module” was the one I had inserted via insmod android_module.ko.
Here’s how to do it:
First the original program was copied from:
http://rechtzeit.wordpress.com/2011/03/21/77/
Or reproduced as follows:
android_module.c:
#include"linux/module.h"
#include"linux/kernel.h"
//replace the "" with angular brackets
int init_module(void)
{
printk(KERN_INFO "Hello android kernel...\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye android kernel...\n");
}
Makefile:
obj-m += android_module.o
all:
make -C /home/tteikhua/android/sony_ericsson_src/58/kernel/ M=$(PWD) modules
clean:
make -C /home/tteikhua/android/sony_ericsson_src/58/kernel/ M=$(PWD) clean
The directory where the kernel is located (“-C” above) is where kernel is located.
And the following command will use the Makefile from above:
ARCH=arm CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi- make
As shown above, the cross compiler I had used is from CodeSourcery.
And after insmod android_module.ko you can see the debugging message in dmesg output:
<6>[11184.063507] Hello android kernel...
<7>[11619.209655] msmrtc_timeremote_set_time: 11/29/2011 10:09:36 (04)
<6>[11619.210418] RPC CALL -- TOD TIME UPDATE: ttick = 404244221
<6>[11619.210418] stamp=52910543933046785, freq = 0
<7>[11619.211578] msmrtc_tod_proc_result: 12/29/2011 10:09:36 (03)
<6>[11619.211578] rs30000048 rs30000048.262144: setting system clock to 2011-12-29 10:09:36 UTC (1325153376)
<6>[11662.112365] device rmnet0 left promiscuous mode
<6>[11662.112579] device rmnet0 entered promiscuous mode
<6>[11669.958221] device rmnet0 left promiscuous mode
<6>[11669.958435] device rmnet0 entered promiscuous mode
<7>[11698.181060] msmrtc_timeremote_set_time: 11/29/2011 10:10:55 (04)
<6>[11698.187622] RPC CALL -- TOD TIME UPDATE: ttick = 406832008
<6>[11698.187652] stamp=52910548228014081, freq = 0
<7>[11698.193939] msmrtc_tod_proc_result: 12/29/2011 10:10:55 (03)
<6>[11698.194030] rs30000048 rs30000048.262144: setting system clock to 2011-12-29 10:10:55 UTC (1325153455)
<6>[11814.442901] bq27520 0-0055: bq27520_handle_soc_worker() capacity=97 (100) flags=0x229 ctrl_status=0x28b soh_state=0x3, valid=1
<6>[11984.057373] Goodbye android kernel...
And the “Goodbye” is when rmmod android_module is executed. In between are debugging message from other components in the kernel.
Final words:
The above are written in 2011, for more modern resources, please refe to the following to get started:
https://source.android.com/docs/core/architecture/kernel/modular-kernels
https://source.android.com/docs/core/architecture/kernel
https://source.android.com/docs/setup/build/building-kernels
https://source.android.com/docs/core/architecture/kernel/loadable-kernel-modules
I think I've red that emulator kernel does not support module, so you must compile also the kernel with modules support.
I hope that this link will help you
There are two things you'll need to do. Firstly, create an emulator kernel that supports loadable kernel modules.
There's a comprehensive post here covering the process of setting up the emulator kernel.
There are 2 parts of the instructions to alter:
I find it easiest to keep the kernel within the repo area (in this case, ~/WORKING_DIRECTORY), like so:
cd ~/WORKING_DIRECTORY
mkdir kernel
cd kernel
git clone git://android.git.kernel.org/kernel/common.git
The branch information is no longer correct, however, so where it says:
git checkout -t origin/android-goldfish-2.6.29 -b goldfish
use this instead:
git checkout -t archive/android-gldfish-2.6.29 -b goldfish
As you've found out, the kernel by default is not configured with loadable module support. Enable before compiling. After, this step:
make ARCH=arm goldfish_defconfig
do this:
make ARCH=arm menuconfig
A text-based menu will show up. Use the Up/Down arrow keys to navigate, Space to select an option, Enter to expand a menu (menus have --->) at the end of the line, and Esc-Esc to go back a menu.
Select "Enable loadable module support" by scrolling down and hitting Space
Hit Esc-Esc to exit, and hit Enter to save the new configuration
Now build. Using your setup, it would be:
make ARCH=arm CROSS_COMPILE=/home/<myuser>/WORKING_DIRECTORY/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
Now that that's done you can do the second part, which is making a loadable kernel module. You were almost there, but because you didn't have the kernel source for the emulator, it didn't work. Just take the makefile you have and change KERNEL_DIR to:
KERNEL_DIR ?= /home/<myuser>/WORKING_DIRECTORY/kernel/common

Categories

Resources