2011-06-29 06:43:12 +02:00
|
|
|
set -ev
|
|
|
|
|
|
|
|
# (possibly) build the kernel
|
|
|
|
|
2012-01-09 22:17:42 +01:00
|
|
|
current_kernel=""
|
|
|
|
if [ -d "/var/db/pkg/sys-kernel" ]
|
|
|
|
then
|
|
|
|
cd "/var/db/pkg/sys-kernel"
|
|
|
|
current_kernel=`/bin/ls -d1 "${KERNEL}-"* | tail -n 1|sed s/"${KERNEL}-//;s/-r[1-9]\+$//"`
|
|
|
|
fi
|
|
|
|
|
2011-06-29 06:43:12 +02:00
|
|
|
# If there is already a kernel in /boot and emerging the kernel only
|
|
|
|
# re-installs the same package, we can skip this
|
2012-01-09 22:17:42 +01:00
|
|
|
if [ -n "$current_kernel" ] && [ -e /boot/vmlinuz ] && \
|
|
|
|
readlink /boot/vmlinuz | grep $current_kernel > /dev/null
|
2011-06-29 06:43:12 +02:00
|
|
|
then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2014-06-13 13:16:25 +02:00
|
|
|
${EMERGE} ${USEPKG} -Nn sys-kernel/${KERNEL}
|
2011-06-29 06:43:12 +02:00
|
|
|
cp /root/kernel.config /usr/src/linux/.config
|
|
|
|
gcc-config 1
|
|
|
|
cd /usr/src/linux
|
|
|
|
make ${MAKEOPTS} oldconfig
|
|
|
|
make ${MAKEOPTS}
|
|
|
|
rm -rf /lib/modules/*
|
|
|
|
make ${MAKEOPTS} modules_install
|
|
|
|
rm -f /boot/vmlinuz*
|
|
|
|
make ${MAKEOPTS} install
|
2014-06-14 23:52:04 +02:00
|
|
|
cp -a /usr/src/linux/.config /root/kernel.config
|
2014-06-13 13:18:26 +02:00
|
|
|
make ${MAKEOPTS} mrproper
|
2011-06-29 06:43:12 +02:00
|
|
|
cd /boot
|
|
|
|
k=`/bin/ls -1 vmlinuz-*`
|
|
|
|
ln -nsf $k vmlinuz
|
2011-11-12 14:24:50 +01:00
|
|
|
${EMERGE} --depclean
|