Wednesday, July 11, 2012

mknod in Android

mknod

  1. Android provides mknod() api (unistd.h) , but not provides mknod execution file.
  2. download the mknod.c from mknod.c
  3. There are two way to let the mknod work
    1. Build with toolbox (system/core/toolbox)
      1. change the mknod.c main function name to mknod_main
      2. Modify the Android.mk
        TOOLS :=\
        .... \
        mknod
      3. build android, then redownload the system.img and userdata.img
    2. Create a new appliation
      1. You can crate a new application in externel folder - mknod
      2. Copy the mknod to new folder
      3. Create a Android.mk
        LOCAL_PATH:= $(call my-dir)
        include $(CLEAR_VARS)
        LOCAL_SRC_FILES:= mknod.c
        LOCAL_MODULE := mknod
        include $(BUILD_EXECUTABLE)
      4. Build through NDK by using, ndk-build -C

No comments: