博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NEXUS 5为驱动添加硬件抽象层
阅读量:6694 次
发布时间:2019-06-25

本文共 7858 字,大约阅读时间需要 26 分钟。

接着上个教程,同样用的罗老师的代码。

NEXUS 5为驱动添加硬件抽象层
添加头文件。
NEXUS 5为驱动添加硬件抽象层
添加源文件。
NEXUS 5为驱动添加硬件抽象层
初始化环境。

source build/envsetup.shlunch export PATH=/home/haidragon/Desktop/java-7-openjdk-amd64/bin/:$PATH

然后添加。 (代码有点老要修改下把所有的LOG宏前面加了一个字母A)

NEXUS 5为驱动添加硬件抽象层

mmm  ./hardware/libhardware/modules/freg/make snod

NEXUS 5为驱动添加硬件抽象层

NEXUS 5为驱动添加硬件抽象层
然而驱动一般只有root用户才用访问,所以这里修改下权限。
找到ramdisk.img 文件 重新命名为.gz
命令操作如下:

haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ lsandroid-info.txt  cache.img       fake_packages        mkbootimg                 ramdisk.cpio.gz       recovery      symbols     unmkbootimgboot.img          clean_steps.mk  ×××talled-files.txt  obj                       ramdisk.img           recovery.img  system      userdata.imgcache             data            kernel               previous_build_config.mk  ramdisk-recovery.img  root          system.img  zImage-dtbhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ lsandroid-info.txt  cache.img       fake_packages        mkbootimg                 ramdisk.cpio.gz       recovery      symbols     unmkbootimgboot.img          clean_steps.mk  ×××talled-files.txt  obj                       ramdisk.img           recovery.img  system      userdata.imgcache             data            kernel               previous_build_config.mk  ramdisk-recovery.img  root          system.img  zImage-dtbhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ lltotal 478708drwxr-xr-x 10 haidragon haidragon      4096 Jun 15 00:16 ./drwxr-xr-x  4 haidragon haidragon      4096 May 29 23:09 ../-rw-r--r--  1 haidragon haidragon        25 May 29 21:51 android-info.txt-rwxrw-rw-  1 haidragon haidragon   9078784 Jun 15 00:16 boot.img*drwxr-xr-x  2 haidragon haidragon      4096 May 29 22:19 cache/-rw-r--r--  1 haidragon haidragon  13668728 May 29 22:19 cache.img-rw-r--r--  1 haidragon haidragon     40349 May 29 21:46 clean_steps.mkdrwxr-xr-x  2 haidragon haidragon      4096 May 29 22:19 data/drwxr-xr-x  2 haidragon haidragon      4096 May 29 22:58 fake_packages/-rw-r--r--  1 haidragon haidragon     67168 May 29 22:58 ×××talled-files.txt-rw-r--r--  1 haidragon haidragon   8410192 Jun 15 00:16 kernel-rwxr-xr-x  1 haidragon haidragon     58104 Jun  2 20:02 mkbootimg*drwxr-xr-x 14 haidragon haidragon      4096 May 29 22:58 obj/-rw-r--r--  1 haidragon haidragon       716 May 29 21:46 previous_build_config.mk-rw-r--r--  1 haidragon haidragon    664636 Jun 15 00:16 ramdisk.cpio.gz-rw-r--r--  1 haidragon haidragon    498995 May 29 22:23 ramdisk.img-rw-r--r--  1 haidragon haidragon   1096536 May 29 22:39 ramdisk-recovery.imgdrwxr-xr-x  3 haidragon haidragon      4096 May 29 22:39 recovery/-rw-r--r--  1 haidragon haidragon   9506816 May 29 22:39 recovery.imgdrwxr-xr-x  9 haidragon haidragon      4096 May 29 22:23 root/drwxr-xr-x  4 haidragon haidragon      4096 May 29 22:21 symbols/drwxr-xr-x 14 haidragon haidragon      4096 May 29 22:43 system/-rw-r--r--  1 haidragon haidragon 297984228 May 29 22:58 system.img-rwxr-xr-x  1 haidragon haidragon     13096 Jun  2 20:02 unmkbootimg*-rw-r--r--  1 haidragon haidragon 140614516 May 29 22:19 userdata.img-rw-r--r--  1 haidragon haidragon   8410664 Jun 15 00:16 zImage-dtbhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ mv ./ramdisk.ramdisk.cpio.gz  ramdisk.img      haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ mv ./ramdisk.ramdisk.cpio.gz  ramdisk.img      haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ mv ./ramdisk.ramdisk.cpio.gz  ramdisk.img      haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ mv ./ramdisk.img ./ramdisk.img.gzhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ lsandroid-info.txt  cache.img       fake_packages        mkbootimg                 ramdisk.cpio.gz       recovery      symbols     unmkbootimgboot.img          clean_steps.mk  ×××talled-files.txt  obj                       ramdisk.img.gz        recovery.img  system      userdata.imgcache             data            kernel               previous_build_config.mk  ramdisk-recovery.img  root          system.img  zImage-dtbhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ lltotal 478708drwxr-xr-x 10 haidragon haidragon      4096 Jun 15 01:38 ./drwxr-xr-x  4 haidragon haidragon      4096 May 29 23:09 ../-rw-r--r--  1 haidragon haidragon        25 May 29 21:51 android-info.txt-rwxrw-rw-  1 haidragon haidragon   9078784 Jun 15 00:16 boot.img*drwxr-xr-x  2 haidragon haidragon      4096 May 29 22:19 cache/-rw-r--r--  1 haidragon haidragon  13668728 May 29 22:19 cache.img-rw-r--r--  1 haidragon haidragon     40349 May 29 21:46 clean_steps.mkdrwxr-xr-x  2 haidragon haidragon      4096 May 29 22:19 data/drwxr-xr-x  2 haidragon haidragon      4096 May 29 22:58 fake_packages/-rw-r--r--  1 haidragon haidragon     67168 May 29 22:58 ×××talled-files.txt-rw-r--r--  1 haidragon haidragon   8410192 Jun 15 00:16 kernel-rwxr-xr-x  1 haidragon haidragon     58104 Jun  2 20:02 mkbootimg*drwxr-xr-x 14 haidragon haidragon      4096 May 29 22:58 obj/-rw-r--r--  1 haidragon haidragon       716 May 29 21:46 previous_build_config.mk-rw-r--r--  1 haidragon haidragon    664636 Jun 15 00:16 ramdisk.cpio.gz-rw-r--r--  1 haidragon haidragon    498995 May 29 22:23 ramdisk.img.gz-rw-r--r--  1 haidragon haidragon   1096536 May 29 22:39 ramdisk-recovery.imgdrwxr-xr-x  3 haidragon haidragon      4096 May 29 22:39 recovery/-rw-r--r--  1 haidragon haidragon   9506816 May 29 22:39 recovery.imgdrwxr-xr-x  9 haidragon haidragon      4096 May 29 22:23 root/drwxr-xr-x  4 haidragon haidragon      4096 May 29 22:21 symbols/drwxr-xr-x 14 haidragon haidragon      4096 May 29 22:43 system/-rw-r--r--  1 haidragon haidragon 297984228 May 29 22:58 system.img-rwxr-xr-x  1 haidragon haidragon     13096 Jun  2 20:02 unmkbootimg*-rw-r--r--  1 haidragon haidragon 140614516 May 29 22:19 userdata.img-rw-r--r--  1 haidragon haidragon   8410664 Jun 15 00:16 zImage-dtbhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ gunzip ./ramdisk.img.gz haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ mkdir ramdiskhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ cd ./ramdisk/haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead/ramdisk$ cpio -i -F ../ramdisk.img 1760 blockshaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead/ramdisk$ rm -f ../ramdisk.img haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead/ramdisk$ find . | cpio -o - H newc > ../ramdisk.img.unzipcpio: Too many argumentsTry 'cpio --help' or 'cpio --usage' for more information.haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead/ramdisk$ find . | cpio -o -H newc > ../ramdisk.img.unzip1760 blockshaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead/ramdisk$ cd ..haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ gzgzexe  gzip   haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ gzip -c ./ramdisk.img.unzip >./ramdisk.img.gzhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ rm -f ./ramdisk.img.unzip haidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ rm -R ./ramdiskhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ mv ./ramdisk.img.gz ./ramdisk.imghaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$ lsandroid-info.txt  cache.img       fake_packages        mkbootimg                 ramdisk.cpio.gz       recovery      symbols     unmkbootimgboot.img          clean_steps.mk  ×××talled-files.txt  obj                       ramdisk.img           recovery.img  system      userdata.imgcache             data            kernel               previous_build_config.mk  ramdisk-recovery.img  root          system.img  zImage-dtbhaidragon@ubuntu:~/Desktop/android/out/target/product/hammerhead$

把system.img和ramdisk.img 重新刷入手机。(ramdisk.img这个是要重新打包到boot.img)

效果:
NEXUS 5为驱动添加硬件抽象层

转载于:https://blog.51cto.com/haidragon/2409495

你可能感兴趣的文章
js 监控iframe URL的变化
查看>>
浏览器标签显式网页logo
查看>>
[emuch.net]MatrixComputations(1-6)
查看>>
Latex
查看>>
Android学习笔记(八)——四种基本布局
查看>>
爬虫--Scrapy框架的基本使用
查看>>
(最小生成树) Building a Space Station -- POJ -- 2031
查看>>
maven常用技巧
查看>>
Luogu_2876_[USACO07JAN]解决问题Problem Solving
查看>>
C#多态问题
查看>>
如何选择梯度下降法中的学习速率α(Gradient Descent Learning Rate Alpha)
查看>>
Linux shell中运行命令后加上字符“&”的作用
查看>>
Redis----windows下的常用命令
查看>>
python-递归函数
查看>>
执行sudo pip3 ...报错 Traceback (most recent call last): File "/usr/bin/pip3", line 9, in <module> ...
查看>>
白底黑字!Android浅色状态栏黑色字体模式(另)
查看>>
Docker以https访问Harbor私有仓库(二)
查看>>
Centos7安装redis
查看>>
股票自动化交易 设想
查看>>
Linux之shell脚本for、while、case语句的高级用法
查看>>