summaryrefslogtreecommitdiffstats
path: root/helper
diff options
context:
space:
mode:
authorJonathan Bauer2013-07-08 14:37:38 +0200
committerJonathan Bauer2013-07-08 14:37:38 +0200
commitc2362050ff4d92705e50a79906d5e62a7954e2df (patch)
tree6f1951e627dd808e28b38f5cd7c30321369ee483 /helper
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
downloadtm-scripts-c2362050ff4d92705e50a79906d5e62a7954e2df.tar.gz
tm-scripts-c2362050ff4d92705e50a79906d5e62a7954e2df.tar.xz
tm-scripts-c2362050ff4d92705e50a79906d5e62a7954e2df.zip
[kernel] remember last built version and if new kernel is detected, ask what to do. WARNING: KVERSION file will be missing, write the old (uname -r) under remote/modules/ksrc/KVERSION to be safe :)
Diffstat (limited to 'helper')
-rw-r--r--helper/kernel.inc38
-rw-r--r--helper/system.inc4
2 files changed, 20 insertions, 22 deletions
diff --git a/helper/kernel.inc b/helper/kernel.inc
index af2af38b..61fa3efd 100644
--- a/helper/kernel.inc
+++ b/helper/kernel.inc
@@ -7,21 +7,21 @@
# copies kernel modules as given in the module config file
# * depends on 'depmod'
# * requires REQUIRED_KERNEL_MODULES to be set.
-# (entries must be a relative path to /lib/modules/<KERNEL_VERSION>)
+# (entries must be a relative path to /lib/modules/<KERNEL_CURRENT_VERSION>)
#
# ex: for /lib/modules/3.2.0/kernel/fs/nfs/nfs.ko
# must be given as kernel/fs/nfs/nfs.ko
#
-# this code depends on KERNEL_VERSION, this file needs to be sourced after helper/system.inc!
-# (TODO: maybe source system.inc if KERNEL_VERSION is empty.
-if [ -z "${KERNEL_VERSION}" ]; then
+# this code depends on KERNEL_CURRENT_VERSION, this file needs to be sourced after helper/system.inc!
+# (TODO: maybe source system.inc if KERNEL_CURRENT_VERSION
+if [ -z "${KERNEL_CURRENT_VERSION}" ]; then
. ${ROOT_DIR}/helper/system.inc
- [ -z "${KERNEL_VERSION}" ] && perror "KERNEL_VERSION still not set after sourcing, something is very wrong..."
+ [ -z "${KERNEL_CURRENT_VERSION}" ] && perror "KERNEL_CURRENT_VERSION still not set after sourcing, something is very wrong..."
fi
# set global KERNEL_TARGET_NAME
-KERNEL_TARGET_NAME="vmlinuz-${KERNEL_VERSION}-openslx"
+KERNEL_TARGET_NAME="kernel"
check_kernel_build_dir() {
[ -d "${MODULES_DIR}/kernel/build" ] && KERNEL_BUILD_DIR="${MODULES_DIR}/kernel/build" \
@@ -31,7 +31,7 @@ check_kernel_build_dir() {
}
copy_kernel_modules() {
-
+ pinfo "Copying kernel modules for kernel ${KERNEL_CURRENT_VERSION}..."
[ -z "${REQUIRED_KERNEL_MODULES}" ] && perror "REQUIRED_KERNEL_MODULES is empty. Check your config file."
check_kernel_build_dir
#
@@ -104,8 +104,9 @@ copy_kernel_modules() {
copy_firmware() {
+ pinfo "Copying firmware for kernel ${KERNEL_CURRENT_VERSION}..."
[ -z "${REQUIRED_FIRMWARE}" ] && perror "REQUIRED_FIRMWARE is empty. Check your config file."
- local HORST=$(pwd)
+ local OLD_DIR=$(pwd)
check_kernel_build_dir
#
# process firmware list
@@ -126,14 +127,14 @@ copy_firmware() {
# if we didn't found it in the kernel build directory, check for firmware in the system firmware directory
if [ $FOUND -ne 1 ]; then
- for CANDIDATE in "/${FIRMWARE_DIR}/${FIRMWARE}" "/${FIRMWARE_DIR}/${KERNEL_VERSION}/${FIRMWARE}"; do
+ for CANDIDATE in "/${FIRMWARE_DIR}/${FIRMWARE}" "/${FIRMWARE_DIR}/${KERNEL_CURRENT_VERSION}/${FIRMWARE}"; do
if [ -e "${CANDIDATE}" ]; then
- if [ $(echo "${CANDIDATE}" | grep -c "${KERNEL_VERSION}") -eq 0 ]; then
+ if [ $(echo "${CANDIDATE}" | grep -c "${KERNEL_CURRENT_VERSION}") -eq 0 ]; then
pdebug "Copying from system: '${CANDIDATE}'"
FIRMWARE_LIST+=" ${CANDIDATE}"
else
pdebug "Copying from system: '${CANDIDATE}' to ${FIRMWARE_DIR}/${KERNEL_NEW_VERSION}/${FIRMWARE}"
- FIRMWARE_LIST+=" /${FIRMWARE_DIR}/${KERNEL_VERSION}/${FIRMWARE}"
+ FIRMWARE_LIST+=" /${FIRMWARE_DIR}/${KERNEL_CURRENT_VERSION}/${FIRMWARE}"
fi
FOUND=1
fi
@@ -152,26 +153,23 @@ copy_firmware() {
# post-process to fix the path of the firmwares found on the system unter /lib/firmware/$(uname -r)
# which have to be copied to /lib/firmware/${KERNEL_NEW_VERSION}
- if [ -d "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_VERSION}" ]; then
+ if [ -d "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_CURRENT_VERSION}" ]; then
mkdir -p "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_NEW_VERSION}/"
- #mv -f "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_VERSION}/"* "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_NEW_VERSION}/"
- cd "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_VERSION}" || perror "old kernel but no old kernel"
+ cd "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_CURRENT_VERSION}" || perror "old kernel but no old kernel"
tarcopy "$(ls)" "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_NEW_VERSION}/"
cd -
- rm -r "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_VERSION}" || perror "something went very wrong..."
+ rm -r "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_CURRENT_VERSION}" || perror "something went very wrong..."
else
- pdebug "No ${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_VERSION} directory, skipping the merge."
+ pdebug "No ${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_CURRENT_VERSION} directory, skipping the merge."
fi
- cd "$HORST"
+ cd "$OLD_DIR"
}
copy_kernel() {
-
- local TOOL_STR="$TOOL_STR copy_kernel:"
-
check_kernel_build_dir
+ local TOOL_STR="$TOOL_STR copy_kernel:"
local KERNEL_DIR="${MODE_DIR}/builds/kernel"
pinfo "Copying '${KERNEL_TARGET_NAME}' to '${KERNEL_DIR}'."
[ -d "${KERNEL_DIR}" ] || mkdir -p "${KERNEL_DIR}"
diff --git a/helper/system.inc b/helper/system.inc
index c37368cb..0796c974 100644
--- a/helper/system.inc
+++ b/helper/system.inc
@@ -12,8 +12,8 @@ ARCH_LIB_DIR=$(ldd $SHELL | grep "libc.so" | sed -r 's#^.*(/lib.*)/libc.so.*$#\1
[ -z "$ARCH_LIB_DIR" -o ! -d "$ARCH_LIB_DIR" ] && perror "Could not determine arch dependent lib dir (where libc.so resides)"
# determine kernel version
-KERNEL_VERSION=$(uname -r)
-[ ! -z $KERNEL_VERSION ] || pwarning "Could not determine kernel version."
+KERNEL_CURRENT_VERSION=$(uname -r)
+[ ! -z $KERNEL_CURRENT_VERSION ] || pwarning "Could not determine kernel version."
# determine number of CPU cores
CPU_CORES=$(cat /proc/cpuinfo | grep processor | wc -l)