3
votes

My customer send me the prebuilt kernel output directory(They can not release the kernel source tree to us). This output directory is as below(under /home/michael/Clients/android_p_Hzh/kernel/kernel/):

  • arch
  • block
  • build-in.o
  • certs
  • ...
  • .config
  • Makefile
  • Module.symvers
  • source (symbol link to a local source tree in my customer's file system)

Is it possible to build my external module against with this directory?

/home/michael/Source/Linux/br_driver is my driver's directory. I have tried to build my driver under this directory as below make command:

make CROSS_COMPILE=x86_64-poky-linux- -C /home/michael/Clients/android_p_Hzh/kernel/kernel/ M=pwd $1

It fails with below output:

*** No rule to make target '/home/michael/Source/Linux/br_driver/common.o' needed by ...

The Makefile under br_driver is like below:

brt-objs := $(BRTOFILES)
obj-$(DRIVER_TYPE)   += brt.o

all:
    @echo "$(MAKE) --no-print-directory -C $(KDIR) SUBDIRS=$(CURDIR) modules"
    @$(MAKE) --no-print-directory -C $(KDIR) SUBDIRS=$(CURDIR) modules

clean:
    rm -rf *.o *.ko *.mod.c *~ .*.cmd *.o.cmd .*.o.cmd \
    Module.symvers modules.order .tmp_versions modules.builtin

install:
    @$(MAKE) --no-print-directory -C $(KDIR) \
        SUBDIRS=$(CURDIR) modules_install
1
Yes, it is possible to build kernel module against such directory. If you want us to help you with the error you got, you need to provide more information: what is directory /home/michael/Source/Linux/ means for your machine, is br_driver, how your Makefile looks like and so on. - Tsyvarev
/home/michael/Source/Linux is my workspace diretory. /home/michael/Source/Linux/br_driver is the source directory of my driver. I run "make CROSS_COMPILE=..." under this directory. - Micheal.zu
Makefile looks like as below: ... brt-objs := $(BRTFILES) obj-$(DRIVER_TYPE) += brt.o all: @echo "$(MAKE) --no-print-directory -C $(KDIR) SUBDIRS=$(CURDIR) modules" @$(MAKE) --no-print-directory -C $(KDIR) SUBDIRS=$(CURDIR) modules clean: rm -rf .o *.ko *.mod.c *~ ..cmd .o.cmd ..o.cmd \ Module.symvers modules.order .tmp_versions modules.builtin install: @$(MAKE) --no-print-directory -C $(KDIR) \ SUBDIRS=$(CURDIR) modules_install - Micheal.zu
Needed information should be in the question post, not in the comments. (As you can see, comments are badly suited for represent multiline files and logs). Please, edit you question post and add all required information into it. - Tsyvarev
@Tsyvarev Thanks you for reminding. I have edited my question. - Micheal.zu

1 Answers

0
votes

I have resolved this problem. The only things I need is the .config and Modules.symvers. The key operation is make oldconfig and modules_prepare.