Lynx framebuffers multidomain implementation.
[linux/elbrus.git] / scripts / gen-osl-build
blob2a2f7ea84a45eabd16e0778b877705c0da3cb383
1 #!/bin/sh
3 usage() {
4 printf "Usage: `basename $0` -l <linuxsrc> -m <modpath>\n"
7 while [ $# -gt 0 ]; do
8 arg="$1"
9 shift
10 case "$arg" in
11 "-l") linuxsrc="$1"; shift;;
12 "-m") modpath="$1"; shift;;
13 "-h") usage; exit 0;;
15 printf "ERROR: unknown option \"$arg\"\n" >&2
16 usage >&2; exit 1;;
17 esac
18 done
20 docmd()
22 cmd="$*"
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
29 exit 1
31 if [[ -z ${modpath} ]]; then
32 echo "incorrect params: set -m option" >&2
33 exit 1
36 SRCARCH=$ARCH
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/
61 ### CLEANUP
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
75 exit 0