例如,有一个我自己加的驱动,路径为:Drivers/abc/abc.c,通常,我们会在abc目录下的Makefile文件中加类似:obj-$(CONFIG_ABC) += abc.o,这样的编译命令。然后编译内核,会在这里生成abc.o,并且会把这个驱动编译到内核中,启动后,驱动会自动加载,并开始工作。
现在,我要把我的内核Source给别人,但是,我又不想把这里的abc驱动的源码给出去,那么,我该怎么做,才可以让别人在没有abc.c源码的情况下,也可以编译内核,并且可以正常使用这个驱动呢?
我是新手,望大家指点!

解决方案 »

  1.   

    我见过一个样例,是用uudecode的
    obj-$(CONFIG_ABC) += abc.o
    $abc.o: $abc.uu
    @echo "UUDE  My Private  abc.uu"
    @uudecode $abc.uu -o $abc.ouudecode的用法参考网上资料
      

  2.   

    ifeq ($(FILE), $(wildcard $(FILE)))
    #do something here
    endif
    在makefile里判断你的文件是否存在可以吗
      

  3.   

    if you have you driver included in the kernel, you have to accept gpl and provide it to other people.If you wanna keep your driver as a private, you should not put it in the kernel directly. You should just build it as kernel module.Don't try to broke the rules and law.
      

  4.   

    我现在的想法是,可不可以在obj-$(CONFIG_ABC) += abc.o这一句之后,加一拷贝的语句,把其它地方我编译好的abc.o拷贝到这里把这里的这个abc.o覆盖掉,不知道这样是否可行?还有在这里应该怎样写拷贝的语句。
      

  5.   

    编译成module之后,其他人再更改kernel,那么之前的module还能顺利的插入新的kernel吗?