Monday, May 23, 2011

Your order has shipped

The following items have been shipped to you by
-------------------------------------------------------------------- items (Sold by, LLC) :
1 C Programming Language (2n...
1 Operating Systems Design a...
1 The Design of the UNIX Ope...

via Expedited Int'l Shipping (estimated delivery date: June 20, 2011).

Steps to test custom Kernel RPM build on Fedora 15

These are minimum steps required to test if your Fedora 15 has everything it needs to build custom Kernel RPM. Lines starting with "#" are actions done with root. Lines starting with "$" are done with non-root user.

# yum install @"Development Tools"
# yum install rpmdevtools yum-utils
$ rpmdev-setuptree
$ yumdownloader --source kernel
# yum-builddep kernel-
# yum install qt3-devel qt3 libXi-devel

Note for Fedora 15: If you are experiencing problems related to missing dependencies, mainly on x64 systems, try to add --enablerepo=updates-testing on the end of yum commands, so it will look like:
# yum install @"Development Tools" --enablerepo=updates-testing

$ rpm -Uvh kernel-
$ cd ~/rpmbuild/SPECS
$ rpmbuild -bp --target=$(uname -m) kernel.spec
$ cd ../BUILD
$ cp -r kernel-2.6.38.fc15/ kernel-2.6.38.fc15.orig
$ cp -a kernel-2.6.38.fc15.orig

$ cd ../SPECS
$ vi kernel.spec
Open the kernel.spec file for editing to give the kernel a unique name. This is important to ensure the custom kernel is not confused with any released kernel. Add a unique string to the kernel name by changing the 'buildid' line. Optionally, change ".local" to your initials, a bug number, the date or any other unique string.

Change this line:

#% define buildid .local

To this (note the extra space is removed in addition to the pound sign):
%define buildid .custom_text

$ rpmbuild -bb --with baseonly --without debuginfo --target=`uname -m` kernel.spec

Copying and installing custom Kernel RPM into test VM
$ scp ../RPMS/x86_64/kernel- root@kdpeter:/tmp; ssh root@kdpeter 'rpm -ivh --force /tmp/kernel-'

Saturday, May 21, 2011

distcc to paralel compile the Linux Kernel

Have you heard about distcc? distcc home page

distcc is a program to distribute builds of C, C++, Objective C or Objective C++ code across several machines on a network. distcc should always generate the same results as a local build, is simple to install and use, and is usually much faster than a local compile.

As I'll compile Linux Kernel hundreds of times in the upcoming months, and as I have two available servers, I decided to give distcc a try. It is easy to install and use. There are two modes: Regular and Pump-mode. Regular mode is easy to use but I was not able to boost the performance over 15%. The pump-mode did not work on my 64 bits system. I've tried pump-mode on 32 bits system, it worked easily but the performance gain wasn't as high as I was expecting. For now I decided to not use distcc.

But I learned about a magic performance argument for "make". It is "-jX", where X is the number of simultaneous actions that "make" will start. On x86 systems, you can set X to something between the number of cores and its double. For my notebook with Intel Core 2 Duo, setting "-j3" gave me the best results.

ADDED ON JUN 27: I got great results with distcc. See it here.

Peter's plan

I got inspired by: The origins of Linux[2]

I was bored and looking for genuine challenges! I think I found it! I'll become Linux Kernel Developer. This goal is turning my boredom into fun!

My 4 fun steps plan:
1 - Update my 2006 article about kernel modification. The updated version will follow the community rules, and will expand concepts explanation.
2 - Read three books that Linus talks about: C Programming Language, The Design of the Unix Operating System, and Operating Systems Design and Implementation.
3 - After being away from the keyboard to read the books... Start to hunt and kill Kernel Bugs. Today I would choose to do this at Device Mapper or at Memory Swapping.
4 - Becoming productive! This means being able to make patches that are accepted by the Kernel Development community.

make xconfig on Fedora 15

If you are planning to make custom kernel on Fedora 15, I suggest that you follow:

But the command:

su -c 'yum-builddep kernel-version.src.rpm'

Will not resolve all dependecies you need. Before running:

make xconfig

You will need to:

su -c 'yum install qt3-devel qt3 libXi-devel'

This fixes the errors:

[peter@notepeter kernel-2.6.38.fc15]$ make xconfig
* Unable to find the QT4 tool qmake. Trying to use QT3
* Unable to find any QT installation. Please make sure that
* the QT4 or QT3 development package is correctly installed and
* either qmake can be found or install pkg-config or set
* the QTDIR environment variable to the correct location.

HOSTCC scripts/kconfig/conf.o
sed < scripts/kconfig/lkc_proto.h > scripts/kconfig/lkc_defs.h 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
HOSTCC scripts/kconfig/kconfig_load.o
HOSTCC scripts/kconfig/kxgettext.o
SHIPPED scripts/kconfig/lex.zconf.c
HOSTCC scripts/kconfig/
make[1]: *** No rule to make target `scripts/kconfig/.tmp_qtcheck', needed by `scripts/kconfig/qconf.o'. Stop.
make: *** [xconfig] Error 2


[peter@notepeter kernel-2.6.38.fc15]$ make xconfig
* Unable to find the QT4 tool qmake. Trying to use QT3
/usr/lib64/qt-3.3/bin/moc -i scripts/kconfig/qconf.h -o scripts/kconfig/qconf.moc
HOSTCXX scripts/kconfig/qconf.o
HOSTLD scripts/kconfig/qconf
/usr/bin/ld: cannot find -lXi
collect2: ld returned 1 exit status
make[1]: *** [scripts/kconfig/qconf] Error 1
make: *** [xconfig] Error 2