How to add code into the linux kernel?

1

I am studying how to analyse and evaluate the TCP/IP protocol stack of Linux. My goal is to study the performance of the tcp/ip protocol stack as a whole, to study the time cost of each layer and interaction between the layers of tcp/p protocol and queuinf of the ip layer.

To do the above : I am using a probing node based schema to to study the internal behaviour of TCP/IP protocol of linux. probing node is a piece of code added into the kernel to record the information like timestamp, queuing length and size of packet.

my question : how to add the probing node into the kernel ?

user313912

Posted 2014-04-08T11:17:42.103

Reputation: 11

Answers

1

You should start by downloading, configuring, building and installing the Linux kernel from scratch. This in itself is no small task, in particular the configuration part, and will teach you much about the kernel and its structure.

When you're ready to start inserting code, a good place to start reading is in net/ipv4 in the kernel source tree. Linux's implementation of TCP resides there.

Flup

Posted 2014-04-08T11:17:42.103

Reputation: 3 151

I already installed a linux kernel but dont know where will be the kernel source code exactly ? – user313912 – 2014-04-08T11:41:20.573

You need the source, not just the kernel. You can download it from the official Linux kernel site at https://www.kernel.org/ .

– Flup – 2014-04-08T11:43:07.110

In the existing installed kernel - it contains the all the libraries in /usr/linux/linux version/include/linux – user313912 – 2014-04-08T12:12:30.940