File: kernelsrc

package info (click to toggle)
mol 0.9.70-17
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,436 kB
  • ctags: 11,008
  • sloc: ansic: 60,495; asm: 3,306; makefile: 716; yacc: 706; sh: 546; lex: 501; cpp: 370; perl: 228; pascal: 18
file content (45 lines) | stat: -rwxr-xr-x 1,104 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#
# determine which kernel tree to use and verify
# that the kernel source is properly configured


function headercheck()
{
    test -d $KERNEL_SOURCE || KERNEL_SOURCE="/lib/modules/`uname -r`/build"
    test -d $KERNEL_SOURCE || KERNEL_SOURCE=/usr/src/linux

    if ! test -d $KERNEL_SOURCE ; then
	echo 
	echo " --- The kernel source directory '$KERNEL_SOURCE' does not exist."
	echo " --- Set the KERNEL_SOURCE environment variable to the appropriate directory."
	echo 
	exit 1
    fi

    if ! test -f $KERNEL_SOURCE/include/linux/config.h ; then
	echo 
	echo " --- Error: Unconfigured kernel source!"
	echo " --- (missing file: $KERNEL_SOURCE/include/linux/config.h)"
	echo 
	exit 1
    fi

    if ! test -f $KERNEL_SOURCE/include/linux/autoconf.h ; then
	echo
	echo " --- Error: Unconfigured kernel headers!"
	echo " --- (missing file: $KERNEL_SOURCE/include/linux/autoconf.h)"
	echo
	exit 1
    fi

    if ! test -f $KERNEL_SOURCE/Makefile ; then
	echo " --- The kernel source '$KERNEL_SOURCE' does not have a Makefile!"
	exit 1
    fi
}

headercheck 1>&2

echo $KERNEL_SOURCE
exit 0