Re: A new way to dive into the kernel!

2014-03-11 Thread Srivardhan M S
Yes... Just sent the solution for the 1st assignment... You  not
gettting? What is the issue?

Thank-you,
Sri

On Tue, Mar 11, 2014 at 11:19 AM, Mandeep Sandhu
mandeepsandhu@gmail.com wrote:
 Yes.

 Just remember to send a plain text mail.

 HTH,
 -mandeep


 On Tue, Mar 11, 2014 at 10:36 AM, sanjeev sharma
 sanjeevsharmae...@gmail.com wrote:
 Hello All,

 Have you guys getting your assignment's ?

 Regards
 Sanjeev Sharma


 On Wed, Mar 5, 2014 at 10:50 AM, Mallesh Koujalagi
 mallesh.koujalagi.sandi...@gmail.com wrote:

 Good info, thanks for sharing


 On Tue, Mar 4, 2014 at 8:38 PM, Amit Saha amitsaha...@gmail.com wrote:

 On Wed, Mar 5, 2014 at 2:19 PM, Mandeep Sandhu
 mandeepsandhu@gmail.com wrote:
  Came across this in Greg (KH)s G+ feed.
 
  http://eudyptula-challenge.org/
 
  Thought I'd share it here too in case someone missed it.
 
  Looks like a fun and interesting way to start off doing stuff in the
  kernel!

 Interesting! Thanks for sharing.


 --
 http://echorand.me

 ___
 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



 ___
 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: A new way to dive into the kernel!

2014-03-11 Thread Aruna Hewapathirane
It seems too many people signed up at the moment... causing the scripts to
malfunction. Should be resolved in a day or two is what I was told. I have
so far received four tasks. Thank you !

Aruna


On Tue, Mar 11, 2014 at 2:14 AM, Srivardhan M S srivardha...@gmail.comwrote:

 Yes... Just sent the solution for the 1st assignment... You  not
 gettting? What is the issue?

 Thank-you,
 Sri

 On Tue, Mar 11, 2014 at 11:19 AM, Mandeep Sandhu
 mandeepsandhu@gmail.com wrote:
  Yes.
 
  Just remember to send a plain text mail.
 
  HTH,
  -mandeep
 
 
  On Tue, Mar 11, 2014 at 10:36 AM, sanjeev sharma
  sanjeevsharmae...@gmail.com wrote:
  Hello All,
 
  Have you guys getting your assignment's ?
 
  Regards
  Sanjeev Sharma
 
 
  On Wed, Mar 5, 2014 at 10:50 AM, Mallesh Koujalagi
  mallesh.koujalagi.sandi...@gmail.com wrote:
 
  Good info, thanks for sharing
 
 
  On Tue, Mar 4, 2014 at 8:38 PM, Amit Saha amitsaha...@gmail.com
 wrote:
 
  On Wed, Mar 5, 2014 at 2:19 PM, Mandeep Sandhu
  mandeepsandhu@gmail.com wrote:
   Came across this in Greg (KH)s G+ feed.
  
   http://eudyptula-challenge.org/
  
   Thought I'd share it here too in case someone missed it.
  
   Looks like a fun and interesting way to start off doing stuff in the
   kernel!
 
  Interesting! Thanks for sharing.
 
 
  --
  http://echorand.me
 
  ___
  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
 
 
 
  ___
  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

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


RE: Does register_chrdev function make device file under /dev ?

2014-03-11 Thread Kim Chan

Yeah, I know mknod command. I just wanted to know if the register_chrdev makes 
the file or not.
To my understanding, device file is needed when a user program wants to access 
the device and we don't need to generate the device file for us to use the 
device in kernel. Is my understanding correct?

For example, busybox (a user program) starts shell on tty2-4 by default. (as 
the assumed default inittab below)
tty2::askfirst:-/bin/sh
tty3::askfirst:-/bin/sh
tty4::askfirst:-/bin/sh
I have had some mknod commands before in /etc/init.d/rcS to make tty2~tty4 
device files, but when I remove them for test, I can see busybox (almost sure 
it's coming from busybox) complaining that it cannot find the tty2~tty4 device 
files.

I am trying to open a shell on my LCD (is it going to be tty2 ? I don't know) 
and I'm not sure if I have to make vcs1 vcs2 vcs3 files. And I don't know how 
to switch to LCD shell. during the boot, the texts come out on the LCD but I 
cannot see the texts (printf) from busybox. and cannot see the shell on LCD. 
When I press the keyboad, it looks like it's connected to tty1(I can see using 
prints on uart window). Can anybody tell me some direction?

From : Kernel bu.ker...@gmail.com
Sent : 2014-03-11 14:44:09 ( +09:00 )
To : Kim Chan c...@etri.re.kr
Cc : kernelnewbies@kernelnewbies.org kernelnewbies@kernelnewbies.org
Subject : Re: Does register_chrdev function make device file under /dev ?



On Mar 10, 2014, at 10:25 PM, 김찬 c...@etri.re.krmailto:c...@etri.re.kr 
wrote:

Hi,

This should be a basic question.
Does the regisetr_chrdev function make the device file under /dev directory?
I am running linux on our embedded system and inside vcs_init, register_chrdev 
is called as below.

int __init vcs_init(void)
{
unsigned int i;
if (register_chrdev(VCS_MAJOR, vcs, vcs_fops))
panic(unable to get major %d for vcs device, VCS_MAJOR);

I can see the function is returning ok but I don't see any vcs* file under /dev.
Does it only register the device on /sys or /proc directory and not under /dev?
Thanks in advance.

Chan


You have to create a device file using 'mknod'

Ex: mknod -m 666 /dev/vcs c major no minor no


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


Re: Does register_chrdev function make device file under /dev ?

2014-03-11 Thread Mandeep Sandhu
On Tue, Mar 11, 2014 at 1:31 PM, Kim Chan c...@etri.re.kr wrote:

 Yeah, I know mknod command. I just wanted to know if the register_chrdev
 makes the file or not.

It doesn't. Also note that this is the old way of registering a char
device. New code should use cdev_add() etc.

 To my understanding, device file is needed when a user program wants to
 access the device and we don't need to generate the device file for us to
 use the device in kernel. Is my understanding correct?

Yes, device nodes are needed for userspace code to access a device
(the good ol devices are also files Unix paradigm! :)).

I'm not sure how an in-kernel access will work (maybe via directly
getting the corresponding cdec structure).


 For example, busybox (a user program) starts shell on tty2-4 by default. (as
 the assumed default inittab below)
 tty2::askfirst:-/bin/sh
 tty3::askfirst:-/bin/sh
 tty4::askfirst:-/bin/sh
 I have had some mknod commands before in /etc/init.d/rcS to make tty2~tty4
 device files, but when I remove them for test, I can see busybox (almost
 sure it's coming from busybox) complaining that it cannot find the tty2~tty4
 device files.

Correct. You will have to create those nodes manually.


 I am trying to open a shell on my LCD (is it going to be tty2 ? I don't
 know) and I'm not sure if I have to make vcs1 vcs2 vcs3 files. And I don't
 know how to switch to LCD shell. during the boot, the texts come out on the
 LCD but I cannot see the texts (printf) from busybox. and cannot see the
 shell on LCD. When I press the keyboad, it looks like it's connected to
 tty1(I can see using prints on uart window). Can anybody tell me some
 direction?

I think you need to point getty or a shell to the correct tty before
you can see o/p on the screen. Do you know which device file you're
supposed to create for the LCD? If so, just use that in your inittab.
Something like:

::askfirst:-/bin/sh

HTH,
-mandeep


 
 From : Kernel bu.ker...@gmail.com
 Sent : 2014-03-11 14:44:09 ( +09:00 )
 To : Kim Chan c...@etri.re.kr
 Cc : kernelnewbies@kernelnewbies.org kernelnewbies@kernelnewbies.org
 Subject : Re: Does register_chrdev function make device file under /dev ?



 On Mar 10, 2014, at 10:25 PM, 김찬 c...@etri.re.kr wrote:

 Hi,

 This should be a basic question.
 Does the regisetr_chrdev function make the device file under /dev directory?
 I am running linux on our embedded system and inside vcs_init,
 register_chrdev is called as below.

 int __init vcs_init(void)
 {
 unsigned int i;
 if (register_chrdev(VCS_MAJOR, vcs, vcs_fops))
 panic(unable to get major %d for vcs device, VCS_MAJOR);

 I can see the function is returning ok but I don't see any vcs* file under
 /dev.
 Does it only register the device on /sys or /proc directory and not under
 /dev?
 Thanks in advance.

 Chan



 You have to create a device file using 'mknod'

 Ex: mknod -m 666 /dev/vcs c major no minor no


 ___
 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


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


RE: Does register_chrdev function make device file under /dev ?

2014-03-11 Thread 김찬
Hi, Mandeep, Thanks for clearing some things for me.

For accessing the device in kernel code, I think maybe we can use the /proc or 
/sys file system.
(I remember seeing people saying something like that.. correct me if I'm wrong)

 I think you need to point getty or a shell to the correct tty before you
 can see o/p on the screen. Do you know which device file you're supposed
 to create for the LCD? If so, just use that in your inittab.
 Something like:
 
 ::askfirst:-/bin/sh

The problem is, after the final sys_execve() which executes /sbin/init of the 
ramdisk, I cannot see any shell coming up so I cannot use getty command.
Using some prints on separate uart print routine, I can see from the kbd_event 
function the key value is going to current vc which is using tty1. The key 
value is then handed to put_queue function where the character is somehow 
copied to tty buffer. Flush_to_ldisc is scheduled for it and it will probably 
get passed on to the virtual console.
Added to this, there is a notifier_call_chain and the notifier block is 
registered by vcs_poll_data_get function which I don't know weather is 
necessary or not. So one of my questions is  if vcs is necessary for my case. 
(I guess not. There is no other notifier blocks registered)

I gathered without inittab (I don't use inittab which should be ok for most 
cases) the assumed default inittab
tty2::askfirst:-/bin/sh
tty3::askfirst:-/bin/sh 
tty4::askfirst:-/bin/sh 
is being applied by the busybox so there maybe 3 shells on tty2,tty3, and tty4 
running somewhere.
But even if there are shells running I don't know how to switch to those ttys.
I tried using Ctrl-Alt F2 (or F3, F4) using the USB keyboard to switch to 
tty2,3,4 to see if any shell comes up on the LCD but couldn't see it.
I tried using inittab with no avail before.

I hope somebody could point me on what should be checked. Any hint will be 
appreciated.
Regards,
Chan

 -Original Message-
 From: Mandeep Sandhu [mailto:mandeepsandhu@gmail.com]
 Sent: Tuesday, March 11, 2014 6:01 PM
 To: Chan Kim
 Cc: Kernel; kernelnewbies@kernelnewbies.org
 Subject: Re: Does register_chrdev function make device file under /dev ?
 
 On Tue, Mar 11, 2014 at 1:31 PM, Kim Chan c...@etri.re.kr wrote:
 
  Yeah, I know mknod command. I just wanted to know if the
  register_chrdev makes the file or not.
 
 It doesn't. Also note that this is the old way of registering a char
 device. New code should use cdev_add() etc.
 
  To my understanding, device file is needed when a user program wants
  to access the device and we don't need to generate the device file for
  us to use the device in kernel. Is my understanding correct?
 
 Yes, device nodes are needed for userspace code to access a device (the
 good ol devices are also files Unix paradigm! :)).
 
 I'm not sure how an in-kernel access will work (maybe via directly getting
 the corresponding cdec structure).
 
 
  For example, busybox (a user program) starts shell on tty2-4 by
  default. (as the assumed default inittab below)
  tty2::askfirst:-/bin/sh tty3::askfirst:-/bin/sh
  tty4::askfirst:-/bin/sh I have had some mknod commands before in
  /etc/init.d/rcS to make tty2~tty4 device files, but when I remove them
  for test, I can see busybox (almost sure it's coming from busybox)
  complaining that it cannot find the tty2~tty4 device files.
 
 Correct. You will have to create those nodes manually.
 
 
  I am trying to open a shell on my LCD (is it going to be tty2 ? I
  don't
  know) and I'm not sure if I have to make vcs1 vcs2 vcs3 files. And I
  don't know how to switch to LCD shell. during the boot, the texts come
  out on the LCD but I cannot see the texts (printf) from busybox. and
  cannot see the shell on LCD. When I press the keyboad, it looks like
  it's connected to tty1(I can see using prints on uart window). Can
  anybody tell me some direction?
 
 I think you need to point getty or a shell to the correct tty before you
 can see o/p on the screen. Do you know which device file you're supposed
 to create for the LCD? If so, just use that in your inittab.
 Something like:
 
 ::askfirst:-/bin/sh
 
 HTH,
 -mandeep
 
 
  
  From : Kernel bu.ker...@gmail.com
  Sent : 2014-03-11 14:44:09 ( +09:00 )
  To : Kim Chan c...@etri.re.kr
  Cc : kernelnewbies@kernelnewbies.org kernelnewbies@kernelnewbies.org
  Subject : Re: Does register_chrdev function make device file under /dev ?
 
 
 
  On Mar 10, 2014, at 10:25 PM, 김찬 c...@etri.re.kr wrote:
 
  Hi,
 
  This should be a basic question.
  Does the regisetr_chrdev function make the device file under /dev
 directory?
  I am running linux on our embedded system and inside vcs_init,
  register_chrdev is called as below.
 
  int __init vcs_init(void)
  {
  unsigned int i;
  if (register_chrdev(VCS_MAJOR, vcs, vcs_fops))
  panic(unable to get major %d for vcs device,
  VCS_MAJOR);
 
  I can see the function is returning ok but I don't 

building kernel modules for linux differnet version

2014-03-11 Thread Saket Sinha
Hi,

 I have a scenario where I need to build a driver for
different kernel versions.
I have kernel-headers of different version in /lib/modules/
2.6.32-
2.6.39-

and currently I am booted into 2.6.32-(which I find out by uname -r)

Now in my driver makefile, I generate .ko of driver
make  -C   /lib/modules/$(shell uname -r)/build  M=$(PWD)  modules

but I notice that the driver .ko gets generated for 2.6.39- though
I am booted into  2.6.32-. Can anyone help me figure out why this
is happening?

Regards,
Saket Sinha

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


Re: building kernel modules for linux differnet version

2014-03-11 Thread Yann Droneaud
Hi,

Le mardi 11 mars 2014 à 21:16 +0530, Saket Sinha a écrit :
 
  I have a scenario where I need to build a driver for
 different kernel versions.
 I have kernel-headers of different version in /lib/modules/
 2.6.32-
 2.6.39-
 
 and currently I am booted into 2.6.32-(which I find out by uname -r)
 

You don't need to boot on a specific kernel version to build external
module for it.

 Now in my driver makefile, I generate .ko of driver
 make  -C   /lib/modules/$(shell uname -r)/build  M=$(PWD)  modules
 
 but I notice that the driver .ko gets generated for 2.6.39- though
 I am booted into  2.6.32-. Can anyone help me figure out why this
 is happening?
 

Could you check that /lib/modules/2.6.32-/build is not a symbolic
link to linux 2.6.39- sources ?

Regards.

-- 
Yann Droneaud
OPTEYA



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


Re: building kernel modules for linux differnet version

2014-03-11 Thread Yann Droneaud
Le mardi 11 mars 2014 à 22:42 +0530, Saket Sinha a écrit :
 Please find my response inline
 
   I have a scenario where I need to build a driver for
  different kernel versions.
  I have kernel-headers of different version in /lib/modules/
  2.6.32-
  2.6.39-
 
  and currently I am booted into 2.6.32-(which I find out by uname -r)
 
 
  You don't need to boot on a specific kernel version to build external
  module for it.
 
 
 I am aware of that. I just need the kernel header of that specific
 version instead.
 What I meant was that since I was using the expression uname -r in
 my makefile below-
  make  -C   /lib/modules/$(shell uname -r)/build  M=$(PWD)  modules
 so I specified that.
 
  Now in my driver makefile, I generate .ko of driver
  make  -C   /lib/modules/$(shell uname -r)/build  M=$(PWD)  modules
 
  but I notice that the driver .ko gets generated for 2.6.39- though
  I am booted into  2.6.32-. Can anyone help me figure out why this
  is happening?
 
 
  Could you check that /lib/modules/2.6.32-/build is not a symbolic
  link to linux 2.6.39- sources ?
 
 I am pasting the output for you to check
 
 [root@Noi1-502156 ~]# cd /lib/modules
 [root@Noi1-502156 modules]# ls
 2.6.32-220.4.2.el6.x86_64  2.6.39-300.17.1.el6uek.x86_64
 2.6.32-358.6.2.el6.x86_64  2.6.39-400.24.1.el6uek.x86_64
 [root@Noi1-502156 modules]# ll
 total 16
 drwxr-xr-x. 8 root root 4096 Feb 28 14:41 2.6.32-220.4.2.el6.x86_64
 drwxr-xr-x. 7 root root 4096 Jul 15  2013 2.6.32-358.6.2.el6.x86_64
 drwxr-xr-x  8 root root 4096 Aug 12  2013 2.6.39-300.17.1.el6uek.x86_64
 drwxr-xr-x. 4 root root 4096 Jul 10  2013 2.6.39-400.24.1.el6uek.x86_64
 [root@Noi1-502156 modules]#
 

Now try ls -dFl  /lib/modules/2.6.3*/build

And

grep '^\(\(VERSION\)\|\(PATCHLEVEL\)\|\(SUBLEVEL\)\|\(EXTRAVERSION\)\|
\(MAKEARGS\)\)' /lib/modules/*/build/Makefile

Check that matches the expected version.

-- 
Yann Droneaud
OPTEYA



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


Re: building kernel modules for linux differnet version

2014-03-11 Thread Saket Sinha
On Tue, Mar 11, 2014 at 11:09 PM, Yann Droneaud ydrone...@opteya.com wrote:
 Le mardi 11 mars 2014 à 22:42 +0530, Saket Sinha a écrit :
 Please find my response inline

   I have a scenario where I need to build a driver for
  different kernel versions.
  I have kernel-headers of different version in /lib/modules/
  2.6.32-
  2.6.39-
 
  and currently I am booted into 2.6.32-(which I find out by uname -r)
 
 
  You don't need to boot on a specific kernel version to build external
  module for it.
 

 I am aware of that. I just need the kernel header of that specific
 version instead.
 What I meant was that since I was using the expression uname -r in
 my makefile below-
  make  -C   /lib/modules/$(shell uname -r)/build  M=$(PWD)  modules
 so I specified that.

  Now in my driver makefile, I generate .ko of driver
  make  -C   /lib/modules/$(shell uname -r)/build  M=$(PWD)  modules
 
  but I notice that the driver .ko gets generated for 2.6.39- though
  I am booted into  2.6.32-. Can anyone help me figure out why this
  is happening?
 
 
  Could you check that /lib/modules/2.6.32-/build is not a symbolic
  link to linux 2.6.39- sources ?

 I am pasting the output for you to check

 [root@Noi1-502156 ~]# cd /lib/modules
 [root@Noi1-502156 modules]# ls
 2.6.32-220.4.2.el6.x86_64  2.6.39-300.17.1.el6uek.x86_64
 2.6.32-358.6.2.el6.x86_64  2.6.39-400.24.1.el6uek.x86_64
 [root@Noi1-502156 modules]# ll
 total 16
 drwxr-xr-x. 8 root root 4096 Feb 28 14:41 2.6.32-220.4.2.el6.x86_64
 drwxr-xr-x. 7 root root 4096 Jul 15  2013 2.6.32-358.6.2.el6.x86_64
 drwxr-xr-x  8 root root 4096 Aug 12  2013 2.6.39-300.17.1.el6uek.x86_64
 drwxr-xr-x. 4 root root 4096 Jul 10  2013 2.6.39-400.24.1.el6uek.x86_64
 [root@Noi1-502156 modules]#


 Now try ls -dFl  /lib/modules/2.6.3*/build

[root@Noi1-502156 ~]# ls -dFl  /lib/modules/2.6.3*/build
lrwxrwxrwx. 1 root root 50 Feb 17  2012
/lib/modules/2.6.32-220.4.2.el6.x86_64/build -
../../../usr/src/kernels/2.6.32-220.4.2.el6.x86_64/
lrwxrwxrwx. 1 root root 50 Jun 11  2013
/lib/modules/2.6.32-358.6.2.el6.x86_64/build -
../../../usr/src/kernels/2.6.32-358.6.2.el6.x86_64
lrwxrwxrwx  1 root root 54 Jul 10  2013
/lib/modules/2.6.39-300.17.1.el6uek.x86_64/build -
../../../usr/src/kernels/2.6.39-300.17.1.el6uek.x86_64/


 And

 grep '^\(\(VERSION\)\|\(PATCHLEVEL\)\|\(SUBLEVEL\)\|\(EXTRAVERSION\)\|
 \(MAKEARGS\)\)' /lib/modules/*/build/Makefile


[root@Noi1-502156 ~]# grep
'^\(\(VERSION\)\|\(PATCHLEVEL\)\|\(SUBLEVEL\)\|\(EXTRAVERSION\)\|\(MAKEARGS\)\)'
/lib/modules/*/build/Makefile
/lib/modules/2.6.32-220.4.2.el6.x86_64/build/Makefile:VERSION = 2
/lib/modules/2.6.32-220.4.2.el6.x86_64/build/Makefile:PATCHLEVEL = 6
/lib/modules/2.6.32-220.4.2.el6.x86_64/build/Makefile:SUBLEVEL = 32
/lib/modules/2.6.32-220.4.2.el6.x86_64/build/Makefile:EXTRAVERSION =
-220.4.2.el6.x86_64
/lib/modules/2.6.39-300.17.1.el6uek.x86_64/build/Makefile:VERSION = 3
/lib/modules/2.6.39-300.17.1.el6uek.x86_64/build/Makefile:PATCHLEVEL = 0
/lib/modules/2.6.39-300.17.1.el6uek.x86_64/build/Makefile:SUBLEVEL = 36
/lib/modules/2.6.39-300.17.1.el6uek.x86_64/build/Makefile:EXTRAVERSION
= -300.17.1.el6uek.x86_64

 Check that matches the expected version.

As already mentioned, driver .ko gets generated for 2.6.39-.

Kindly let me know what you could make out of above outputs and why
exactly I am getting a   2.6.39- .ko file when I am specifying a
2.6.32- kernel header.

Regards,
Saket Sinha

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


How to use sparse to check my driver

2014-03-11 Thread m silverstri
I am trying to use sparse to check my driver that I developed.

From http://kernelnewbies.org/Sparse, It said 'make C=2
drivers/staging/wlan-ng/', what does it check it I  do 'make C=2' and
how does it actually call 'spare'? Do I need to modify my Makefile to
add a new target or something?

Thank you.

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


where is the printf source for busybox?

2014-03-11 Thread Kim Chan

Hi,
I've had this question for some time past and I would like to know the answer 
now..
I wanted to follow a printf in busybox but couldn't find the source of the 
printf function.
Then I throught probably the printf is provided by the system library where 
printf is connected to proper linux system call. (Is it printk?)
So I checkd LD_LIBRARY_PATH of my shell and found libc.so under /lib. I could 
see by 'nm libc.so' that printf is in the library.
But where can I see the printf source? Is it under gcc source? in GNU sdk, 
under glibc-2.16.0, I tried
# grep 'int printf(' * -r
but nothing comes up.
In linux kernel source doing the same gaves me
arch/x86/boot/boot.h:int printf(const char *fmt, ...);
arch/x86/boot/printf.c:int printf(const char *fmt, ...)
arch/um/include/shared/kern.h:extern int printf(const char *fmt, ...);
arch/um/os-Linux/user_syms.c:extern int printf(const char *, ...);
arch/powerpc/boot/stdio.h:extern int printf(const char *fmt, ...) 
__attribute__((format(printf, 1, 2)));
so printf is defined only for x86 architecture?
I understand printf is for user program not kernel, so I want to see how the 
printf is connected to kernel print function. (the system call, I know in 
sparc, linux system call is trap 0x90, function 59 when using assembly)
Where can I find the printf (user program) source?
Thanks in advance.
Chan





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


Re: where is the printf source for busybox?

2014-03-11 Thread Mohan L
On Wed, Mar 12, 2014 at 7:14 AM, Kim Chan c...@etri.re.kr wrote:



 Hi,
 I've had this question for some time past and I would like to know the
 answer now..
 I wanted to follow a printf in busybox but couldn't find the source of the
 printf function.
 Then I throught probably the printf is provided by the system library
 where printf is connected to proper linux system call. (Is it printk?)
 So I checkd LD_LIBRARY_PATH of my shell and found libc.so under /lib. I
 could see by 'nm libc.so' that printf is in the library.
 But where can I see the printf source? Is it under gcc source? in GNU sdk,
 under glibc-2.16.0, I tried
 # grep 'int printf(' * -r
 but nothing comes up.
 In linux kernel source doing the same gaves me
 arch/x86/boot/boot.h:int printf(const char *fmt, ...);
 arch/x86/boot/printf.c:int printf(const char *fmt, ...)
 arch/um/include/shared/kern.h:extern int printf(const char *fmt,
 ...);
 arch/um/os-Linux/user_syms.c:extern int printf(const char *, ...);
 arch/powerpc/boot/stdio.h:extern int printf(const char *fmt, ...)
 __attribute__((format(printf, 1, 2)));
 so printf is defined only for x86 architecture?
 I understand printf is for user program not kernel, so I want to see how
 the printf is connected to kernel print function. (the system call, I know
 in sparc, linux system call is trap 0x90, function 59 when using assembly)
 Where can I find the printf (user program) source?
 Thanks in advance.
 Chan


Hi Chan,

Here is Glibc printf.c code:

int
__printf (const char *format, ...)
{
  va_list arg;
  int done;

  va_start (arg, format);
  done = vfprintf (stdout, format, arg);
  va_end (arg);

  return done;
}

it in turn call vfprintf. You can see Glibc vfprintf.c
(glibc-2.18/stdio-common/vfprintf.c)

Correct me If my understanding is wrong.

Thanks
Mohan L

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


RE: where is the printf source for busybox?

2014-03-11 Thread Kim Chan

Hi, Mohan,
Thanks!  so the printf is name chagned to _printf by the compiler. I missed 
that.
Chan


From : Mohan L l.mohan...@gmail.com
Sent : 2014-03-12 11:07:45 ( +09:00 )
To : Kim Chan c...@etri.re.kr
Cc : kernelnewbies@kernelnewbies.org kernelnewbies@kernelnewbies.org
Subject : Re: where is the printf source for busybox?

On Wed, Mar 12, 2014 at 7:14 AM, Kim Chan 
c...@etri.re.krmailto:c...@etri.re.kr wrote:


Hi,
I've had this question for some time past and I would like to know the answer 
now..
I wanted to follow a printf in busybox but couldn't find the source of the 
printf function.
Then I throught probably the printf is provided by the system library where 
printf is connected to proper linux system call. (Is it printk?)
So I checkd LD_LIBRARY_PATH of my shell and found libc.so under /lib. I could 
see by 'nm libc.so' that printf is in the library.
But where can I see the printf source? Is it under gcc source? in GNU sdk, 
under glibc-2.16.0, I tried
# grep 'int printf(' * -r
but nothing comes up.
In linux kernel source doing the same gaves me
arch/x86/boot/boot.h:int printf(const char *fmt, ...);
arch/x86/boot/printf.c:int printf(const char *fmt, ...)
arch/um/include/shared/kern.h:extern int printf(const char *fmt, ...);
arch/um/os-Linux/user_syms.c:extern int printf(const char *, ...);
arch/powerpc/boot/stdio.h:extern int printf(const char *fmt, ...) 
__attribute__((format(printf, 1, 2)));
so printf is defined only for x86 architecture?
I understand printf is for user program not kernel, so I want to see how the 
printf is connected to kernel print function. (the system call, I know in 
sparc, linux system call is trap 0x90, function 59 when using assembly)
Where can I find the printf (user program) source?
Thanks in advance.
Chan

Hi Chan,

Here is Glibc printf.c code:

int
__printf (const char *format, ...)
{
  va_list arg;
  int done;

  va_start (arg, format);
  done = vfprintf (stdout, format, arg);
  va_end (arg);

  return done;
}

it in turn call vfprintf. You can see Glibc vfprintf.c 
(glibc-2.18/stdio-common/vfprintf.c)

Correct me If my understanding is wrong.

Thanks
Mohan L

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


Not mounting rootfs

2014-03-11 Thread Flavio Ceolin
Hi folks,

I trying to boot a kernel with a rootfs generated with buildroot under
qemu but with any success, the output is:

[0.814014]   Magic number: 6:562:333
[0.814522] tty tty54: hash matches
[0.815121] rtc_cmos 00:00: setting system clock to 2014-03-11 14:19:08 UTC 
(1394547548)
[0.820886] List of all partitions:
[0.821097] No filesystem could mount root, tried:
[0.821399] Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(0,0)
[0.821877] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 
3.14.0-rc5-ARCH-00265-gb01d4e6 #1
[0.822184] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[0.822550]   880007107df8 814f7bc4 
816e5af0
[0.822903]  880007107e70 814f4749 0010 
880007107e80
[0.823216]  880007107e20 880007107e28 880007107e90 
0012
[0.823421] Call Trace:

That is the way I'm invoking qemu:

qemu-system-x86_64 -boot c -m 128 -nographic -kernel ./path/to/bzImage
-hda ./buildroot-2013.05/output/images/rootfs.ext2 -append
root=/dev/ram0 console=ttyS0 init=/sbin/init

Any tip is extremely welcome :)

---
Flavio Ceolin

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


Re: where is the printf source for busybox?

2014-03-11 Thread Mohan L
On Wed, Mar 12, 2014 at 10:09 AM, Dave Hylands dhyla...@gmail.com wrote:

 Hi,


 On Tue, Mar 11, 2014 at 6:44 PM, Kim Chan c...@etri.re.kr wrote:
 
 
  Hi,
  I've had this question for some time past and I would like to know the
 answer now..
  I wanted to follow a printf in busybox but couldn't find the source of
 the printf function.
  Then I throught probably the printf is provided by the system library
 where printf is connected to proper linux system call. (Is it printk?)

 
 busybox is typically built using uclibc, which is here:
 http://www.uclibc.org/

 The printf source code within uclibc is here:
 http://git.uclibc.org/uClibc/tree/libc/stdio/printf.c

 It eveentually winds up in _vfprintf here:
 http://git.uclibc.org/uClibc/tree/libc/stdio/_vfprintf.c


Hi Dave,

I missed 

busybox. Thanks!

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


Re:Re: A new way to dive into the kernel! [Eudyptula Challenge]

2014-03-11 Thread Rahul Garg
Hi all,

I am also thinking of taking this challenge. But I found very limited
information on submission.
So can you help me what we need to submit for the Assigment 1,
will dmesg (or /proc/kmsg) output and module(assignement1.c and
Makeflie) be enough ??

Also is there any group of forum where we can discuss assignments ?

Regards
Rahul

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


Re: Re: A new way to dive into the kernel! [Eudyptula Challenge]

2014-03-11 Thread Sudip Mukherjee
I just completed successfully  task 1 .. :)

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


RE: where is the printf source for busybox?

2014-03-11 Thread Kim Chan
Hello Dave, (and Mohan)
Thanks for the nice info.

I've downloaded uClibc code and ran ctags -R and searched down printf.
It looks like the main print path is  (assuming __STDIO_BUFFERS : I guess user 
level buffer for stdin, stdout, stderr) and assuming STDIO_GETC/PUTC_MACRO 
defined. without the macro, it seems to directly go to __fputc_unlocked..)
printf - vfprintf (very complex doing all the format conversions..) - PUTC - 
putc_unlocked - __FPUTC_UNLOCKED -(after some macro conversion) 
__fputc_unlocked - __stdio_WRITE (sometime write only to buffer) - __WRITE - 
__gcs.write - write

in libc/stdio/_stdio.h, the __gcs.wirte is assigned to _cs_write and
in libc/stdio/_cs_funcs.c,  the _cs_write function is defined as below.
ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t 
bufsize)
{
return write(*((int *) cookie), (char *) buf, bufsize);
}
what does cs stand for here? (Hm.. seems like custom streams..in the code) and 
I couldn't follow past write above. Where is the function write defined?
Any hint will be deeply appreciated and if I'm wrong with something, please 
correct me.
Thanks and regards,

Chan

From : Dave Hylands dhyla...@gmail.com
Sent : 2014-03-12 13:39:11 ( +09:00 )
To : Kim Chan c...@etri.re.kr
Cc : kernelnewbies@kernelnewbies.org kernelnewbies@kernelnewbies.org
Subject : Re: where is the printf source for busybox?

Hi,

On Tue, Mar 11, 2014 at 6:44 PM, Kim Chan 
c...@etri.re.krmailto:c...@etri.re.kr wrote:


 Hi,
 I've had this question for some time past and I would like to know the answer 
 now..
 I wanted to follow a printf in busybox but couldn't find the source of the 
 printf function.
 Then I throught probably the printf is provided by the system library where 
 printf is connected to proper linux system call. (Is it printk?)

busybox is typically built using uclibc, which is here:
http://www.uclibc.org/

The printf source code within uclibc is here:
http://git.uclibc.org/uClibc/tree/libc/stdio/printf.c

It eveentually winds up in _vfprintf here:
http://git.uclibc.org/uClibc/tree/libc/stdio/_vfprintf.c

--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.comhttp://www.davehylands.com/
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies