导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

    f133增加驱动未编译进固件中

    MR Series
    1
    1
    883
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • F
      furyfangyu LV 3 最后由 编辑

      我想将驱动编译进内核中,我做的操作如下:
      1.编写Kconfig Makefile 驱动文件
      03b1af83-21ff-4498-be81-829808b72daa-image.png

      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路径下,
      ad9d9956-a5fb-4df1-a4f2-bb82bdfa52d7-image.png
      可进入这个路径后里面没有任何显示,且这时候编译的固件是没有这个驱动的,
      697e090c-e9c1-47dc-81f8-c841e6b7b23a-image.png
      我又尝试在kernel根目录下的.config文件中添加了CONFIG_PLATFORM_HELLOWORLD但编译时好像会根据Kconfig的内容重新生成,故也没有效果。所以这里有几个疑问想请教下各位大佬:
      1.怎么控制自己添加的Kconfig选项在make menuconfig的什么目录结构下?
      2.有直接修改.config而不被覆盖的方法吗?
      3.为什么OPTEE下面没有任何选项?
      若有提供回答的或者提供方向的,非常感谢!

      1 条回复 最后回复 回复 引用 分享 0
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策