|
1 | 1 |
|
| 2 | +First up, some basics about the source code control tool that the Linux |
| 3 | +kernel uses, git. Git can be found in any Linux distro these days, and |
| 4 | +there are numerous good tutorials on how to use it and set it up |
| 5 | +availble on the web. One good one is comes within git itself, and can |
| 6 | +be read by running: |
| 7 | + $ man gittutorial |
| 8 | +after you have installed git on your machine. |
| 9 | + |
| 10 | +So run off and install git on your Linux system using the package |
| 11 | +manager you are comfortable with (personally, I use openSUSE, and a |
| 12 | +simple 'zypper install git' does everything that is needed.) |
| 13 | + |
| 14 | +Then start by cloning the main Linux kernel repository: |
| 15 | + |
| 16 | + $ mkdir ~/linux |
| 17 | + $ cd ~/linux |
| 18 | + $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git |
| 19 | + |
| 20 | +This will create the directory 'linux-2.6' within the linux/ directory. |
| 21 | +Everything we do from here out will be within that directory, so go into |
| 22 | +it to start with: |
| 23 | + $ cd ~/linux/linux-2.6 |
| 24 | + |
| 25 | +Now that you have the raw source code, how do you build it and install |
| 26 | +it on your system? That is a much larger task, one that is beyond this |
| 27 | +article. Luckily a whole book has been written on this topic, "Linux |
| 28 | +Kernel in a Nutshell", and can be found free online at: |
| 29 | + http://www.kroah.com/lkn/ |
| 30 | +if you don't want to purchase it. |
| 31 | + |
| 32 | +So go and get your kernel configured and building, and then come back |
| 33 | +here to figure out what to do next. |
| 34 | + |
| 35 | + |
| 36 | +-- Git tips |
| 37 | + |
| 38 | +Here are a few tips to use with git when working with the kernel source |
| 39 | +tree. First off, never do your work on the same branch that Linus |
| 40 | +pushes to, called "master". Create your own branch, and use that |
| 41 | +instead. This ensures that any changes that are committed to Linus's |
| 42 | +branch upstream, will be able to be updated by you without any problems. |
| 43 | + |
| 44 | +To create a new branch called 'tutorial' and check it out, do the |
| 45 | +following: |
| 46 | + $ git branch tutorial |
| 47 | + $ git checkout tutorial |
| 48 | +That's it. You are now in the 'tutorial' branch of your kernel |
| 49 | +repository, as can be seen by the following command: |
| 50 | + $ git branch |
| 51 | + master |
| 52 | + * tutorial |
| 53 | +The '*' in front of the 'tutorial' name shows that you are on the |
| 54 | +correct branch. |
| 55 | + |
| 56 | +Now, let's go and make some changes to the kernel code. |
| 57 | + |
| 58 | +-- What to change |
| 59 | + |
| 60 | +Wait, you don't know what change you want to make to the Linux kernel |
| 61 | +source tree? Everything is working just fine for you? Well, don't |
| 62 | +dispair, the Linux kernel developers need all the help they can get, and |
| 63 | +have plenty of code in the tree that is just waiting to get cleaned up. |
| 64 | + |
| 65 | +The code in the drivers/staging/ tree consists of a lot of drivers that |
| 66 | +do not meet the normal Linux kernel coding guidelines. The code is in |
| 67 | +that location so that other developers can help on cleaning it up, and |
| 68 | +getting it merged into the main portion of the Linux kernel tree. |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
2 | 76 |
|
3 | 77 | git stuff |
4 | 78 |
|
|
0 commit comments