#! /bin/sh# slax-kernel-build.sh# This script automates the task of rebuilding the Slax 6.1.2 kernel, which is 2.6.27.27.# You need an internet connection for it to work, or you can get the packages and put# them in place, then comment the wget lines.# It will fetch the required files, modify them to work with 2.6.27.27 and prepare# the scripts so you only need to fire build.kernel, adjust the config, and go for a coffee# Major credit to Tomas for his 'kit' and to markds for his pointers over various threads# on the Slax forum.# Feel free to edit as much as you want/need to.# This script is licensed under the WTFPL, available at http://sam.zoy.org/wtfpl/# Written by raydeejay# Step 1 - Preparing the environmentmkdir -p /usr/src/slax-kernel-build/{patches/squashfs,scripts}# Step 2 - Get the files and put them in the proper places# note that subsequent runs of this script will accumulate extra useless files with numerical# extensions on the cwd.cd /usr/src/slax-kernel-buildwget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/aufs.tar.gzwget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/build.kernelwget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/configwget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/get-aufs-cvs.shwget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/lzma457.tar.bz2wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/prepare-crippled-kernel-sourceswget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/squashfs3.4.tar.gzcd /usr/src/slax-kernel-build/patches/squashfswget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/patches/squashfs/mksquashfs.quiet.patchwget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/patches/squashfs/sqlzma3.4-457.tar.bz2wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/patches/squashfs/unsquashfs.quiet.patchcd /usr/src/slax-kernel-build/scriptswget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/scripts/rc.modulescd /usr/src/slax-kernel-buildwget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.27.27.tar.bz2# Step 3 - Apply some voodoo to the files:# - make the scripts act on 2.6.27.27# - extract the config from the currently running kernel# - allow for overwriting before menuconfig# - patch squashfs' code with a missing include# - fix a bug in the command line that builds the .tgz packagecd /usr/src/slax-kernel-buildmv build.kernel build.kernel.origmv prepare-crippled-kernel-sources prepare-crippled-kernel-sources.origsed -e "s/2.6.27.8/2.6.27.27/" \ -e "s/configuring kernel/Press a key to configure kernel, or copy over .config now and then press a key./" \ -e "s/make oldconfig/zcat \/proc\/config.gz > .config\nread\nmake menuconfig/" \ -e "s/unsquashfs.quiet.patch/unsquashfs.quiet.patch\ncd \$TMP\/\$KERNEL\nmv fs\/squashfs\/inode.c fs\/squashfs\/inode.c.orig\nsed -e \"33i#include <linux\/sched.h>\" fs\/squashfs\/inode.c.orig > fs\/squashfs\/inode.c/" \ -e "s/makepkg -l n -c n /makepkg -l n -c n ..\//" \ build.kernel.orig > build.kernelsed -e "s/2.6.27.8/2.6.27.27/" prepare-crippled-kernel-sources.orig > prepare-crippled-kernel-sourceschmod +x build.kernel# Step 4 - Finishedecho "Now execute ./build.kernel, adjust configuration, and wait for it to compile."exit