Build Android Kernel && Kernel Module

I Build Android Kernel (with Module enabled)

1. Kernel source is under android_src/kernel folder

2. Config file is under kernel_src/arch/arm/configs folder xxx_deconfig

3. setup config:

$make ARCH=arm CROSS_COMPILE=arm-eabi- xxx_defconfig

(.config file can also be created from device:

adb pull proc/config.gz

zcat config.gz > .config

)

4. enable module:

$make ARCH=arm CROSS_COMPILE=arm-eabi- modules_prepare

5. build kernel:

$make ARCH=arm CROSS_COMPILE=arm-eabi- -jX

[Error in compiling kernel:]

[error1 : ]

    drivers/scsi/ufs/ufs_test.c:25:19: fatal error: ../sd.h: No such file or directory
    #include <../sd.h>
  SOLUTION:
            --- Kernel2/drivers/scsi/ufs/ufs_test.c 2014-09-18 14:37:07.000000000 +0800

+++ Kernel/drivers/scsi/ufs/ufs_test.c 2014-11-02 10:18:05.282973816 +0800

@@ -22,7 +22,7 @@

#include <scsi/scsi_device.h>

#include <scsi/scsi_cmnd.h>

#include <scsi/scsi_host.h>

-#include <../sd.h>

+#include "../sd.h"

#include "ufshcd.h"

#include "ufs.h"

[error2 : ]

In file included from drivers/video/msm/mdss/mdss_mdp_trace.h:260:0,
                 from drivers/video/msm/mdss/mdss_mdp.c:61:
            include/trace/define_trace.h:79:43: fatal error: ./mdss_mdp_trace.h: No such file or directory
            #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)

  SOLUTION:

--- Kernel2/drivers/video/msm/mdss/mdss_mdp_trace.h 2014-09-18 14:37:12.000000000 +0800

+++Kernel/drivers/video/msm/mdss/mdss_mdp_trace.h 2014-11-02 10:31:53.000000000 +0800

@@ -17,7 +17,7 @@

#undef TRACE_SYSTEM

#define TRACE_SYSTEM mdss

#undef TRACE_INCLUDE_PATH

-#define TRACE_INCLUDE_PATH .

+#define TRACE_INCLUDE_PATH ../../../../drivers/video/msm/mdss

#undef TRACE_INCLUDE_FILE

#define TRACE_INCLUDE_FILE mdss_mdp_trace

II Build Module

  1. Makefile:

VERSION = 3
        PATCHLEVEL = 10
        SUBLEVEL = 40
        EXTRAVERSION = -xxxxxx
        EXTRA_CFLAGS=-fno-pic
        obj-m += xxxx.o
        KDIR=src_to_android_src/source/kernel
        PWD := $(shell pwd)
        CCPATH := src_to_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin
  default:

    make -C $(KDIR) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- SUBDIRS=$(PWD) modules
  clean:

    make -C $(KDIR) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- SUBDIRS=$(PWD) clean

  2. VERSION in Makefile:

  Kernel version can be found using the following command

$ adb shell

$ cat /proc/version

3. after build, adb push ...ko /sdcard/;  adb shell; insmode ...ko

dmesg see log

Reference:

  [1] https://github.com/marco-pratesi/android/blob/master/HOWTOs/Android-Build-Kernel-Modules-HOWTO.txt

  [2] http://forum.xda-developers.com/showthread.php?t=1585289

  [3] http://forum.xda-developers.com/note-4/snapdragon-dev/sm-n910f-twrp-2-8-1-0-t2923509/page3

  [4] https://www.movzio.com/howto/compile-android-kernel-source-beginners-guide-2/

  [5] http://forum.xda-developers.com/showthread.php?t=1236576

时间: 2024-10-15 03:20:06

Build Android Kernel && Kernel Module的相关文章

ionic build Android错误记录未解决

1.try itcordova -v cordova create testing cd testing cordova plugin add cordova-plugin-sim cordova platform add android cordova build android

ionic build android log

RubertdeMacBook-Pro:~ Rubert$ ionic build android Current working directory is not a Cordova-based project. RubertdeMacBook-Pro:~ Rubert$ cd myApp/ RubertdeMacBook-Pro:myApp Rubert$ ionic build android Running command: /Users/Rubert/myApp/hooks/after

Build Android Project with Gradle

现在随着友盟这类统计工具在项目中集成,根据不同渠道打不同的APK包也成为日常工作之一.神马?你还在手动改渠道号一个一个打包?!那你一定是个非常勤奋的程序员- -!正好尝试使用Android Studio,稍微了解了下Android Studio的使用的构建工具:Gradle. 什么是Gradle 你可以看一下Gradle主页. 简单来说,Gradle是一个自动化编译部署测试工具.Gradle内容很广,还有专门的书介绍Gradle.而Android Studio使用的是Gradle中的一部分功能.

ionic3打包出错ionic cordova build android(系列一):could not find an installed version of gradle either in android studio

1.运行ionic cordova build android 时报错:could not find an installed version of gradle either in android studio. 2.问题原因:cordova在6.4.0(cordova-android在6.1.2)之后,会要求安装Gradle,基于Gradle来编译.打包android. 3.解决办法: 1)去Gradle官网:https://gradle.org/install 2)下载Gradle:htt

Android Gradle 指定 Module 打包

Android Gradle 指定 Module 打包 项目中有许多的可以直接独立运行的 Module ,如何在 Gradle 中将签名文件配置好了,那么就不需要普通的手动点击 Generate Signed APK,使用 Terminal更加方便. 指定Module打包命令 输入: ./gradlew :<ModuleName>:assembleRelease 示例: ./gradlew :sampleApp:assembleRelease [error]command not found

Android Studio新建Module时弹出窗口显示不全的问题

本人用的是14吋联想笔记本,Android Studio新建Module的时候,发现弹出的窗口在屏幕上显示不全,怎么拖拉都没有用 看不到底部是什么,如果是第一次操作,根本没法进行下一步操作. 用度娘搜了一下,发现遇到相似问题的网友不少,解决办法五花八门:调分辨率.升级显卡驱动等等.这些办法我都有去尝试过,然而并没有什么卵用! 折腾了一个晚上,发现一个折中的办法,操作如下: 1.将"Create New Module"弹窗尽可能的拉宽一点(不拉大一点是没办法实现的) 2.鼠标定位到任务栏

使用ionic cordova build android --release --prod命令打包报错解决方法

使用ionic cordova build android --release --prod命令打包报有如下错误及解决方法 只要把以下内容添加到build-extras.gradle或(build***.gradle)即可 configurations.all { resolutionStrategy { force 'com.android.support:support-v4:27.1.0' } } 原文地址:https://www.cnblogs.com/sftp/p/8555884.ht

ionic cordova build android 报错 解决

执行 ionic cordova build android 时遇到报错,build时需要安装一些依赖的,所以首先必须联网,另外,这遇到这个错误时npm registry用的是taobao的镜像:https://registry.npm.taobao.org/, 然后我改为了cnpm镜像 :http://r.cnpmjs.org/,再次执行ionic cordova build android成功了.推荐安装nrm,用nrm来进行npm registry的管理,简单方便. 原文地址:https:

Android linux kernel privilege escalation vulnerability and exploit (CVE-2014-4322)

In this blog post we'll go over a Linux kernel privilege escalation vulnerability I discovered which enables arbitrary code execution within the kernel. The vulnerability affected all devices based on Qualcomm chipsets (that is, based on the "msm&quo