Whamcloud - gitweb
LU-8083 lfsck: repair symbol file nlink properly
[fs/lustre-release.git] / lustre-dkms_post-build.sh
1 #!/bin/bash
2 # $1 : $module
3 # $2 : $module_version
4 # $3 : $kernelver
5 # $4 : $kernel_source_dir
6 # $5 : $arch
7 # $6 : $source_tree
8 # $7 : $dkms_tree
9 #
10 # This script ensure that ALL Lustre kernel modules that have been built
11 # during DKMS build step of lustre[-client]-dkms module will be moved in
12 # DKMS vault/repository, and this before the build directory content will be
13 # trashed.
14 # This is required because dkms.conf file is only sourced at the very
15 # beginning of the DKMS build step when its content has to be on-target
16 # customized during pre_build script. This can lead to incomplete list
17 # of built Lustre kernel modules then to be saved for next DKMS install step.
18
19 # Use this place to also save config.log that has been generated during
20 # pre_build.
21 # $7/$1/$2/$3/$5/log repository should have already been created to save
22 # make.log and $kernel_config
23 mkdir -p "$7/$1/$2/$3/$5/log"
24 mv -f "$7/$1/$2/build/config.log" "$7/$1/$2/$3/$5/log/config.log" 2>/dev/null
25
26 # read last dkms.conf version that has just been customized during pre_build
27 source $6/$1-$2/dkms.conf
28
29 # Make sure all the modules built successfully
30 for ((count=0; count < ${#BUILT_MODULE_NAME[@]}; count++)); do
31         # Lustre supported kernels are >= 2.5, so don't need to check for old .o
32         # module suffix
33         [[ -e ${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko ]] && continue
34         echo "Build of ${BUILT_MODULE_NAME[$count]}.ko failed for: $3 ($5)" \
35              "Consult logs in $7/$1/$2/$3/$5/log/ for more information."
36 done
37
38 # Strip modules ?
39 for ((count=0; count < ${#BUILT_MODULE_NAME[@]}; count++)); do
40         [[ ${STRIP[$count]} = '' ]] && STRIP[$count]=${STRIP[0]:-yes}
41         [[ ${STRIP[$count]} != no ]] && strip -g "$7/$1/$2/build/${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko"
42
43         # Save a copy of the new module in save area that should have been created in previous build steps
44         mkdir -p "$7/$1/$2/$3/$5/module" >/dev/null
45         # if DEST_MODULE_NAME[] is different than BUILD_MODULE_NAME[], need to use it as the module name in save area
46         # this is not presently the case for none of the Lustre kernel modules.
47         cp -f "$7/$1/$2/build/${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko" \
48               "$7/$1/$2/$3/$5/module/${BUILT_MODULE_NAME[$count]}.ko" >/dev/null
49 done
50