Re: Where does the linux kernel put local variables

2015-08-04 Thread Rock Lee
Hi, Dave

 If you look at the linker script file for the kernel
 http://lxr.free-electrons.com/source/arch/arm/kernel/vmlinux.lds.S#L244
 , you'll see that INIT_TASK_DATA (which includes the kernel stack) is
 between _data and _edata. This is the stack used for kernel booting and
 then taken over by the init task.

Thanks for your advice ,after read 
http://lxr.free-electrons.com/source/arch/arm/kernel/head-common.S#L122, 
I'v got my answer.
-- 
Rock Lee

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


Re: Newbie help

2015-08-04 Thread Bjørn Mork
Rishabh Chakrabarti bassdevelo...@gmail.com writes:

 Hello all,

 Where can I search the archives and other resources for answering the
 following questions:
   
 1. How to dive into the code? i.e. entry points

Wherever your interest is. There are no strict rules.  If you don't know
ahere your interest is, then you should ask yourself why you are
interested in the Linux kernel in the first place.

Out of your areas of interest, try to find a part of the kernel which is
well maintained and have (semi-)sufficient reviewer resources, because
you will need that as a newbie. You may use the Status field in
MAINTAINERS as an initial guide, but only recent mailing list archives
will tell for sure.  Look for comments and feedback on patches.

 2. What are the pre-requisites for understanding the whole code?

I don't think that is possible...

You should understand the part you want to modify.  You'll need some
knowledge of C, and an ability to learn.  The latter is most important.

 3. Best books and resource material

I see that Documentation/ and LDD3 is already mentioned. Other than
that: The source code is there, and is much more readable and commented
than most other C projects.  Use it.  Reading code, and trying to figure
out how it works and why it was written like that, is a great way to
learn.

Use the git commit messsages to help understanding if there is something
which isn't obvious (there will be, of course).  Every single commit is
justified and explained and in detail in git.  And you will have to do
the same, so you should familiarize yourself with those messages in any
case.


Bjørn

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


Re: Where does the linux kernel put local variables

2015-08-04 Thread Dave Hylands
Hi Rock,

On Mon, Aug 3, 2015 at 7:28 PM, Rock Lee rocklee_...@outlook.com wrote:

 Hi, all:
 I print a local variable address in start_kernel(), and I realize
this
 address is between __data_start and _edata. In my opinion,
 local variables should be located in stack, why is this local variable
 located in data section? BTW, I use a arm11 board with linux-2.6.28.


If you look at the linker script file for the kernel
http://lxr.free-electrons.com/source/arch/arm/kernel/vmlinux.lds.S#L244 ,
you'll see that INIT_TASK_DATA (which includes the kernel stack) is between
_data and _edata. This is the stack used for kernel booting and then taken
over by the init task.

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


Re: Newbie help

2015-08-04 Thread Schrey, Moritz
If your goals tend towards 

* creating something new or
* having a clearer look onto the interfaces between modules/layers

get a copy of Linux Device Drivers (abbreviated LDD3 here), which is 
available online. The example code from that book is definitey outdated and 
will not compile as is since it is based on 2.6.10(?), but finding the errors 
is a good exercise too. 
Since the book is widely known, you will also find several repos, which brought 
the code up to some more recent kernel version. 
I guess we are all more or less eagerly waiting for LDD4, which should be 
released in end of November. 

Regards, 
Moritz

 -Ursprüngliche Nachricht-
 Von: kernelnewbies-boun...@kernelnewbies.org [mailto:kernelnewbies-
 boun...@kernelnewbies.org] Im Auftrag von Rishabh Chakrabarti
 Gesendet: Montag, 3. August 2015 16:38
 An: kernelnewbies@kernelnewbies.org
 Betreff: Newbie help
 
 Hello all,
 
 Where can I search the archives and other resources for answering the
 following questions:
 
 1. How to dive into the code? i.e. entry points 2. What are the pre-
 requisites for understanding the whole code?
 3. Best books and resource material
 
 Kindly keep a lay person in mind while answering.
 Please direct me to the right place and the rest i'll DIY. Thank you.
 
 Regards,
 
 Rishabh
 
 ___
 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: Newbie help

2015-08-04 Thread Manavendra Nath Manav
On Tue, 4 Aug 2015 at 13:51 Bjørn Mork bj...@mork.no wrote:

 Rishabh Chakrabarti bassdevelo...@gmail.com writes:

  Hello all,
 
  Where can I search the archives and other resources for answering the
  following questions:
 
  1. How to dive into the code? i.e. entry points

  2. What are the pre-requisites for understanding the whole code?

  3. Best books and resource material


You can refer this answer from Stackoverflow:

http://unix.stackexchange.com/questions/1003/linux-kernel-good-beginners-tutorial/177539#177539
It basically provides a bird's eye view of the Linux kernel along with it's
broader subsystems with links to related books/resources. I am reproducing
parts of the answer below:

**TODO** +editPic: Linux Kernel Developer - (Ring Layer 0) +addSection:
Kernel Virtualization Engine KERN_WARN_CODING_STYLE: Do not Loop unless you
absolutely have to.

Recommended Books for the Uninitialized void *i: Men do not understand
books until they have a certain amount of life, or at any rate no man
understands a deep book, until he has seen and lived at least part of its
contents. –Ezra Pound. A journey of a thousand code-miles must begin with
a single step. If you are in confusion about which of the following books
to start with, don't worry, pick any one of your choice. Not all those who
wander are lost. As all roads ultimately connect to highway, you will
explore new things in your kernel journey as the pages progress without
meeting any dead ends, and ultimately connect to the code-set. Read with
alert mind and remember: Code is not Literature.

What is left is not a thing or an emotion or an image or a mental picture
or a memory or even an idea. It is a function. A process of some sort. An
aspect of Life that could be described as a function of something larger.
And therefore, it appears that it is not really separate from that
something else. Like the function of a knife - cutting something - is not,
in fact, separate from the knife itself. The function may or may not be in
use at the moment, but it is potentially NEVER separate.

Solovay Strassen Derandomized Algorithm for Primality Test: Read not to
contradict and confute; nor to believe and take for granted; nor to find
talk and discourse; but to weigh and consider. Some books are to be tasted,
others to be swallowed, and some few to be chewed and digested: that is,
some books are to be read only in parts, others to be read, but not
curiously, and some few to be read wholly, and with diligence and
attention.
---
Core Linux ( 5 - 1 - 3 - 2 - 7 - 4 - 6 ) “Nature has neither kernel
nor shell; she is everything at once” -- Johann Wolfgang von Goethe Reader
should be well versed with operating system concepts; a fair understanding
of long running processes and its differences with processes with short
bursts of execution; fault tolerance while meeting soft and hard real time
constraints. While reading, it's important to understand and n/ack the
design choices made by the linux kernel source in the core subsystems.
Threads [and] signals [are] a platform-dependent trail of misery, despair,
horror and madness (~Anthony Baxte). That being said you should be a
self-evaluating C expert, before diving into the kernel. You should also
have good experience with Linked Lists, Stacks, Queues, Red Blacks Trees,
Hash Functions, et al. volatile int i; int main(void) { int c; for (i=0;
i3; i++) { c = ii; printf(%d\n, c); /* find c */ } return 0; } The
beauty and art of the Linux Kernel source lies in the deliberate code
obfuscation used along. This is often necessitated as to convey the
computational meaning involving two or more operations in a clean and
elegant way. This is especially true when writing code for multi-core
architecture.
-
Device Drivers ( 1 - 2 - 4 - 3 - 8 - ... ) Music does not carry you
along. You have to carry it along strictly by your ability to really just
focus on that little small kernel of emotion or story. -- Debbie Harry
Your task is basically to establish a high speed communication interface
between the hardware device and the software kernel. You should read the
hardware reference datasheet/manual to understand the behavior of the
device and it's control and data states and provided physical channels.
Knowledge of Assembly for your particular architecture and a fair knowledge
of VLSI Hardware Description Languages like VHDL or Verilog will help you
in the long run. Intel® 64 and IA-32 Architectures Software Developer’s
Manual ARM Architecture Reference Manual ARM System Developer's Guide Q:
But, why do I have to read the hardware specs? A: Because, There is a
chasm of carbon and silicon the software can't bridge - Rahul Sonnad
However, the above doesn't poses a problem for Computational Algorithms
(Driver code - bottom-half processing), as it can 

Requirement to customize Linux Network Interface naming Convention

2015-08-04 Thread Akash Bhatnagar
Hi,

We have a requirement to tweak the Linux Network Interface Naming
conventions so that, it can support names of interfaces with / character.

For example, ip tuntap add dev fe/1/1 mode tap

With iproute2 it simply shows error as INVALID Argument. What are the
changes we supposed to do inside Kernel and iproute2 package?

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


Re: debugging kernel module __init function?

2015-08-04 Thread Valdis . Kletnieks
On Tue, 04 Aug 2015 12:23:18 -0700, Nicholas Murphy said:

 How do I debug the __init function (that is called on module load)?

Is your .init function actually doing so much odd stuff that a few
carefully placed printk() calls aren't sufficient?


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


debugging kernel module __init function?

2015-08-04 Thread Nicholas Murphy
I can’t for the life of me figure out how to set a breakpoint on a kernel 
module’s __init function.  Everything I’ve read talks about using 
add-symbol-file with the values for .text, .bss, and .data after the module is 
loaded, a la:

https://www.linux.com/learn/linux-training/33991-the-kernel-newbie-corner-kernel-and-module-debugging-with-gdb

How do I debug the __init function (that is called on module load)?

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


Re: debugging kernel module __init function?

2015-08-04 Thread Nicholas Murphy
In this case, no.  But I’m curious if there’s a way to pull this off, or if 
it’s fundamentally impossible?

Thanks,
Nick

 On Aug 4, 2015, at 1:07 PM, valdis.kletni...@vt.edu wrote:
 
 On Tue, 04 Aug 2015 12:23:18 -0700, Nicholas Murphy said:
 
 How do I debug the __init function (that is called on module load)?
 
 Is your .init function actually doing so much odd stuff that a few
 carefully placed printk() calls aren't sufficient?


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


Re: debugging kernel module __init function?

2015-08-04 Thread Aruna Hewapathirane
 In this case, no.  But I’m curious if there’s a way to pull this off, or if 
 it’s fundamentally impossible?

What happens 'after' __init gets called ?

After boot, the kernel frees up a special section. All functions
marked with __init and data structures marked with __initdata are
dropped after boot is complete.

Similarly 'modules' DISCARD this memory after initialization.

So what is the workaround ?  Write the module_init function without
the __init attribute.

( They never read the documentation :
/Documentation/DocBook/kernel-hacking.tmpl , I never used to read the
documentation either :)

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