#!/bin/bash -e # prepare-kernel-sources.sh - To be documented # License: BSD-style (for this file only) # Revision: 240801 #--------------------------------------------------------------------- # Some rules: # # 1. This script must be run interactively due to the use of "make # menuconfig (which needs to be run at least once initially). # # 2. To use this script, you need to be in an xterm that is at least # 80x25 characters in size. # # 3. This script must be run in the directory that contains the assoc- # iated files (such as the original Linux kernel source tarball that # it starts with). # # 4. This script needs write access to the directory in question. # # 5. This script includes a "program parameters" section. Be sure to # review the comments in the section in question before setting the # parameters therein. #--------------------------------------------------------------------- # Program parameters. CFGLOCAL="-240801-32" # Set this to the value of CONFIG_ # LOCALVERSION. Should be of the form: # dash, 6-digit date, dash 32 or 64 to # indicate 32 or 64 bits LINUXREL=6.9.12 # Set this to the Linux kernel release # string (generally of the form #.#.#) # Set EXT3DIR to an absolute path for a folder in a filesystem that # has plenty of disk space free. If the folder does not already exist, # this script will attempt to create it. # The user must have read-write access to the directory in which # $EXT3DIR resides and to $EXT3DIR itself. A temporary directory will # be created in $EXT3DIR and then deleted. KERNTMPDIR specifies the # name of the temporary directory (without a path component). # Depending on various factors, some types of filesystems may not work # for this purpose; i.e., to hold $EXT3DIR. If problems occur, try a # filesystem of type "ext3" or "ext4". EXT3DIR=/ram/kernelsbuilt KERNTMPDIR=tmpkernel #--------------------------------------------------------------------- # Additional setup. KERNTMPPATH=$EXT3DIR/$KERNTMPDIR SDIR=`pwd` XDIRNAME=linux-$LINUXREL XKERNBALL=$XDIRNAME.tar.xz NDIRNAME=kernel$CFGLOCAL NKERNBALL=$NDIRNAME.tar.bz2 export FORCECFLAGS64=yes if [ \! -f config.kernel ]; then echo Error: Must be run in same directory as config.kernel exit 1 fi if [ \! -f $XKERNBALL ]; then echo Error: Must be run in same directory as $XKERNBALL exit 1 fi mkdir -p $EXT3DIR rm -fr $KERNTMPPATH mkdir -p $KERNTMPPATH cd $KERNTMPPATH rm -fr $XDIRNAME $NDIRNAME $NKERNBALL echo Unpacking a tarball, this may take a while tar Jxf $SDIR/$XKERNBALL mv $XDIRNAME $NDIRNAME cd $NDIRNAME cp -p $SDIR/config.kernel .config cp -p $SDIR/build-kernel.sh . chmod 755 build-kernel.sh for x in $SDIR/kernel*.patch do patch -p1 < $x done #--------------------------------------------------------------------- # Try to disable WiFi LEDs (the blinking is annoying). for x in `find . -type f -name Kconfig` do sed -e "/select MAC80211_LEDS/d" -i $x done sed -e "/CONFIG_MAC80211_LEDS=/d" \ -e "/CONFIG_RTL8187_LEDS=/d" \ -e "/CONFIG_B43_LEDS=/d" \ -e "/CONFIG_B43LEGACY_LEDS=/d" \ -e "/CONFIG_P54_LEDS=/d" \ -i .config #--------------------------------------------------------------------- # Remaining steps. make menuconfig # This must be run at least once cp -p .config $SDIR/config.kernel cd .. echo Creating a tarball, this may take a while tar cf - $NDIRNAME | pbzip2 -c > $NKERNBALL mv $NKERNBALL $SDIR/ cd $SDIR/ rm -fr $KERNTMPPATH tardate $NKERNBALL ls -l $NKERNBALL echo Done