1

I've a router that runs Linux kernel version of 2.6.33, it came without tun/tap support. The cpu is MIPSlittle endien. I setup a buildroot and successed compile "Hello world" program for the router.

I'm trying to compile tun.c from linux-kernel-2.6.33/drivers/net/tun.c as a standalone kernel object. But I have not successed yet! I use buildroot to get the header files for the kernel (by make menuconfig) and setup a Makefile for tun.c:

obj-m := tun.o
KDIR=/opt/buildroot/output/build/linux-kernel-2.6.33
PWD=$(shell pwd)
default:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean

I run the make file with

make ARCH=mips CROSS_COMPILE=/opt/buildroot/output/bin/buildroot-compiler-

I got warnings and erros:

Warning: Symbol version dump /opt/buildroot/output/build/linux-kernel-2.6.33/Module.symvers is missing; modules will have no dependencies and modversions.

include/linux/mmzone.h:18:30: fatel error: generated/bounds.h. No such or directory .#include

Which one of my steps are wrong?

ssdfdsfsd
  • 21
  • 3

1 Answers1

2

I'm betting you're trying to build your module against a pure, unconfigured kernel source tree. you can't do that. Your kernel tree must, at the very least, be configured and, more than that, it should have make modules_prepare run at the top level.

Running cd /usr/src/linux && make modules_prepare should solve your problem.

jgr208
  • 2,896
  • 9
  • 36
  • 64
  • 1
    You must also use a kernel configuration that corresponds to what is used on the board. Also, it is not /usr/src/linux but the extracted linux-2.6.33. I edited the answer accordingly. – Arnout Sep 29 '16 at 19:31