LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-26-2012, 03:50 PM   #1
floppy_stuttgart
Member
 
Registered: Nov 2010
Location: Stuttgart, Germany
Distribution: Debian like
Posts: 717
Blog Entries: 2

Rep: Reputation: 68
Compile kernel 3.x for a PC; howto?


hello,
I want to make a specific kernel for my P4 Hp DC7100 in order to achieve good boot times. I am trying around since few hours and could not find a howto.
Can somebody help and give to me an howto?

My latest status is:
- "sudo tar xf linux-3.0.3-patched.tar.xz" from my distro
- "mkdir /home/linux"
- "sudo ln -s /sdb1/files/linux-3.0.3/ /home/linux"
- "cd /home/linux"
- "sudo make localmodconfig"
error "make: *** No rule to make target ' localmodconfig' . Stop.").
 
Old 02-26-2012, 04:09 PM   #2
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Which OS you are using?
 
Old 02-26-2012, 04:14 PM   #3
floppy_stuttgart
Member
 
Registered: Nov 2010
Location: Stuttgart, Germany
Distribution: Debian like
Posts: 717
Blog Entries: 2

Original Poster
Rep: Reputation: 68
www.tinycorelinux.net
.. but no HowTo is there..
 
Old 02-26-2012, 04:25 PM   #4
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Actually for compiling you need a full compiling environment(headers etc), plus ncurses and perl.

Standard Linux kernel sources are available at:
http://www.kernel.org/pub/linux/kernel

The Tiny Core(TC) patches and other related files for the standard TC kernel are available at:
http://distro.ibiblio.org/tinycoreli...#/release/src/

The process to create a custom kernel could in short be described as:

1. Get the sources for the version of the standard Linux kernel that you are going to base your kernel on
2. Get the patches you intend to apply - both TC kernel patches and possibly others (in my case the RT-patches)
3. Unpack the linux sources and cd into the top level directory of the source package
4. Apply the patches using (in most cases) “patch -p1 < patchfile” for each patch file
5. Move the kernel config file from the standard TC kernel into the same directory and rename it to ”.config”
6. Do “make oldconfig” and answer all questions, in case you have no clue on the answer just provide the default ones (i.e. just hit Return)
7. Do “make menuconfig” and make any changes you need to the configuration
8. Do “make bzImage” to build the kernel itself
9. Do “make modules” to build the loadable modules
10. Do “make INSTALL_MOD_PATH=/path modules_install firmware_install” where /path is a path to a directory where you expect to find the modules.

At this point you will find the kernel file as “arch/x86/boot/bzImage” (relative to the directory from where you issues all the make commands). Further you will find all loadable modules and firmware files under ”/path/lib/modules/kernel_version” and ”/path/lib/firmware”

The bzImage file need to be moved to a location where your boot loader can access it and the boot loader needs also to be configured to boot using the new kernel.

Last edited by Satyaveer Arya; 02-26-2012 at 04:31 PM.
 
1 members found this post helpful.
Old 02-26-2012, 04:48 PM   #5
floppy_stuttgart
Member
 
Registered: Nov 2010
Location: Stuttgart, Germany
Distribution: Debian like
Posts: 717
Blog Entries: 2

Original Poster
Rep: Reputation: 68
“make oldconfig” gives
"make: *** No rule to make target 'oldconfig' . Stop."
..
 
Old 02-26-2012, 04:53 PM   #6
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
When it comes to the modules and firmware files, you basically have two options, either let them be part of your initrd (a file named “tinycore.gz” in TC) or let them be part of extension files (*.tcem). In most cases it is probably best to have some of them built into the initrd and some available as loadable extensions. If you are unsure, build all of your files into the initrd. This will give you a tinycore.gz which is significantly larger than the one provided by standard TC, but in most cases you could probably live with that until you have the time to sort out the details of what modules should be put where. When you build your initrd you need to place the modules found under ”/path/lib/modules” under “lib/modules” relative to the root of the initrd. Similarly the files under ”/path/lib/firmware” should be put under “lib/firmware” relative to the initrd root.

IMPORTANT: If you are using a custom kernel you should never use any *.tcem files from standard TC. You could probably load them and they will likely not produce any harm, but taking up memory space, but they will not provide the function you expected. As you can notice above the modules are placed under a directory that contains the current kernel version and the modprobe program will only load modules from the directory that matches the version of the current kernel.
 
1 members found this post helpful.
Old 02-26-2012, 04:59 PM   #7
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
From which path you are executing make oldconfig command? In which directory you're when you're executing this command?
 
Old 02-26-2012, 05:01 PM   #8
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
The standard TC initrd and the standard *.tcem packages are structured as follows to allow dynamic loading of module extensions:

Quote:
The module files in the *.tcem, when installed, are found as
/usr/local/lib/modules/......
In order fro them to be visible under
/lib/modules/...
the initrd contains a link called "lib/modules/<<kernel_version>>/kernel.tclocal" which points to "/usr/local/lib/modules/<<kernel_version>>/kernel
 
1 members found this post helpful.
Old 02-26-2012, 08:06 PM   #9
TKH
Member
 
Registered: Jul 2011
Location: Milky Way
Distribution: Ubuntu, LFS, Slackware, Fedora
Posts: 218

Rep: Reputation: 20
Try referring to Linux From Scratch for compiling help

Here is a site that I'm sure might help you with it:
http://www.linuxfromscratch.org/lfs/...08/kernel.html
 
  


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: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 09:21 PM
Howto compile libata module into kernel Clemente Linux - General 1 02-13-2006 01:38 AM
Howto: Compile new 2.6.x kernel for Gentoo? Please help.. :S CrapBag Linux - Newbie 1 07-09-2005 02:41 PM
Kernel Problems. Howto Compile a new kernel from 4.2 with backwards compatibility ? ShoCkwave Linux - General 2 06-19-2004 07:02 AM
orinoco_cs howto compile? Satriani Linux - Networking 2 05-11-2003 10:08 AM


All times are GMT -5. The time now is 12:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration