buildCurrentSymlinkedKernel: add support for chroot build

Save config to /etc/kernelconf and use it for rebuilds. this should
prevent raceconditions between enabling a feature and rebooting and
upgrading the kernel. (the upgraded kernel should no be based on the new
feature build.)
This commit is contained in:
layman 2019-06-25 10:33:29 +02:00
parent 21f44786fc
commit 30dc18a5dc

View file

@ -3,6 +3,8 @@
SRC_TREE="/usr/src/linux"
SRC_CONFIG=".config"
CONFIGDIR="/etc/kernelconf"
declare -a OUT
umask 022
@ -18,10 +20,11 @@ if [[ "$1" == "--force" ]] ; then
FORCE="1"
fi
if [[ -f /proc/config.gz ]] ; then
OLDCONFIG="1"
fi
for config in "/proc/config.gz" "$CONFIGDIR/latest" ; do
if [[ -f "$config" ]] ; then
OLDCONFIG="$config"
fi
done
if [[ "$NOCONFIG" || "$FORCE" ]] ; then
echo "**************** building kernel ***********"
@ -29,10 +32,10 @@ if [[ "$NOCONFIG" || "$FORCE" ]] ; then
TIMESTAMP=$(date +%F-%H_%M_%S)
if [[ "$NOCONFIG" ]] ; then
if [[ "$OLDCONFIG" ]] ; then
if [[ -n "$OLDCONFIG" ]] ; then
OUT+=("********** Using old config ************")
echo "${OUT[-1]}"
zcat /proc/config.gz > .config
zcat -f "$config" > .config
else
OUT+=("********** WARNING! No old config has been found! Using defconfig! ************")
echo "${OUT[-1]}"
@ -68,7 +71,14 @@ if [[ "$NOCONFIG" || "$FORCE" ]] ; then
echo Summary:
IFS=$'\n' echo -e "${OUT[*]}"
echo diff between current running und last build config:
diff .config <(zcat /proc/config.gz )
diff .config <(zcat -f "${OLDCONFIG}" )
if [[ -d "$CONFIGDIR" ]] ; then
VERSIONSTRING=$(basename $(realpath $(pwd)))
TARGET="$CONFIGDIR/${VERSIONSTRING}_$(date --iso=minutes)"
cp .config "$TARGET"
ln -f -rs "$TARGET" "$CONFIGDIR/latest"
fi
fi