File: prepare-kernel-source

package info (click to toggle)
isdnutils 1%3A3.1pre4-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 17,096 kB
  • ctags: 11,039
  • sloc: ansic: 95,142; sh: 15,612; perl: 4,429; makefile: 3,064; cpp: 2,708; sql: 54
file content (62 lines) | stat: -rw-r--r-- 1,779 bytes parent folder | download | duplicates (5)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh -x

rm -f linux	# Cleaning up

# Only do the below on linux systems
if [ `uname -s` != Linux ]; then exit 0; fi

DEB_HOST_ARCH="$1"

# find kernel source. We build-depend on kernel-source-2.4, so it could
# be 2.4.7, 2.4.9, 2.4.123, ...

LINUXVER=`ls /usr/src |
    grep 'kernel-source-2.4.*tar.bz2' |
    tail -1 |
    sed 's,.*source-\(2.4.[^.]*\).tar..*,\1,'`

curdir=`pwd`
# powerpc shouldn't need to be special anymore
case $DEB_HOST_ARCH in
    XXXnot-powerpc)
	# On PowerPC the kernel needs to be reconfigured,
	# before we can build.  Otherwise we would create broken packages.
	rm -rf debian/kernel-source-$LINUXVER
	if [ -e /usr/src/kernel-source-$LINUXVER.tar.bz2 ]; then
	    cd debian
	    bzcat /usr/src/kernel-source-$LINUXVER.tar.bz2 | tar xf -
	    ln -sf debian/kernel-source-$LINUXVER ../linux
	    cp kernel-config-2.4.ppc ../linux/.config
	    cd ../linux && make oldconfig dep
	fi
	;;
    powerpc|alpha|arm|i386|ia64|m68k|mips|mipsel|sparc)
	if [ -e ../linux-for-isdnutils ]; then
	    # hack for maintainer to not (slowly) extract source everytime
	    ln -s ../linux-for-isdnutils linux
	fi
	if [ ! -e linux ]; then
	    cd debian
	    bzcat /usr/src/kernel-source-$LINUXVER.tar.bz2 |
		tar xf - kernel-source-$LINUXVER/drivers/isdn kernel-source-$LINUXVER/include
	    ln -sf debian/kernel-source-$LINUXVER ../linux
	    # now correct asm symlink
	    cd ../linux/include
	    rm -f asm && ln -s asm-$DEB_HOST_ARCH asm
	fi
	;;
    *)
        echo "Architecture not in powerpc|alpha|arm|i386|ia64|m68k|mips|mipsel|sparc"
        echo "so no need for kernel source."
        exit 0
        ;;
esac

# sanity check
cd $curdir
if [ ! -e linux -o ! -e linux/drivers/isdn/isdn_tty.h ]; then
    echo "kernel source not found!!"
    exit 1
fi

exit 0