4 printf "Usage: `basename $0` -l <linuxsrc> -m <modpath>\n"
11 "-l") linuxsrc
="$1"; shift;;
12 "-m") modpath
="$1"; shift;;
15 printf "ERROR: unknown option \"$arg\"\n" >&2
23 [ ${KBUILD_VERBOSE} -eq 1 ] && echo $cmd
24 $cmd; [ $?
-ne 0 ] && exit 1
27 if [[ -z ${linuxsrc} ]]; then
28 echo "incorrect params: set -l option" >&2
31 if [[ -z ${modpath} ]]; then
32 echo "incorrect params: set -m option" >&2
37 [[ $ARCH == sparc64
]] && SRCARCH
=sparc
38 [[ $ARCH == i386
]] && SRCARCH
=x86
39 [[ $ARCH == x86_64
]] && SRCARCH
=x86
41 [ -L ${modpath}/build
] && docmd unlink
${modpath}/build
42 [ -d ${modpath}/build
] && docmd
rm -rf ${modpath}/build
43 [ -L ${modpath}/source ] && docmd unlink
${modpath}/source
44 [ -d ${modpath}/source ] && docmd
rm -rf ${modpath}/source
46 docmd mkdir
-p ${modpath}/build
47 docmd
cp ${linuxsrc}/Module.symvers
${modpath}/build
/
48 docmd
cp ${linuxsrc}/.config
${modpath}/build
/
49 docmd
cp ${linuxsrc}/Makefile
${modpath}/build
/
50 docmd
cp -r ${linuxsrc}/scripts
${modpath}/build
/
52 docmd mkdir
-p ${modpath}/build
/arch
/$SRCARCH
53 docmd
cp ${linuxsrc}/arch
/$SRCARCH/Makefile
${modpath}/build
/arch
/$SRCARCH/
54 [[ $ARCH == i386
]] && cp ${linuxsrc}/arch
/x86
/Makefile_32.cpu
${modpath}/build
/arch
/x86
/
56 docmd
cp -r -L ${linuxsrc}/include
${modpath}/build
/
58 docmd mkdir
-p ${modpath}/build
/arch
/$SRCARCH
59 docmd
cp -r -L ${linuxsrc}/arch
/$SRCARCH/include
${modpath}/build
/arch
/$SRCARCH/
63 docmd
rm -f ${modpath}/build
/include
/linux
/mac
/mac_kernel.h
65 docmd
cd ${modpath}/build
66 rm -rf $
(find -name ".svn")
68 docmd
cd ${modpath}/build
/scripts
69 ll
=$
(find -name .
'*'.cmd
); docmd
rm -rf $ll
70 ll
=$
(find -name '*'.c
); docmd
rm -rf $ll
71 ll
=$
(find -name '*'.o
); docmd
rm -rf $ll
72 ll
=$
(find -name '*'.h
); docmd
rm -rf $ll