5777003 [rkeene@sledge /home/rkeene/archive/boot-slack/slackware-9.1-minicd/kernels]$ cat -n compile_kern.sh
 1 #!/bin/sh
 2 # compile_kern.sh version 1.2 (Sat Mar  8 13:22:29 PST 2003) pjv
 3 #
 4 # Rebuild a tree of directories containing a System.map, .config (renamed
 5 # config), and kernel (zImage or bzImage).  The input is a tree of
 6 # directories beneath the current one with names matching the wildcard *.?
 7 # (in Slackware, these will typically be *.i for IDE kernels and *.s for
 8 # IDE/SCSI kernels).  At the minimum, each directory must contain the file
 9 # 'config', which is the .config to start with when building the kernel.
10 
11 CWD=`pwd`
12 KERNEL=2.4.22
13 KERNELSRC=$CWD/../slackware/k/kernel-source-${KERNEL}-noarch-3.tgz
14 TMP=/tmp
15 OUTPUT=$TMP/output
16 
17 # Use the source from Slackware's K series.
18 if [ ! -d $TMP/linux-${KERNEL} ]; then
19   ( cd $TMP
20     rm -rf krntmp
21     mkdir krntmp
22     explodepkg $KERNELSRC
23     sh install/doinst.sh
24     mv usr/src/linux-${KERNEL} $TMP
25     rm -rf krntmp
26   )
27 fi
28 if [ ! -d $OUTPUT ]; then
29   mkdir -p $OUTPUT
30 fi
31 
32 for dir in *.? ; do
33   if [ ! -r $dir/config ]; then
34     continue
35   fi
36   if [ -r $OUTPUT/$dir/zImage \
37        -o -r $OUTPUT/$dir/bzImage ]; then
38     echo "kernel found in $OUTPUT/$dir... skipping."
39   #  sleep 1
40     continue
41   fi
42   echo
43   echo "------------------------------------------"
44   echo " BUILDING: $dir"
45   echo "------------------------------------------"
46   echo
47   sleep 1
48   cp $dir/config $TMP/linux-${KERNEL}/.config
49   cd $TMP/linux-${KERNEL}
50   make oldconfig ; make dep ; make clean
51   make -j 3 zImage
52   if [ $? = 0 ]; then # good build
53     echo
54     echo "------------------------------------------"
55     echo "Saving output in $OUTPUT/$dir"
56     echo "------------------------------------------"
57     echo
58     mkdir -p $OUTPUT/$dir
59     cp arch/i386/boot/zImage $OUTPUT/$dir
60     cp System.map $OUTPUT/$dir
61     cp .config $OUTPUT/$dir/config
62     echo "Cleaning up..."
63     make clean
64   else
65     # If building a zImage didn't fit, we'll try building a bzImage.
66     make -j 3 bzImage
67     if [ $? = 0 ]; then # good build
68       echo
69       echo "------------------------------------------"
70       echo "Saving output in $OUTPUT/$dir"
71       echo "------------------------------------------"
72       echo
73       mkdir -p $OUTPUT/$dir
74       cp arch/i386/boot/bzImage $OUTPUT/$dir
75       cp System.map $OUTPUT/$dir
76       cp .config $OUTPUT/$dir/config
77       echo "Cleaning up..."
78       make clean
79     fi
80   fi
81   cd $CWD
82 done
5777004 [rkeene@sledge /home/rkeene/archive/boot-slack/slackware-9.1-minicd/kernels]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2004-01-11 03:20:52