当前位置: 代码迷 >> Android >> 怎么在不给别人源码的情况下也可以正常编译内核
  详细解决方案

怎么在不给别人源码的情况下也可以正常编译内核

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

------解决方案--------------------
我见过一个样例,是用uudecode的
obj-$(CONFIG_ABC) += abc.o
$abc.o: $abc.uu
@echo "UUDE My Private abc.uu"
@uudecode $abc.uu -o $abc.o

uudecode的用法参考网上资料

------解决方案--------------------
ifeq ($(FILE), $(wildcard $(FILE)))
#do something here
endif
在makefile里判断你的文件是否存在可以吗
------解决方案--------------------
探讨

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.

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

探讨

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 ……
  相关解决方案