Re: Linux Kernel and Device Drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks to Srinivas and others. I got a point to start from.

Regards,
Prakash


On Thu, Jul 18, 2013 at 12:01 PM, Srinivas Ganji <srinivasganji.kernel@xxxxxxxxx> wrote:
Yes. As said by Anish, I generally practice through a dummy hello world module. Suppose, if I want to print all the processes currently running, I do like this.

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>

MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
struct task_struct *task; 

printk("Hello World!\n");
for_each_process(task) {
printk("%s %d\n", task->comm, task->pid);
}
printk("\n\n\n");
for(task = &init_task; ((task=next_task(task)) != &init_task) ; )
printk("%s %d\n", task->comm, task->pid);
printk("\n\n\n");
return 0;
}

static void hello_exit(void)
{
printk("Good bye!\n");
}

module_init(hello_init);
module_exit(hello_exit);

By the way, you can do as suggested by Valdis, too. I do search for a particular code/strings using find, xargs, grep combination.

I hope this helps you.

Regards,
Srinivas



On Tue, Jul 16, 2013 at 12:42 PM, Satya Prakash Prasad <unixkernel497@xxxxxxxxx> wrote:
Thanks .. I have another question. I was trying to practice some kernel process management APIs as in http://reiber.org/nxt/pub/Linux/LinuxKernelDevelopment/Linux.Kernel.Development.3rd.Edition.pdf (Linux Kernel Development by Robert Love, 3rd edition).

I am not sure how to practice the code snippet given in the text book. I can understand the theory but do not find a way to practice. For example: I want to read a process 'struct task_struct' to find it parent's process identifier, how many tasks are in which state, creating kernel threads etc?

Any idea?


On Mon, Jul 15, 2013 at 2:32 PM, Srinivas Ganji <srinivasganji.kernel@xxxxxxxxx> wrote:
As per as I know, you can follow two text books. 

1. Linux Kernel Development by Robert Love, 3rd edition. 
2. Linux Device Drivers by Alessandro Rubini, Jonathan Corbet, Greh Kroah-Hartman. 3rd edition.

At the same time, you can practice the exercises given in the text books - practice makes a man perfect. The other thing is "Make your hands dirty by digging the kernel code whenever you have a doubt".

Regards,
Srinivas




On Mon, Jul 15, 2013 at 2:06 PM, Satya Prakash Prasad <unixkernel497@xxxxxxxxx> wrote:
Please let me know how to study and get hands on experience on Linux Kernel and Device Drivers?

Regards,
Prakash

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





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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux