Tuesday, March 31, 2009

How to compile a slackware kernel

There are many reasons to build a new kernel in a distro like slackware. It could be that you bought a new usb camera or printer that the new kernel supports. Or perhaps a newer kernel has better support for your wifi card. Whatever the reason, we'll cover here how to build the latest and greatest on your box. At the time of this writing it's the first release of the 2.6.29 tree.

The first thing we need to do is to download the source from kernel.org. The 2.6 tree is found here.

Scroll down to the desired version to be compiled and select "copy link location". Then open a terminal and become root and change to your build environment. We'll use /usr/src as the default.

su -
cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.tar.bz2

now we need to unpack the tar ball.

tar -jxf linux-2.6.29.tar.bz2

Next we're going to remove the current symlink to the linux directory and link to the new directory.

rm linux
ln -s linux-2.6.29 linux

Now we'll move into the build directory.

cd linux

To get this far means that you have a working kernel. So we're going to utilize the current kernel config to build our new kernel.

zcat /proc/config.gz > .config
make oldconfig

New additions to the kernel will be displayed and you can choose which ones you want to keep and in what form. It will ask you to keep them in module form (m), or you can select y for it to be built in to the kernel, or n for it to be left out. Simply hitting enter will do the default action, which the dialog will tell you what that is.

Next we can alter anything we want in the kernel itself.

make menuconfig

There are a couple of things I always change here. One is the processor support. Scroll to processor type and features, and then processor family. For my celeron M on this laptop I pick the pentium M option. For my core 2 duo system, I choose the core 2/ newer xeon option.

We then exit from the processor type and features menu back to the main menu.

Next we scroll down to Device Drivers and select it. Then we select usb support. Finally we modularize "USB Mass Storage Support" by pressing "m" while it is highlighted.

We click exit to exit out of our submenus all the way back to the main menu. Hitting exit one more time, will ask if you want to save the kernel configuration, to which we reply yes.

Now we want to build the kernel so we type

make all

This can take a while, depending on your processor, so grab a cup of coffee, read the paper and come back in a little while.

Once that completes, we'll grab a nice script by Dagmar to install the kernel in /boot.

wget http://dagmar.droplinegnome.org/experimental/installkernel
install -m 755 installkernel /sbin/

Then we execute the following to be able to use the new kernel

make modules_install
make install

These commands will install the new modules and copy the config, system.map, and kernel to the proper locations in /boot.

now we'll change to the /boot directory to modify a few things.

cd /boot

It's time to remove the current symlinks to config, System.map, and vmlinuz.

rm config
rm System.map
rm vmlinuz

and then link them to the new kernel.

ln -s config-2.6.29-smp config
ln -s System.map-2.6.29-smp System.map
ln -s vmlinuz-2.6.29-smp vmlinuz

At this point it's a good idea to create an initrd. For ext3 we use the following command. Note that sda3 is my root partition. be sure to alter yours accordingly.

mkinitrd -c -k 2.6.29-smp -m mbcache:jbd:ext3 -f ext3 -r /dev/sda3

For reiser it would be

mkinitrd -c -k 2.6.29-smp -m reiserfs

next, we'll edit lilo to use the initrd.gz. we add the following line above "root = /dev/sda3"
initrd = /boot/initrd.gz

so it will look something like this.

image = /boot/vmlinuz
initrd = /boot/initrd.gz
root = /dev/sda3
label = Linux

Now we need to run lilo to update it.


That's it. upon rebooting you should now be utilizing your shiny new 2.6.29 kernel. If you somehow messed something up, and you end up with a kernel panic, you can use your slackware 12.2 cd to boot your system in a pinch.

Good luck and happy slacking!

I borrowed heavily from this excellent guide on the dropline wiki.

Saturday, March 21, 2009

How to use slackbuilds

I posted this on the hackmy forums and figure my blog is a good place for this as well. Enjoy Slackers!

If you're using slackware, you'll find there are many packages not "included" with the base distribution. Slack tends to use vanilla packages with little or no patching from how the application was intended by the author upstream... so this means that you can build virtually anything you need with the excellent build tools.

Utilizing slackbuilds from slackbuilds.org is a good way to do this.

First, we need to su to root so that we can build and install the packages. so we open a terminal and type

su -

then we need to create our build directory. this can be anywhere, but you may want to put it in your user's home directory. So we create the directory like so.. substitute your user name where "user" is listed.

mkdir /home/user/build

then we'll change directory to our build directory

cd /home/user/build

now we can begin building packages. navigate in your favorite web browser to http://slackbuilds.org/

On the right hand side of the screen you will find a search navigation tool, and the version number. So if you're using slackware 12.2, you select that and then search for the package you want to build. Let's try something simple like flash... which brings us to this page.

now at this point the different options available for building flash are listed. We'll simply go with flash-player-plugin so we can watch some videos on youtube.

Now that we're on this page, we have access to the slackbuild tar ball and a link to the source required to compile it. It's a good idea to read the README file linked to at the bottom of the page and to peruse the slackbuild script.

Next we'll download the slackbuild in our terminal session using wget which is very reliable. Simply right click on the link to the slackbuild source under "Download slackbuild" and select "copy link location". Then type


then leave a space and right click in the terminal and select paste. this will paste the location of the source slackbuild for you to download. then hit enter. so in this case it would look like this.

wget http://slackbuilds.org/slackbuilds/12.2/multimedia/flash-player-plugin.tar.gz

now we need to untar the archive

tar -zxf flash-player-plugin.tar.gz

now we need to see what directory has been created, and we can do this with ls


it will show the directory. in this case it's "flash-player-plugin". so we'll change to that directory.

cd flash-player-plugin

now we'll download the source linked to on the slackbuild page under "Download Source"

wget http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.tar.gz

we now want to make sure that our slackbuild is fine, so we can open a text editor and take a look to make sure everything seems fine. sometimes the slackbuild site doesn't link to the latest version available, so we can navigate to the homepage of the original author, download the source and edit the slackbuild. we'll cover that another time however and focus on installing this slackbuild.

next we have to ensure that the slackbuild is executable.

chmod +x flash-player-plugin.SlackBuild

now we're ready to build the package.


the program will compile now, assuming we've met the needed dependencies. flash-player-plugin doesn't have any additional dependencies, so it should compile just fine on a stock slack install.

the created package is created and moved to /tmp, and the full file name is listed. we can either cd to the tmp directory and then use installpkg, or we can simply use the full path. so our next step is to install the package now.

installpkg /tmp/flash-player-plugin-10.0_r22-i386-1_SBo.tgz

congrats! you have just compiled your first slackware compliant package and installed it.

Thursday, March 12, 2009

ice ice archie

I've been working on a icewm rpm in pclos, and decided to port it to a pkgbuild in arch linux. I absolutely love the result. I used the ybutton.cc patch to give borderless buttons on the toolbar and it looks fantastic in my opinion.

Here's the revised pkgbuild. Be sure to modify the pkgbuild to use your path to the ybutton patch, or comment it out if you want borders on your buttons. I got the patch from the silverxp theme here.

The theme used is called eleganceice and I got it from box-look.org

$Id: PKGBUILD 25822 2009-01-30 08:33:36Z eric $
# Maintainer: Eric Belanger
# Contributor: dorphell

pkgdesc="A Window Manager designed for speed, usability, and consistency"
arch=('i686' 'x86_64')
depends=('gcc-libs' 'imlib' 'libxrandr' 'libxft' 'libsm' 'libxinerama' 'giflib')
source=(http://downloads.sourceforge.net/sourceforge/icewm/${pkgname}-${pkgver}.tar.gz icewm.desktop)
md5sums=('970a21588d26eb361020fd60a61a482c' 'a3ed467f0199792205b04272402a9945')
sha1sums=('bee1ca66d2282888807551bc28a65b08e4108027' '7dcb1f2c89792a35b687182584ed9baa0d34cc80')

build() {
cd ${srcdir}/${pkgname}-${pkgver} || return 1
cd src
patch < /path/to/patch/SilverXP-1.2.17-single-1/Linux/ybutton.cc.patch
cd ..
./configure --prefix=/usr --sysconfdir=/etc --with-imlib \
--enable-shaped-decorations --enable-gradients --enable-antialiasing || return 1
make || return 1
make DESTDIR=${pkgdir} install install-man install-docs || return 1
install -D -m644 ${srcdir}/icewm.desktop ${pkgdir}/etc/X11/sessions/icewm.desktop

here's a direct link as blogger doesn't format the pkgbuild correctly.