Android—Step by step - Compile kernel module for Samsung Galaxy S3 (Linux)
2016-02-01 00:00
681 查看
http://www.edv-huber.com/index.php/problemloesungen/20-step-by-step-compile-kernel-module-for-samsung-galaxy-s3-linux
1. Download the Source for your current kernel version from "http://opensource.samsung.com".
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/10bbec77a04e702f9c0a76af4e371adf.png)
![](http://www.edv-huber.com/images/androidkernel/2.png)
2.
Extract the file "Kernel.tar.gz" (inside the downloaded zip) into a
folder, for example "/home/<your_user_name>/androidkernel".
3. Open the README_Kernel.txt
4.
Download the Android NDK containing the suggested toolchain, in our
case "arm-eabi-4.4.3". The latest NDK package often does not contain
older toolchains, so you have to make some experiments until you find
the right one. All the NDKs are available from
"http://developer.android.com/tools/sdk/ndk". Copy the URL and modify it
according to the given version numbers.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/21a3da44de785f104bdea99068b47896.png)
5. For a 64bit operating system, you have to take the 64bit link, of course. Paste the URL into a text editor of your choice.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/995b19a9bbf4dd4799ac72daec837efd.png)
6. Now you have to find out, which NDK version contains the needed 4.4.3 toolchain. In our case, it is the version "8e".
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/eb3c0e0302dd26ef405fa495643b8002.png)
7. Copy the modified link back to your browser and download the old NDK version.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/72d9e5de82a2b9d67f30a4f89b7c342a.png)
8. Extract the archive, for example to "/home/<your_user_name>/androidbuild".
9.
Modify "/home/<your_user_name>/androidkernel/Makefile" and change
the following parts according to your environment. The "EXTRAVERSION"
string has to be the one from your phone's system information.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/10bbec77a04e702f9c0a76af4e371adf.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/e3f8ad05a7a862dfdc600ab42e8a9e65.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/95a48ca0f61fd731fac8353e8f78cbf4.png)
10.
Pay attention to the correct line ending "arm-linux-androideabi-". The
build process will look for the compiler "gcc" inside the "bin"
directory. The android NDK contains the compiler, but the filename
always starts with "arm-linux-androideabi-". The NDK version, the
toolchain version, and the system architecture (32/64bit) have to match
your environment.
11. Move to the directory of your kernel in a
command line interface, for example "cd
/home/<your_user_name>/androidkernel/".
12. Enter "make arch=arm m0_00_defconfig".
13. Enter "make menuconfig".
14.
Modify the kernel configuration according to your wishes. For example
select "M" for "Device drivers -> Input device support -> Joystick
interface" to create the module "joydev.ko".
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/228206702403cf2395c80d968cc26cbf.png)
15. Leave "menuconfig" and save.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/7a8a92fb72dc8dec62e6120e16c9bb9e.png)
14. Enter "make CFLAGS_MODULE=-fno-pic modules".
15.
The modules will be compiled and stored in
"/home/<your_user_name>/androidkernel/drivers/*/*.ko", according
to each module's category.
16. If you like, you can comiple a
completely new kernel for your phone with the command "make". The kernel
image will be stored in
"/home/<your_user_name>/androidkernel/arch/arm/boot/zImage" then.
1. Download the Source for your current kernel version from "http://opensource.samsung.com".
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/10bbec77a04e702f9c0a76af4e371adf.png)
![](http://www.edv-huber.com/images/androidkernel/2.png)
2.
Extract the file "Kernel.tar.gz" (inside the downloaded zip) into a
folder, for example "/home/<your_user_name>/androidkernel".
3. Open the README_Kernel.txt
4.
Download the Android NDK containing the suggested toolchain, in our
case "arm-eabi-4.4.3". The latest NDK package often does not contain
older toolchains, so you have to make some experiments until you find
the right one. All the NDKs are available from
"http://developer.android.com/tools/sdk/ndk". Copy the URL and modify it
according to the given version numbers.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/21a3da44de785f104bdea99068b47896.png)
5. For a 64bit operating system, you have to take the 64bit link, of course. Paste the URL into a text editor of your choice.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/995b19a9bbf4dd4799ac72daec837efd.png)
6. Now you have to find out, which NDK version contains the needed 4.4.3 toolchain. In our case, it is the version "8e".
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/eb3c0e0302dd26ef405fa495643b8002.png)
7. Copy the modified link back to your browser and download the old NDK version.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/72d9e5de82a2b9d67f30a4f89b7c342a.png)
8. Extract the archive, for example to "/home/<your_user_name>/androidbuild".
9.
Modify "/home/<your_user_name>/androidkernel/Makefile" and change
the following parts according to your environment. The "EXTRAVERSION"
string has to be the one from your phone's system information.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/10bbec77a04e702f9c0a76af4e371adf.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/e3f8ad05a7a862dfdc600ab42e8a9e65.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/95a48ca0f61fd731fac8353e8f78cbf4.png)
10.
Pay attention to the correct line ending "arm-linux-androideabi-". The
build process will look for the compiler "gcc" inside the "bin"
directory. The android NDK contains the compiler, but the filename
always starts with "arm-linux-androideabi-". The NDK version, the
toolchain version, and the system architecture (32/64bit) have to match
your environment.
11. Move to the directory of your kernel in a
command line interface, for example "cd
/home/<your_user_name>/androidkernel/".
12. Enter "make arch=arm m0_00_defconfig".
13. Enter "make menuconfig".
14.
Modify the kernel configuration according to your wishes. For example
select "M" for "Device drivers -> Input device support -> Joystick
interface" to create the module "joydev.ko".
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/228206702403cf2395c80d968cc26cbf.png)
15. Leave "menuconfig" and save.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/25/7a8a92fb72dc8dec62e6120e16c9bb9e.png)
14. Enter "make CFLAGS_MODULE=-fno-pic modules".
15.
The modules will be compiled and stored in
"/home/<your_user_name>/androidkernel/drivers/*/*.ko", according
to each module's category.
16. If you like, you can comiple a
completely new kernel for your phone with the command "make". The kernel
image will be stored in
"/home/<your_user_name>/androidkernel/arch/arm/boot/zImage" then.
相关文章推荐
- Linux Kernel and Driver Development Training
- XP使用VNC远程桌面CentOS 6
- CentOS安装Code::Blocks
- Red Hat Enterprise Linux 7 Release Candidate Now Publicly Available
- CentOS7——解压7z文件——p7zip
- 编译Linux内核—浅谈EABI和OABI
- 命令总结—Linux查询系统各项资源
- sublime—angularjs plugin—linux—web—cbpm
- 为什么有很深的windows基础还是不能动摇linux半步
- Linux Kernel and Driver Development Training——linux-kernel-slides
- linux内核外部驱动模块编译报错ERROR—drivers/*.ko] undefined
- linux sar用法大全
- kali linux: /android-sdk-linux/platform-tools/adb: 没有那个文件或目录
- CentOS 6.2 下安装QQ2012完全可用
- 3.3.3 改变目标(运行级别)—— RHEL7 / CentOS7
- 美国海军采购Linux系统去引导无人机舰队
- Debian / Ubuntu Linux: Setup Wireless Access Point (WAP) with Hostapd
- linux设备驱动归纳总结(三):2.字符型设备的操作open、close、read、write
- Linux 从虚拟地址到物理地址
- kali linux——aircrack-ng