Re: error: missing syscalls when compiling kernel module

2015-02-16 Thread Sudip Mukherjee
On Tue, Feb 17, 2015 at 12:21 AM,   wrote:
> On Mon, 16 Feb 2015 12:14:59 +0530, noyb noybee said:
>> Hi all. This is the error that I am getting when I try to compile a
>> loadable module(it tries to intercept a system call by directly
>> editing the sys_call_table in the memory):-
>
> In general, that's a *really* bad idea, for numerous reasons.  What problem
> are you trying to solve by intercepting a system call?
>
by any chance - is this related to Eudyptula Challenge? it looks
similar to one of the tasks which involves modifying the system call
table..

regards
sudip

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: error: missing syscalls when compiling kernel module

2015-02-16 Thread Valdis . Kletnieks
On Mon, 16 Feb 2015 12:14:59 +0530, noyb noybee said:
> Hi all. This is the error that I am getting when I try to compile a
> loadable module(it tries to intercept a system call by directly
> editing the sys_call_table in the memory):-

In general, that's a *really* bad idea, for numerous reasons.  What problem
are you trying to solve by intercepting a system call?



pgpIcODKn6tMl.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: error: missing syscalls when compiling kernel module

2015-02-16 Thread Kapil Mathur
Replace PWD=$(pwd) with PWD=$(shell pwd)

On Mon, Feb 16, 2015 at 1:53 PM, Paul Bolle  wrote:

> On Mon, 2015-02-16 at 12:14 +0530, noyb noybee wrote:
> > Hi all. This is the error that I am getting when I try to compile a
> > loadable module(it tries to intercept a system call by directly
> > editing the sys_call_table in the memory):-
> >
> > make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M= modules
> > make[1]: Entering directory `/usr/src/kernels/2.6.32-504.1.3.el6.x86_64'
> > make[2]: Nothing to be done for `all'.
> >   CHK include/linux/version.h
> >   CHK include/linux/utsrelease.h
> >   SYMLINK include/asm -> include/asm-x86
> > make[2]: *** No rule to make target `missing-syscalls'.  Stop.
> > make[1]: *** [prepare0] Error 2
> > make[1]: Leaving directory `/usr/src/kernels/2.6.32-504.1.3.el6.x86_64'
> > make: *** [all] Error 2
> >
> > The Makefile is:-
> >
> > obj-m   +:= hijack.o
>
> You want ":=" here. "+:=" gives
> Makefile:1: *** empty variable name.  Stop.
>
> when I try it.
>
> > PWD:= $(pwd)
>
> I think this line sets the value of variable PWD to the value of the
> variable pwd, which is probably empty. Look at "M=" in the output you
> quoted above.
>
> > all:
> > make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M=$(PWD)
> modules
> > clean:
> > make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M=$(PWD)
> clean
> >
> > I have googled the error but most links are unresolved. I am trying to
> > install this against the currently running kernel and not the complete
> > source.
>
> I'm not sure what you're trying to do here, and I'm not really
> comfortable reading Makefiles. But the examples in "3. Creating a Kbuild
> File for an External Module" in Documentation/kbuild/modules.txt suggest
> you could also drop the assignment to PWD and use 'M=$$PWD' in those two
> lines.
>
> Hope this helps,
>
>
> Paul Bolle
>
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: error: missing syscalls when compiling kernel module

2015-02-16 Thread Paul Bolle
On Mon, 2015-02-16 at 12:14 +0530, noyb noybee wrote:
> Hi all. This is the error that I am getting when I try to compile a
> loadable module(it tries to intercept a system call by directly
> editing the sys_call_table in the memory):-
> 
> make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M= modules
> make[1]: Entering directory `/usr/src/kernels/2.6.32-504.1.3.el6.x86_64'
> make[2]: Nothing to be done for `all'.
>   CHK include/linux/version.h
>   CHK include/linux/utsrelease.h
>   SYMLINK include/asm -> include/asm-x86
> make[2]: *** No rule to make target `missing-syscalls'.  Stop.
> make[1]: *** [prepare0] Error 2
> make[1]: Leaving directory `/usr/src/kernels/2.6.32-504.1.3.el6.x86_64'
> make: *** [all] Error 2
>
> The Makefile is:-
> 
> obj-m   +:= hijack.o

You want ":=" here. "+:=" gives
Makefile:1: *** empty variable name.  Stop.

when I try it.

> PWD:= $(pwd)

I think this line sets the value of variable PWD to the value of the
variable pwd, which is probably empty. Look at "M=" in the output you
quoted above.

> all:
> make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M=$(PWD) modules
> clean:
> make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M=$(PWD) clean
>
> I have googled the error but most links are unresolved. I am trying to
> install this against the currently running kernel and not the complete
> source.

I'm not sure what you're trying to do here, and I'm not really
comfortable reading Makefiles. But the examples in "3. Creating a Kbuild
File for an External Module" in Documentation/kbuild/modules.txt suggest
you could also drop the assignment to PWD and use 'M=$$PWD' in those two
lines.

Hope this helps,


Paul Bolle


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


error: missing syscalls when compiling kernel module

2015-02-15 Thread noyb noybee
Hi all. This is the error that I am getting when I try to compile a
loadable module(it tries to intercept a system call by directly
editing the sys_call_table in the memory):-

make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M= modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-504.1.3.el6.x86_64'
make[2]: Nothing to be done for `all'.
  CHK include/linux/version.h
  CHK include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-x86
make[2]: *** No rule to make target `missing-syscalls'.  Stop.
make[1]: *** [prepare0] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.32-504.1.3.el6.x86_64'
make: *** [all] Error 2



The Makefile is:-

obj-m   +:= hijack.o
PWD:= $(pwd)
all:
make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M=$(PWD) modules
clean:
make -C /lib/modules/2.6.32-504.1.3.el6.x86_64/build M=$(PWD) clean




I have googled the error but most links are unresolved. I am trying to
install this against the currently running kernel and not the complete
source.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: issue with compiling kernel module

2014-01-17 Thread Prabhakar Lad
Hi Arun,

On Sat, Jan 11, 2014 at 9:03 AM, Arun M Kumar  wrote:
> I am facing the following error message when i try to compile my kernel
> module.
> it is a simple hello world module
>
> make: Entering directory `/usr/src/linux-3.4.6-2.10'
>
>ERROR: Kernel configuration is invalid.
>   include/generated/autoconf.h or include/config/auto.conf are
> missing.
>   Run 'make oldconfig && make prepare' on kernel src to fix it.
>
> make: *** No rule to make target `Device'.  Stop.
> make: Leaving directory `/usr/src/linux-3.4.6-2.10'
>
>
>
> I have tried the said option, of make oldconfig and prepare...
>
> I even recompiled the source using defconfig and am using that kernel,
> but still i get this error.
> Please help.
>
Need more info on this to help..
1: Is your module part of kernel source tree or Independent ?
2: How you  makefile looks ?

Thanks,
--Prabhakar Lad
https://www.linkedin.com/in/prabhakarlad

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


issue with compiling kernel module

2014-01-10 Thread Arun M Kumar
I am facing the following error message when i try to compile my kernel 
module.
it is a simple hello world module

make: Entering directory `/usr/src/linux-3.4.6-2.10'

   ERROR: Kernel configuration is invalid.
  include/generated/autoconf.h or include/config/auto.conf are 
missing.
  Run 'make oldconfig && make prepare' on kernel src to fix it.

make: *** No rule to make target `Device'.  Stop.
make: Leaving directory `/usr/src/linux-3.4.6-2.10'



I have tried the said option, of make oldconfig and prepare...

I even recompiled the source using defconfig and am using that kernel, 
but still i get this error.
Please help.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Issue compiling Kernel Module

2014-01-08 Thread Valdis . Kletnieks
On Thu, 09 Jan 2014 03:00:11 +0530, Arun M Kumar said:


> all:
>  make -C /home/arun/Linux_Source M=`pwd`

The directory the -C parameter points at has to be a Linux source
tree that has had at least a 'make prepare' run inside it.

In addition, to actually *use* the module, you'll need to modprobe it
into a kernel built in that directory (in other words, you need to build
against the source tree of the kernel you plan to be running).  So
you'll need to do a 'make config', then a 'make' and then
install and boot that kernel in order to actually test your module.



pgp5l4M9ncE6A.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Issue compiling Kernel Module

2014-01-08 Thread Valentina Manea
Hi,

You need to have a kernel configuration in your source tree.
Run make defconfig (resulting in a default configuration file for your
architecture) into your kernel tree.

Valentina

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Issue compiling Kernel Module

2014-01-08 Thread Arun M Kumar
I have recently started with Device Drivers in Linux and have made a 
simple Hello world module.

My code is this
//-
/* My first kernel Module */

#include 
#include 

static init my_init(void){
 printk(KERN_ALERT "Hello World\n");
 return 0;
}

static void my_exit(void){
 printk(KERN_ALERT "asta la vista baby\n");
}

MODULE_LICENSE("GPL");
module_init(my_init);
module_exit(my_exit);
//-


and the makefile i am using is like this...
//-
all:
 make -C /home/arun/Linux_Source M=`pwd`

clean:
 make -C /home/arun/Linux_Source M=`pwd` clean

obj-m := Hello_World.o
//-

I receive the following error on running "$make"

//-
make -C /home/arun/Linux_Source M=`pwd`
make[1]: Entering directory `/home/arun/Linux_Source'

   ERROR: Kernel configuration is invalid.
  include/generated/autoconf.h or include/config/auto.conf are 
missing.
  Run 'make oldconfig && make prepare' on kernel src to fix it.

make[1]: *** No rule to make target `Device'.  Stop.
make[1]: Leaving directory `/home/arun/Linux_Source'
make: *** [all] Error 2
//--



PS:
The kernel Source i am using is a Copy of my Git Repository and is a 
copy of the branch 3.10.25.

my system details are:
Linux linux-nwya.site 3.10.25-2.10-desktop #2 SMP PREEMPT Tue Jan 7 
00:25:03 IST 2014 i686 i686 i386 GNU/Linux

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Compiling kernel module ...

2011-08-06 Thread Greg KH
On Sat, Aug 06, 2011 at 11:52:06AM -0700, Abu Rasheda wrote:
> 
> Get the code merged upstream so you never have to worry about it again.
> 
> 
> Greg, my issue is basic. I am talking about change in parameter .create of
> net_proto_family struct.
> 
> It seems that Scientific Linux had it back ported.

Again, the real solution here is to get your code merged into the main
kernel tree.  Do you have a pointer to it anywhere so we can look at it
to see what that would entail?

thanks,

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Compiling kernel module ...

2011-08-06 Thread Abu Rasheda
> Get the code merged upstream so you never have to worry about it again.
>

Greg, my issue is basic. I am talking about change in parameter .create of
net_proto_family struct.

It seems that Scientific Linux had it back ported.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Compiling kernel module ...

2011-08-06 Thread Greg KH
On Sat, Aug 06, 2011 at 11:34:46AM -0700, Abu Rasheda wrote:
> On Fri, Aug 5, 2011 at 5:10 PM, Akash  wrote:
> 
> Use #if like
> 
> #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
> 
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
>    // New socket create function
> #else
>    // Old socket create function
> #endif
> 
> LINUX_VERSION_CODE is defined somewhere in the kernel and you should get 
> to
> use it easily.
> 
> 
> HTH
> 
> Akash
> 
> 
> I do this in many parts of my code. Issue in this particular case is 
> different.
> In Vanila kernel this change appears in 2.6.33 and in Scientific Linux this
> change appears in 2.6.32. So in addition to LINUX_KERNEL_VERSION, I have to 
> use
> some distribution specific #if.
> 
> I was wondwring what is general practice in this regard.

Get the code merged upstream so you never have to worry about it again.

Seriously, that is how this is handled, please read
Documenation/stable_api_nonsense.txt for details.

If you need help getting your driver merged, please let me know.  We
have ways of merging drivers that need "work" into the tree through the
drivers/staging/ portion of the kernel and we have people to help out
with the work as well.

What type of driver is this?  Why hasn't it been submitted for inclusion
in the kernel already?

thanks,

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Compiling kernel module ...

2011-08-06 Thread Abu Rasheda
On Fri, Aug 5, 2011 at 5:10 PM, Akash  wrote:

> Use #if like
> *
> *#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
>
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
>// New socket create function
> #else
>// Old socket create function
> #endif
>
> LINUX_VERSION_CODE is defined somewhere in the kernel and you should get to
> use it easily.
>
>
> HTH
>
> Akash
>

I do this in many parts of my code. Issue in this particular case is
different. In Vanila kernel this change appears in 2.6.33 and in Scientific
Linux this change appears in 2.6.32. So in addition to LINUX_KERNEL_VERSION,
I have to use some distribution specific #if.

I was wondwring what is general practice in this regard.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Compiling kernel module ...

2011-08-05 Thread Akash
Use #if like

*
*#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
   // New socket create function
#else
   // Old socket create function
#endif

LINUX_VERSION_CODE is defined somewhere in the kernel and you should get to
use it easily.


HTH

Akash


On Fri, Aug 5, 2011 at 12:34 PM, Abu Rasheda  wrote:

> I am compiling my driver and have run into following scenario.
>
> Socket create function got a new parameter in Vanila kenrel 2.6.33. while
> Scientific Linux has it back ported to 2.6.32. How do I handle this kind of
> situation ? so that my driver compiles for both kernel versions.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Compiling kernel module ...

2011-08-05 Thread Abu Rasheda
I am compiling my driver and have run into following scenario.

Socket create function got a new parameter in Vanila kenrel 2.6.33. while
Scientific Linux has it back ported to 2.6.32. How do I handle this kind of
situation ? so that my driver compiles for both kernel versions.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies