diff options
| author | Jonathan Bauer | 2015-10-16 14:54:40 +0200 |
|---|---|---|
| committer | root | 2015-10-16 14:54:40 +0200 |
| commit | 060cb57e979ac29d0939fc2ecccc58e157119e1e (patch) | |
| tree | c7b459d12e73ce4477ba5387bc35979ce883c1ad /remote/includes | |
| parent | Merge branch 'master' of git://git.openslx.org/openslx-ng/tm-scripts (diff) | |
| download | tm-scripts-060cb57e979ac29d0939fc2ecccc58e157119e1e.tar.gz tm-scripts-060cb57e979ac29d0939fc2ecccc58e157119e1e.tar.xz tm-scripts-060cb57e979ac29d0939fc2ecccc58e157119e1e.zip | |
[kernel.inc] copy firmware from both the system and the build directory, prioritizing the later
Diffstat (limited to 'remote/includes')
| -rw-r--r-- | remote/includes/kernel.inc | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/remote/includes/kernel.inc b/remote/includes/kernel.inc index 9a5be9bb..d9e9a085 100644 --- a/remote/includes/kernel.inc +++ b/remote/includes/kernel.inc @@ -29,9 +29,9 @@ check_kernel_base_dir () { # check if KERNEL_BASE_DIR was set, if not we don't know # whether kernel-openslx or kernel-system has been built - # and therefore not were to look for kernel modules, + # and therefore not were to look for kernel modules, # firmware and the kernel itself - + if [ -z "${KERNEL_BASE_DIR}" ]; then # this is bad, abort perror "KERNEL_BASE_DIR is not set. The kernel module did not run properly" @@ -50,20 +50,20 @@ copy_kernel_modules () { check_kernel_base_dir local OLD_DIR="$(pwd)" - + # # process modules list # # search for modules in KERNEL_BASE_DIR cd "${KERNEL_BASE_DIR}" || perror "Could not cd to ${KERNEL_BASE_DIR}" - + local KERNEL_MODULES_DIR="lib/modules/${TARGET_KERNEL_LONG}" local KERNEL_MODULES_LIST="" local REQUIRED_KERNEL_MODULES_EXPANDED="" local KERNEL_MODULE="" local KERNEL_MODULE_PATH="" local ELEM="" - + # Do some fancy stuff to allow wildcards etc. in required kernel modules. cd "${KERNEL_MODULES_DIR}" for KERNEL_MODULE in ${REQUIRED_KERNEL_MODULES}; do @@ -89,7 +89,7 @@ copy_kernel_modules () { pwarning "Module ${KERNEL_MODULE} not found. Skipping. (might cause problems on certain clients!)" continue fi - + # check for dependencies local DEPS=$(grep "${KERNEL_MODULE}:" "${KERNEL_BASE_DIR}/${KERNEL_MODULES_DIR}/modules.dep" | cut -d ":" -f2-) if [ ! -z "$DEPS" ]; then @@ -101,13 +101,13 @@ copy_kernel_modules () { pdebug "${KERNEL_MODULE} has no dependencies." fi done - + if [ ! -z "${KERNEL_MODULES_LIST}" ]; then local COUNT=$(echo "${KERNEL_MODULES_LIST}" | wc -w) pinfo "Copying $COUNT modules to target directory." tarcopy "${KERNEL_MODULES_LIST}" "${TARGET_BUILD_DIR}" fi - + # # generate modules map files # @@ -124,7 +124,7 @@ copy_kernel_modules () { } copy_firmware () { - + pinfo "Copying firmware for kernel ${SYSTEM_KERNEL_LONG}..." [ -z "${REQUIRED_FIRMWARE}" ] && perror "REQUIRED_FIRMWARE is empty. Check your config file." @@ -136,52 +136,53 @@ copy_firmware () { # cd "${KERNEL_BASE_DIR}" || perror "Could not cd to ${KERNEL_BASE_DIR}" local FIRMWARE_DIR="lib/firmware" - local FIRMWARE_LIST="" + local FIRMWARE_SYSTEM_LIST="" + local FIRMWARE_BUILD_LIST="" for FIRMWARE in ${REQUIRED_FIRMWARE}; do local FOUND=0 # check for firmware in the build directory of the kernel for CANDIDATE in "${FIRMWARE_DIR}/${FIRMWARE}" "${FIRMWARE_DIR}/${TARGET_KERNEL_LONG}/${FIRMWARE}"; do if [ -e "${CANDIDATE}" ]; then pdebug "Copying from kernel base dir ('$KERNEL_BASE_DIR'): '${CANDIDATE}'" - FIRMWARE_LIST+=" ${CANDIDATE}" + FIRMWARE_BUILD_LIST+=" ${CANDIDATE}" FOUND=1 fi done # dont look under / if KERNEL_BASE_DIR is already / - if [ "x${KERNEL_BASE_DIR}" == "x/" ]; then - [ $FOUND -ne 1 ] && pwarning "Neither '${FIRMWARE_DIR}/${FIRMWARE}' nor '${FIRMWARE_DIR}/${TARGET_KERNEL_LONG}/${FIRMWARE}' found on the system" - continue - fi - + #if [ "x${KERNEL_BASE_DIR}" == "x/" ]; then + # [ $FOUND -ne 1 ] && pwarning "Neither '${FIRMWARE_DIR}/${FIRMWARE}' nor '${FIRMWARE_DIR}/${TARGET_KERNEL_LONG}/${FIRMWARE}' found on the system" + # continue + #fi + # if we didn't found it in the kernel build directory, check for firmware in the system firmware directory - if [ $FOUND -ne 1 ]; then - pdebug "Did not found '$FIRMWARE' in kernel base dir. Searching system..." - for CANDIDATE in "/${FIRMWARE_DIR}/${FIRMWARE}" "/${FIRMWARE_DIR}/${SYSTEM_KERNEL_LONG}/${FIRMWARE}"; do - if [ -e "${CANDIDATE}" ]; then - if [ $(echo "${CANDIDATE}" | grep -c "${SYSTEM_KERNEL_LONG}") -eq 0 ]; then - pdebug "Copying from system: '${CANDIDATE}'" - FIRMWARE_LIST+=" ${CANDIDATE}" - else - pdebug "Copying from system: '${CANDIDATE}' to ${FIRMWARE_DIR}/${TARGET_KERNEL_LONG}/${FIRMWARE}" - FIRMWARE_LIST+=" /${FIRMWARE_DIR}/${SYSTEM_KERNEL_LONG}/${FIRMWARE}" - fi - FOUND=1 + #if [ $FOUND -ne 1 ]; then + for CANDIDATE in "/${FIRMWARE_DIR}/${FIRMWARE}" "/${FIRMWARE_DIR}/${SYSTEM_KERNEL_LONG}/${FIRMWARE}"; do + if [ -e "${CANDIDATE}" ]; then + if [ $(echo "${CANDIDATE}" | grep -c "${SYSTEM_KERNEL_LONG}") -eq 0 ]; then + pdebug "Copying from system: '${CANDIDATE}'" + FIRMWARE_SYSTEM_LIST+=" ${CANDIDATE}" + else + pdebug "Copying from system: '${CANDIDATE}' to ${FIRMWARE_DIR}/${TARGET_KERNEL_LONG}/${FIRMWARE}" + FIRMWARE_SYSTEM_LIST+=" /${FIRMWARE_DIR}/${SYSTEM_KERNEL_LONG}/${FIRMWARE}" fi - done - fi - + FOUND=1 + fi + done + #fi + [ $FOUND -ne 1 ] && pwarning "Neither '${FIRMWARE_DIR}/${FIRMWARE}' nor '${FIRMWARE_DIR}/${TARGET_KERNEL_LONG}/${FIRMWARE}' "\ " was found on the system. Skipping. (might cause problems on certain clients!)" done - - if [ ! -z "${FIRMWARE_LIST}" ]; then - echo "$FIRMWARE_LIST" > "${MODULE_BUILD_DIR}/fwlist" - local COUNT=$(echo "${FIRMWARE_LIST}" | wc -w) + + for LIST in "${FIRMWARE_SYSTEM_LIST}" "${FIRMWARE_BUILD_LIST}"; do + [ -z "${LIST}" ] && continue + echo "${LIST}" >> "${MODULE_BUILD_DIR}/fwlist" + local COUNT=$(echo "${LIST}" | wc -w) pinfo "Copying $COUNT firmware to target directory." - tarcopy "${FIRMWARE_LIST}" "${TARGET_BUILD_DIR}" - fi - + tarcopy "${LIST}" "${TARGET_BUILD_DIR}" + done + # only for kernel-openslx # 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/${TARGET_KERNEL_LONG} @@ -202,7 +203,7 @@ copy_firmware () { copy_kernel () { check_kernel_base_dir - + local TOOL_STR="$TOOL_STR copy_kernel:" local KERNEL_DIR="${MODE_DIR}/builds/kernel" |
