0

I have a RK3288 SOC platform and its all AOSP source code(Andorid SDK, NDK, Linux kernel, U-boot).

There is \external\mmc-util\mmc.c in AOSP. That seems to use ioctl function to test eMMC device by different eMMC command

I want to build and execute it in the SOC platform.

Refer Adding a new program to build, but enter mm will get following:

fatal error: #include asm-generic/int-ll64.h: No such file or directory
fatal error: #include <linux/mmc/ioctl.h>: No such file or directory

My purpose is designed a program, that can send some eMMC command to test eMMC device in SOC platform.

So I think some .c files in /external/mmc-util folder can help me. These files use ioctl function to send command to eMMC device, they are like sample code.

It should be executed through ADB or include in Android system image, isn't?

How can I build(make) it success for running in Android?

I don't know how to solve and do next step.

artless noise
  • 21,212
  • 6
  • 68
  • 105
Mei
  • 1
  • 4

1 Answers1

0

The simplest way (for Linux and Eclipse ADT) is:

  1. Take the hello-jni example; make sure it compiles (via ndk-build) and runs.

  2. In the jni/ subdirectory, locate Android.mk

  3. Modify it to compile your file.

Example Android.mk:

LOCAL_PATH := $(call my-dir) # magic spell

include $(CLEAR_VARS)
LOCAL_MODULE := one
LOCAL_SRC_FILES += one.c ... # files to compile
# link with liblog.so libMyStuff.so libTheirStuff.so
LOCAL_LDLIBS := -llog -L$(LOCAL_PATH)/lib -lMyStuff -lTheirStuff
include $(BUILD_SHARED_LIBRARY)    # this builds libone.so


# you can build more than one module via the same .mk
include $(CLEAR_VARS)

LOCAL_MODULE := sendraw
LOCAL_SRC_FILES := sendRawEth.c
#LOCAL_CPPFLAGS := -std=gnu++0x -Wall         # whatever g++ flags you like
#LOCAL_LDLIBS := -llog   # whatever ld flags you like

include $(BUILD_EXECUTABLE)    # <-- Use this to build an executable.
18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
  • If I don't want to use Eclipse, can I use arm-linux-androideabi to compile my program? – Mei Jan 20 '15 at 13:44
  • In general, yes; the following 2 links describe building iw and another tool which in fact does not work: https://z4ziggy.wordpress.com/2014/03/28/building-aircrack-ng-binaries-and-friends-for-android/ https://z4ziggy.wordpress.com/2014/03/21/how-to-run-aircrack-ng-on-your-android/ . If you manage to build iw, you will be able to reduce it to a hello-world. BTW, you ***cannot*** use Eclipse/ADT for editing C/C++ source, it just creates a hello-world to start with. – 18446744073709551615 Jan 20 '15 at 14:07