Android添加HelloWorldService实践

本文详细介绍了如何在Ubuntu环境下为Android系统添加硬件抽象层(HAL)模块,以访问Linux内核驱动程序。首先,讲解了如何在Android内核中编写和构建驱动程序,然后阐述了如何创建C语言应用程序来测试驱动,接着展示了如何在Android的HAL层增加接口访问驱动,接着添加JNI服务接口,最后通过创建TranHelloApp应用,实现了对HAL服务的访问。整个过程涵盖了从驱动编写到应用程序实现的完整流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考链接

http://blog.csdn.net/myarrow/article/details/7175204

 

Android硬件抽象层(HAL)概要介绍和学习计划

http://blog.csdn.net/luoshengyang/article/details/6567257

    一. 在Android内核源代码工程中编写硬件驱动程序

    二. 在Android系统中增加C可执行程序来访问硬件驱动程序

    三. 在Android硬件抽象层增加接口模块访问硬件驱动程序

    四. 在Android系统中编写JNI方法在应用程序框架层提供Java接口访问硬件

    五. 在Android系统的应用程序框架层增加硬件服务接口

    六. 在Android系统中编写APP通过应用程序框架层访问硬件服务

 

在Ubuntu上为Android增加硬件抽象层(HAL)模块访问Linux内核驱动程序

http://blog.csdn.net/luoshengyang/article/details/6573809

 

在Ubuntu上为Android系统编写Linux内核驱动程序

http://blog.csdn.net/luoshengyang/article/details/6568411

 

一、Linuxkernel添加HelloDrv

Ø  1.1 code

release-o1-one/kernel-4.4/drivers/hello/hello.c 

release-o1-one/kernel-4.4/drivers/hello/hello.h

 

Ø  1.2 build

1.2.1 release-o1-one/kernel-4.4/drivers/hello/Kconfig内容

config HELLO

   tristate "First Android Driver"

   default n

   help

     This is the first android driver.

1.2.2 release-o1-one/kernel-4.4/drivers/hello/Makefile内容

obj-$(CONFIG_HELLO) += hello.o

 

release-o1-one/kernel-4.4/drivers/Kconfig添加

menu "Device Drivers"

source"drivers/hello/Kconfig"<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值