LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-08-2011, 09:07 PM   #1
gschen2010
LQ Newbie
 
Registered: Jan 2011
Location: Shanghai,China
Posts: 4

Rep: Reputation: 0
Talking how can I get to learn linux kernel


hi, I am a fresh man, and I am very interesting in linux kernel programing. I want to ask a question that how can I access this programing easily and effectively.

Thanks for all of you!

Last edited by gschen2010; 01-08-2011 at 09:08 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-08-2011, 09:59 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by gschen2010 View Post
hi, I am a fresh man, and I am very interesting in linux kernel programing. I want to ask a question that how can I access this programing easily and effectively.

Thanks for all of you!
http://kernelnewbies.org/
 
2 members found this post helpful.
Old 01-08-2011, 10:03 PM   #3
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
I recommend the Linux Kernel Newbies website. If you're new to Linux, better check out the Introduction to Linux and Linux.com and perhaps the Introduction to Linux first.

The Linux kernel uses the C (not C++) programming language; unless you are familiar with it, you won't be able to get much out of the source code. Please don't ask the kernel developers to teach you C, that would be extremely rude.

The C source for the Linux kernel is available at kernel.org. The gitweb link will show you the latest changes applied; click the tree link to browse the entire source code tree.

Various distributions like Debian, Ubuntu and Fedora use a specific version of the Linux kernel, with a number of "patches" applied. These patches are also available, but from the distribution itself; they are mostly bug fixes and sometimes new device drivers backported to work on the "older" kernel used by the distribution. Distributions do this "stabilization" work in order for users to get all bug fixes, but otherwise as few changes as possible. (This is actually quite beneficial for all, including users: we get rapid development from the vanilla kernel developers, and also stabilization and bug fixes from the distribution kernel maintainers!)

You might get most benefits for yourself by first installing a user-friendly Linux distribution such as Ubuntu on your computer. Personally, I use Xubuntu, but do pick whichever you feel best suited for you. There is a large list of Linux distributions at Distrowatch.com. Then, after familiarizing yourself with it, install the linux-source package (name might vary in other distributions), to get the kernel source code for the kernel version you're running.

You can also install Linux easily in a virtual machine; personally I use VirtualBox. (It's best installed via the distribution's own package manager, just like almost all software. Don't ask me how to use it in Windows; it don't touch that stuff.) With a virtual machine running a Linux distribution, and either another virtual machine or your "real" workstation running the same distribution, you can make changes to the kernel sources, recompile it in minutes, install the new kernel into a virtual machine, and run your customized kernel, without ever rebooting your computer, and never interrupting your work flow.

Although Linux is open and free, don't expect it (especially the kernel) to be simple. If you want to really understand and work with it, you'll have to invest a lot of time learning it. (To be honest, you'll probably spend more time initially in "un-learning" stuff, in learning that there are multiple ways to do things - and the way you do it with Windows is often not the best way to do it in Linux.) In my experience the time is well worth the effort, though
Nominal Animal

Last edited by Nominal Animal; 03-21-2011 at 01:41 AM.
 
1 members found this post helpful.
Old 01-09-2011, 06:14 AM   #4
gschen2010
LQ Newbie
 
Registered: Jan 2011
Location: Shanghai,China
Posts: 4

Original Poster
Rep: Reputation: 0
Thumbs up thanks for your reply

Quote:
Originally Posted by Nominal Animal View Post
I recommend the Linux Kernel Newbies website. If you're new to Linux, better check out the Introduction to Linux and Linux.com and perhaps the Introduction to Linux first.

The Linux kernel uses the C (not C++) programming language; unless you are familiar with it, you won't be able to get much out of the source code. Please don't ask the kernel developers to teach you C, that would be extremely rude.

The C source for the Linux kernel is available at kernel.org. The gitweb link will show you the latest changes applied; click the tree link to browse the entire source code tree.

Various distributions like Debian, Ubuntu and Fedora use a specific version of the Linux kernel, with a number of "patches" applied. These patches are also available, but from the distribution itself; they are mostly bug fixes and sometimes new device drivers backported to work on the "older" kernel used by the distribution. Distributions do this "stabilization" work in order for users to get all bug fixes, but otherwise as few changes as possible. (This is actually quite beneficial for all, including users: we get rapid development from the vanilla kernel developers, and also stabilization and bug fixes from the distribution kernel maintainers!)

You might get most benefits for yourself by first installing a user-friendly Linux distribution such as Ubuntu on your computer. Personally, I use Xubuntu, but do pick whichever you feel best suited for you. There is a large list of Linux distributions at Distrowatch.com. Then, after familiarizing yourself with it, install the linux-source package (name might vary in other distributions), to get the kernel source code for the kernel version you're running.

You can also install Linux easily in a virtual machine; personally I use VirtualBox. (It's best installed via the distribution's own package manager, just like almost all software. Don't ask me how to use it in Windows; it don't touch that stuff.) With a virtual machine running a Linux distribution, and either another virtual machine or your "real" workstation running the same distribution, you can make changes to the kernel sources, recompile it in minutes, install the new kernel into a virtual machine, and run your customized kernel, without ever rebooting your computer, and never interrupting your work flow.

Although Linux is open and free, don't expect it (especially the kernel) to be simple. If you want to really understand and work with it, you'll have to invest a lot of time learning it. (To be honest, you'll probably spend more time initially in "un-learning" stuff, in learning that there are multiple ways to do things - and the way you do it with Windows is often not the best way to do it in Linux.) In my experience the time is well worth the effort, though
Nominal Animal

Thank you very very much!
 
Old 01-12-2011, 02:31 PM   #5
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
Eh? Is it really possible for ONE person to understand what, 20 years of work, by probably thousands of people??!!

Why don't you just design your OWN OS, gschen?
 
0 members found this post helpful.
Old 01-12-2011, 10:37 PM   #6
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by gschen2010 View Post
I am very interesting in linux kernel programing. I want to ask a question that how can I access this programing easily and effectively.

Last edited by Aquarius_Girl; 01-13-2011 at 01:36 AM. Reason: added bullets
 
Old 01-13-2011, 01:57 AM   #7
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Nominal Animal View Post
... The Linux kernel uses the C (not C++) programming language ...
This is correct, but requires a clarification. The language is neither C89 (ANSI "C"), nor C99, but GNU dialect of "C". I.e. to compile Linux kernel one needs 'gcc' and not just any standards compliant "C" compiler.
 
2 members found this post helpful.
Old 01-13-2011, 02:12 AM   #8
Vermidias
Member
 
Registered: Dec 2010
Location: GERMANY
Posts: 32

Rep: Reputation: 2
simple example for driver programming
http://people.ee.ethz.ch/~arkeller/l...ace_howto.html

---------- Post added 01-13-11 at 09:12 AM ----------

simple example for driver programming
http://people.ee.ethz.ch/~arkeller/l...ace_howto.html
 
Old 01-13-2011, 04:47 AM   #9
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
Quote:
Originally Posted by Sergei Steshenko View Post
This is correct, but requires a clarification. The language is neither C89 (ANSI "C"), nor C99, but GNU dialect of "C". I.e. to compile Linux kernel one needs 'gcc' and not just any standards compliant "C" compiler.
Right. Some compilers (Intel Compiler Collection and Open64) are GCC-compatible enough to compile a working kernel, but it is not recommended at all; there might be bugs nobody has noticed yet in the end result. And development versions of GCC often fail to build a working kernel.

You should use the stable GCC version that your Linux distribution provides to compile the kernel. It should be what the distribution maintainers have used to compile the distribution kernel. On Debian (and variants like Ubuntu), you can use the make-kpkg script (part of kernel-package) to build installable kernel packages with just one command. (You don't have to use the distribution sources or patches, it works fine with kernel sources downloaded from kernel.org.)

If you are unsure, the file Documentation/Changes in the Linux kernel sources describes the versions of tools needed to compile the kernel on Linux; those, or any later stable (not development or beta) versions should be okay, unless the file says otherwise. There is also Documentation/HOWTO to help aspiring kernel developers further along.
Nominal Animal

Last edited by Nominal Animal; 03-21-2011 at 03:21 AM.
 
Old 01-13-2011, 05:20 AM   #10
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Nominal Animal View Post
... development versions of GCC often fail to build a working kernel. ...
IIRC there was a case that even the released 'gcc' failed to compile Linux kernel.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Learn how to invoke Linux kernel function system calls LXer Syndicated Linux News 0 04-07-2010 09:10 PM
Learn How To Compile The Linux Kernel AwesomeMachine Linux - Newbie 18 02-13-2010 02:12 PM
How to learn kernel programming? vrishankaryan Linux - Newbie 6 08-16-2007 02:49 AM
How to learn kernel ? yangwuking Linux - Newbie 1 12-27-2004 07:48 AM
Best way to learn to hack the kernel Boudewijn Programming 5 11-12-2004 08:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration