Add log file facility
This commit is contained in:
@@ -21,6 +21,7 @@ set -euo pipefail
|
||||
name=$(basename $0)
|
||||
NUMCORES=$(nproc)
|
||||
JOBS=$((${NUMCORES}*2))
|
||||
LOG=kbuild_log
|
||||
|
||||
CONFIGURE=1
|
||||
BUILD_INSTALL_MOD=1
|
||||
@@ -42,23 +43,34 @@ set +u
|
||||
}
|
||||
set -u
|
||||
cd $1 || exit 1
|
||||
rm -f ${LOG} 2>/dev/null
|
||||
(
|
||||
date
|
||||
echo "[Logging to file ${LOG} ...]"
|
||||
echo "Version: $(head Makefile)"
|
||||
) 2>&1 | tee -a ${LOG}
|
||||
|
||||
if [[ ${CONFIGURE} -eq 1 ]] ; then
|
||||
(
|
||||
lsmod > /tmp/lsmod.now
|
||||
echo "[+] make LSMOD=/tmp/lsmod.now localmodconfig"
|
||||
make LSMOD=/tmp/lsmod.now localmodconfig
|
||||
echo "[+] make oldconfig"
|
||||
make oldconfig # Update current config utilising a provided .config as base
|
||||
echo "[+] make menuconfig "
|
||||
) 2>&1 | tee -a ${LOG}
|
||||
# menuconfig and tee (w/ stderr too redirected) don't seem to get along..
|
||||
make menuconfig && echo || die "menuconfig failed"
|
||||
ls -l .config
|
||||
ls -l .config 2>&1 | tee -a ${LOG}
|
||||
else
|
||||
(
|
||||
echo "[-] Skipping kernel configure, just running 'make oldconfig'"
|
||||
echo "[+] make oldconfig"
|
||||
make oldconfig # Update current config utilising a provided .config as base
|
||||
) 2>&1 | tee -a ${LOG}
|
||||
fi
|
||||
|
||||
(
|
||||
# Ensure config is sane; on recent Ubuntu (~ kernel ver >= 5.13),
|
||||
# SYSTEM_REVOCATION_KEYS being enabled causes the build to fail..
|
||||
echo
|
||||
@@ -66,8 +78,12 @@ echo "[+] scripts/config --disable SYSTEM_REVOCATION_KEYS"
|
||||
scripts/config --disable SYSTEM_REVOCATION_KEYS
|
||||
|
||||
echo
|
||||
date
|
||||
echo "[+] time make -j${JOBS}"
|
||||
time make -j${JOBS} && echo || die "make <kernel> *failed*"
|
||||
time make -j${JOBS} && {
|
||||
echo
|
||||
date
|
||||
} || die "make <kernel> *failed*"
|
||||
[[ ! -f arch/x86/boot/bzImage ]] && die "make <kernel> *failed*? arch/x86/boot/bzImage not gen."
|
||||
|
||||
if [[ ${BUILD_INSTALL_MOD} -eq 1 ]] ; then
|
||||
@@ -84,4 +100,6 @@ sudo make install || die "*Failed*"
|
||||
echo "
|
||||
Done, reboot, select your new kernel from the bootloader menu & boot it
|
||||
(If not already done, you first need to configure GRUB to show the menu at boot)"
|
||||
date
|
||||
) 2>&1 | tee -a ${LOG}
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user