#! /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 environment mkdir -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-build wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/aufs.tar.gz wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/build.kernel wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/config wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/get-aufs-cvs.sh wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/lzma457.tar.bz2 wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/prepare-crippled-kernel-sources wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/squashfs3.4.tar.gz cd /usr/src/slax-kernel-build/patches/squashfs wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/patches/squashfs/mksquashfs.quiet.patch wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/patches/squashfs/sqlzma3.4-457.tar.bz2 wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/patches/squashfs/unsquashfs.quiet.patch cd /usr/src/slax-kernel-build/scripts wget ftp://ftp.slax.org/source/slax/kernel/2.6.27.8/scripts/rc.modules cd /usr/src/slax-kernel-build wget 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 package cd /usr/src/slax-kernel-build mv build.kernel build.kernel.orig mv prepare-crippled-kernel-sources prepare-crippled-kernel-sources.orig sed -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 \" 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.kernel sed -e "s/2.6.27.8/2.6.27.27/" prepare-crippled-kernel-sources.orig > prepare-crippled-kernel-sources chmod +x build.kernel # Step 4 - Finished echo "Now execute ./build.kernel, adjust configuration, and wait for it to compile." exit