3 # Copyright (C) 2012, Luis R. Rodriguez <mcgrof@frijolero.org>
4 # Copyright (C) 2012, Hauke Mehrtens <hauke@hauke-m.de>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 2 as
8 # published by the Free Software Foundation.
10 # You can use this to compile a module accross all installed kernels
11 # found. This relies on distribution specific kernels, but can handle
12 # your own custom list of target kernels. Log is setnt to LOG variable.
24 #export KCFLAGS="-Wno-unused-but-set-variable"
25 KERNEL_DIR="/lib/modules"
29 LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
32 for i in $(find /lib/modules/ -type d -name \*generic\* | sort -n -r); do
37 echo -e "Unsupported distribution"
42 nice make clean 2>&1 > $LOG
47 echo -e "--------------------------------------------" >> $LOG
49 if [[ ! -d $DIR ]]; then
53 echo -en "Trying kernel ${BLUE}" | tee -a $LOG
54 printf "%40s\t" "${KERNEL}" | tee -a $LOG
55 echo -en "${NORMAL}" | tee -a $LOG
57 ionice -c 3 nice -n 20 make KLIB=$DIR KLIB_BUILD=$DIR -j6 -Wunused-but-set-variable &>> $LOG
58 if [[ $? -eq 0 ]]; then
59 echo -e "${GREEN}[OK]${NORMAL}" | tee -a $LOG
61 echo -e "${RED}[FAILED]${NORMAL}" | tee -a $LOG
64 nice make clean KLIB=$DIR KLIB_BUILD=$DIR 2>&1 >> $LOG
67 cat $LOG | ./scripts/skip-colors > $LOG.tmp