Visit Our UNIX and Linux User Community

Top Forums UNIX for Advanced & Expert Users Kernel module compilation problem Post 302281326 by marcintom on Wednesday 28th of January 2009 04:21:52 PM
Old 01-28-2009
Error Kernel module compilation problem

I have one big module 2.6.18 kernel mod.c
I want to divide this to several files.
The problem is to write right Makefile



mod.c works fine normally but when I divide into several files
and try to compile with this makefile

obj-m := mod.o
mod-objs := lib1.o

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

I get this
zet modulANDlibs # make
make -C /lib/modules/2.6.18-gentoo-r2/build SUBDIRS=/root/modulANDlibs modules
make[1]: Entering directory `/usr/src/linux-2.6.18-gentoo-r2'
CC [M] /root/modulANDlibs/lib1.o
LD [M] /root/modulANDlibs/mod.o
Building modules, stage 2.
CC /root/modulANDlibs/mod.mod.o
LD [M] /root/modulANDlibs/mod.ko
make[1]: Leaving directory `/usr/src/linux-2.6.18-gentoo-r2'
zet modulANDlibs #

so this is ok but when I load this module there are no any operation
this mean mod.ko is loaded but dont work - before dividing it print to KERN_INFO "Hello world" ( dmesg )

There is one more thing. When I compile mod.c without lib* mod.ko have about 5.5Kb
but if I compile with mod-objs variable doesnt matter what is in mod.c and in lib1.c
compilation is ok loading is ok and size mod.ko is about 1.6 Kb constatntly

The questin is WHY ? Smilie

Last edited by marcintom; 01-28-2009 at 05:31 PM..
Test Your Knowledge in Computers #825
Difficulty: Medium
The term API seems to appear for the first time in the article of Ira W. Cotton, Data structures and techniques for remote computer graphics, published in 1968.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Kernel compilation

I have re-compiled kernel source code available in /usr/src/linux.2.4.20 with "make" command. The compilation is succesful. Now the problem is create the image for this. The documentation in the same folder says that now you have compile "make image". There is no option for image in Makefile. ... (3 Replies)
Discussion started by: mankrish
3 Replies

2. SuSE

max number of slabs per kernel module (kernel 2.6.17, suse)

Hi All, Is there a max number of slabs that can be used per kernel module? I'm having a tough time finding out that kind of information, but the array 'node_zonelists' (mmzone.h) has a size of 5. I just want to avoid buffer overruns and other bad stuff. Cheers, Brendan (4 Replies)
Discussion started by: Brendan Kennedy
4 Replies

3. Red Hat

Problem with kernel-module-ntfs

Hi All Im trying to access the my windows XP NTFS from Redhat linux 4.0 Enterprise edition I have downloaded the respective rpm And im able to install it successfully Then i have given the following command , but got an error Here are my partitions And when i give the below... (1 Reply)
Discussion started by: balumankala
1 Replies

4. Linux

How to convert Linux Kernel built-in module into a loadable module

Hi all, I am working on USB data monitoring on Fedora Core 9. Kernel 2.6.25 has a built-in module (the one that isn't loadable, but compiles and links statically with the kernel during compilation) to snoop USB data. It is in <kernel_source_code>/drivers/usb/mon/. I need to know if I can... (0 Replies)
Discussion started by: anitemp
0 Replies

5. Linux

problem with kernel module loading

Hi masters, I am new to linux and unix forum and this is my first forum. So please excuse if I am not giving sufficient information. I will give them on request. I have created a bandwidth manager module. I am using a 2.6.9 kernel and in Red Hat 3.4.3 distribution. But when i run make... (1 Reply)
Discussion started by: iamjayanth
1 Replies

6. UNIX and Linux Applications

Apache module compilation error

I'm trying to compile an apache module (a tutorial module, Apache 2 Module Tutorial - GNU Build Tools and the Development Environment) and I get errors like this: apr.h:273: error: expected ´=´, ´,´,´;´,´asm´ or ´__attribute__´ before ´apr_off_t´ those errors occur like 30 times in different... (4 Replies)
Discussion started by: hjalle
4 Replies

7. Red Hat

Kernel compilation for s3c2440

Hi All, I am trying to compile Kernel 2.6.31 with arm-linux-gcc3.2.2 for s3c2440a, but I am not able to perform the task. I am using Redhat 9 firstly i am using the following commands $make s3c2410_defconfig // there is no error in execution of this command next i run $make ... (0 Replies)
Discussion started by: niranjanvg
0 Replies

8. Linux

Linux kernel compilation

I have complied the kernel with a default settings... now if I load this kernel , it'll load perfectly but the INTERNET is not workink... I think in the default settings The network modules are not included.. Can anybody help me out with the selection of the network module when i give "make... (1 Reply)
Discussion started by: naresh046
1 Replies

9. UNIX for Dummies Questions & Answers

Kernel Compilation Issue

I have installed ubuntu 11.04 on my system. After this when I used to give uname -r it showed me kernel version as 2.6.38. Now I had downloaded kernel from and installed it using the following steps: make make modules make modules_install make install This created... (2 Replies)
Discussion started by: rupeshkp728
2 Replies

10. Linux

Unload kernel module at boot time (Debian Wheezy 7.2, 3.2.0-4-686-pae kernel)

Hi everyone, I am trying to prevent the ehci_hcd kernel module to load at boot time. Here's what I've tried so far: 1) Add the following line to /etc/modprobe.d/blacklist.conf (as suggested here): 2) Blacklisted the module by adding the following string to 3) Tried to blacklist the module... (0 Replies)
Discussion started by: gacanepa
0 Replies
xmonad(1)							   xmonad manual							 xmonad(1)

       xmonad - a tiling window manager

       xmonad  is  a minimalist tiling window manager for X, written in Haskell.  Windows are managed using automatic layout algorithms, which can
       be dynamically reconfigured.  At any time windows are arranged so as to maximize the use of screen real estate.	All features of the window
       manager	are  accessible  purely from the keyboard: a mouse is entirely optional.  xmonad is configured in Haskell, and custom layout algo-
       rithms may be implemented by the user in config files.  A principle of xmonad is predictability: the user should know in advance  precisely
       the window arrangement that will result from any action.

       By  default,  xmonad  provides three layout algorithms: tall, wide and fullscreen.  In tall or wide mode, windows are tiled and arranged to
       prevent overlap and maximize screen use.  Sets of windows are grouped together on virtual screens, and each screen retains its own  layout,
       which may be reconfigured dynamically.  Multiple physical monitors are supported via Xinerama, allowing simultaneous display of a number of

       By utilizing the expressivity of a modern functional language with a rich static type system, xmonad provides a complete, featureful window
       manager	in  less  than	1200 lines of code, with an emphasis on correctness and robustness.  Internal properties of the window manager are
       checked using a combination of static guarantees provided by the type system, and type-based automated testing.	A benefit of this is  that
       the code is simple to understand, and easy to modify.

       xmonad  places  each  window  into a "workspace".  Each workspace can have any number of windows, which you can cycle though with mod-j and
       mod-k.  Windows are either displayed full screen, tiled horizontally, or tiled vertically.  You can toggle the layout mode with	mod-space,
       which will cycle through the available modes.

       You  can switch to workspace N with mod-N.  For example, to switch to workspace 5, you would press mod-5.  Similarly, you can move the cur-
       rent window to another workspace with mod-shift-N.

       When running with multiple monitors (Xinerama), each screen has exactly 1 workspace visible.  mod-{w,e,r} switch the focus between screens,
       while  shift-mod-{w,e,r}  move the current window to that screen.  When xmonad starts, workspace 1 is on screen 1, workspace 2 is on screen
       2, etc.	When switching workspaces to one that is already visible, the current and visible workspaces are swapped.

       xmonad has several flags which you may pass to the executable.  These flags are:

	      Recompiles your configuration in ~/.xmonad/xmonad.hs

	      Causes the currently running xmonad process to restart

	      Replace the current window manager with xmonad

	      Display version of xmonad

	      Display detailed version of xmonad

   Default keyboard bindings
	      Launch terminal

       mod-p  Launch dmenu

	      Launch gmrun

	      Close the focused window

	      Rotate through the available layout algorithms

	      Reset the layouts on the current workspace to default

       mod-n  Resize viewed windows to the correct size

	      Move focus to the next window

	      Move focus to the previous window

       mod-j  Move focus to the next window

       mod-k  Move focus to the previous window

       mod-m  Move focus to the master window

	      Swap the focused window and the master window

	      Swap the focused window with the next window

	      Swap the focused window with the previous window

       mod-h  Shrink the master area

       mod-l  Expand the master area

       mod-t  Push window back into tiling

	      Increment the number of windows in the master area

	      Deincrement the number of windows in the master area

       mod-b  Toggle the status bar gap

	      Quit xmonad

       mod-q  Restart xmonad

	      Switch to workspace N

	      Move client to workspace N

	      Switch to physical/Xinerama screens 1, 2, or 3

	      Move client to screen 1, 2, or 3

	      Set the window to floating mode and move by dragging

	      Raise the window to the top of the stack

	      Set the window to floating mode and resize by dragging

       To use xmonad as your window manager add to your ~/.xinitrc file:

	      exec xmonad

       xmonad is customized in ~/.xmonad/xmonad.hs, and then restarting with mod-q.

       You can find many extensions to the core feature set in the xmonad- contrib  package,  available  through  your	package  manager  or  from (

   Modular Configuration
       As  of  xmonad-0.9, any additional Haskell modules may be placed in ~/.xmonad/lib/ are available in GHC's searchpath.  Hierarchical modules
       are supported: for example, the file ~/.xmonad/lib/XMonad/Stack/MyAdditions.hs could contain:

	      module XMonad.Stack.MyAdditions (function1) where
		  function1 = error "function1: Not implemented yet!"

       Your xmonad.hs may then import XMonad.Stack.MyAdditions as if that module was contained within xmonad or xmonad-contrib.

       Probably.  If you find any, please report them to the bugtracker (

xmonad-0.10							   25 October 09							 xmonad(1)

Featured Tech Videos

All times are GMT -4. The time now is 08:09 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy