f133增加驱动未编译进固件中
-
我想将驱动编译进内核中,我做的操作如下:
1.编写Kconfig Makefile 驱动文件
Makefile: obj-$(CONFIG_PLATFORM_HELLOWORLD) += platform_helloworld.o Kconfig: config helloworld bool "helloworld supported" default y help hello world for sunxi platform 驱动文件: #include <linux/init.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/of.h> #include <linux/mod_devicetable.h> static struct device_node *mydevice_node; static struct property *myproperty; int size; int my_probe(struct platform_device *dev){ int ret = 0; printk("furry hello platform_device probe\n"); mydevice_node = of_find_node_by_name(NULL, "mykey"); printk("furry mydevice_node = %s\n", mydevice_node->name); myproperty = of_find_property(mydevice_node, "reg", &size); printk("furry myproperty = %s\n", myproperty->name); return ret; } int my_remove(struct platform_device *dev){ int ret = 0; printk("furry hello platform_device remove\n"); return ret; } const struct platform_device_id id_table_my = { .name = "my_platform_driver", } const struct of_device_id of_match_table_my[] = { {.compatible = "mydevices_tree", }, {} }; struct platform_driver my_platform_driver = { .probe = my_probe, .remove = my_remove, .driver = { .name = "my_platform_driver", .owner = THIS_MODULE, .of_match_table = of_match_table_my, }; .id_table = &id_table_my, }; static int __init platform_init(void){ printk("furry hello platform_init\n"); platform_driver_register(); return 0; } static void __exit platform_exit(void){ printk("furry hello platform_exit\n"); platform_driver_unregister(); } module_init(platform_init); module_exit(platform_exit); MODUEL_AUTHOR("furry"); MODULE_LICENSE("GPL");
2.在board.dts的根节点下做了如下添加
furry { #address-cell = <1>; #size-cell = <1>; compatible = "simple-bus"; mykey{ compatible = "mydevices_tree"; reg = <0x32 0x01>; }; };
3.在上级Kconfig中做了如下添加
source "drivers/char/helloworld/Kconfig"
然而,在make menuconfig中搜索发现我添加的选项在security ->OPTEE路径下,
可进入这个路径后里面没有任何显示,且这时候编译的固件是没有这个驱动的,
我又尝试在kernel根目录下的.config文件中添加了CONFIG_PLATFORM_HELLOWORLD但编译时好像会根据Kconfig的内容重新生成,故也没有效果。所以这里有几个疑问想请教下各位大佬:
1.怎么控制自己添加的Kconfig选项在make menuconfig的什么目录结构下?
2.有直接修改.config而不被覆盖的方法吗?
3.为什么OPTEE下面没有任何选项?
若有提供回答的或者提供方向的,非常感谢!
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号