Building Android MSM for MSM8994 or MSM8998 to access DSP - android

The upshot is I want to run code on the Hexagon DSP.
I've tried building Android-MSM for msm8994-eng (for a Nexus 6P) and msm8998-eng (for Intrinsyc APQ8098) but I get build errors with both.
I'm building on Ubuntu 14.04 with openjdk-8.
Not finding a lot of help in either the project or filing tickets for the board so as a last ditch effort thought I'd ask here.
Anyone with experience building Android-MSM for either msm8994 or msm8998?
The specific build error for msm8998-eng (for Intrinsyc APQ8098) is:
In file included from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/include/linux/seqlock.h:35:0,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/include/linux/time.h:5,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/include/uapi/linux/timex.h:56,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/include/linux/timex.h:56,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/include/linux/sched.h:19,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/arch/arm64/include/asm/compat.h:25,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/arch/arm64/include/asm/stat.h:23,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/include/linux/stat.h:5,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/include/linux/module.h:10,
from /media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/drivers/soc/qcom/qdsp6v2/apr_tal.c:15:
/media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/drivers/soc/qcom/qdsp6v2/apr_tal.c:290:40: error: 'struct apr_svc_ch_dev' has no member named 'lock'
spin_lock_init(&apr_svc_ch[i][j][k].lock);
^
/media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/include/linux/spinlock.h:99:24: note: in definition of macro 'raw_spin_lock_init'
__raw_spin_lock_init((lock), #lock, &__key); \
^
/media/openq835/OpenQ-835_Android-N_v1.0/OpenQ-835-v1.0/Source_Package/APQ8098_LA.UM.5.8.r1-01900-8x98.0_OpenQ835-v1.0/kernel/msm-4.4/drivers/soc/qcom/qdsp6v2/apr_tal.c:290:5: note: in expansion of macro 'spin_lock_init'
spin_lock_init(&apr_svc_ch[i][j][k].lock);
^

You need to backport functions from older kernel or update those drivers.
Cheers

Related

Kotlin native hello world compilation failed on arch linux. UnsatidfiedLinkError: Undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE

I have already compiled this simple example on windows using this https://kotlinlang.org/docs/tutorials/native/using-command-line-compiler.html
Then I tried to set up my arch Linux environment, using this
https://snapcraft.io/install/kotlin-native/arch
while also installing the android sdk from AUR using this,
https://noirscape.github.io/guides/2018/06/14/android-sdk-arch-linux.html
ls gives this - build build.gradle.kts main.kt. README.md settings.gradle.kts src
I am not using gradle for this problem but it is installed
cat main.kt gives this -
fun main() {
println("Hello Kotlin/Native!")
}
when I run kotlinc-native main.kt -o build/hello
I get error: compilation failed: /var/lib/snapd/snap/kotlin-native/13/konan/nativelib/libllvmstubs.so: /snap/core/current/lib/x86_64-linux-gnu/librt.so.1:undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
*source files main.kt
*compiler version info: Konan: 0.9.3 / Kotlin: 1.3.0
*Output Kind PROGRAM
exception: java.lang.unsatisfiedLinkError: /var/lib/snapd/snap/kotlin-native/13/konan/nativelib/libllvmstubs.so: /snap/core/current/lib/x86_64-linux-gnu/librt.so.1 undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
then there are a lot of at java.base at llvm.llvm and at org.jetbrains.kotlin after that. If those are important I can let me know.
I am a baby kotlin user and a baby Linux user. I believe learning starts from the bottom up so I really want to understand what is happening here instead of just solving it by using gradle or android studios.
I have a feeling that the compiler might not have downloaded all the dependencies on its first run or maybe this has something to do with the symbolic link I made from the first link. please help me understand
ps. I am also sharing a git repo for this project across the two OS's. So maybe this is windows getting in the way but I cant really see how that could be.

android kernel build (first time)

Ok so first off,
Im brand new to android dev. This is my first attempt at any form of kernel anything. I have a limited knowledge of java and python, but no C.
I have a galaxy tab 4 sm-t330nu running 4.4.2. its running a qualcomm snapdragon 400 msm8226 cpu. im simply trying to do a test build with a vanilla kernel at this point. (also my build environment is the newest kali 1.1 and im loosely following the tutorial at https://github.com/offensive-security/kali-nethunter/wiki/Porting-Nethunter)
so i have all of the required dependencies (i hope), and ive downloaded my source from samsung opensource. unzipped and went through the available defconfigs. after finding "msm8226-sec_milletwifiue_defconfig" i decided it was the most likely candidate for my tablet. (when doing a custom recovery i remember it being "philz touch milletwifiue something)
Ive done my exports (arch= subarch= cross_compile=) and all seems well. When i run a build following exactly as the tutorial says (using the defconfig in their example as a test) i receive an error stating "must define variant_defconfig". So i instead do "make variant_defconfig=msm8974_sec_defconfig" and it builds great.
Now the issue:
When i change "msm8974_sec_defconfig" to my actual msm8226 i receive an error on every build that i cannot seem to workaround. (cut down for size)
CC arch/arm/kernel/armksyms.o
CC arch/arm/kernel/module.o
AS arch/arm/kernel/sleep.o
CC arch/arm/kernel/suspend.o
CC arch/arm/kernel/io.o
arch/arm/kernel/io.c: In function '_memcpy_fromio':
arch/arm/kernel/io.c:14:3: error: implicit declaration of function 'nop' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[1]: *** [arch/arm/kernel/io.o] Error 1
make: *** [arch/arm/kernel] Error 2
My exact bash line reads
make VARIANT_DEFCONFIG=msm8226-sec_milletwifiue_defconfig
Any assistance on clearing this up would be great
edit
although im not familiar with c, it seems to me that '_memcpy_fromio' is where the error lies. and my google searches tell me that the error is that a function is used without being declared. however i dont know if memcpy is a function? or is the function within class memcpy (dont know if c has classes just closest equivalent that i know of) how do i debug this code and declare what needs to be declared (more importantly, if this is a stock kernel thats used by thousands of devices, how can it possibly have an undeclared function?
/edit
found the answer! needed
#import linux/modules.h
#import linux/kernel.h

Why SDL_Window is an incomplete type?

I am porting to SDL2 and the Android platform a C++ game that uses SDL 1.2. Everything went well so far except for one thing: when I try to access the fields of SDL_Window, the compiler tells me
error: invalid use of incomplete type 'SDL_Window {aka struct SDL_Window}'
I think my installation of SDL may be faulty. I have compiled SDL 2.0.0 from the source found on libsdl.org using the folloing command:
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_PLATFORM=android-18
Then, I have copied the freshly built libSDL2.so into $ANDROID_TOOLCHAIN/sysroot/usr/lib and the files in the include/ directory in $ANDROID_TOOLCHAIN/sysroot/usr/include/SDL. These files are given to CMake and referenced by the game's code. I managed to convert every SDL calls and now I am stuck with this SDL_Window problem.
I did a quick search in SDL's source code and found that SDL.h includes SDL_video.h which contains a typedef SDL_Window on struct SDL_Window. Then I searched for this struct and did not find anything except in the original source archive, in a file named src/video/SDL_sysvideo.h. Since it is not a file of the API, I doubt I have to include it in my code.
So, how to find a definition of SDL_Window in SDL2, for Android (if this is relevant)?
It appears that the problem is a lack of knowledge of SDL 2's API. Let's remember that one does not access the fields of struct SDL_Window: there are functions to get the size and the flags of the window, such as SDL_GetWindowFlags and SDL_GetWindowSize.
So the problem is absolutely not related to the installation of the SDL or to Android builds. Sorry for the waste of time, people of the Web.
I would expect that you are expected to only deal in pointers to SDL_Window objects, and not actually put a full SDL_Window object on the stack.

Error while compiling C++ kernel module with Android kernel for Nexus 7

I am writing a C++ module for the Nexus 7 Android kernel. Previously I compiled this module successfully with the Goldfish kernel. But now after porting the necessary changes to the Nexus 7 kernel, I am getting a compilation error. The problem seems to be with the headers. Whenever i include the linux/fs.h or linux/debugfs.h in the module, it is giving the following error.
/linux/radix-tree.h: In function 'void* radix_tree_deref_slot(void**)':
/android_kernel_grouper-android-tegra3-grouper-3.1-jb-fr2/include/linux/radix-tree.h:153:9: error: 'void*' is not a pointer-to-object type
The corresponding line in the radix-tree.h has something to do with rcu_dereference().
Is the problem with the headers, or the makefile or due to faulty patching?
To find out the compilation parameters used in gcc (or g++), you should use "make V=1" against the makefile. but the error:
error: 'void*' is not a pointer-to-object type
looked more like a C++ error, which is inherent in your code (Android kernel does not use C++).
This seemed to be solvable by recasting:
Error: ‘void*’ is not a pointer-to-object type
C++. Error: void is not a pointer-to-object type
etc.

Problems with build.xml when using the Android ADK to communicate with an Arduino Mega ADK

So a few days ago I got my hands on an Arduino Mega ADK board, and the last couple of nights I have been setting up my development environment, getting to grips with the tools etc. The tools and libraries all work fine, for example I can get a program written in the Processing IDE to compile and run on an Asus Eee Pad Transformer TF101 running Android 4.03. But when I get it to try to compile and run one of the pre-written examples, it gives me a compiler error:
Android SDK Tools Revision 20
Installed at C:\NVPACK\android-sdk-windows
Project Type: Application
Project Target: Android 2.3.3
API level: 10
Library dependencies:
No Libraries
API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.
BUILD FAILED
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:680: The following error occurred while executing this line:
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:693: Compile failed; see the compiler error output for details.
Total time: 7 seconds
And that's all the console seems to output as well, which is rather frustrating! As far as I'm aware all of my SDK versions, tools and plugins are all up to date. I've tried this using a Linux partition I have on my hard drive and it produces the same error message, although it mentions a problem with the package com.Android.future.UsbAccessory. Given what I've seen, it seems that the problem is with the tools, either my directory structure doesn't match up to what the correct setup is, or something else is wrong :S. If anyone has had similar problems, some help would be smashing! (For the record, my setup was done using the instructions on the Arduino website, although I already had the Android SDK tools installed).
Will Scott-Jackson
It sounds like your haven't added in the support library to your project and/or you haven't downloaded it into your Android SDK.
The ADK1 demokit app targets API Level 10 (Android 2.3.3); That means you need to use the support libraries in your project and that's why the compiler is complaining about level 10 library dependencies not being available. The support libraries are a separate download in the SDK Manager, so you might not have them in your development environment.
In Android API Level 12 and higher, the USB Accessory protocol was added to the framework API, so there are two different ways to use the accessory protocol. So, you don't have to use the support libraries if you are targeting Honeycomb and higher versions, but you'll have to update the demokit app code to make this work.
Hope this helps.
So I've double checked my setup and started working on a project I had in mind, it seems to import the libraries appropriately. So far so good, but when I input:
ArduinoAdkUsb arduino;
void setup() {
arduino = new ArduinoAdkUsb(this);
//Other UI initialisation etc.
}
I get this error:
##name## ##version## by ##author##
FATAL EXCEPTION: Animation Thread
java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager
at cc.arduino.ADKCommunication.<init>(Unknown Source)
at cc.arduino.ArduinoAdkUsb.<init>(Unknown Source)
at
processing.android.test.sketch_120730a.
sketch_120730a.setup(sketch_120730a.java:48)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)
After the app has been built and installed onto the Android tablet I am using. Any thoughts how I can over come this? From what I can tell, this has no problem finding com.android.future.usb.manager to compile and install the program, but once it tries to run it can find it.
Based on this tutorial from http://stream.tellart.com/controlling-arduino-with-android/
In the examples RGB_Arduino the name, version and author variables are set at the top of the sketch.
Try adding in this section of code at the top of your arduino sketch just underneath the library imports
// accessory descriptor. It's how Arduino identifies itself to Android
char applicationName[] = "Mega_ADK"; // the app on your phone
char accessoryName[] = "Mega_ADK"; // your Arduino board
char companyName[] = "Freeware";
// make up anything you want for these
char versionNumber[] = "1.0";
char serialNumber[] = "1";
char url[] = "http://labs.arduino.cc/adk/"; // the URL of your app online
//initialize the accessory:
AndroidAccessory usb(companyName, applicationName,
accessoryName,versionNumber,url,serialNumber);

Categories

Resources