Build Error


 
Thread Tools Search this Thread
Top Forums Programming Build Error
# 1  
Old 01-16-2012
Build Error

I am facing a problem while building the device driver code.

I am using suse linux "2.6.31.5-0.1-desktop" on my Laptop.
I have copied a folder containing self written device driver files from Mandriva linux to my system having Suse Linux.
I copied the entire folder in "/home/netuser/sun/". This folder was building properly in Mandriva.

Now when I give a make command it fails as:
linux-8qbp:/home/netuser/Rupesh_KP/Emertxe/CourseTemplates/CharDriver # make
make: *** No targets. Stop.

Will you pls through some light as to what might be the issue and how to resolve it?
# 2  
Old 01-16-2012
Something seems to be wrong with the makefile for it to find no targets at all. Could you post it?
# 3  
Old 01-16-2012
Thanks Corona for the reply.
Actually I have in a folder "\CourseTemplates\CharDriver" in which I have made a simple kernel module file having a null char driver.
To build this folder "CourseTemplates" has three files, while subfolder "\CourseTemplates\CharDriver" has an empty makefile.

The three files of Folder "CourseTemplates" are:
1) Makefile
Code:
	DIRS := $(filter-out Makefile README module.mk, $(wildcard *))
		DIRS_CLEAN := $(DIRS:=_clean)

		.PHONY: all ${DIRS} clean

		all: ${DIRS}

		${DIRS}:
			@echo -n "Building $@ ... "
			@${MAKE} -C $@ KERNEL_SOURCE=/home/netuser/RKP/linux-source/linux-2.6.27.14/linux-2.6.27.14-1mnb/ > /dev/null
			@echo "done"

		clean: ${DIRS_CLEAN}

		%_clean:
			@echo -n "Cleaning $* ... "
			@${MAKE} -C $* KERNEL_SOURCE=/home/netuser/RKP/linux-source/linux-2.6.27.14/linux-2.6.27.14-1mnb/ clean > /dev/null
			@echo "done"

2) Makefile.mixed
Code:
		UNAME := $(shell uname -r)
		KERNEL26 := 2.6
		KERNELVERSION := $(findstring $(KERNEL26),$(UNAME))

		ifeq ($(KERNELVERSION),2.6)

		obj-m   := hello10.o

		INCLUDE := -I/usr/include/asm/mach-default/
		KDIR    := /lib/modules/$(shell uname -r)/build
		PWD     := $(shell pwd)

		all::
			$(MAKE) -C $(KDIR) $(INCLUDE) SUBDIRS=$(PWD) modules

		else

		TARGET  := skeleton
		INCLUDE := -I/lib/modules/`uname -r`/build/include -I/usr/include/asm/mach-default/
		CFLAGS  := -O2 -Wall -DMODULE -D__KERNEL__ -DLINUX
		CC      := gcc

		all:: ${TARGET}.o

		${TARGET}.o: ${TARGET}.c
			$(CC) $(CFLAGS) ${INCLUDE} -c ${TARGET}.c

		endif

3) module.mk
Code:
		# if KERNELRELEASE is defined, we've been invoked from the
		# kernel build system and can use its language.
		ifneq ($(KERNELRELEASE),)
			src-m := $(wildcard ${SUBDIRS}/*.c)
			src-mod := $(wildcard ${SUBDIRS}/*.mod.c)
			src-m := $(notdir ${src-m})
			src-mod := $(notdir ${src-mod})
			src-m := $(filter-out ${src-mod}, ${src-m})
			obj-m := $(src-m:.c=.o)
		# Otherwise we were called directly from the command
		# line; invoke the kernel build system.
		else
			KERNEL_SOURCE := /home/netuser/RKP/linux-source/linux-2.6.27.14/linux-2.6.27.14-1mnb/
			PWD := $(shell pwd)
		default:
			$(MAKE) -C $(KERNEL_SOURCE) SUBDIRS=$(PWD) modules

		clean:
			$(MAKE) -C $(KERNEL_SOURCE) SUBDIRS=$(PWD) clean
		endif

---------- Post updated at 01:03 AM ---------- Previous update was at 01:00 AM ----------

I have suse linux "linux-2.6.31.5-0.1" on my PC.

Now I have created a new makefile in CharDriver folder with below content:
Code:
# if KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
src-m := $(wildcard ${SUBDIRS}/*.c)
src-mod := $(wildcard ${SUBDIRS}/*.mod.c)
src-m := $(notdir ${src-m})
src-mod := $(notdir ${src-mod})
src-m := $(filter-out ${src-mod}, ${src-m})
obj-m := $(src-m:.c=.o)
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNEL_SOURCE := /home/netuser/RKP/linux-source/linux-2.6.27.14/linux-2.6.27.14-1mnb/
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNEL_SOURCE) SUBDIRS=$(PWD) modules

clean:
$(MAKE) -C $(KERNEL_SOURCE) SUBDIRS=$(PWD) clean
endif

Now it gives me the following build error:
Code:
linux-8qbp:/home/netuser/RKP/CourseTemplates/CharDriver # make
make -C /home/netuser/RKP/linux-source/linux-2.6.27.14/linux-2.6.27.14-1mnb/ SUBDIRS=/home/netuser/RKP/CourseTemplates/CharDriver modules
make[1]: Entering directory `/home/netuser/RKP/linux-source/linux-2.6.27.14/linux-2.6.27.14-1mnb'

WARNING: Symbol version dump /home/netuser/RKP/linux-source/linux-2.6.27.14/linux-2.6.27.14-1mnb/Module.symvers
is missing; modules will have no dependencies and modversions.

CC [M] /home/netuser/RKP/CourseTemplates/CharDriver/char_driver.o
/home/netuser/RKP/CourseTemplates/CharDriver/char_driver.c:1: error: code model ‘kernel’ not supported in the 32 bit mode
/home/netuser/RKP/CourseTemplates/CharDriver/char_driver.c:1: sorry, unimplemented: 64-bit mode not compiled in
make[2]: *** [/home/netuser/RKP/CourseTemplates/CharDriver/char_driver.o] Error 1
make[1]: *** [_module_/home/netuser/RKP/CourseTemplates/CharDriver] Error 2
make[1]: Leaving directory `/home/netuser/RKP/linux-source/linux-2.6.27.14/linux-2.6.27.14-1mnb'
make: *** [default] Error

Will you pls through some light as to what might be the issue and how to resolve it.

Last edited by rupeshkp728; 01-16-2012 at 03:03 PM..
# 4  
Old 01-16-2012
Could you please ensure that the kernel versions are compatible?

From the error messages it seems to be a compilation targeted for 64-bit system whereas you new host is 32-bit installation.

Also do a touch recursively to all the files to update the timestamp of all the files in your sandbox to ensure that make utility finds everything on your new host for compilation; the error-2 unimplemented: 64-bit mode not compiled in ... and the initial ones make: *** No targets. Stop.
..
of the error which went off automatically for you and you could atleast run the compilation (posted in your last one ...) gives me an impression of the mismatch time/date set in both of your machine there by Make not finding objects to compile.

Run (from the top directory of your sandbox):
Code:
find . -type f -exec touch {} \;

Further ensure that target is set for 32 bit compilation and kernel version mismatch is properly appended in your code.

If possible post your code here in the forum as a tar/zip attachment.
This User Gave Thanks to Praveen_218 For This Post:
# 5  
Old 01-17-2012
Thanks Praveen for the reply.
I just changed the kernel source to an another and built it.
But now I am facing another problem.
I tried with a simple kernel module:
Code:
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>

/* Add your variables here */

static int __init mfd_init(void)
{
	printk(KERN_INFO "mfd registered");
	return 0;
}

static void __exit mfd_exit(void)
{
	printk(KERN_INFO "mfd deregistered");
}

module_init(mfd_init);
module_exit(mfd_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("RKP");
MODULE_DESCRIPTION("Test Driver");

I used the earlier makefile just changing the kernel source:
Code:
# if KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
	src-m := $(wildcard ${SUBDIRS}/*.c)
	src-mod := $(wildcard ${SUBDIRS}/*.mod.c)
	src-m := $(notdir ${src-m})
	src-mod := $(notdir ${src-mod})
	src-m := $(filter-out ${src-mod}, ${src-m})
	obj-m := $(src-m:.c=.o)
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
	KERNEL_SOURCE := /usr/src/linux-2.6.31.5-0.1/
	PWD := $(shell pwd)
default:
	$(MAKE) -C $(KERNEL_SOURCE) SUBDIRS=$(PWD) modules

clean:
	$(MAKE) -C $(KERNEL_SOURCE) SUBDIRS=$(PWD) clean
endif

The code got built.
But on loading the module it gives me an error:
Code:
insmod test_driver.ko 
insmod: error inserting 'test_driver.ko': -1 Invalid module format

Any idea how to get rid of this?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Build.xml invocation by Build Script

Hi I have a build.xml file and I can run it on Windows via cmd. Now I want to write a script to invoke the same. Is there a way to do this? (1 Reply)
Discussion started by: ankur328
1 Replies

2. UNIX for Dummies Questions & Answers

Adding SDK Build on Kernel Source Build

Hi, So I downloaded this kernel source and was able to build it successfully. But I want to add this SDK source code inside, can anyone help me how to do this? Note that the SDK source can be built by itself. I added the SDK in the main Makefile: init-y := init/ #added SDK... (0 Replies)
Discussion started by: h0ujun
0 Replies

3. Solaris

Error at ndiswrapper build

Today I tried to generate ndis Solaris driver. Problem is when I try to compile ndiswapper following instructions on opensolaris site. ndis wrapper (Community Group laptop.ndis) - XWiki My version of Solaris $ uname -a SunOS pc001 5.10 Generic_142910-17 i86pc i386 i86pc ... (0 Replies)
Discussion started by: solaris_user
0 Replies

4. UNIX for Advanced & Expert Users

Error with ANT build for red5

I installed java at usr/local/jdk directory. My Java Version is 1.6.0_05. I have installed apache ant version 1.8.1 in folder opt/ant successfully. And later on I have installed RED 5.0.9 final version at /opt/ant directory. But I am getting error while building ant at RED5 , I got following... (1 Reply)
Discussion started by: ninadgac
1 Replies

5. UNIX for Dummies Questions & Answers

Build Error: error: dereferencing pointer to incomplete type

I'm getting the following Error: prepare_pcap.c: In function `prepare_pkts': prepare_pcap.c:127: error: dereferencing pointer to incomplete type prepare_pcap.c:138: error: dereferencing pointer to incomplete type ==================================== This is the part of the relevant... (8 Replies)
Discussion started by: katwala
8 Replies

6. Programming

kdevelop build project error

Hi, I am starting to learn how to use KDevelop. I have a console program with .cc, .h and Makefile. To work it in KDevelop, I firstly create a C++ Simple Hello World program, remove the single existing target in the project and also the auto-created main.cpp. Then I copy my .cc and .h files into... (1 Reply)
Discussion started by: flylehe
1 Replies

7. AIX

Error thrown while trying to build in AIX 5.2

Hi All, Currently my project source code is compatible with HP-UX11.0 and Sun Solaris5.8. I m trying to build the source code in AIX 5.2 using gcc 4.2.2 compiler. Can anyone suggest me after seeing the rules file, what options do i need to specify to get rid of the cb error I m... (0 Replies)
Discussion started by: cleopatra789
0 Replies

8. SCO

Installation error for Kernel Re-build

Hi All, While installing a Service Pack on my Unix Solaris machine, i got the following error: UX:acomp: ERROR: "space.c", line 16: undefined symbol: CHROOT_SECURITY UX:acomp: ERROR: "space.c", line 16: non-constant initializer: op "NAME" UX:idmkunix: ERROR: Compile/link of 'Driver_atup.o... (9 Replies)
Discussion started by: am_yadav
9 Replies

9. Solaris

build error

dears i working in solaris and when i type make for report it gives me the error kindly can you help me what is the reason -bash-3.00$ make BPSEXT130 make: Warning: File `BPSEXT130.rc' has modification time 12 s in the future make BPSEXT130.c make: Entering directory... (3 Replies)
Discussion started by: murad.jaber
3 Replies

10. SuSE

How can I build gcc (gettng 'cc' error)?

Hi I have installed Suse Linux 9.3 desktop on my computer. I found out I need to install 'gcc', and I was able to download the source code. I then tried to follow some instructions from WEB search to compile and build gcc, and I am getting the following error: --- linux:/gcc/gcc-2.95.3 #... (1 Reply)
Discussion started by: pat_and_cami
1 Replies
Login or Register to Ask a Question