LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 02:50 PM   #1
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
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, 03:09 PM   #2
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Which OS you are using?
 
Old 02-26-2012, 03:14 PM   #3
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153

Original Poster
Blog Entries: 5

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

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 03:31 PM.
 
1 members found this post helpful.
Old 02-26-2012, 03:48 PM   #5
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153

Original Poster
Blog Entries: 5

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

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, 03:59 PM   #7
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

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, 04:01 PM   #8
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

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, 07:06 PM   #9
TKH
Member
 
Registered: Jul 2011
Location: Milky Way
Distribution: Ubuntu, LFS, Slackware, Fedora
Posts: 223

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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:20 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