home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] Need advice from kernel hackers !

* William Case <billlinux [ at ] rogers [ dot ] com> [071215 15:52]:
> I am about to do a fresh install of Fedora 8.  I want to begin exploring
> the kernel so if I need new partitions etc. now would be a good time to
> set up properly.

You don't need separate partitions if you are just swapping a kernel
with one that is relatively close to it.  You can run just about any
2.6.x kernel with the same modern userspace (such as FC8).

        ls /boot/vmlinuz* | wc -l
        18

I seem to have 18 of them.

> I need some advice on how to set up so that I can:
> 1) download a separate kernel -- binary, source and documentation.

I don't use (and avoid) rpm based systems, but you should be able to
install a different kernel using rpm/yum.  You would then select the
right one using grub (or another boot loader) at boot time.

> 2) have access to it from my home directory -- if possible.

You want to have the files in $HOME ?  Well that's not really how linux
distros are setup to boot.

You can however build the kernel in your $HOME dir and install it in the
system directories (/boot and /lib/modules/).  You probably want to use
git.

> 3) trace various trees -- operations from first mention of symbol to
> end.

So you want source, not binaries?

Let me recommend git.

> 4) make sure anything I might do does not screw up my existing system.

Use virtualization or another harddisk.

If you have a modern CPU, you should get a kernel that supports KVM and
run another distro inside a virtual machine.  You can then hack up the
virtualized kernel and not worry about breaking things.

See http://kvm.qumranet.com/ for more info.  Feel free to ask if you
want some help on KVM.

> The advice that I have found even on Linux Kernel Newbies seems to be
> for hackers who are building drivers etc. as contributions (ie. using
> git).  I just want to play and explore -- maybe viewing C and some asm.

You want to use git, even if you just view the source.

Here is how you build a kernel:

        # I assume that you have build tools installed, if not something
        # like this will cure it
        #  - substitute apt with your favorite method of getting packages
        apt-get install build-essential

        # get the git software:
        #  - again, substitute apt with your favorite method of getting packages
        apt-get install git-core                

        # get the linux kernel
        git clone git://git2.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
        cd linux-2.6

        # checkout the last release (or any release you want)
        git reset --hard v2.6.23

        # get the config file from the running kernel:
        zcat /proc/config.gz > .config

        # configure the kernel
        #  - note many questions are answered from the .config file above
        #  - you can use any of the following
        make oldconfig          # text based
        make menuconfig         # curses based
        make xconfig            # X based

        # build the kernel
        make bzImage modules

        # install the kernel
        make modules-install install

        # build a new initramfs for the kernel
        #  - substitute the <new version> with the version you just built, or with "all"
        update-initramfs -c -k <new version>
        
        # get grub to see the new kernel
        update-grub

        # reboot

Please note that the update-* tools above are Debian specific.  The
actual build steps are distro agnostic.

-Bart

-- 
				WebSig: http://www.jukie.net/~bart/sig/