Remixing Android

Posted on Feb 13, 2012 (2 years ago). Seen 6,715 times. 20 comments. Permalink Feed
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
Stream Posts: 42

Why Remix Android??

Vanilla is just not for everyone.

re·mix/rēˈmiks/:

Verb:
      Mix (something) again.
Noun:
      A different version of an open operating system produced in such a way.
  • Because Android is open

  • Because custom is better

  • Because we can

Remix What?!?

Cosmetics aside, we’re focusing on major surgery to Android OS.

  • Registering New Marakana Alpha

  • Makefile Plumbing

  • Building Alpha Device

  • Adding Custom Kernel

  • Adding Native Libs

  • Adding Native Daemon

  • Exposing Libs via JNI

  • Registering New System Service

  • Extending Android Framework

  • Adding New App

  • Creating SDK Add-on

Android Stack: The High Level Overview

images/AndroidStackArchitecture.svg
Figure 1. Android Stack Architecture

Android Stack: From Source to Device

images/Android_Stack_Source_to_Device.svg
Figure 2. Android Stack Source to Device

Android Stack: Layer Interaction

images/Android_Stack_Interaction.svg
Figure 3. Android Stack Interaction

Interaction Between Apps

images/Android_Stack_Vertical_Stacks.svg
Figure 4. Android Stack Vertical Stacks

Marakana Alpha

images/MarakanaAlphaDeviceCustomComponents.svg
Figure 5. Marakana Alpha Device Custom Components

Setting up the Directory Structure

screens/RemixingAndroid-DirectoryStructure.png
Figure 6. Marakana Alpha Directory Structure

Self-contained directory structure:

  • device/marakana/: Main placeholder for Marakana Alpha codebase.

  • device/marakana/alpha: Code that goes onto the device.

  • device/marakana/alpha-sdk_addon: Code that goes into the SDK add-on.

  • device/marakana/alpha-common: Shared codebase for device and SDK add-on.

Registering Marakana Alpha

To future-proof your changes, don’t sprinkle other people’s code - keep it separate.

  • Create vendorsetup.sh file:

    device/marakana/alpha/vendorsetup.sh
    add_lunch_combo full_marakana_alpha-eng
  • Rebuild the lunch menu:

    $ source build/envsetup.sh
    including device/marakana/alpha/vendorsetup.sh
    including device/moto/stingray/vendorsetup.sh
    including device/moto/wingray/vendorsetup.sh
    including device/samsung/crespo4g/vendorsetup.sh
    including device/samsung/crespo/vendorsetup.sh
    including device/samsung/maguro/vendorsetup.sh
    including device/samsung/toro/vendorsetup.sh
    including device/samsung/tuna/vendorsetup.sh
    including device/ti/panda/vendorsetup.sh
    including sdk/bash_completion/adb.bash

Makefile Plumbing

The make system is complex - copy from samples to get started.

  • Create main product make file:

    device/marakana/alpha/AndroidProducts.mk
    PRODUCT_MAKEFILES := $(LOCAL_DIR)/full_alpha.mk
  • Create the main build file:

    device/marakana/alpha/full_alpha.mk
    $(call inherit-product, $(SRC_TARGET_DIR)/product/languages_small.mk)
    $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
    
    # Discard inherited values and use our own instead.
    PRODUCT_NAME := full_marakana_alpha
    PRODUCT_DEVICE := alpha
    PRODUCT_MODEL := Full Marakana Alpha Image for Emulator
    
    include $(call all-makefiles-under,$(LOCAL_PATH))
  • Copy boiler-plate files from generic:

    $ cp build/target/board/generic/BoardConfig.mk device/marakana/alpha/.
    $ cp build/target/board/generic/AndroidBoard.mk device/marakana/alpha/.
    $ cp build/target/board/generic/device.mk device/marakana/alpha/.
    $ cp build/target/board/generic/system.prop device/marakana/alpha/.

Building Alpha Device

Let’s build Alpha - so far a vanilla Android.

  • Register the device with build system

    $ source build/envsetup.sh
    including device/marakana/alpha/vendorsetup.sh
    …
  • Choose lunch menu

    $ lunch full_marakana_alpha-eng
    
    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=4.0.3
    TARGET_PRODUCT=full_marakana_alpha
    TARGET_BUILD_VARIANT=eng
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    TARGET_ARCH_VARIANT=armv7-a
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=IML74K
    ============================================
  • Compile the device

    $ export USE_CCACHE=1
    $ make -j10
    …
    Installed file list: out/target/product/alpha/installed-files.txt
    Target system fs image: out/target/product/alpha/obj/PACKAGING/systemimage_intermediates/system.img
    Install system fs image: out/target/product/alpha/system.img
  • Run new device

    $ emulator -avd Alpha \
               -system out/target/product/alpha/system.img \
               -ramdisk out/target/product/alpha/ramdisk.img
  • Verify build number

    Look for the Build number property in System Settings→About phone screen.

    screens/MarakanaAlpha-AboutPhone-v1.png
    Figure 7. Marakana Alpha About Phone

Marakana Alpha Custom Kernel

images/MarakanaAlphaDeviceCustomComponents-kernel.svg
Figure 8. Marakana Alpha Device Custom Components - Kernel

Android Stack - Kernel

images/Android_Stack-Kernel.svg
Figure 9. Android Stack - Kernel

Marakana Alpha Custom Kernel Steps

Not everyone is going to need a custom kernel - but we can have it.

  • Download and build kernel source

    $ mkdir ~/kernel/
    $ cd ~/kernel/
    $ git clone https://android.googlesource.com/kernel/goldfish.git
    $ cd goldfish/
    $ git branch -a
    $ git checkout -t remotes/origin/android-goldfish-2.6.29
    $ make goldfish_armv7_defconfig ARCH=arm
    $ make menuconfig
    $ make -j10 ARCH=arm \
      CROSS_COMPILE=/AOSP/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
  • Copy kernel into our device folder

    cp /path/to/kernel/arch/arm/boot/zImage device/marakana/alpha-common/kernel
  • Enable our custom kernel in BoardConfig.mk

    device/marakana/alpha/BoardConfig.mk
    TARGET_NO_KERNEL := false
  • Create a alpha.mk makefile for our common components

    device/marakana/alpha-common/alpha.mk
    MY_PATH := $(LOCAL_PATH)/../alpha-common
    
    include $(call all-subdir-makefiles)
    
    # Enable our custom kernel
    LOCAL_KERNEL := $(MY_PATH)/kernel
    PRODUCT_COPY_FILES += $(LOCAL_KERNEL):kernel
  • Include alpha.mk in main makefile full_alpha.mk

    device/marakana/alpha/full_alpha.mk
    …
    include device/marakana/alpha-common/alpha.mk
  • Rebuild the device and restart the device with:

    $ emulator -avd Alpha \
               -kernel out/target/product/alpha/kernel \
               -system out/target/product/alpha/system.img \
               -ramdisk out/target/product/alpha/ramdisk.img
  • Verify it worked

    $ adb shell cat /proc/version
    Linux version 2.6.29-marakana-example-gb0d93fb (student@ubuntu) (gcc version 4.4.0 (GCC) ) #5 Tue Jul 19 22:24:03 PDT 2011
    screens/MarakanaAlpha-AboutPhone-v2.png
    Figure 10. Marakana Alpha About Phone

Marakana Alpha Custom Lib

images/MarakanaAlphaDeviceCustomComponents-lib.svg
Figure 11. Marakana Alpha Device Custom Components - Native Library

Android Stack - Native Libraries

images/Android_Stack-Lib.svg
Figure 12. Android Stack - Native Libraries

Marakana Alpha Custom Lib Steps

From drivers to open source libraries, you likely need custom libraries.

  • Create home for shared libraries

    $ mkdir device/marakana/alpha-common/lib/
  • Create shared libs makefile

    device/marakana/alpha-common/lib/Android.mk
    include $(call all-subdir-makefiles)
  • Create folder for libmrknlog library

    mkdir device/marakana/alpha-common/lib/libmrknlog
  • Create libmrknlog.h header file

    device/marakana/alpha-common/lib/libmrknlog/libmrknlog.h
    ...
    extern int mrkn_flush_log();
    extern int mrkn_get_total_log_size();
    extern int mrkn_get_used_log_size();
    ...
  • Implement the library libmrknlog.c using ioctl() to talk to kernel

    device/marakana/alpha-common/lib/libmrknlog/libmrknlog.c
    #define LOG_FILE "/dev/log/main"
    #define LOG_TAG "MrknLog"
    
    #include "libmrknlog.h"
    
    static int ioctl_log(int mode, int request) {
        int logfd = open(LOG_FILE, mode);
        if (logfd < 0) {
            LOGE("Failed to open %s: %s", LOG_FILE, strerror(errno));
            return -1;
        } else {
            int ret = ioctl(logfd, request);
            close(logfd);
            return ret;
        }
    }
    
    extern int mrkn_flush_log() {
        return ioctl_log(O_WRONLY, LOGGER_FLUSH_LOG);
    }
    
    extern int mrkn_get_total_log_size() {
        return ioctl_log(O_RDONLY, LOGGER_GET_LOG_BUF_SIZE);
    }
    
    extern int mrkn_get_used_log_size() {
        return ioctl_log(O_RDONLY, LOGGER_GET_LOG_LEN);
    }
  • Create the Android.mk makefile

    device/marakana/alpha-common/lib/libmrknlog/Android.mk
    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_SRC_FILES := libmrknlog.c
    LOCAL_SHARED_LIBRARIES := libcutils libutils libc
    LOCAL_MODULE := libmrknlog
    LOCAL_PRELINK_MODULE := false
    include $(BUILD_SHARED_LIBRARY)
  • Register the library with alpha.mk

    device/marakana/alpha-common/alpha.mk
    …
    PRODUCT_PACKAGES += libmrknlog
  • Test libmrknlog.so builds

    $ make -j10 libmrknlog
    …
    target SharedLib: libmrknlog (out/target/product/generic/obj/SHARED_LIBRARIES/libmrknlog_intermediates/LINKED/libmrknlog.so)
    target Non-prelinked: libmrknlog (out/target/product/generic/symbols/system/lib/libmrknlog.so)
    target Strip: libmrknlog (out/target/product/generic/obj/lib/libmrknlog.so)
    Install: out/target/product/generic/system/lib/libmrknlog.so

Marakana Alpha Native Daemon

images/MarakanaAlphaDeviceCustomComponents-daemon.svg
Figure 13. Marakana Alpha Device Custom Components - Daemon

Android Stack - Native Daemons

images/Android_Stack-Daemon.svg
Figure 14. Android Stack - Native Daemons

Marakana Alpha Native Daemon Steps

It’s nice to have a native daemon look over your shoulder.

  • Create folder for binaries

    $ mkdir device/marakana/alpha-common/bin
    $ mkdir device/marakana/alpha-common/bin/mrknlogd
  • Create Android.mk for binaries

    device/marakana/alpha-common/bin/Android.mk
    include $(call all-subdir-makefiles)
  • Create daemon source file mrknlogd.c

    device/marakana/alpha-common/bin/mrknlogd/mrknlogd.c
    #define LOG_TAG "MRKN Log Daemon"
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <utils/Log.h>
    #include <libmrknlog.h>
    
    int main (int argc, char* argv[]) {
      if (argc != 2) {
        fprintf(stderr, "Usage: %s <flush-frequency-in-seconds>\n", argv[0]);
        exit(2);
      } else {
        int frequency = atoi(argv[1]);
        int totalSize = mrkn_get_total_log_size();
        int usedSize;
        int count = 1;
        while(1) {
          usedSize = mrkn_get_used_log_size();
          if (mrkn_flush_log() == 0) {
            LOGI("Flushed log (%d, %d of %d bytes). Waiting %d seconds before the next flush.",
              count, usedSize, totalSize, frequency);
            count++;
          } else {
            LOGE("Failed to flush log. Waiting %d seconds before the next attempt",
              frequency);
          }
          sleep(frequency);
        }
      }
    }
  • Create Android.mk file

    device/marakana/alpha-common/bin/mrknlogd/Android.mk
    LOCAL_PATH:= $(call my-dir)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_SRC_FILES := mrknlogd.c
    LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../lib/libmrknlog/
    LOCAL_SHARED_LIBRARIES := libmrknlog libc libcutils libutils
    LOCAL_MODULE := mrknlogd
    include $(BUILD_EXECUTABLE)
  • Register mrknlogd with alpha.mk file

    device/marakana/alpha-common/alpha.mk
    …
    PRODUCT_PACKAGES += mrknlogd
  • Create custom init.rc by using the default one

    $ cp system/core/rootdir/init.rc device/marakana/alpha-common/.
  • Register mrknlogd with init.rc

    device/marakana/alpha-common/init.rc
    # Marakana's custom log-flushing daemon
    service mrknlogd /system/bin/mrknlogd 60
        user system
        group log
        oneshot
  • Include init.rc in our alpha.mk device build

    device/marakana/alpha-common/alpha.mk
    # Copy our init.rc file over the existing one (since ours contains extra changes)
    PRODUCT_COPY_FILES += $(MY_PATH)/init.rc:root/init.rc
  • Build the device

    $ make -j10
    …
    Install system fs image: out/target/product/alpha/system.img
    Installed file list: out/target/product/alpha/installed-files.txt
  • Verify it all works by restarting the device

    # (re)start the emulator
    $ emulator -kernel out/target/product/alpha/kernel &
    # wait for the emulator to finish
    # check out our daemon
    $ adb shell ls -l /system/bin/mrknlogd
    -rwxr-xr-x root     shell        5508 2011-07-13 02:25 mrknlogd
    # check that it runs
    $ adb shell ps | grep mrknlogd
    system    37    1     1044   292   c00520f8 afd0bdac S /system/bin/mrknlogd
    $ adb logcat | grep MRKN
    I/MRKN Log Daemon(   37): Flushed log (1, 60 of 65536 bytes). Waiting 60 seconds before the next flush.
    I/MRKN Log Daemon(   37): Flushed log (2, 34406 of 65536 bytes). Waiting 60 seconds before the next flush.
    I/MRKN Log Daemon(   37): Flushed log (3, 232 of 65536 bytes). Waiting 60 seconds before the next flush.
    ^C
    $ adb logcat -g
    /dev/log/main: ring buffer is 64Kb (0Kb consumed), max entry is 4096b, max payload is 4076b
    # good :-)

Wrapping Native Lib with JNI

images/MarakanaAlphaDeviceCustomComponents-jni.svg
Figure 15. Marakana Alpha Device Custom Components - JNI Wrapper

Wrapping Native Lib with JNI Steps

The glue for Java to talk to C and back.

  • Create directory structure for our JNI wrapper

    $ mkdir device/marakana/alpha-common/framework
    $ mkdir device/marakana/alpha-common/framework/mrknlog_jni
    $ mkdir device/marakana/alpha-common/framework/mrknlog_jni/java
    $ mkdir device/marakana/alpha-common/framework/mrknlog_jni/jni
  • Create top level Android.mk files

    device/marakana/alpha-common/framework/Android.mk
    include $(call all-subdir-makefiles)
    device/marakana/alpha-common/framework/mrknlog_jni/Android.mk
    include $(call all-subdir-makefiles)
  • Create Java Library LibLog.java

    device/marakana/alpha-common/framework/mrknlog_jni/java/com/marakana/android/lib/log/LibLog.java
    package com.marakana.android.lib.log;
    
    public class LibLog {
      public native static void flushLog() throws LibLogException;
      public native static int getTotalLogSize() throws LibLogException;
      public native static int getUsedLogSize() throws LibLogException;
    
      static {
         System.loadLibrary("mrknlog_jni");
      }
    }
  • Create test Main.java

    device/marakana/alpha-common/framework/mrknlog_jni/java/com/marakana/android/lib/log/Main.java
    package com.marakana.android.lib.log;
    
    /** @hide */
    public class Main {
      public static void main (String[] args) {
            try {
          int usedSize = LibLog.getUsedLogSize();
          int totalSize = LibLog.getTotalLogSize();
          LibLog.flushLog();
          System.out.printf("Flushed log. Previously it was consuming %d of %d bytes\n",
              usedSize, totalSize);
        } catch (LibLogException e) {
              System.err.println("Failed to flush the log");
              e.printStackTrace();
        }
      }
    }
  • Create custom permission

    device/marakana/alpha-common/framework/mrknlog_jni/java/com.marakana.android.lib.log.xml
    <?xml version="1.0" encoding="utf-8"?>
    <permissions>
      <library name="com.marakana.android.lib.log"
        file="/system/framework/com.marakana.android.lib.log.jar"/>
    </permissions>
  • Create Android.mk file for our JNI wrapper

    device/marakana/alpha-common/framework/mrknlog_jni/java/Android.mk
    LOCAL_PATH := $(call my-dir)
    
    # Build the library
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE := com.marakana.android.lib.log
    LOCAL_SRC_FILES := $(call all-java-files-under,.)
    LOCAL_JAVA_LIBRARIES := core
    LOCAL_NO_STANDARD_LIBRARIES := true
    include $(BUILD_JAVA_LIBRARY)
    
    # Build the documentation
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all-subdir-html-files)
    LOCAL_MODULE:= com.marakana.android.lib.log_doc
    LOCAL_DROIDDOC_OPTIONS := com.marakana.android.lib.log
    LOCAL_MODULE_CLASS := JAVA_LIBRARIES
    LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true
    include $(BUILD_DROIDDOC)
    
    # Copy com.marakana.android.lib.log.xml to /system/etc/permissions/
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE := com.marakana.android.lib.log.xml
    LOCAL_MODULE_CLASS := ETC
    LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
    LOCAL_SRC_FILES := $(LOCAL_MODULE)
    include $(BUILD_PREBUILT)
  • Create the JNI header file

    $ javah -jni \
            -d device/marakana/alpha-common/framework/mrknlog_jni/jni/ \
            -classpath out/target/common/obj/JAVA_LIBRARIES/com.marakana.android.lib.log_intermediates/classes.jar \
            com.marakana.android.lib.log.LibLog
  • Check that you got the right JNI header

    device/marakana/alpha-common/framework/mrknlog_jni/jni/com_marakana_android_lib_log_LibLog.h
    …
    JNIEXPORT void JNICALL Java_com_marakana_android_lib_log_LibLog_flushLog
      (JNIEnv *, jclass);
    …
    JNIEXPORT jint JNICALL Java_com_marakana_android_lib_log_LibLog_getTotalLogSize
      (JNIEnv *, jclass);
    …
    JNIEXPORT jint JNICALL Java_com_marakana_android_lib_log_LibLog_getUsedLogSize
      (JNIEnv *, jclass);
  • Implement the header file, wrapping calls to our libmrknlog shared library

    device/marakana/alpha-common/framework/mrknlog_jni/jni/com_marakana_android_lib_log_LibLog.c
    #include <libmrknlog.h>
    #include "com_marakana_android_lib_log_LibLog.h"
    
    static void ThrowLibLogException(JNIEnv *env, const char *message) {
      jclass class = (*env)->FindClass(env, "com/marakana/android/lib/log/LibLogException");
      if (class != NULL) {
        (*env)->ThrowNew(env, class, message);
      }
      (*env)->DeleteLocalRef(env, class);
    }
    
    JNIEXPORT void JNICALL Java_com_marakana_android_lib_log_LibLog_flushLog
      (JNIEnv *env, jclass clazz) {
      if (mrkn_flush_log() != 0) {
        ThrowLibLogException(env, "Failed to flush log");
      }
    }
    
    JNIEXPORT jint JNICALL Java_com_marakana_android_lib_log_LibLog_getTotalLogSize
      (JNIEnv *env, jclass clazz) {
      jint result = mrkn_get_total_log_size();
      if (result < 0) {
        ThrowLibLogException(env, "Failed to get total log size");
      }
      return result;
    }
    
    JNIEXPORT jint JNICALL Java_com_marakana_android_lib_log_LibLog_getUsedLogSize
      (JNIEnv *env, jclass clazz) {
      jint result = mrkn_get_used_log_size();
      if (result < 0) {
        ThrowLibLogException(env, "Failed to get used log size");
      }
      return result;
    }
  • Create Android.mk file

    device/marakana/alpha-common/framework/mrknlog_jni/jni/Android.mk
    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_SRC_FILES := com_marakana_android_lib_log_LibLog.c
    LOCAL_C_INCLUDES += $(JNI_H_INCLUDE) $(LOCAL_PATH)/../../../lib/libmrknlog
    LOCAL_SHARED_LIBRARIES := libmrknlog
    LOCAL_MODULE := libmrknlog_jni
    LOCAL_PRELINK_MODULE := false
    include $(BUILD_SHARED_LIBRARY)
  • Register this module with alpha.mk file

    device/marakana/alpha-common/alpha.mk
    …
    PRODUCT_PACKAGES += \
            com.marakana.android.lib.log \
            com.marakana.android.lib.log.xml \
            libmrknlog_jni
  • Build the device

    $ make -j10
    …
    target Prebuilt: com.marakana.android.lib.log.xml (out/target/product/alpha/obj/ETC/com.marakana.android.lib.log.xml_intermediates/com.marakana.android.lib.log.xml)
    …
    Install: out/target/product/alpha/system/lib/libmrknlog_jni.so
    …
    Install system fs image: out/target/product/alpha/system.img
    Installed file list: out/target/product/alpha/installed-files.txt
  • Verify it works via our Main.main() test code

    # (re)start the emulator
    $ emulator -kernel out/target/product/alpha/kernel &
    # wait for the emulator to finish
    # check out our Java library
    $ adb shell ls -l /system/framework/com.marakana.android.lib.log.jar
    -rw-r--r-- root     root         1471 2011-07-11 00:01 com.marakana.android.lib.log.jar
    # check out our Java library registry file
    $ adb shell ls -l /system/etc/permissions/com.marakana.android.lib.log.xml
    -rw-r--r-- root     root          179 2011-07-10 23:57 com.marakana.android.lib.log.xml
    # check out our JNI shared library
    $ adb shell ls -l /system/lib/libmrknlog_jni.so
    -rw-r--r-- root     root         5296 2011-07-11 01:41 libmrknlog_jni.so
    # check if our utility is doing what it is supposed to
    $ adb logcat -g
    /dev/log/main: ring buffer is 64Kb (33Kb consumed), max entry is 4096b, max payload is 4076b
    # now run our Java library's Main.main() by directly invoking the Dalvik VM
    $ adb shell dalvikvm -cp /system/framework/com.marakana.android.lib.log.jar com.marakana.android.lib.log.Main
    Flushed log. Previously it was consuming 34346 of 65536 bytes
    # check again
    $ adb logcat -g
    /dev/log/main: ring buffer is 64Kb (0Kb consumed), max entry is 4096b, max payload is 4076b
    $ adb shell dalvikvm -cp /system/framework/com.marakana.android.lib.log.jar com.marakana.android.lib.log.Main
    Flushed log. Previously it was consuming 217 of 65536 bytes
    # good :-)

Marakana Alpha Service Interface

images/MarakanaAlphaDeviceCustomComponents-interface.svg
Figure 16. Marakana Alpha Device Custom Components - Service Interface

Android Stack - Framework

images/Android_Stack-Framework.svg
Figure 17. Android Stack - Framework

Marakana Alpha Service Interface Steps

Because other apps are going to want to use our service as well.

  • Create directory structure for our mrknlogservice

    $ mkdir -p device/marakana/alpha-common/framework/mrknlogservice/com/marakana/android/service/log
  • Create the interface LogService.aidl file

    device/marakana/alpha-common/framework/mrknlogservice/com/marakana/android/service/log/ILogService.aidl
    package com.marakana.android.service.log;
    
    /**
     * System-private API for talking to the LogService.
     *
     * {@hide}
     */
    interface ILogService {
      void flushLog();
      int getTotalLogSize();
      int getUsedLogSize();
    }
  • Create LogManager.java proxy to our bound service

    device/marakana/alpha-common/framework/mrknlogservice/com/marakana/android/service/log/LogManager.java
    package com.marakana.android.service.log;
    
    import android.os.IBinder;
    import android.os.RemoteException;
    import android.os.ServiceManager;
    import android.util.Log;
    
    public class LogManager {
      private static final String TAG = "LogManager";
      private static final String REMOTE_SERVICE_NAME = ILogService.class.getName();
      private final ILogService service;
    
      public static LogManager getInstance() {
        return new LogManager();
      }
    
      private LogManager() {
        Log.d(TAG, "Connecting to ILogService by name [" + REMOTE_SERVICE_NAME + "]");
        this.service = ILogService.Stub.asInterface(ServiceManager.getService(REMOTE_SERVICE_NAME));
        if (this.service == null) {
          throw new IllegalStateException("Failed to find ILogService by name [" + REMOTE_SERVICE_NAME + "]");
        }
      }
    
      public void flushLog() {
        try {
          Log.d(TAG, "Flushing logs. If it works, you won't see this message.");
          this.service.flushLog();
        } catch (RemoteException e) {
          throw new RuntimeException("Failed to flush log", e);
        }
      }
    
      public int getTotalLogSize() {
        try {
          return this.service.getTotalLogSize();
        } catch (RemoteException e) {
          throw new RuntimeException("Failed to get total log size", e);
        }
      }
    
      public int getUsedLogSize() {
        try {
          return this.service.getUsedLogSize();
        } catch (Exception e) {
          throw new RuntimeException("Failed to get used log size", e);
        }
      }
    }
  • Expose LogManager.java as a Java library

    device/marakana/alpha-common/framework/mrknlogservice/com.marakana.android.service.log.xml
    <?xml version="1.0" encoding="utf-8"?>
    <permissions>
      <library name="com.marakana.android.service.log"
        file="/system/framework/com.marakana.android.service.log.jar"/>
    </permissions>
  • Create Android.mk file for mrknlogservice

    device/marakana/alpha-common/framework/mrknlogservice/Android.mk
    LOCAL_PATH := $(call my-dir)
    
    # Build the library
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE := com.marakana.android.service.log
    LOCAL_SRC_FILES := $(call all-java-files-under,.)
    LOCAL_SRC_FILES += com/marakana/android/service/log/ILogService.aidl
    LOCAL_JAVA_STATIC_LIBRARIES := android-common
    LOCAL_JAVA_LIBRARIES := core
    include $(BUILD_JAVA_LIBRARY)
    
    # Build the documentation
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all-subdir-html-files)
    LOCAL_MODULE:= com.marakana.android.service.log_doc
    LOCAL_DROIDDOC_OPTIONS := com.marakana.android.service.log
    LOCAL_MODULE_CLASS := JAVA_LIBRARIES
    LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true
    include $(BUILD_DROIDDOC)
    
    # Copy com.marakana.android.service.log.xml to /system/etc/permissions/
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE := com.marakana.android.service.log.xml
    LOCAL_MODULE_CLASS := ETC
    LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
    LOCAL_SRC_FILES := $(LOCAL_MODULE)
    include $(BUILD_PREBUILT)
  • Add it to alpha.mk file

    device/marakana/alpha-common/alpha.mk
    …
    PRODUCT_PACKAGES += \
            com.marakana.android.service.log \
            com.marakana.android.service.log.xml
  • Verify that the device builds okay

    $ make -j10 com.marakana.android.service.log com.marakana.android.service.log.xml
    …
    target Prebuilt: com.marakana.android.service.log.xml
    …
    Install: out/target/product/alpha/system/etc/permissions/com.marakana.android.service.log.xml
    …
    Aidl: com.marakana.android.service.log <= device/marakana/alpha-common/framework/mrknlogservice/com/marakana/android/service/log/ILogService.aidl
    …
    target Jar: com.marakana.android.service.log
    …
    Install: out/target/product/alpha/system/framework/com.marakana.android.service.log.jar
    …

Marakana Alpha Service App

images/MarakanaAlphaDeviceCustomComponents-service.svg
Figure 18. Marakana Alpha Device Custom Components - Service App

Android Stack - Services

images/Android_Stack-Service.svg
Figure 19. Android Stack - Services

Marakana Alpha Service App Steps

Register the service with the Service Manager so others can use it.

  • Create the directory structure for our code

    $ mkdir device/marakana/alpha-common/app
  • Create main Android.mk file

    device/marakana/alpha-common/app/Android.mk
    include $(call all-subdir-makefiles)
  • Create AndroidManifest.xml file for our server app

    device/marakana/alpha-common/app/MrknLogService/AndroidManifest.xml
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.marakana.android.logservice"
      android:versionCode="1"
      android:versionName="1.0"
      android:sharedUserId="android.uid.system">
      <uses-sdk android:minSdkVersion="8" />
      <uses-permission android:name="android.permission.READ_LOGS"/>
      <application android:name=".LogServiceApp" android:persistent="true">
        <uses-library android:name="com.marakana.android.service.log" android:required="true"/>
        <uses-library android:name="com.marakana.android.lib.log" android:required="true"/>
      </application>
      <permission android:name="com.marakana.android.logservice.FLUSH_LOG"
        android:protectionLevel="dangerous"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:label="@string/flush_log_permission_label"
        android:description="@string/flush_log_permission_description"/>
    </manifest>
  • Provide ILogServiceImpl.java implementation for our service

    device/marakana/alpha-common/app/MrknLogService/src/com/marakana/android/logservice/ILogServiceImpl.java
    package com.marakana.android.logservice;
    
    ...
    
    class ILogServiceImpl extends ILogService.Stub {
      private static final String TAG = "ILogServiceImpl";
      private final Context context;
    
      ILogServiceImpl(Context context) {
        this.context = context;
      }
    
      public void flushLog() throws RemoteException {
        if (this.context.checkCallingOrSelfPermission(Manifest.permission.FLUSH_LOG) !=
            PackageManager.PERMISSION_GRANTED) {
          throw new SecurityException("Requires FLUSH_LOG permission");
        }
        Log.d(TAG, "Flushing logs. If it works, you won't see this message.");
        LibLog.flushLog();
      }
    
      public int getUsedLogSize() throws RemoteException {
        return LibLog.getUsedLogSize();
      }
    
      public int getTotalLogSize() throws RemoteException {
        return LibLog.getTotalLogSize();
      }
    }
  • Register LogServiceApp with ServiceManager

    device/marakana/alpha-common/app/MrknLogService/src/com/marakana/android/logservice/LogServiceApp.java
    package com.marakana.android.logservice;
    
    ...
    
    public class LogServiceApp extends Application {
      private static final String TAG = "LogServiceApp";
      private static final String REMOTE_SERVICE_NAME = ILogService.class.getName();
      private ILogServiceImpl serviceImpl;
    
      public void onCreate() {
        super.onCreate();
        this.serviceImpl = new ILogServiceImpl(this);
        ServiceManager.addService(REMOTE_SERVICE_NAME, this.serviceImpl);
        Log.d(TAG, "Registered [" + serviceImpl.getClass().getName() + "] as [" + REMOTE_SERVICE_NAME + "]");
      }
    
      public void onTerminate() {
        super.onTerminate();
        Log.d(TAG, "Terminated");
      }
    }
  • Create the Android.mk file

    device/marakana/alpha-common/app/MrknLogService/Android.mk
    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_SRC_FILES := $(call all-java-files-under,src)
    LOCAL_REQUIRED_MODULES := \
            com.marakana.android.service.log \
            com.marakana.android.lib.log
    LOCAL_JAVA_LIBRARIES := \
            com.marakana.android.service.log \
            com.marakana.android.lib.log \
            core \
            framework
    LOCAL_PACKAGE_NAME := MrknLogService
    LOCAL_SDK_VERSION := current
    LOCAL_PROGUARD_ENABLED := disabled
    LOCAL_CERTIFICATE := platform
    include $(BUILD_PACKAGE)
  • Register our service app with alpha.mk file

    device/marakana/alpha-common/alpha.mk
    …
    PRODUCT_PACKAGES += MrknLogService
  • Build the device

    $ make -j10
    …
    Install: out/target/product/alpha/system/app/MrknLogService.apk
    …
    Install system fs image: out/target/product/alpha/system.img
    Installed file list: out/target/product/alpha/installed-files.txt

Marakana Alpha Client App

images/MarakanaAlphaDeviceCustomComponents-client.svg
Figure 20. Marakana Alpha Device Custom Components - Client App

Android Stack - Apps

images/Android_Stack-App.svg
Figure 21. Android Stack - Apps

Marakana Alpha Client App Steps

A demo client app - to make sure it all works.

  • Create directory structure for our MrknLogServiceClient app

    $ mkdir device/marakana/alpha/app/MrknLogServiceClient
    $ mkdir device/marakana/alpha/app/MrknLogServiceClient/res
    $ mkdir device/marakana/alpha/app/MrknLogServiceClient/res/values
    $ mkdir device/marakana/alpha/app/MrknLogServiceClient/res/layout
    $ mkdir device/marakana/alpha/app/MrknLogServiceClient/src
    $ mkdir -p device/marakana/alpha/app/MrknLogServiceClient/src/com/marakana/android/logserviceclient
  • Create LogActivity.java

    LogActivity.java
    package com.marakana.android.logserviceclient;
    
    ...
    import com.marakana.android.service.log.LogManager;
    
    public class LogActivity extends Activity implements Runnable, OnClickListener {
    
      private TextView output;
    
      private Handler handler;
    
      private LogManager logManager;
    
      public void onCreate(Bundle savedInstanceState) {
        this.logManager = LogManager.getInstance();
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.log);
        this.output = (TextView)super.findViewById(R.id.output);
        Button button = (Button)super.findViewById(R.id.button);
        button.setOnClickListener(this);
        this.handler = new Handler();
      }
    
      private void updateOutput() {
        this.output.setText(super.getString(R.string.log_utilization_message,
          this.logManager.getUsedLogSize(), this.logManager.getTotalLogSize()));
      }
    
      @Override
      public void onResume() {
        super.onResume();
        this.handler.post(this);
      }
    
      @Override
      public void onPause() {
        super.onPause();
        this.handler.removeCallbacks(this);
      }
    
      public void onClick(View view) {
        this.logManager.flushLog();
        this.updateOutput();
      }
    
      public void run() {
        this.updateOutput();
        this.handler.postDelayed(this, 1000);
      }
    }
  • Create ` AndroidManifest.xml` file

    device/marakana/alpha/app/MrknLogServiceClient/AndroidManifest.xml
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.marakana.android.logserviceclient"
      android:versionCode="1" android:versionName="1.0">
      <uses-sdk android:minSdkVersion="8" />
      <uses-permission android:name="com.marakana.android.logservice.FLUSH_LOG" />
      <application android:label="@string/app_name">
        <uses-library android:name="com.marakana.android.service.log"
          android:required="true" />
        <activity android:name=".LogActivity"
          android:label="@string/app_name">
          <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
          </intent-filter>
        </activity>
      </application>
    </manifest>
  • Create Android.mk file

    device/marakana/alpha/app/MrknLogServiceClient/Android.mk
    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_SRC_FILES := $(call all-java-files-under,src)
    LOCAL_JAVA_LIBRARIES := com.marakana.android.service.log
    LOCAL_PACKAGE_NAME := MrknLogServiceClient
    LOCAL_SDK_VERSION := current
    LOCAL_PROGUARD_ENABLED := disabled
    include $(BUILD_PACKAGE)
  • Register MrknLogServiceClient with main makefile full_alpha.xml

    device/marakana/alpha/full_alpha.mk
    …
    PRODUCT_PACKAGES += MrknLogServiceClient
  • Build entire device

    $ make -j10
    …
    Install system fs image: out/target/product/alpha/system.img
    Installed file list: out/target/product/alpha/installed-files.txt
  • Verify it all works

    Run the MrknLogServiceClient app and try to flush the log.

    screens/MrknLogServiceClient.png
    Figure 22. MrknLogServiceClient

Marakana Alpha SDK Add-On

Other developers may want to develop for our cool Alpha device as well.

  • Create directory structure

    $ mkdir device/marakana/alpha-sdk_addon/skins
    $ cp -r sdk/emulator/skins/HVGA device/marakana/alpha-sdk_addon/skins/MrknHvgaMdpi
  • Create portrait layout background

    We took a standard one and just added our logo.

    code/CustomRom/device/marakana/alpha-sdk_addon/skins/MrknHvgaMdpi/background_port.png
    Figure 23. device/marakana/alpha-sdk_addon/skins/MrknHvgaMdpi/background_port.png
  • Create landscape layout background

    Same as with the previous image, just add a logo.

    code/CustomRom/device/marakana/alpha-sdk_addon/skins/MrknHvgaMdpi/background_land.png
    Figure 24. device/marakana/alpha-sdk_addon/skins/MrknHvgaMdpi/background_land.png
  • Define hardware.ini file

    device/marakana/alpha-sdk_addon/hardware.ini
    # Custom hardware options for the add-on.
    # Properties defined here impact all AVD targeting this add-on.
    # Each skin can also override those values with its own hardware.ini file.
    vm.heapSize = 24
  • Create SDK Add-on manifest.ini file

    device/marakana/alpha-sdk_addon/manifest.ini
    name=Alpha Add-On
    vendor=Marakana
    description=Marakana Alpha Add-on
    api=10
    revision=1
    libraries=com.marakana.android.lib.log;com.marakana.android.service.log
    com.marakana.android.lib.log=com.marakana.android.lib.log.jar;Marakana Log Library
    com.marakana.android.service.log=com.marakana.android.service.log.jar;Marakana Log Service
    skin=MrknHvgaMdpi
  • Define classes to be included

    device/marakana/alpha-sdk_addon/alpha_sdk_addon_stub_defs.txt
    +com.marakana.android.lib.log.*
    -com.marakana.android.lib.log.Main
    +com.marakana.android.service.log.*
  • Create main alpha_sdk_addon.mk makefile for Alpha SDK Add-on

    device/marakana/alpha-sdk_addon/alpha_sdk_addon.mk
    # Include the common stuff
    include device/marakana/alpha-common/alpha.mk
    
    # List of modules to include in the the add-on system image
    PRODUCT_PACKAGES += \
            com.marakana.android.lib.log_doc \
            com.marakana.android.service.log_doc \
    
    # The name of this add-on (for the SDK)
    PRODUCT_SDK_ADDON_NAME := marakana_alpha_addon
    
    # Copy the following files for this add-on's SDK
    PRODUCT_SDK_ADDON_COPY_FILES := \
            $(LOCAL_PATH)/manifest.ini:manifest.ini \
            $(LOCAL_PATH)/hardware.ini:hardware.ini \
            $(call find-copy-subdir-files,*,$(LOCAL_PATH)/skins/MrknHvgaMdpi,skins/MrknHvgaMdpi)
    
    
    # Copy the jar files for the libraries (APIs) exposed in this add-on's SDK
    PRODUCT_SDK_ADDON_COPY_MODULES := \
            com.marakana.android.lib.log:libs/com.marakana.android.lib.log.jar \
            com.marakana.android.service.log:libs/com.marakana.android.service.log.jar
    
    PRODUCT_SDK_ADDON_STUB_DEFS := $(LOCAL_PATH)/alpha_sdk_addon_stub_defs.txt
    
    # Define the name of the documentation to generate for this add-on's SDK
    PRODUCT_SDK_ADDON_DOC_MODULE := \
            com.marakana.android.service.log_doc
    
    # Since the add-on is an emulator, we also need to explicitly copy the kernel to images
    PRODUCT_SDK_ADDON_COPY_FILES += $(LOCAL_KERNEL):images/kernel-qemu
    
    # This add-on extends the default sdk product.
    $(call inherit-product, $(SRC_TARGET_DIR)/product/sdk.mk)
    
    # The name of this add-on (for the build system)
    # Use 'make PRODUCT-<PRODUCT_NAME>-sdk_addon' to build the an add-on,
    # so in this case, we would run 'make PRODUCT-marakana_alpha_addon-sdk_addon'
    PRODUCT_NAME := marakana_alpha_addon
    PRODUCT_DEVICE := alpha
    PRODUCT_MODEL := Marakana Alpha SDK Addon Image for Emulator
  • Create main AndroidProducts.mk listing other makefiles

    device/marakana/alpha-sdk_addon/AndroidProducts.mk
    PRODUCT_MAKEFILES := $(LOCAL_DIR)/alpha_sdk_addon.mk
  • Create top-level makefile

    device/marakana/alpha-sdk_addon/Android.mk
    include $(call all-subdir-makefiles)
  • Build the SDK Add-on

    $ make -j10 PRODUCT-marakana_alpha_addon-sdk_addon
    …
    Packaging SDK Addon: out/host/linux-x86/sdk_addon/marakana_alpha_addon-eng.student-linux-x86.zip
  • Check that Marakana Alpha shows in Android SDK Manager

    Start the Android SDK Manager to see all available Add-ons.

    screens/Android_SDK_and_AVD_Manager-with-MarakanaAlphaSDKAddon.png
    Figure 25. Android SDK and AVD Manager with Marakana Alpha SDK Add-on
  • Create new AVD based on Marakana Alpha

    From the Android AVD Manager, create new AVD using Alpha as the target.

    screens/Android_SDK_and_AVD_Manager-Create-MarakanaAlphaSDKAddon-AVD.png
    Figure 26. Create Marakana Alpha SDK Add-on AVD
  • Verify the new AVD boots up with right ROM image

    Start the new AVD. You should see all of the modifications we’ve done.

    screens/MarakanaAlphaSDKAddon.png
    Figure 27. Marakana Alpha SDK Addon

Remixing Android Summary

Thank you!

Marko Gargenta & Marakana Team

Special thanks to Aleksandar (Saša) Gargenta for providing most of the research on how to put together Marakana Alpha, properly.

Slides & video of this presentation is available at Marakana.com


thumbnail

Comments

Posted on Feb 24, 2012
Photo Bhaumik Shukla
Application Engineer
Azoi Inc
Member since Feb 24, 2012
Location: Ahmedabad
Hello,
I have one query here, I am adding new package "Abc" in "/framework/base/packages/", so do i need to register somewhere for this new package? if so then can you say me where?

PS: while building it is not giving error, but when i call it from other apps, it gives "com.xxx.xxx" package is not exist.

thanks.
Posted on Feb 28, 2012
Photo Bhaumik Shukla
Application Engineer
Azoi Inc
Member since Feb 24, 2012
Location: Ahmedabad
today i just found answer of my question, for above thing just add your package into build/target/product/core.mk into PRODUCT_PACKAGES. so it will register itself from here.
Posted on Feb 28, 2012
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
Awesome! Happy it worked out!
Posted on Mar 2, 2012
Photo Khosi Morafo
Feerlaroc
Member since Feb 28, 2012
Given Bhaumiks' solution (which I tried and it works), what does this step do?


PRODUCT_PACKAGES += \
com.marakana.android.lib.log \
com.marakana.android.lib.log.xml \
libmrknlog_jni

At File:- [device/marakana/alpha-common/alpha.mk]
Posted on Mar 2, 2012
Photo Khosi Morafo
Feerlaroc
Member since Feb 28, 2012
Is the source for this available? Many imports are missing and it gets confusing to try and trace all the objects that will break as a result.
Posted on Mar 5, 2012
Photo Khosi Morafo
Feerlaroc
Member since Feb 28, 2012
Finally got around to finishing this exercise! It works. Thank you Marko! Next time please do not hide so much of the code. :-)

Once again, thank you!
Posted on Mar 23, 2012
Photo Shubham Patni
S F
Member since Sep 12, 2011
Heyy Khosi Morafo , please share your knowledge to build new sdk add-on.

thanks
Posted on Apr 25, 2012
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
All code is available at https://github.com/marakana/marakana-alpha
Marko
Posted on Apr 25, 2012
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
Just a note that creating custom platform keys won't work on OSX due to a different version of mknod. Use Linux to create custom keys.
Posted on May 19, 2012
Photo Bhaumik Shukla
Application Engineer
Azoi Inc
Member since Feb 24, 2012
Location: Ahmedabad
for registering new package, here is the information which might be helpful to all..
http://www.boomtech.in/post/23224620856/android-add-register-new-package-in-framework-for
Posted on Jun 30, 2012
Photo Chandra Gopalaiah
Personal
Member since Jun 12, 2012
Hi Marko,
I am trying the steps you have given, but I am facing a problem while creating MrknLogServiceClient app.

Here I am not using custom kernel, instead using the prebuilt kernel.

I am not able to import com.marakana.android.service.log.LogManager.
But still if I copy and paste manually from your code and fire a build. The build goes through and when I try to launch the app from the emulator, it is crashing.

When I analyzed the logs, dalvinvm is not able to find the LogManager class hence the app is crashing.

I verified the AndroidManifestfile.xml and everything is similar to yours in the source code link you provided.

Here is the log snapshot
06-30 13:42:58.234 I/ActivityManager( 77): Start proc com.marakana.android.logserviceclient for activity com.marakana.android.logserviceclient/.LogActivity: pid=442 uid=10004 gids={1007}
06-30 13:42:58.374 W/NetworkManagementSocketTagger( 77): setKernelCountSet(10004, 1) failed with errno -2
06-30 13:42:58.675 I/dalvikvm( 442): Could not find method com.marakana.android.service.log.LogManager.getUsedLogSize, referenced from method com.marakana.android.logserviceclient.LogActivity.updateOutput
06-30 13:42:58.675 W/dalvikvm( 442): VFY: unable to resolve virtual method 29: Lcom/marakana/android/service/log/LogManager;.getUsedLogSize ()I
06-30 13:42:58.675 D/dalvikvm( 442): VFY: replacing opcode 0x6e at 0x000b
06-30 13:42:58.715 I/dalvikvm( 442): Could not find method com.marakana.android.service.log.LogManager.flushLog, referenced from method com.marakana.android.logserviceclient.LogActivity.onClick
06-30 13:42:58.715 W/dalvikvm( 442): VFY: unable to resolve virtual method 26: Lcom/marakana/android/service/log/LogManager;.flushLog ()V
06-30 13:42:58.715 D/dalvikvm( 442): VFY: replacing opcode 0x6e at 0x0002
06-30 13:42:58.715 I/dalvikvm( 442): Could not find method com.marakana.android.service.log.LogManager.getInstance, referenced from method com.marakana.android.logserviceclient.LogActivity.onCreate
06-30 13:42:58.715 W/dalvikvm( 442): VFY: unable to resolve static method 27: Lcom/marakana/android/service/log/LogManager;.getInstance ()Lcom/marakana/android/service/log/LogManager;
06-30 13:42:58.715 D/dalvikvm( 442): VFY: replacing opcode 0x71 at 0x0000
06-30 13:42:58.715 D/AndroidRuntime( 442): Shutting down VM
06-30 13:42:58.715 W/dalvikvm( 442): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
06-30 13:42:58.815 E/AndroidRuntime( 442): FATAL EXCEPTION: main
06-30 13:42:58.815 E/AndroidRuntime( 442): java.lang.NoClassDefFoundError: com.marakana.android.service.log.LogManager
06-30 13:42:58.815 E/AndroidRuntime( 442): at com.marakana.android.logserviceclient.LogActivity.onCreate(LogActivity.java:22)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.app.Activity.performCreate(Activity.java:4465)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.os.Handler.dispatchMessage(Handler.java:99)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.os.Looper.loop(Looper.java:137)
06-30 13:42:58.815 E/AndroidRuntime( 442): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-30 13:42:58.815 E/AndroidRuntime( 442): at java.lang.reflect.Method.invokeNative(Native Method)
06-30 13:42:58.815 E/AndroidRuntime( 442): at java.lang.reflect.Method.invoke(Method.java:511)
06-30 13:42:58.815 E/AndroidRuntime( 442): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-30 13:42:58.815 E/AndroidRuntime( 442): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-30 13:42:58.815 E/AndroidRuntime( 442): at dalvik.system.NativeStart.main(Native Method)
06-30 13:42:58.885 W/ActivityManager( 77): Force finishing activity com.marakana.android.logserviceclient/.LogActivity

Please help me in fixing this issue.

Highly appreciate your help.

Thanks,
Chandra
Posted on Jun 30, 2012
Photo Chandra Gopalaiah
Personal
Member since Jun 12, 2012
One more issue is, I am not able to find MrknLogLibClient app in my emulator. I only see MrknLogServiceClient app. But I am compiling both of them and also included
Posted on Jun 30, 2012
Photo Chandra Gopalaiah
Personal
Member since Jun 12, 2012
Sorry please ignore my last comment.
Posted on Jun 30, 2012
Photo Chandra Gopalaiah
Personal
Member since Jun 12, 2012
Hi Marko,
I tried the exact steps to compile the kernel for android. But after the last step, I was presented with several questions, after answering the questions, the compilation started but it didn't go through to the end. I don't see any zImage generated in arch/arm/boot.

Base on my selection in first step, i think the rest of the question populated. I selected option 2.
Is that the right option to be choosen?
If not, can you provide me a detailed instructions on how to compile the kernel

In the compilation log i see an error
make: *** [arch/arm/mm] Error 2
make: *** Waiting for unfinished jobs....

Highly appreciate your help

Below is the log of entire compilation,

scripts/kconfig/conf -s arch/arm/Kconfig
*
* Restart config...
*
*
* System Type
*
ARM system type
1. Agilent AAEC-2000 based (ARCH_AAEC2000) (NEW)
2. Goldfish (ARCH_GOLDFISH) (NEW)
3. ARM Ltd. Integrator family (ARCH_INTEGRATOR) (NEW)
4. ARM Ltd. RealView family (ARCH_REALVIEW) (NEW)
> 5. ARM Ltd. Versatile family (ARCH_VERSATILE) (NEW)
6. Atmel AT91 (ARCH_AT91) (NEW)
7. Cirrus Logic CLPS711x/EP721x-based (ARCH_CLPS711X) (NEW)
8. EBSA-110 (ARCH_EBSA110) (NEW)
9. EP93xx-based (ARCH_EP93XX) (NEW)
10. FootBridge (ARCH_FOOTBRIDGE) (NEW)
11. Hilscher NetX based (ARCH_NETX) (NEW)
12. Hynix HMS720x-based (ARCH_H720X) (NEW)
13. IMX (ARCH_IMX) (NEW)
14. IOP13xx-based (ARCH_IOP13XX) (NEW)
15. IOP32x-based (ARCH_IOP32X) (NEW)
16. IOP33x-based (ARCH_IOP33X) (NEW)
17. IXP23XX-based (ARCH_IXP23XX) (NEW)
18. IXP2400/2800-based (ARCH_IXP2000) (NEW)
19. IXP4xx-based (ARCH_IXP4XX) (NEW)
20. LinkUp-L7200 (ARCH_L7200) (NEW)
21. Marvell Kirkwood (ARCH_KIRKWOOD) (NEW)
22. Micrel/Kendin KS8695 (ARCH_KS8695) (NEW)
23. NetSilicon NS9xxx (ARCH_NS9XXX) (NEW)
24. Marvell Loki (88RC8480) (ARCH_LOKI) (NEW)
25. Marvell MV78xx0 (ARCH_MV78XX0) (NEW)
26. Freescale MXC/iMX-based (ARCH_MXC) (NEW)
27. Marvell Orion (ARCH_ORION5X) (NEW)
28. Philips Nexperia PNX4008 Mobile (ARCH_PNX4008) (NEW)
29. PXA2xx/PXA3xx-based (ARCH_PXA) (NEW)
30. RiscPC (ARCH_RPC) (NEW)
31. SA1100-based (ARCH_SA1100) (NEW)
32. Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443 (ARCH_S3C2410) (NEW)
33. Samsung S3C64XX (ARCH_S3C64XX) (NEW)
34. Shark (ARCH_SHARK) (NEW)
35. Sharp LH7A40X (ARCH_LH7A40X) (NEW)
36. TI DaVinci (ARCH_DAVINCI) (NEW)
37. TI OMAP (ARCH_OMAP) (NEW)
38. Qualcomm MSM (ARCH_MSM) (NEW)
39. Nuvoton W90X900 CPU (ARCH_W90X900) (NEW)
choice[1-39]: 2
*
* Goldfish Options
*
Goldfish (Virtual Platform) (MACH_GOLDFISH) [N/y] (NEW) y
Goldfish ARMv7 (Virtual Platform) (MACH_GOLDFISH_ARMV7) [N/y] (NEW) y
*
* Processor Type
*
*
* Processor Features
*
Support Thumb user binaries (ARM_THUMB) [Y/n/?] (NEW) y
Enable ThumbEE CPU extension (ARM_THUMBEE) [N/y/?] (NEW) y
Disable I-Cache (I-bit) (CPU_ICACHE_DISABLE) [N/y/?] (NEW) y
Disable D-Cache (C-bit) (CPU_DCACHE_DISABLE) [N/y/?] (NEW) y
Disable branch prediction (CPU_BPREDICT_DISABLE) [N/y/?] (NEW) y
*
* Kernel Features
*
Tickless System (Dynamic Ticks) (NO_HZ) [Y/n/?] y
High Resolution Timer Support (HIGH_RES_TIMERS) [Y/n/?] y
Memory split
> 1. 3G/1G user/kernel split (VMSPLIT_3G) (NEW)
2. 2G/2G user/kernel split (VMSPLIT_2G) (NEW)
3. 1G/3G user/kernel split (VMSPLIT_1G) (NEW)
choice[1-3?]: 1
Preemptible Kernel (EXPERIMENTAL) (PREEMPT) [N/y/?] n
Use the ARM EABI to compile the kernel (AEABI) [N/y/?] (NEW) y
Allow old ABI binaries to run with this kernel (EXPERIMENTAL) (OABI_COMPAT) [Y/n/?] (NEW) y
Memory model
> 1. Flat Memory (FLATMEM_MANUAL)
choice[1]: 1
Add LRU list to track non-evictable pages (UNEVICTABLE_LRU) [Y/n/?] y
Low address space to protect from user allocation (DEFAULT_MMAP_MIN_ADDR) [4096] 4096
*
* Boot options
*
Compressed ROM boot loader base address (ZBOOT_ROM_TEXT) [0] (NEW)
Compressed ROM boot loader BSS address (ZBOOT_ROM_BSS) [0] (NEW)
Default kernel command string (CMDLINE) [] (NEW)
Kernel Execute-In-Place from ROM (XIP_KERNEL) [N/y/?] (NEW)
Kexec system call (EXPERIMENTAL) (KEXEC) [N/y/?] n
*
* Floating point emulation
*
*
* At least one emulation must be selected
*
NWFPE math emulation (FPE_NWFPE) [N/y/?] (NEW) n
FastFPE math emulation (EXPERIMENTAL) (FPE_FASTFPE) [N/y/?] (NEW) n
VFP-format floating point maths (VFP) [Y/?] (NEW) y
Advanced SIMD (NEON) Extension support (NEON) [Y/?] (NEW) y
*
* Power management options
*
Power Management support (PM) [Y/n/?] y
Power Management Debug Support (PM_DEBUG) [N/y/?] n
Suspend to RAM and standby (SUSPEND) [Y/n/?] y
Wake lock (WAKELOCK) [Y/n/?] y
Wake lock stats (WAKELOCK_STAT) [Y/n/?] y
Userspace wake locks (USER_WAKELOCK) [Y/n/?] y
Early suspend (EARLYSUSPEND) [Y/n/?] y
User-space screen access
1. None (NO_USER_SPACE_SCREEN_ACCESS_CONTROL)
2. Console switch on early-suspend (CONSOLE_EARLYSUSPEND)
> 3. Sysfs interface (FB_EARLYSUSPEND)
choice[1-3]: 3
Advanced Power Management Emulation (APM_EMULATION) [N/y/?] (NEW)n
*
* Ethernet (10 or 100Mbit)
*
Ethernet (10 or 100Mbit) (NET_ETHERNET) [Y/n/?] y
Generic Media Independent Interface device support (MII) [Y/n/?] y
ASIX AX88796 NE2000 clone support (AX88796) [N/y/?] (NEW) n
SMC 91C9x/91C1xxx support (SMC91X) [N/y/?] (NEW) n
DM9000 support (DM9000) [N/y/?] (NEW) n
SMSC LAN911[5678] support (SMC911X) [N/y/?] (NEW) n
SMSC LAN911x/LAN921x families embedded ethernet support (SMSC911X) [N/y/?] (NEW) n
Dave ethernet support (DNET) (DNET) [N/y/?] n
Broadcom 440x/47xx ethernet support (B44) [N/y/?] n
*
* Character devices
*
Virtual terminal (VT) [Y/?] y
Support for binding and unbinding console drivers (VT_HW_CONSOLE_BINDING) [N/y/?] n
Memory device driver (DEVMEM) [Y/n/?] y
/dev/kmem virtual device support (DEVKMEM) [Y/n/?] y
Non-standard serial port support (SERIAL_NONSTANDARD) [N/y/?] n
Unix98 PTY support (UNIX98_PTYS) [Y/?] y
Support multiple instances of devpts (DEVPTS_MULTIPLE_INSTANCES) [N/y/?] n
Legacy (BSD) PTY support (LEGACY_PTYS) [N/y/?] n
Hardware Random Number Generator Core support (HW_RANDOM) [Y/n/?] y
Siemens R3964 line discipline (R3964) [N/y/?] n
RAW driver (/dev/raw/rawN) (RAW_DRIVER) [N/y/?] n
DCC tty driver (DCC_TTY) [N/y] (NEW) n
Goldfish TTY Driver (GOLDFISH_TTY) [Y/n/?] y
*
* MMC/SD/SDIO card support
*
MMC/SD/SDIO card support (MMC) [Y/n/?] y
MMC debugging (MMC_DEBUG) [N/y/?] n
Allow unsafe resume (DANGEROUS) (MMC_UNSAFE_RESUME) [N/y/?] n
MMC embedded SDIO device support (EXPERIMENTAL) (MMC_EMBEDDED_SDIO) [N/y/?] n
Enable paranoid SD card initialization (EXPERIMENTAL) (MMC_PARANOID_SD_INIT) [N/y/?] n
*
* MMC/SD/SDIO Card Drivers
*
MMC block device driver (MMC_BLOCK) [Y/n/?] y
Use bounce buffer for simple hosts (MMC_BLOCK_BOUNCE) [Y/n/?] y
Deferr MMC layer resume until I/O is requested (MMC_BLOCK_DEFERRED_RESUME) [N/y/?] n
SDIO UART/GPS class support (SDIO_UART) [N/y/?] n
MMC host test driver (MMC_TEST) [N/y/?] n
*
* MMC/SD/SDIO Host Controller Drivers
*
Secure Digital Host Controller Interface support (MMC_SDHCI) [N/y/?] n
goldfish qemu Multimedia Card Interface support (MMC_GOLDFISH) [N/y/?] (NEW) n
*
* Real Time Clock
*
Real Time Clock (RTC_CLASS) [Y/n/?] y
Set system time from RTC on startup and resume (RTC_HCTOSYS) [Y/n/?] y
RTC used to set the system time (RTC_HCTOSYS_DEVICE) [rtc0] rtc0
RTC debug support (RTC_DEBUG) [N/y/?] n
*
* RTC interfaces
*
/sys/class/rtc/rtcN (sysfs) (RTC_INTF_SYSFS) [Y/n/?] y
/proc/driver/rtc (procfs for rtc0) (RTC_INTF_PROC) [Y/n/?] y
/dev/rtcN (character devices) (RTC_INTF_DEV) [Y/n/?] y
RTC UIE emulation on dev interface (RTC_INTF_DEV_UIE_EMUL) [N/y/?] n
Android alarm driver (RTC_INTF_ALARM) [Y/n/?] y
Test driver/device (RTC_DRV_TEST) [N/y/?] n
*
* SPI RTC drivers
*
*
* Platform RTC drivers
*
PC-style 'CMOS' (RTC_DRV_CMOS) [N/y/?] n
Dallas DS1286 (RTC_DRV_DS1286) [N/y/?] n
Dallas DS1511 (RTC_DRV_DS1511) [N/y/?] n
Maxim/Dallas DS1553 (RTC_DRV_DS1553) [N/y/?] n
Maxim/Dallas DS1742/1743 (RTC_DRV_DS1742) [N/y/?] n
Simtek STK17TA8 (RTC_DRV_STK17TA8) [N/y/?] n
ST M48T86/Dallas DS12887 (RTC_DRV_M48T86) [N/y/?] n
ST M48T35 (RTC_DRV_M48T35) [N/y/?] n
ST M48T59/M48T08/M48T02 (RTC_DRV_M48T59) [N/y/?] n
TI BQ4802 (RTC_DRV_BQ4802) [N/y/?] n
EM Microelectronic V3020 (RTC_DRV_V3020) [N/y/?] n
*
* on-CPU RTC drivers
*
GOLDFISH (RTC_DRV_GOLDFISH) [N/y/?] (NEW) n
*
* Kernel hacking
*
Show timing information on printks (PRINTK_TIME) [N/y/?] n
Enable __deprecated logic (ENABLE_WARN_DEPRECATED) [Y/n/?] y
Enable __must_check logic (ENABLE_MUST_CHECK) [Y/n/?] y
Warn for stack frames larger than (needs gcc 4.4) (FRAME_WARN) [1024] 1024
Magic SysRq key (MAGIC_SYSRQ) [Y/n/?] y
Enable unused/obsolete exported symbols (UNUSED_SYMBOLS) [N/y/?] n
Debug Filesystem (DEBUG_FS) [N/y/?] n
Run 'make headers_check' when building vmlinux (HEADERS_CHECK) [N/y/?] n
Kernel debugging (DEBUG_KERNEL) [Y/n/?] y
Debug shared IRQ handlers (DEBUG_SHIRQ) [N/y/?] n
Detect Soft Lockups (DETECT_SOFTLOCKUP) [N/y/?] n
Collect scheduler debugging info (SCHED_DEBUG) [Y/n/?] y
Collect scheduler statistics (SCHEDSTATS) [Y/n/?] y
Collect kernel timers statistics (TIMER_STATS) [N/y/?] n
Debug object operations (DEBUG_OBJECTS) [N/y/?] n
Debug slab memory allocations (DEBUG_SLAB) [N/y/?] n
RT Mutex debugging, deadlock detection (DEBUG_RT_MUTEXES) [N/y/?] n
Built-in scriptable tester for rt-mutexes (RT_MUTEX_TESTER) [N/y/?] n
Spinlock and rw-lock debugging: basic checks (DEBUG_SPINLOCK) [N/y/?] n
Mutex debugging: basic checks (DEBUG_MUTEXES) [N/y/?] n
Lock debugging: detect incorrect freeing of live locks (DEBUG_LOCK_ALLOC) [N/y/?] n
Lock debugging: prove locking correctness (PROVE_LOCKING) [N/y/?] n
Lock usage statistics (LOCK_STAT) [N/y/?] n
Spinlock debugging: sleep-inside-spinlock checking (DEBUG_SPINLOCK_SLEEP) [N/y/?] n
Locking API boot-time self-tests (DEBUG_LOCKING_API_SELFTESTS) [N/y/?] n
kobject debugging (DEBUG_KOBJECT) [N/y/?] n
Compile the kernel with debug info (DEBUG_INFO) [N/y/?] n
Debug VM (DEBUG_VM) [N/y/?] n
Debug filesystem writers count (DEBUG_WRITECOUNT) [N/y/?] n
Debug linked list manipulation (DEBUG_LIST) [N/y/?] n
Debug SG table operations (DEBUG_SG) [N/y/?] n
Debug notifier call chains (DEBUG_NOTIFIERS) [N/y/?] n
Delay each boot printk message by N milliseconds (BOOT_PRINTK_DELAY) [N/y/?] n
torture tests for RCU (RCU_TORTURE_TEST) [N/y/?] n
Check for stalled CPUs delaying RCU grace periods (RCU_CPU_STALL_DETECTOR) [N/y/?] n
Self test for the backtrace code (BACKTRACE_SELF_TEST) [N/y/?] n
Force extended block device numbers and spread them (DEBUG_BLOCK_EXT_DEVT) [N/y/?] n
Fault-injection framework (FAULT_INJECTION) [N/y/?] n
Latency measuring infrastructure (LATENCYTOP) [N/y/?] n
Sysctl checks (SYSCTL_SYSCALL_CHECK) [N/y/?] n
Enable dynamic printk() call support (DYNAMIC_PRINTK_DEBUG) [N/y/?] n
Verbose user fault messages (DEBUG_USER) [N/y/?] (NEW) n
Verbose kernel error messages (DEBUG_ERRORS) [N/y/?] (NEW) n
Enable stack utilization instrumentation (DEBUG_STACK_USAGE) [N/y/?] n
Kernel low-level debugging functions (DEBUG_LL) [N/y/?] (NEW) n
#
# configuration written to .config
#
CHK include/linux/version.h
SYMLINK include/asm -> include/asm-arm
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CC scripts/mod/empty.o
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/modpost.o
HOSTCC scripts/mod/sumversion.o
scripts/mod/modpost.c: In function ‘get_markers’:
scripts/mod/modpost.c:1542: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result
scripts/mod/modpost.c: In function ‘add_marker’:
scripts/mod/modpost.c:1962: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result
HOSTLD scripts/mod/modpost
CC kernel/bounds.s
GEN include/linux/bounds.h
CC arch/arm/kernel/asm-offsets.s
GEN include/asm/asm-offsets.h
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
AS usr/initramfs_data.o
CC init/main.o
CC arch/arm/mm/dma-mapping.o
CC arch/arm/mm/extable.o
CC arch/arm/mm/fault.o
CC arch/arm/mm/init.o
CC arch/arm/mm/iomap.o
CHK include/linux/compile.h
LD usr/built-in.o
CC init/do_mounts.o
LD arch/arm/common/built-in.o
CC init/do_mounts_rd.o
CC arch/arm/kernel/compat.o
CC init/do_mounts_initrd.o
CC init/initramfs.o
CC init/calibrate.o
CC arch/arm/mm/fault-armv.o
CC arch/arm/mm/flush.o
CC arch/arm/kernel/elf.o
CC arch/arm/mach-goldfish/pdev_bus.o
CC init/version.o
CC arch/arm/mach-goldfish/timer.o
CC arch/arm/mm/ioremap.o
CC arch/arm/mm/mmap.o
AS arch/arm/kernel/entry-armv.o
LD init/mounts.o
CC arch/arm/mm/pgd.o
CC arch/arm/mm/mmu.o
AS arch/arm/kernel/entry-common.o
CC arch/arm/mach-goldfish/switch.o
CC arch/arm/mm/alignment.o
AS arch/arm/mm/abort-ev5tj.o
AS arch/arm/mm/abort-ev7.o
arch/arm/mm/abort-ev7.S: Assembler messages:
arch/arm/mm/abort-ev7.S:23: Error: selected processor does not support `clrex'
make[1]: *** [arch/arm/mm/abort-ev7.o] Error 1
make[1]: *** Waiting for unfinished jobs....
CC arch/arm/mach-goldfish/pm.o
CC arch/arm/mach-goldfish/board-goldfish.o
CC arch/arm/kernel/irq.o
CC arch/arm/kernel/process.o
arch/arm/mm/mmu.c: In function 'sanity_check_meminfo':
arch/arm/mm/mmu.c:697: warning: comparison between pointer and integer
CC arch/arm/kernel/ptrace.o
CC arch/arm/vfp/vfpmodule.o
CC arch/arm/kernel/setup.o
LD init/built-in.o
CC arch/arm/kernel/signal.o
CC arch/arm/kernel/sys_arm.o
AS arch/arm/vfp/entry.o
make: *** [arch/arm/mm] Error 2
make: *** Waiting for unfinished jobs....
AS arch/arm/vfp/vfphw.o
CC mm/bootmem.o
CC arch/arm/kernel/time.o
CC arch/arm/kernel/stacktrace.o
CC arch/arm/vfp/vfpsingle.o
CC kernel/sched.o
CC arch/arm/vfp/vfpdouble.o
CC arch/arm/kernel/traps.o
LD arch/arm/mach-goldfish/built-in.o
CC kernel/fork.o
CC kernel/exec_domain.o
CC kernel/panic.o
CC mm/filemap.o
CC arch/arm/kernel/sys_oabi-compat.o
CC mm/mempool.o
CC kernel/printk.o
CC kernel/cpu.o
CC arch/arm/kernel/thumbee.o
CC arch/arm/kernel/io.o
CC kernel/exit.o
CC kernel/itimer.o
LD arch/arm/vfp/vfp.o
LD arch/arm/vfp/built-in.o
AS arch/arm/kernel/head.o
CC mm/oom_kill.o
CC mm/fadvise.o
CC arch/arm/kernel/init_task.o
CC kernel/time.o
LDS arch/arm/kernel/vmlinux.lds
CC mm/maccess.o
LD arch/arm/kernel/built-in.o
CC kernel/softirq.o
CC mm/page_alloc.o
CC kernel/resource.o
CC kernel/sysctl.o
CC mm/page-writeback.o
CC mm/pdflush.o
CC kernel/capability.o
kernel/sysctl.c:104: warning: 'one' defined but not used
CC mm/readahead.o
CC mm/swap.o
CC kernel/ptrace.o
CC kernel/timer.o
CC kernel/user.o
CC kernel/signal.o
CC mm/truncate.o
CC kernel/sys.o
CC kernel/kmod.o
CC kernel/workqueue.o
CC mm/vmscan.o
CC mm/shmem.o
CC kernel/pid.o
CC mm/prio_tree.o
CC kernel/rcupdate.o
CC mm/util.o
CC mm/mmzone.o
CC kernel/extable.o
CC kernel/params.o
CC mm/vmstat.o
CC mm/backing-dev.o
CC kernel/posix-timers.o
CC kernel/kthread.o
CC kernel/wait.o
CC kernel/kfifo.o
CC mm/page_isolation.o
CC kernel/sys_ni.o
CC kernel/posix-cpu-timers.o
CC mm/mm_init.o
CC kernel/mutex.o
CC mm/fremap.o
CC kernel/hrtimer.o
CC kernel/rwsem.o
CC mm/highmem.o
CC kernel/nsproxy.o
CC mm/madvise.o
CC kernel/srcu.o
CC kernel/semaphore.o
CC mm/memory.o
CC mm/mincore.o
CC mm/mlock.o
CC mm/mmap.o
CC kernel/notifier.o
CC mm/mprotect.o
CC kernel/ksysfs.o
CC kernel/pm_qos_params.o
CC kernel/sched_clock.o
CC kernel/cred.o
CC mm/mremap.o
CC kernel/async.o
CC kernel/freezer.o
CC kernel/irq/handle.o
CC mm/msync.o
CC mm/rmap.o
CC kernel/power/main.o
CC mm/vmalloc.o
CC kernel/time/timekeeping.o
CC kernel/futex.o
CC kernel/irq/manage.o
CC mm/pagewalk.o
CC mm/page_io.o
CC mm/swap_state.o
CC kernel/power/console.o
CC mm/swapfile.o
CC kernel/irq/spurious.o
CC mm/thrash.o
CC mm/dmapool.o
CC kernel/time/ntp.o
CC kernel/power/process.o
CC kernel/rtmutex.o
CC mm/ashmem.o
CC kernel/irq/resend.o
CC kernel/power/wakelock.o
CC kernel/time/clocksource.o
CC kernel/irq/chip.o
CC kernel/irq/devres.o
CC kernel/irq/autoprobe.o
CC kernel/time/jiffies.o
kernel/power/wakelock.c: In function 'print_active_locks':
kernel/power/wakelock.c:228: warning: unused variable 'irqflags'
CC mm/slab.o
CC kernel/up.o
CC kernel/time/timer_list.o
CC kernel/uid16.o
CC kernel/kallsyms.o
CC kernel/cgroup.o
CC kernel/irq/proc.o
CC kernel/time/clockevents.o
CC kernel/time/tick-common.o
CC kernel/power/userwakelock.o
LD kernel/irq/built-in.o
CC kernel/power/earlysuspend.o
CC kernel/power/fbearlysuspend.o
CC kernel/cgroup_debug.o
CC kernel/time/tick-oneshot.o
CC kernel/cgroup_freezer.o
CC kernel/time/tick-sched.o
CC kernel/power/poweroff.o
GZIP kernel/config_data.gz
CC kernel/res_counter.o
CC kernel/rcuclassic.o
CC kernel/utsname_sysctl.o
CC kernel/dma-coherent.o
IKCFG kernel/config_data.h
LD kernel/power/built-in.o
CC kernel/configs.o
LD kernel/time/built-in.o
LD mm/built-in.o
LD kernel/built-in.o

Thanks,
Chandra
Posted on Jun 30, 2012
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
Chandra,

The working code for Marakana Alpha device is at https://github.com/marakana/alpha
We constantly update it. Hope that works for you!

Marko
Posted on Jul 2, 2012
Photo Chandra Gopalaiah
Personal
Member since Jun 12, 2012
Hi Marko,
Finally it is working now. Thanks a lot for your help.
Also, I compiled the kernel and was able to run emulator with my custom kernel.

The only issue I have now is with daemon.
I don't see the daemon running when I do adb shell ps.
But the compiled executable is present in /system/bin/.

I have exactly followed the steps you described in the tutorial.

But still the daemon is not running.
May be is that something that need to do with init.rc file?

Thanks,
Chandra
Posted on May 14, 2013
Photo Andrew Van Uitert
Principal Engineer
Control4
Member since Feb 6, 2013
For the SDK docs to be built, there is one small correction that needs to be made to the device/marakana/alpha-sdk_addon/alpha_sdk_addon.mk file.


-PRODUCT_SDK_ADDON_DOC_MODULE := \
- com.marakana.android.service.log_doc

+PRODUCT_SDK_ADDON_DOC_MODULES := \
+ com.marakana.android.service.log_doc

Hope this helps,
Andrew
Posted on May 14, 2013
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
Thanks Andrew!

The lastest Alpha is maintained here: https://github.com/marakana/alpha
It's been updated for 4.2.2

Cheers,
Marko
Posted on Jun 6, 2013
Photo Mandar Yadav
Student
Member since Jun 6, 2013
Hi,
I want to create a system service which is only accessible to other system services. Is that possible by adding Binder.getCallingUid() in the example given above? Assuming that system has uid 0, is it possible to check that in my service?
Also, I dont want to create any Android app (as service is only available to other system services). So following 'Marakana Alpha Service Interface' and 'Marakana Alpha Service App' will create a system service accessible from other services. Is that right?
Posted on Jun 6, 2013
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
Yes, you can check the calling UID and do a dynamic permission enforcement that way. The service you create must be part of an app, so if you don't want to create a new one (like we do), then you have to hack it into say a system service app. But, I think it's cleaner to create a new one and register it with the system server instead.
M...