skimppimppin along! NEWS   FORUM   DOWNLOAD   LINKS    
HOME ACCOUNT PRIVATE MESSAGE  
Login
Username:

Password:


Lost Password?

Register now!

Main Menu

Search

skimpydog.com Forum Index
   No Distro Specific
  Kernel Building

Browsing this Thread:   1 Anonymous Users

 

 Bottom   Previous Topic   Next Topic
  •  Rate Thread
      Rate this Thread
      Excellent
      Good
      Average
      Bad
      Terrible
Poster Thread
Kernel Building
#1
Webmaster
Joined: 2007/6/10
From Dallas, TX
Posts: 79
Level : 7
HP : 0 / 170
MP : 26 / 8763
EXP : 83
Group:
Webmasters
Registered Users
Offline
Building the Linux Kernel is really quite simple - IF you have a decent auto-generated configuration to start with.

What I mean by that, is simply this:

You can build your kernel by hand, and often things will fail until you have your kernel 100% how you want it - that is working with your hardware, how you want it 100%.

Keep in mind you will have to configure things for iptables/ipfw, network, video performance, audio, hard disks (RAID, SCSI) etc... until you have what you want in a working manner. Stable..

A few key pointers I have learned are like this, If you have a .config, or anything like that in /usr/src/kernel(linux)-{whatever}.x.x-x, you can use for your new kernel builds.

This can become a bit more difficult than this, but for that you MUST read up on the specific hardware you are attempting to configure, and from there you may need to stay on top of drivers after you rebuild your kernel.

This is very common for video cards whereas you will have to reinstall your video drivers after rebuilding your kernel.

______________________________


So, if you cd to /etc/src/kernel-XXX you can see your source files for your kernel.

If you do not have these crucial files, you will need to install the kernel source.

##################

A note about kernel building:

You ultimately build the kernel you are wanting to run - a kernel that works stably with your hardware, and preferably boots quickly (that's if you can help it - some drivers take a moment to load, or fail to load). With that in mind, if the source of the kernel you have available to you is all you have available, then that is your new kernel version until you decide to upgrade {or downgrade}.

You should be able to port your kernel between operating systems (Linux variants if you use the Linux kernel) if you build things properly, and actually use your .config that you ultimately build with any of the kernel releases from kernel.org when you build your kernel.


_____________________________________

The configuration

I will advise to build your kernel starting off with a newer kernel that has been auto-generated.

If you run gentoo, you can actually use the "genkernel all" command to generate a kernel for you, then you can customize things.

You can load your kernel configuration into "make menuconfig" once you locate the initial .config file which is normally located at /usr/src/kernel(linux|symlink)/.config.

If this is the same directory for the source you are building from, it should automatically load, if you do not trust this, or wish to change the location for the build you want to configure, scroll all of the way down, and choose, "Load an Alternate Configuration File", such as:
cd /usr/src/linux
make menuconfig

 Linux Kernel v2.6.19-gentoo-r5 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌────────────────────── Linux Kernel Configuration ───────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌────^(-)─────────────────────────────────────────────────────────────┐ │
  │ │        Device Drivers  --->                                         │ │
  │ │        File systems  --->                                           │ │
  │ │        Instrumentation Support  --->                                │ │
  │ │        Kernel hacking  --->                                         │ │
  │ │        Security options  --->                                       │ │
  │ │        Cryptographic options  --->                                  │ │
  │ │        Library routines  --->                                       │ │
  │ │    ---                                                              │ │
  │ │        Load an Alternate Configuration File                         │ │
  │ │        Save an Alternate Configuration File                         │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘


As I previously stated, you will want to configure your kernel to meet your specific needs.

If you want ntfs support (if you have a dual boot, or if you have a NTFS drive (partition)), add this as a module, not built into the kernel; such as:
while in make menuconfig
Choose:
File systems  --->

Scroll Down until you see:
DOS/FAT/NT Filesystems  --->

Build in NTFS support as a module:
 Linux Kernel v2.6.19-gentoo-r5 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌──────────────────────── DOS/FAT/NT Filesystems ─────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    <M> MSDOS fs support                                             │ │
  │ │    <M> VFAT (Windows-95) fs support                                 │ │
  │ │    (437) Default codepage for FAT                                   │ │
  │ │    (iso8859-1) Default iocharset for FAT                            │ │
  │ │    <M> NTFS file system support                                     │ │
  │ │    [*]   NTFS debugging support                                     │ │
  │ │    [*]   NTFS write support                                         │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘



Setup anything else you may need, Video Card, network cards, wifi cards, HAM Radio if you are licensed for it and have the equipment, or make yourself a vending machine out of a Linux box - and save your configuration.
 Linux Kernel v2.6.19-gentoo-r5 Configuration
 ──────────────────────────────────────────────────────────────────────────────







          ┌──────────────────────────────────────────────────────────┐
          │  Do you wish to save your new kernel configuration?      │
          │  <ESC><ESC> to continue.                                 │
          ├──────────────────────────────────────────────────────────┤
          │                   < Yes >      <  No  >                  │
          └──────────────────────────────────────────────────────────┘



Then build the kernel.

The Build

Building is really quite simple, but it can take a lot of time.
-- You must be in the kernel source directory first
make
make modules
make install
make modules_install


or you can run this as one string:
make ; make modules ; make install ; make modules_install


Check to make sure your grub is up to date (pointing to the correct kernel, and you have the proper arguments to boot):
vi /boot/grub/grub.conf

The following will be customized for your specific layout! This is what I use on a machine:
timeout 30
default 2
fallback 1
splashimage=/boot/grub/splash.xpm.gz

title Gentoo Linux
kernel (hd0,0)/boot/kernel-genkernel-x86-2.6.19-gentoo-r5 root=/dev/hda4

title GenKernel Linux
kernel (hd0,0)/boot/kernel-genkernel-x86-2.6.19-gentoo-r5.1 root=dev/ram0 init=linuxrc ramdisk=8192 real_root=/dev/hda4 vga=791 splash=silent
initrd (hd0,0)/boot/initramfs-genkernel-x86-2.6.19-gentoo-r5

title Windows
rootnoverify (hd0,2)
chainloader +1




After you have verified things are going to work (drive locations, and grub (or lilo) is configured to boot the new kernel), you should be good to go.
Posted on: 2009/1/28 22:29
Create PDF from Post Print
Top
Re: Kernel Building
#2
Webmaster
Joined: 2007/6/10
From Dallas, TX
Posts: 79
Level : 7
HP : 0 / 170
MP : 26 / 8763
EXP : 83
Group:
Webmasters
Registered Users
Offline
So, if you are updating your kernel, and you would like to build with the same configuration that you currently have running; try something like the following example:

Copy the config into the newly installed kernel, and recreate the symlink in the /usr/src directory:
ls -la /usr/src
total 24
drwxr-xr-x  6 root root 4096 Jan 13 22:17 .
drwxr-xr-x 14 root root 4096 Dec  4  2008 ..
-rw-r--r--  1 root root    0 Jun 11  2008 .keep
lrwxrwxrwx  1 root root   22 Jan 13 22:17 linux -> linux-2.6.30-gentoo-r8
drwxr-xr-x 22 root root 4096 Apr  1  2009 linux-2.6.26-gentoo-r3
drwxr-xr-x 23 root root 4096 Nov 20 02:41 linux-2.6.27-gentoo-r8
drwxr-xr-x 23 root root 4096 Jan 13 21:54 linux-2.6.30-gentoo-r8
drwxr-xr-x 24 root root 4096 Jan 14 23:34 linux-2.6.31-gentoo-r6

cp /usr/src/linux-2.6.30-gentoo-r8/.config /usr/src/linux-2.6.31-gentoo-r6/.config
rm /usr/src/linux
ln -s /usr/src/linux-2.6.31-gentoo-r6 /usr/src/linux

Now build off of the config:
genkernel --menuconfig --splash=natural_gentoo --install --mountboot --no-clean all
Posted on: 2010/1/19 19:41
Create PDF from Post Print
Top
Re: Kernel Building
#3
Webmaster
Joined: 2007/6/10
From Dallas, TX
Posts: 79
Level : 7
HP : 0 / 170
MP : 26 / 8763
EXP : 83
Group:
Webmasters
Registered Users
Offline
So I just spent the last few weeks figuring out why Gentoo on my laptop wasn't working properly.

This started by I wanted to update Firefox for the Clippings plugin.
emerge -av firefox


Without me paying attention, firefox required a newer version of perl and was pulled in.

The emerge completes - no big deal.

I go on about my way, and I notice "vi" has an error complaining about perl.

So I go about attempting to rebuild packages, and end up with a lot of errors and break my box ultimately trying to perform a revdep-rebuild.

My last backup of this machine, my laptop, was in 2008 - It's now 2011. Everything is running well on it with the backup, however it is old, and I can't emerge --sync as it complains it requires python-2.5, and it only had 2.4. Then complains stating it can't install because.....

We all know the moral of the story. BackUp!


Now to recover:

date
fdisk -l
mkfs.ext3 /dev/sda2
mkfs.ext3 /dev/sda6
swapon /dev/sda5
mount /dev/sda6 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda2 /mnt/gentoo/boot
cd /mnt/gentoo
links http://www.gentoo.org/main/en/mirrors.xml
tar xjpf stage3*
links http://www.gentoo.org/main/en/mirrors.xml
tar xjf portage-lat*
mount -o bind /dev /mnt/gentoo/dev
mount -t proc proc /mnt/gentoo/proc


scp over the /etc/make.conf from another box that I like, and built well, edit the file to meet my requirements...

Edit fstab, grub.conf yada yada-ya

All builds well.

Kernel issues with Video. Go Figure. Hrmmm, that's odd.

I got the config to build gentoo-sources-2.6.36-r5 by booting to a pmagick Live CD as it is running a 2.6.36-r2 kernel. It discovered everything quite well once I went into menuconfig.

Now I'm running an Intel 945GM on a FIC MB02 Whitebook. It's old at this point, however it works quite well.

I start by attempting to use the xorg.conf, just failing out. That's odd. I keep screwing with it, googling the output when necessary because this is all quite odd.

Modify the kernel a bit, and I go ahead and put in framebuffer support built into the kernel.

Reboot and I just get a black screen. Try even to startx from a remote console, and it just dies on the spot. ssh session lost.

I shut the lid to my laptop and it, and it freezes up. Hard crashes, can't ping it, NUMBERLOCK wont light up; then I discover it's trying to sleep it. This is at the console. So I disable all that, modifying HAL, and ACPI settings. Verifying events in /proc are correct - Which they Were!!

For example, when the lid is closed, laptop-mode shows closed. Open shows open. However editing the kernel making all drivers etc built as external modules gave me the ability to startx.

Then it would crash shortly thereafter. Nothing that I could tell would trigger it.

Kernel after Kernel, patching, updating, and downgrading drivers - creating overlays to build in old drivers from my old backup in 2008 (I couldn't resurrect the old kernel though, and I was not able to find it either) and trying again, keeps crashing.

Setup syslog-ng to accept remote logging on another host, and got minimal output which lead me nowhere, use different kernels, and crash after crash after crash....

Weeks go by.

Today I figured out what I need for stability NOW with Intel Video i815 and i915 - I just rsync'ed it to another workstation with Intel Video, and it's working:

sys-kernel/gentoo-sources-2.6.32-r24
x11-drivers/xf86-video-intel-2.13.0


No xorg.conf! - It's not necessary

Be sure to set your mouse for HAL:
at minimum::
cp /usr/share/hal/fdi/policy/10osvendor/11-x11-synaptics.fdi /etc/hal/fdi/policy/99-x11-synaptics.fdi


Drivers for Mouse and KeyBoard support:
x11-drivers/xf86-input-evdev
x11-drivers/xf86-input-joystick
x11-drivers/xf86-input-keyboard
x11-drivers/xf86-input-mouse
x11-drivers/xf86-input-synaptics


Don't build in framebuffer support for intel as it will blank out your screen once the built in intelfb kicks in. This is done with no additional kernel arguments.
Posted on: 2011/2/10 20:10
Create PDF from Post Print
Top
 Top   Previous Topic   Next Topic

 


 You cannot start a new topic.
 You can view topic.
 You cannot reply to posts.
 You cannot edit your posts.
 You cannot delete your posts.
 You cannot add new polls.
 You cannot vote in polls.
 You cannot attach files to posts.
 You cannot post without approval.
Links