LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   location of folder named "kernel" (https://www.linuxquestions.org/questions/linux-newbie-8/location-of-folder-named-kernel-671179/)

sugantha 09-20-2008 02:22 AM

location of folder named "kernel"
 
Hello...I am working on my final year project and which is improving the Process scheduling algorithm. I ve learnt that the location of the scheduling algorithm is "/kernel/sched.c" ... I am trying to locate the file to read the code but I cant locate a folder by name kernel under '/' ....I am running a Fedora 8 system with kernel version 2.6.25.14-69.fc8...Does the location of the sched.c file differ from distro to distro...If yes, then how to locate the file in fedora...Thanks in advance.

druuna 09-20-2008 06:07 AM

Hi,

There is a sched.c in the kernel source directory (don't know if Fedora installs this by default).

My kernel source is located in: /usr/src/linux-2.6.X/ One of its subdirs is kernel, which holds the sched.c file (there are a lot more sched.c files, make sure you pick the correct one).

Hope this helps.

i92guboj 09-20-2008 06:31 AM

Quote:

Originally Posted by sugantha (Post 3286250)
Hello...I am working on my final year project and which is improving the Process scheduling algorithm. I ve learnt that the location of the scheduling algorithm is "/kernel/sched.c" ... I am trying to locate the file to read the code but I cant locate a folder by name kernel under '/' ....I am running a Fedora 8 system with kernel version 2.6.25.14-69.fc8...Does the location of the sched.c file differ from distro to distro...If yes, then how to locate the file in fedora...Thanks in advance.

Many things...
  • Binary distros like fedora don't usually install the kernel sources. Since the kernel comes precompiled, all they install is a binary image, the kernel will be under /boot and the modules under /lib/modules/$(uname -r)/.
  • On these distros the sources for the kernel can be installed usually via a package with the same name of your kernel but ending in -sources, -dev, -devel or something like that.
  • If you intend to do this for a course project or something like that, then you should consider using stock kernels, and not distro specific kernels. If you develop on top of a patched kernel like the fedora one, you risk your patch not being able to apply over any other sources than those of fedora.
  • You should also pick a concrete version as target for your patch. For example, 2.6.25 or 2.6.26.5 or whatever else.

So, my advise is to go here:

http://www.eu.kernel.org/pub/linux/kernel/v2.6/

Those are stock 2.6 kernels, as released by the linux kernel team, vanilla kernels without any modification or 3rd party patch. Pick one kernel, whichever you prefer, download it, unpack it on your home, and use that same tree to develop your whole patch.

This way you ensure that you are using a standard kernel, and by having it on your home you make sure that no update will break it and render useless your patch.

EDITED: Just in case I wasn't clear enough, a patch made for a version of the kernel might not work against other version. So, if this is a project for the college, you should ask if the patch needs to work against a given version of the linux kernel, and if affirmative, use that version to design your patch.

knudfl 09-20-2008 07:00 AM

The package 'kernel-devel' installs to e.g.
/usr/src/kernels/2.6.23.1-42.fc8-i686 but only contains
a limited set of files.

Example again :
The "full kernel-source" , I found :
The package 'kernel-2.6.23.1-42.fc8.src.rpm'
http://download.fedora.redhat.com/pu.../source/SRPMS/
which will "install" (unpack) to
/usr/src/redhat/SOURCES/linux-2.6.23.tar.bz2 + 170 patches
and other files. 'linux-2.6.23.tar.bz2' can be unpacked to
/home/sugantha/tmp with 'tar xvf linux-2.6.23.tar.bz2'

"sched.c" will then be in /home/sugantha/tmp/linux-2.6.23/kernel

I did not find your version of kernel, 2.6.25.14 is probably
available at kernel.org and you have some patches possibly
still valid for this version, if needed.

Regards

sugantha 09-20-2008 09:42 AM

Thanks a lot i92guboj, druuna, knudfl...
I am downloading the kernel version linux-2.6.26.5...if I use the header files of this version and when I am finally done with the implementation of sched.c, how do I integrate the kernel with the rest of the system to test it. This is too early at this stage but I would feel more comfortable to start with all this information...Thanks a ton.

onebuck 09-20-2008 02:25 PM

Hi,

You should look at the 'Linux Kernel in a Nutshell'. A real good kernel reference. There are other kernel references with the below link.

This link and others are available from 'Slackware-Links'. More than just SlackwareŽ links!

sugantha 09-20-2008 09:39 PM

Thanks Onebuck...
This project needs to be submitted only on the may of next year.So that gives me lot of time to learn the basics. Understanding the Linux kernel is also a good book I heard.Thanks for all your suggestions ppl...

Quakeboy02 09-20-2008 10:28 PM

Quote:

Originally Posted by sugantha (Post 3286868)
Thanks Onebuck...
This project needs to be submitted only on the may of next year.So that gives me lot of time to learn the basics. Understanding the Linux kernel is also a good book I heard.Thanks for all your suggestions ppl...

In that case, your first milestone is to successfully compile a kernel and boot from it. Good luck.

onebuck 09-21-2008 07:50 PM

Hi,
Quote:

Originally Posted by sugantha (Post 3286868)
Thanks Onebuck...
This project needs to be submitted only on the may of next year.So that gives me lot of time to learn the basics. Understanding the Linux kernel is also a good book I heard.Thanks for all your suggestions ppl...

Time flies!

BTW, Your Welcome.

i92guboj 09-22-2008 04:31 AM

Quote:

Originally Posted by sugantha (Post 3286868)
Thanks Onebuck...
This project needs to be submitted only on the may of next year.So that gives me lot of time to learn the basics. Understanding the Linux kernel is also a good book I heard.Thanks for all your suggestions ppl...

You need to understand the basic procedures before you can work on a patch for the kernel. Things like configuring a kernel, compiling it and boot it correctly should be the first things that you will need to know, because without these, you can't even enable and test your patch.

sugantha 09-23-2008 09:33 AM

Quote:

Originally posted by Onebuck
Time flies!
hehe...It sure does.Will try to learn things fast...And compiling the kernel is my first goal. I see a lot of good tutorials online...will try soon and get back in case I have a problem...Thanks and Regards.


All times are GMT -5. The time now is 08:21 AM.