TuxPPC
TuxPPC
home   |   submit: news, guide,   |   volunteer   |     |  


Sponsored by
Sponsored by PowerMax.com

Buy iMac


News Editions

About iMac

About Linux

Getting Started

Getting Help

User Resources

Advertisement

Distributions

Software Picks






Search

 

Links
  iMacLinux Edition Thursday, 03 July 2003  



Posted by on Friday August 11th, 2000 10:35:53 AM
Being able to make your own kernel can be a powerful tool. It enables you to have control over what you need to have in your kernel and what you dont, like pcmcia, I have no use for that on my iMac, or my RedHat box for that matter. Also, it shows a bit of Linux's power enabling you to do anything your heart desires with it. Building your own usable kernel is no exception, and its not all that hard. Anything here stated in bold is something you should do, copy and pasting included.

So where in the world do we begin this thought of being a fearful task you ask?,.. well, first you need to download a kernel. Take a trip and download a from your closest mirror.

Note: the sources should be in your home directory (not root), if your not sure just type: cd and it'll take you there. If you do lose where you put your precious kernel sources try this: find / -name linux*tar* its now bound to show up =)

Note Note: Downloading sources will take a while if your on a 56k like me. (You can go thru the guide until you reach the point of unpacking the the archive. wait until they are done to unpack them for you shall receive an error if you dont ;)

Having that said. now we need a place to download these files too, we're going to use /usr/src/linux-stable, but before we do that we need to change some permissions so you as a normal user can access it. so, su in as root:

su - root (It will prompt you for your password, than take you to your root prompt.)

Then...

cd /usr/src/

mkdir linux-stable

chown -R user linux-stable/ (user being your normal user name, like Shawn)

chmod 755 /usr/src/linux-stable

now exit out of root and those changes will take effect, now as your normal user...

To make sure it worked try copying a file to /usr/src/linux-stable like: cp $HOME/.bashrc /usr/src/linux-stable if you did not get permission denied, all is good. if you did make sure you did the above correctly.

cd /usr/src/linux-stable

If you downloaded a tar.gz file you will need to: tar zxf $HOME/kernel-version.tar.gz the archive.

If you downloaded a tar.bz2 file you will need to: bzip2 -d $HOME/kernel-version.tar.bz2 ; tar xf kernel-version.tar the archive.

Now,.. mv linux/* . ; rmdir linux

Now! Hopefully that didnt hog up too much time, I apologize now if it did ;) su as root and....

make menuconfig

Note: You also have the option of 'make config' which will take you through the config as it compiles (its a PAIN, I warned ya ;), as well as 'make xconfig' which is a X based gui config tool for you gui lovers out there. menuconfig and xconfig are afaik the same "layout". Where ever I tell you to go, should apply to xconfig just as well, but for simplicity, (both console and X users can use menuconfig,..) I'll stick with it

This might get a little tricky, BUT I should be able to uhh 'guide' you through it without hassle. Once you get a feel for where to find what you need its a real breeze,.. honest!

First, lets get you comfortable with Make Kernel Configuration, (MKC). Read through that little section under "General setup" Got it? Good...

For those that use a 56k modem (and if you dont read on). You should make your way to: Network device support -> PPP (point-to-point) support. With that selected, please notice that it has a M in the <>'s,. this means it will be compiled as a module that can be loaded into the kernel. Now,.. hit your spacebar once,.. it now chances to <*>,.. this now means this option will be compile into the kernel (no module will need to be loaded for ppp to work now) Hit spacebar one more time,.. now its blank,.. signifiying ppp will not be included in this kernel. Now for those with a modem,.. compile PPP into the kernel, please =)

Please, have a good look around in here,. there isn't too much to worry about in here,.. if your compiling a cable/dsl modem, make sure to look under Network device support -> Ethernet (10 or 100Mbit) for your card.

Also somethings you will not need (unless you have them) pcmia support and scsi support. you can leave them if you choose but they just use up more space which is partly why we compile kernels, to rid of unnecessary things. =)

Now,.. still in MKC,.. after you poked around for a while,. go to Exit, and SAVE your new configuration. It will take you back to your command prompt...

Now few bits of info... (Thank you Ken Hendrickson! =) you have a file called .config in /usr/src/linux-stable. This file contains your kernel config. You can copy this file someplace safe to keep track of what you tried previously God forbid your kernel uhh should uhhh fail, heh. so...

cp .config /root/.config-version

The diff command also is nice to know.

diff -c /root/.config-version .config (This tells you the differences between /root/.config-version and .config)

Now, let us build our koinol!

make dep

make vmlinux

now I hope that you got past this, most stables should compile without error (knocks on wood), okay, still as root... and in your /usr/src/linux-stable directory...

cp /usr/src/linux-stable/System.map /boot/System.map-kernel-version (if you downloaded kernel 2.2.17pre16 you'll use System.map-2.2.17pre16)

depending on if you use bootx, you will need to copy vmlinux to an hfs partition or on an ftp somewere so you can put it with the kernels on the mac side of your computer and boot with it

If you use yaboot, you will need to put it with the yaboot boot loader, wereever you keep it, i recommend backing up the old kernel and copying the new kernel over so you need to make no changes to yaboots config.

after that reboot, move vmlinux to Linux Kernels in the System Folder, and your on your way... yaboot users, just reboot.

There IS one more thing to do,... I have learned in a recent email (Thanks again Ken!) that is is best to make the modules needed for your kernel using the kernel that the modules are going to be used for when you compile them. so after you reboot.. su in as root and cd /usr/src/linux-stable

make modules

make modules_install

If all installed well with no errors, you should be good to go.

I think thats it, find anything suspicious?

Good luck!,

-Shawn W

Search for kernel

The Fine Print: The following comments are owned by whoever posted them.
(Reply)

by on Wednesday April 11th, 2001 05:25:46 PM
Are there any gotchas, if you were to download an rpm kernel source and rebuild it that way?

Should there be a third version of this HowTo that uses rpm files?

Rick
(Remove nospam in email to reply direct)

by on Saturday April 21st, 2001 08:26:14 AM
Not a bad idea... it wouldnt involve too much i dont think. =) if i get a few minutes ill look that over.

  Legal and Privacy Notices Copyright © 2001