zoukankan      html  css  js  c++  java
  • 安卓系统源码添加自己的可执行文件到system/bin目录

    1、找到路径源码路径 external 下面添加一个hello文件夹

    2、添加 Android.mk文件,写入代码

    LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_CFLAGS += -Wno-unused-const-variable -Wno-unused-variable -Wno-unused-parameter
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE := hello
    LOCAL_SRC_FILES := $(call all-subdir-c-files)
    include $(BUILD_EXECUTABLE)

    3、添加 hello.c文件

    写入代码

    #include <stdio.h>
    #include <stdlib.h>
    int main(int argc, char *argv[])
    {
    printf("hello word ");
    return 0;
    }

    4、打开终端,cd 安卓系统源码路径,

    然后. build/envsetup.sh   

    lunch

    选择序号

    然后 mmm ./external/hello 编译。

    make编译打包进系统

    1. adb shell
    2. cd /system/bin
    3. ./hello

    或者

    mmm ./external/hello
    adb root
    cd /home/ub/bin/ad10/out/target/product/generic_x86_64/system/bin/
    adb push ./hello /system/bin

    直接把可执行文件push到安卓系统目录

    完成。。。

    参考

    https://blog.csdn.net/xipiaoyouzi/article/details/40144233

  • 相关阅读:
    Python开发环境搭建
    Python逻辑判断顺序
    PyCharm快捷改变字体大小
    Python类型转换
    前端面试总结2020
    问题总结20-11-02至20-11-09
    问题总结20-11-30至20-12-06
    项目管理培训20-12-06
    日期计算
    数列分段
  • 原文地址:https://www.cnblogs.com/lvcha/p/15041782.html
Copyright © 2011-2022 走看看