Created
March 22, 2015 10:01
-
-
Save strohel/14568a34b4896dbbd224 to your computer and use it in GitHub Desktop.
Script to install kernel binary to /boot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bootdir="/boot" | |
installfiles=".config arch/x86/boot/bzImage" | |
cdpath=/usr/src/linux | |
grub_config=grub2-mkconfig | |
testfile() { | |
if [ ! -r "$1" ]; then | |
echo "$1" not found | |
exit 1 | |
fi | |
} | |
if ! make kernelrelease > /dev/null; then | |
echo Cannot issue make kernelrelease, attempting to cd into right dir | |
cd "${cdpath}" | |
if ! make kernelrelease > /dev/null; then | |
echo No luck even here, exiting | |
exit 1 | |
fi | |
fi | |
kernelversion=`make kernelrelease` | |
make modules_install || exit 1 | |
echo Installing kernel version ${kernelversion} to ${bootdir} | |
for file in ${installfiles}; do | |
testfile ${file} | |
done | |
mkdir ${bootdir}/${kernelversion} | |
for file in ${installfiles}; do | |
if [ "${file}" = ".config" -a -r ${bootdir}/${kernelversion}/`basename "${file}"` ]; then | |
diff -u ${bootdir}/${kernelversion}/`basename "${file}"` ${file} | less | |
fi | |
cp -iv ${file} ${bootdir}/${kernelversion}/`basename "${file}"` | |
done | |
echo | |
echo "Done. Run \`${grub_config} -o ${bootdir}/grub2/grub.cfg\`? (y/N)" | |
read answer | |
if [ "X${answer}" = "Xy" -o "X${answer}" = "XY" ]; then | |
${grub_config} -o ${bootdir}/grub2/grub.cfg | |
else | |
echo "Not running grub-mkconfig. Bye." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment