Ubuntu 13.04 自动编译内核脚本
1、下载内核编译工具及源码
#! sh gk.sh
sudo apt-get install kernel-wedge kernel-package libncurses5-dev
sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
sudo apt-get source linux-image-$(uname -r)
exit $ret
2、内核配置编译安装
#usage " sh mk.sh kernel-vesion append-to-version revision concurrency-num "
sh mk.sh 3.8.0 -2 1.1 3
if test $# -ne 4; then
echo "Usage: mk.sh kernel-vesion append-to-version revision concurrency-num " >&2
exit 1
fi
KV=$1
AV=$2
RV=$3
CN=$4
#if ! test -e “linux-source-$KV.tar.bz2”; then
echo “Can’t find linux-source-$KV.tar.bz2” >&2
exit 1
#fi
read -p "Do you delete *.deb ? Y/n " -r YN
if test $YN = “Y”; then
rm *.deb
fi
#read -p "Do you unzip linux-source-$KV.tar.bz2 ? Y/n " -r YN
#if test $YN = “Y”; then
tar jfx linux-source-$KV.tar.bz2
#fi
cd linux-$KV
read -p "Do you rebuild ? Y/n " -r YN
if test $YN = “Y”; then
make mrproper
make-kpkg clean
fi
cp /boot/config-uname -r
./.config
make localmodconfig
read -p "Do you config it ? Y/n " -r YN
if test $YN = “Y”; then
make menuconfig
fi
date +%s > starttime
make-kpkg --initrd --append-to-version=$AV --revision $RV kernel-headers kernel_image -j$CN > 1
date +%s > endtime
echo “start time=”
cat starttime
echo “end time=”
cat endtime
cd …
read -p "Do you install linux-image*$AV_$RV_*.deb ? Y/n " -r YN
if test $YN = “Y”; then
if test -e "linux-image*$AV_$RV_.deb"; then
sudo dpkg -i linux-image$AV_$RV_*.deb
fi
fi
ls -l /boot
exit $ret