LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-20-2011, 09:02 AM   #1
dolphin77
Member
 
Registered: May 2009
Location: Odesa, Ukraine
Distribution: Slackware
Posts: 206

Rep: Reputation: 60
Building linux kernel from git


For those willing to follow kernel updates, it becomes a bit tricky, since kernel.org is not updated for some time. The latest version there is still 3.0.4. While 3.0.7 is already prepared.

For me it was quite new to get kernel repository from git. Perhaps other people will find it very straight forward, but for me it was tricky. For any case I decided to share my findings. Hope it would be useful for anyone.

First I got master repository:
Code:
# cd /usr/src
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.0.y
then I made a script in my home dir kernel-build_git.sh:
Code:
cd /usr/src/linux-3.0.y
git checkout v$1
cp /boot/config-generic-3.0.4 .config
make oldconfig
make bzImage modules modules_install
cp arch/x86_64/boot/bzImage /boot/vmlinuz-generic-$1
cp System.map /boot/System.map-generic-$1
cp .config /boot/config-generic-$1
mkinitrd -c -k $1 -m ext4 -f ext4 -r /dev/cryptvg/root -C /dev/sda2 -L -o /boot/initrd-$1.gz
correct the path to your initial config file. Also check initrd preparation to suit your system. Also do not forget to check lilo.conf accordingly.

Now to build linux-3.0.7, I just type:
Code:
sh kernel-build_git.sh 3.0.7
my lilo.conf part for the new kernel:
Code:
image = /boot/vmlinuz-generic-3.0.7
  root = /dev/cryptvg/root
  initrd = /boot/initrd-3.0.7.gz
  label = Linux-3.0.x
  read-only
good luck.

Last edited by dolphin77; 10-20-2011 at 09:36 AM.
 
Old 10-20-2011, 10:02 AM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,873

Rep: Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982
Good guide dolphin.

With the recent kernel.org outage, I've recently converted to using git too.

You might want to add the following to your script after the checkout just to make sure it's nice and clean and there are no stale files laying around.
It might not be necessary, but it doesn't hurt.
Code:
git clean -d -f
make mrproper

Also, given recent developments at kernel.org verifying the tag might not be a bad idea:
Code:
build@slack:/local/mirrors/linux-stable.git$ git tag -v v3.0.7
object 62bf7928bfe312ec6cf829b06893eb5649ceaec5
type commit
tag v3.0.7
tagger Greg Kroah-Hartman <gregkh@suse.de> 1318870270 -0700

This is the 3.0.7 stable release
gpg: Signature made Mon 17 Oct 2011 17:51:18 BST using RSA key ID 6092693E
gpg: Good signature from "Greg Kroah-Hartman (Linux kernel stable release signing key) <greg@kroah.com>"
build@slack:/local/mirrors/linux-stable.git$

Last edited by GazL; 10-20-2011 at 10:05 AM.
 
1 members found this post helpful.
Old 10-20-2011, 10:12 AM   #3
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,060

Rep: Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139
I am aware that git is fun but if can be useful, I'm maintaining for my own use some unofficial patches/tarballs while I wait for the stuff to be back online (they are made with "git diff" and "git archive")

http://ponce.cc/testing/kernel/
 
Old 10-20-2011, 11:28 AM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Nice dolphin

I may combine this with my kernel packaging script and make it an all-in-wonder
 
Old 10-20-2011, 11:29 AM   #5
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
By way, anyone know a way of finding when git version changes (without browsing via web that is)?
 
Old 10-20-2011, 01:07 PM   #6
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware
Posts: 1,134

Rep: Reputation: 277Reputation: 277Reputation: 277
Quote:
Originally Posted by dive View Post
By way, anyone know a way of finding when git version changes (without browsing via web that is)?
Run a cron that does a git pull, or git-request-pull, and notifies you of the results...?

cheers,

Last edited by mrclisdue; 10-20-2011 at 01:10 PM.
 
Old 10-20-2011, 05:54 PM   #7
qweasd
Member
 
Registered: May 2010
Posts: 621

Rep: Reputation: Disabled
Quote:
Originally Posted by mrclisdue View Post
Run a cron that does a git pull, or git-request-pull, and notifies you of the results...?

cheers,
You may also try

Code:
git fetch --dry-run
It makes no changes whatsoever. It prints things if there is new stuff and prints nothing otherwise. This may be useful if you don't want automatic merges.
 
Old 10-20-2011, 06:42 PM   #8
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
I found 'git tag | sed '/rc/d' | tail -n 1' which may be the answer.
 
Old 10-21-2011, 12:13 PM   #9
timetraveler
Member
 
Registered: Apr 2010
Posts: 243
Blog Entries: 2

Rep: Reputation: 31
Seems like one of those cases of snatching complexity from the jaws of simplicity. You can also just download a tarball from the git repo. It's much quicker than using native git and, unless you're doing kernel devel, using git native is overkill. Plus the build process is the same as downloading a tarball from kernel.org. Plus you can do so for different branches.
 
Old 10-21-2011, 12:23 PM   #10
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by timetraveler View Post
Seems like one of those cases of snatching complexity from the jaws of simplicity. You can also just download a tarball from the git repo. It's much quicker than using native git and, unless you're doing kernel devel, using git native is overkill. Plus the build process is the same as downloading a tarball from kernel.org. Plus you can do so for different branches.
That might be true, but it is easier to upgrade to newer kernel versions if you use git.
 
Old 10-21-2011, 01:48 PM   #11
qweasd
Member
 
Registered: May 2010
Posts: 621

Rep: Reputation: Disabled
Quote:
Originally Posted by H_TeXMeX_H View Post
That might be true, but it is easier to upgrade to newer kernel versions if you use git.
It's very easy and fast if you stay with mainline (like I do), but how does one upgrade through a major version tick of stable? When I was gitting stable, I used to reload everything, which is no better than getting tarballs. Is there a remote-related incantation that will do the trick?
 
Old 10-22-2011, 12:58 PM   #12
audriusk
Member
 
Registered: Mar 2011
Location: Klaipėda, Lithuania
Distribution: Slackware
Posts: 352

Rep: Reputation: 198Reputation: 198
If you're like me and upgrade your kernel by patching source of major version (v3.x) with minor version patches (v3.x.y), here's how to get one for v3.0.7 directly from kernel.org's gitweb:

Code:
$ wget 'http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commitdiff_plain;h=refs/tags/v3.0.7;hp=refs/tags/v3.0' -O patch-3.0.7.diff
 
1 members found this post helpful.
Old 10-23-2011, 04:07 AM   #13
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,060

Rep: Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139
http://lkml.org/lkml/2011/10/23/51
 
1 members found this post helpful.
Old 10-23-2011, 04:24 AM   #14
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I am reluctant to download anything from kernel.org. I'm gonna use git, just to make sure everything is authentic.
 
Old 10-23-2011, 04:42 AM   #15
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,554
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Kernel.org is okay to use but they haven't updated anything on the main page in a while. The site is slowly returning to normal however so it might be a while till you see it up-to-date on the main pages.

The new kernel repository webpage is here ATM:

http://git.kernel.org/?p=linux/kerne....git;a=summary

Last edited by ReaperX7; 10-23-2011 at 04:46 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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: Kernel.org hacked, but Linux kernel safe thanks to git LXer Syndicated Linux News 0 09-02-2011 01:00 AM
[SOLVED] Building Cinelerra-CV from git repository - syntax error falmdavis Linux - Software 3 07-19-2010 07:17 PM
inconsistency issue of git-clone ***/git/mesa/drm with the existing kernel source centguy Linux - Desktop 2 10-08-2008 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:02 AM.

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