Re: Debug symbols in kernel modules

2012-10-06 Thread Mulyadi Santosa
On Sat, Oct 6, 2012 at 6:31 PM, Aft nix  wrote:
> Hi,
>
> When i write a makefile to build a kernel module how should i make
> sure that it contains debugging symbols?

IIRC, it's in kernel hacking section during make config/menuconfig/xconfig.

Find "kernel debug" or something like that. Then check the resulting
config. You should find that CONFIG_DEBUG_INFO=y

Or...if it's a stock kernel from your distro repository, just install
the kernel debug symbol package.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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


Re: Question on initrd and initramfs

2012-10-06 Thread Mulyadi Santosa
Hi man :)

On Sat, Oct 6, 2012 at 2:25 AM, Ezequiel Garcia  wrote:
> Just wanted to add something fresh. I'm reading through ramfs sources:
>
> $ wc -l fs/ramfs/*.c
>55 fs/ramfs/file-mmu.c
>   267 fs/ramfs/file-nommu.c
>   289 fs/ramfs/inode.c
>   611 total
>
> 600 lines! This is really readable! There's even a note from Linus
> saying it's a nice template
> code to read as a fs starting point.
>
> Interesting, uh?

Yeap.

I also repeatedly directly suggest anyone that wanna start adventure
in filesystem (me too, although I am lazy hehehhe) to start reading
ramfs.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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


Re: scsi adapter module over block device - need help

2012-10-06 Thread Greg Freemyer
On Sat, Oct 6, 2012 at 9:28 AM, Dmitry Filippov  wrote:
> Hi all,
>
> i'm just learning kernel and not experienced in writing code for it.
> I'm going to write kernel module in studying purposes and i hope
> someone from you could help me with it and in best case guide me
> through overall process.
>
> I want to write module that implements SCSI-disk logic, keeping its
> data on block device. For example partition of existing disk. So i
> want to pass the name of block device as parameter to my module while
> loading to kernel.
>
> So it will be some kind of virtual(pseudo) scsi device that appears in
> /dev as scsi disk and in fact some block device as backend. I want it
> to be as simple as possible... keeping just essential parts... and it
> is not intended to be some kind of production driver... i want it to
> be just as simple as sbull from LDD)))
>
> As from my point of view there are 2 major parts, with which i'm
> completely not confident and doesn't know from where to start...
> 1. scsi subsystem... so how to write my module to interact with scsi
> subsystem in this case and to not reinvent the wheel. using scsi
> kernel API as much as possible.
> i have found interesting thing in kernel source scsi_debug module...
> which represent scsi disk and have ram as backend (so some kind of
> sbull but with scsi). However i got overwhelmed with its code. It is
> very difficult for me to sort out with it by my own... maybe someone
> can help?
>
> 2. module code interaction with existing block device... that is i
> completely don't understand how to achieve. ok.. i have device name in
> kernel space... whats then? how i can access this device?
> so how i can write some adapter for existing device and transit some
> writes/reads and other fops from my device to existing... I saw same
> questions on forums... and the only answer is to use sys_write... or
> vfs_write... to existing block device node... if it is most
> simple/correct way?
>
> i hope someone could help me sort out in those things eventually.
> Really need your help!
>
> thanks in advance,
> -Dmitry Filippov

Dmitry,

I might be able to give some high-level guidance.

The first thing you need to know is the "network stack".

I'm assuming you know ethernet => IP => TCP type of levels for networking.

Can you provide a similar set of layers for scsi.  As an example USB
external drives actually fit into the SCSI stack, not the IDE or SATA
stack.  Can you list the layering starting with the filesystem?

Greg

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


Re: Gpio interrupt shall pass the signal to application

2012-10-06 Thread jeshwanth Kumar N K
Actually what I am doing is, I have 3 inputs to beaglebone from  BLDC motor 
hall sensor. If there is any change in any of 3 inputs, the kernel module has 
to send signal to my beaglebone. From the interrupt my application reads the 
input from sysfs and pass the next sequence to pwm. PWM I am using userspace 
only. 
So is my design right for handling fast input change, I mean 50 micro seconds ? 
Any suggestion ? I am new to device driver concept, please suggest.
Thanks :)

Sent from my HTC

- Reply message -
From: "Jonathan Neuschäfer" 
Date: Sat, Oct 6, 2012 10:29 pm
Subject: Gpio interrupt shall pass the signal to application
To: "jeshwanth Kumar N K" 
Cc: "kernelnewbies" 


On Sat, Oct 06, 2012 at 01:50:55PM +0530, jeshwanth Kumar N K wrote:
> Hello All,
> 
> I am writing a kernel module that shall pass the signal to application 
> running in user space. So which signal i should use? And how to achieve this? 
> Thank you.

What kind of information need to be transmitted from your device to the
application?


Jonathan Neuschäfer
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: enabling config_wireless_ext

2012-10-06 Thread Jorgyano Vieira

Hi,

On Fri, Oct 05, 2012 at 07:04:31PM +0100, captain wrote:
> Sorry Confused. I'm building from the latest 3.6 kernel from git in
> order to be able to submit patches. Well if I get that far. I'm
> running the built on my netbook but I'm having problems building my
> wifi drivers against the 3.6.0 kernel. Basically I've got an error:
> 
> error: 'struct net_device' has no member named 'wireless_handlers'
> 
> Which is fair enough if you look in the kernel source
> include/linux/netdevice.h there's a "'#ifdef CONFIG_WIRELESS_EXT"
> 
> So this is easy all I have to do is enable that switch and rebuild
> the kernel. You might not believe it but that's were I come unstuck.
> I did a search in "make menuconfig" for that switch and it does
> provide some info but normally when I do a search the help tells me
> where to find it. (Which is a God send.) So searching for it is
> finding it but not giving me suitable help on where it is in the
> menu structure.
> 
> I then decided that I'd search for it in the .config file. Can't
> find it in there either.
> 
> This is a mailing list for newbies and I know this is a stupid
> question but can anybody advise me on where that switch is in make
> menuconfig?
> 
> I did find this page out there but that's pointing at Kconfig in
> source code not where it is in the menus:
> 
> http://cateee.net/lkddb/web-lkddb/WIRELESS_EXT.html


First thing: you shouldn't be gettin this error at all.
If this piece of code depends on WIRELESS_EXT, and it is this 
flag is not set the code should not be built or the code should set this flag, 
as we will see below.
You can investigate and fix it if you want.

Searching for WIRELESS_EXT on menuconfig we get: 

 Symbol: WIRELESS_EXT [=n]  

 
   Type  : boolean  


 Selected by: GELIC_WIRELESS [=n] && NETDEVICES [=y] && ETHERNET [=y] && 
NET_VENDOR_TOSHIBA [=n] && GELIC_NET [=n] && WLAN [=y] || PCMCIA_RAYCS [=n] 
(...) 


I didn't put the entire "Selected by" here, there is dozens of fields.

The first thing we learn here is that the flag does not have a "Prompt" field, 
instead, it has a "Selected by" field. This means that you wont see a check box 
to 
this fllag on menuconfig and you should not manually add the flag on .config, 
because this kind of flag is selected by the drivers which needs it, 
and you don't have to worry about it on the configuration.

for example, the WIRELESS_EXT flag b is selected by PCMCIA_RAYCS, 
searching for this synbol on menuconfig we see that it has the prompt:
Aviator/Raytheon 2.4GHz wireless support, and it's located on:
-> Device Drivers
-> Network device support
-> Wireless LAN

selecting it and searching again for WIRELESS_EXT we see that it's selected:
Symbol: WIRELESS_EXT [=y] 

So, perhaps the driver of your wireless device should select WIRELESS_EXT flag


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


Re: Gpio interrupt shall pass the signal to application

2012-10-06 Thread Jonathan Neuschäfer
On Sat, Oct 06, 2012 at 01:50:55PM +0530, jeshwanth Kumar N K wrote:
> Hello All,
> 
> I am writing a kernel module that shall pass the signal to application 
> running in user space. So which signal i should use? And how to achieve this? 
> Thank you.

What kind of information need to be transmitted from your device to the
application?


Jonathan Neuschäfer

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


scsi adapter module over block device - need help

2012-10-06 Thread Dmitry Filippov
Hi all,

i'm just learning kernel and not experienced in writing code for it.
I'm going to write kernel module in studying purposes and i hope
someone from you could help me with it and in best case guide me
through overall process.

I want to write module that implements SCSI-disk logic, keeping its
data on block device. For example partition of existing disk. So i
want to pass the name of block device as parameter to my module while
loading to kernel.

So it will be some kind of virtual(pseudo) scsi device that appears in
/dev as scsi disk and in fact some block device as backend. I want it
to be as simple as possible... keeping just essential parts... and it
is not intended to be some kind of production driver... i want it to
be just as simple as sbull from LDD)))

As from my point of view there are 2 major parts, with which i'm
completely not confident and doesn't know from where to start...
1. scsi subsystem... so how to write my module to interact with scsi
subsystem in this case and to not reinvent the wheel. using scsi
kernel API as much as possible.
i have found interesting thing in kernel source scsi_debug module...
which represent scsi disk and have ram as backend (so some kind of
sbull but with scsi). However i got overwhelmed with its code. It is
very difficult for me to sort out with it by my own... maybe someone
can help?

2. module code interaction with existing block device... that is i
completely don't understand how to achieve. ok.. i have device name in
kernel space... whats then? how i can access this device?
so how i can write some adapter for existing device and transit some
writes/reads and other fops from my device to existing... I saw same
questions on forums... and the only answer is to use sys_write... or
vfs_write... to existing block device node... if it is most
simple/correct way?

i hope someone could help me sort out in those things eventually.
Really need your help!

thanks in advance,
-Dmitry Filippov

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


Re: Gpio interrupt shall pass the signal to application

2012-10-06 Thread devendra.aaru
On Sat, Oct 6, 2012 at 4:20 AM, jeshwanth Kumar N K
 wrote:
> Hello All,
>
> I am writing a kernel module that shall pass the signal to application
> running in user space. So which signal i should use? And how to achieve
> this? Thank you.
>
if any interrupt comes wake up a workqueue or a wait queue and
interrupt the poll wait.

that makes your application wakeup from a select.
> Sent from my HTC
>
>
> ___
> 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: Gpio interrupt shall pass the signal to application

2012-10-06 Thread Fabio Pozzi
Hi Jeshwanth,
I'm not an expert in kernel development, but I think that if you receive an
interrupt every 50_micro_seconds IMHO you should definitely deal with it in
kernel mode and maybe also think about enabling Real Time to be more
certain about kernel latencies and scheduling.
The context switch time between kernel and user space I think it's too long
to delegate the elaboration to userspace.

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


Re: Gpio interrupt shall pass the signal to application

2012-10-06 Thread jeshwanth Kumar N K
Hi Fabio,

Thanks for the reply. Ya I got your point, and I did the same thing by 
exporting the sysfs gpio and poll for value attribute It works fine but the 
thing is time. Actually my interrupts may be every 50 micro seconds. So I 
thought of dealing in kernel mode itself. What's your suggestion ?
Sent from my HTC

- Reply message -
From: "Fabio Pozzi" 
Date: Sat, Oct 6, 2012 2:29 pm
Subject: Gpio interrupt shall pass the signal to application
To: "jeshwanth Kumar N K" 
Cc: "kernelnewbies" 


I think you could use sysfs_notify to send the notification and use
select() or poll() to wait for changes in the sysfs file in the interrupt
handler routine. You can find an example of this in the gpio-fan driver.
Hope it helps

-- 
Saluti,
Fabio Pozzi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Debug symbols in kernel modules

2012-10-06 Thread Aft nix
Hi,

When i write a makefile to build a kernel module how should i make
sure that it contains debugging symbols?

So that when i will use gdb over serial line to debug the module, i
can use "add-symbol-file"?

-- 
-aft

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


Re: Gpio interrupt shall pass the signal to application

2012-10-06 Thread Fabio Pozzi
I think you could use sysfs_notify to send the notification and use
select() or poll() to wait for changes in the sysfs file in the interrupt
handler routine. You can find an example of this in the gpio-fan driver.
Hope it helps

-- 
Saluti,
Fabio Pozzi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Gpio interrupt shall pass the signal to application

2012-10-06 Thread jeshwanth Kumar N K
Hello All,

I am writing a kernel module that shall pass the signal to application running 
in user space. So which signal i should use? And how to achieve this? Thank you.

Sent from my HTC___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies