Linux编辑firmware的文件,thegfw

本文档介绍了Linux内核中firmware文件的存储仓库及其提交流程。该仓库包含从旧驱动程序中提取的固件以及允许单独分发但不能包含在GPL作品中的固件。提交固件需要遵循特定的授权许可要求,并通过git发送补丁或拉取请求给维护者。
摘要由CSDN通过智能技术生成

Linux firmware

==============

git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

This repository contains all these firmware images which have been

extracted from older drivers, as well various new firmware images which

we were never permitted to include in a GPL'd work, but which we _have_

been permitted to redistribute under separate cover.

To submit firmware to this repository, please send either a git binary

diff or preferably a git pull request to:

David Woodhouse

Ben Hutchings

and also cc: to related mailing lists.

Your commit should include an update to the WHENCE file clearly

identifying the licence under which the firmware is available, and

that it is redistributable. If the licence is long and involved, it's

permitted to

Linux中,可以使用request_firmware函数来加载并使用固件文件。request_firmware函数的函数原型如下: ``` int request_firmware(const struct firmware **fw, const char *name, struct device *dev); ``` 其中,fw是返回的固件结构体指针,name是需要请求的固件文件名,dev是使用这个固件的设备结构体指针。 使用request_firmware函数的步骤如下: 1. 通过设备名获取设备结构体指针,如果不需要使用固件的设备可以传入NULL。 2. 调用request_firmware函数,传入固件文件名和设备结构体指针。 3. 如果request_firmware返回0,则表示固件文件加载成功,可以使用返回的固件结构体指针fw来访问固件数据。如果返回错误码,则表示固件文件加载失败。 4. 使用完固件之后,需要通过release_firmware函数释放固件结构体占用的内存。 以下是一个示例代码: ``` #include <linux/firmware.h> #include <linux/device.h> struct device *dev; const struct firmware *fw; int ret; dev = device_get(&platform_bus_type, "my_device"); if (!dev) { printk(KERN_ERR "Failed to get device\n"); return -ENODEV; } ret = request_firmware(&fw, "my_firmware.bin", dev); if (ret) { printk(KERN_ERR "Failed to request firmware\n"); device_put(dev); return ret; } // 使用固件数据 ... release_firmware(fw); device_put(dev); ``` 注意,在使用request_firmware函数时,需要保证固件文件位于正确的位置。通常情况下,固件文件应该存放在/lib/firmware目录下。如果固件文件位于其他位置,需要在调用request_firmware函数之前将搜索路径添加到内核的firmware_class路径中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值