3 # author: hackbard@hackdaworld.dyndns.org
5 # create a kernel binary package
14 -config) config=$2 ; shift 2 ;;
15 -name) name=$2 ; shift 2 ;;
20 echo "-config <kernel config file>"
21 echo "-name <kernel name>"
29 if [ "$hdw_arch" != "ia32" ] ; then
30 echo "warning: only ia32 supported by now"
35 [ -z "$config" ] && config="./misc/arch/${hdw_arch}/linux.config"
36 [ -z "$name" ] && name="custom-$hdw_arch"
38 if [ ! -f $config ] ; then
39 echo "$config doesn't exist, aborting ..."
43 kerpkg="`grep '^#\ \[D\]' ./packages/base/linux/linux | awk '{ print $3 }'`"
44 kerver="`grep '^#\ \[V\]' ./packages/base/linux/linux | awk '{ print $3 }'`"
46 trg=$homedir/kernel-image-${kerver}_${name}.tar.bz2
48 echo "image $trg already exists, aborting ..."
52 [ ! -f ./download/base/linux/$kerpkg ] && ./scripts/Download -package linux
54 # backing up old kernel + modules
56 if [ -f /boot/vmlinuz_$kerver ] ; then
57 mv /boot/vmlinuz_$kerver /boot/vmlinuz_${kerver}__orig
61 if [ -d /lib/modules/$kerver ] ; then
62 mv /lib/modules/$kerver /lib/modules/${kerver}__orig
66 # build kernel & modules
67 kerarch=${hdw_arch//ia32/i386}
68 cp $config /tmp/linux.config
69 rm -rf /tmp/linux-$kerver
70 tar xfj ./download/base/linux/$kerpkg -C /tmp
72 mv ../linux.config .config
73 cd include && ln -sf asm-${kerarch} asm && cd ..
74 yes "" | make oldconfig
75 make bzImage modules modules_install
76 cp arch/$kerarch/boot/bzImage /boot/vmlinuz_$kerver
77 cp .config /boot/kernel-config-$kerver-$name
81 tar --use-compress-program=bzip2 -cf $trg lib/modules/$kerver \
82 boot/vmlinuz_$kerver /boot/kernel-config-$kerver-$name
86 # restore kernel & modules
87 rm -f /boot/vmlinuz_$kerver
88 [ "$kerbackup" = "yes" ] && \
89 mv /boot/vmlinuz_${kerver}__orig /boot/vmlinuz_$kerver
90 rm -rf /lib/modules/$kerver
91 [ "$modbackup" = "yes" ] && \
92 mv /lib/modules/${kerver}__orig /lib/modules/$kerver