43281

How to build \\external\\mmc-util\\ and execute it in Android?

Question:

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

There is <em>\external\mmc-util\mmc.c</em> 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 <a href="http://www.charleswilde.com/android-native-development-using-the-android-open-source-project/" rel="nofollow">Adding a new program to build</a>, 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 <em>/external/mmc-util</em> 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.

Answer1:

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

<ol><li>

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

</li> <li>

In the jni/ subdirectory, locate Android.mk

</li> <li>

Modify it to compile your file.

</li> </ol>

Example <em>Android.mk</em>:

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.

Recommend

  • How to use a bash function in a git alias?
  • Read the value of a cpu control register from admin privilege app (Windows)
  • Accessing embedded image and creating a System.Windows.Controls.Image
  • make: *** [php_mongo.lo] Error 1
  • Equivalent to asm volatile in Gfortran?
  • Subsonic 3.0 Medium Trust Issue
  • How do I use C headers from libgit2 without getting this error?
  • In IEEE 754, why does adding negative zero result in a no-op but adding positive zero does not?
  • StructureMap: Multithreaded env. No default instance defined for PluginFamily
  • good resource for socket errors?
  • How to figure out what value MSVC is using for a preprocessor macro
  • In x86 assembly, is it better to use two separate registers for imul?
  • identifying ``method code too large`` origin
  • Assembly code support in source insight
  • Laravel 5 how to include autoload.php
  • How to automate user interactive command in chef recipe
  • Doctrine: UniqueEntity with Many-to-Many field
  • A simple datepicker in VueJS
  • Get localized short date pattern as String?
  • Scanner nextInt() and hasNextInt() problems
  • Trying to string.Join an IList
  • Error processing multiple files
  • jQuery: How to AJAXify WordPress Search?
  • Trying to get the char code of ENTER key
  • Eloquent paginate function in Slim 3 project using twig
  • Parse a date string in a specific locale (not timezone!)
  • Remove final comma from string in vb.net
  • How to do unit test for HttpContext.Current.Server.MapPath
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • coudnt use logback because of log4j
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Sorting a 2D array using the second column C++
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal