1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs sanitized kernel header installation
|
---|
4 | # ----------------------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | # install kernel headers
|
---|
12 |
|
---|
13 | cd ${SRC}
|
---|
14 | LOG=sanitised-kernel-headers.log
|
---|
15 | unpack_tarball linux-libc-headers-${LINUX_LIBC_HDRS_VER} &&
|
---|
16 | cd ${PKGDIR}
|
---|
17 |
|
---|
18 | # Setup ownership and permissions properly
|
---|
19 | # TODO: This assumes you are root...
|
---|
20 | #chown -R 0 *
|
---|
21 | #chgrp -R 0 *
|
---|
22 |
|
---|
23 | # Setup permissions
|
---|
24 | find . -type d | xargs chmod 755
|
---|
25 | find . -type f | xargs chmod 644
|
---|
26 |
|
---|
27 | max_log_init sanitised-kernel-headers ${LINUX_LIBC_HDRS_VER} '' ${INSTLOGS} ${LOG}
|
---|
28 |
|
---|
29 | # Install the headers.
|
---|
30 |
|
---|
31 | # If we are using sanitised headers,
|
---|
32 | # install the sanitised ones into
|
---|
33 | # ${TGT_TOOLS}/include
|
---|
34 | if [ "${USE_SYSROOT}" = "Y" ]; then
|
---|
35 | INSTALL_PREFIX="${LFS}/usr"
|
---|
36 | else
|
---|
37 | INSTALL_PREFIX="${TGT_TOOLS}"
|
---|
38 | fi
|
---|
39 | KERN_HDR_DIR=${INSTALL_PREFIX}/include
|
---|
40 |
|
---|
41 | # If we are doing a biarch build we will need the kernel headers for
|
---|
42 | # both architectures and will have to create stub headers in include/asm
|
---|
43 |
|
---|
44 | test "Y" = "${MULTIARCH}" &&
|
---|
45 | {
|
---|
46 | case ${TGT_ARCH} in
|
---|
47 | x86_64 | x86-64 )
|
---|
48 | ARCH1_SWITCH=__x86_64__
|
---|
49 | ARCH1=x86_64
|
---|
50 | ARCH2=i386
|
---|
51 | ;;
|
---|
52 | sparc* | ultrasparc* )
|
---|
53 | ARCH1_SWITCH=__arch64__
|
---|
54 | ARCH1=sparc64
|
---|
55 | ARCH2=sparc
|
---|
56 | ;;
|
---|
57 | ppc* | powerpc* )
|
---|
58 | ARCH1_SWITCH=__powerpc64__
|
---|
59 | ARCH1=ppc64
|
---|
60 | ARCH2=ppc
|
---|
61 | ;;
|
---|
62 | s390* )
|
---|
63 | ARCH1_SWITCH=__s390x__
|
---|
64 | ARCH1=s390x
|
---|
65 | ARCH2=s390
|
---|
66 | ;;
|
---|
67 | mips* )
|
---|
68 | ARCH1=mips
|
---|
69 | ;;
|
---|
70 | esac
|
---|
71 |
|
---|
72 | # TODO: This needs to be done better
|
---|
73 | # Here we are handling the case of mips, where only the one set of
|
---|
74 | # asm headers are provided (and needed) for multi-arch.
|
---|
75 | if [ -z "${ARCH1_SWITCH}" ]; then
|
---|
76 | mkdir -p ${KERN_HDR_DIR}/asm
|
---|
77 | yes | cp -Rp include/asm-${ARCH1}/* ${KERN_HDR_DIR}/asm
|
---|
78 | else
|
---|
79 | mkdir -p ${KERN_HDR_DIR}/asm
|
---|
80 | yes | cp -Rp include/asm-${ARCH1} ${KERN_HDR_DIR}
|
---|
81 | yes | cp -Rp include/asm-${ARCH2} ${KERN_HDR_DIR}
|
---|
82 |
|
---|
83 | # Create stubs ( see build-init.x.x.x.sh )
|
---|
84 | create_kernel_stubs ${ARCH1} ${ARCH1_SWITCH} ${ARCH2} ${KERN_HDR_DIR}
|
---|
85 | fi
|
---|
86 |
|
---|
87 | } || {
|
---|
88 | # Install kernel headers in
|
---|
89 | # ${TGT_TOOLS}/include
|
---|
90 | # TODO: this needs to be done better...
|
---|
91 | case ${TGT_ARCH} in
|
---|
92 | i?86 ) ARCH=i386 ;;
|
---|
93 | x86_64 | x86-64 ) ARCH=x86_64 ;;
|
---|
94 | powerpc | ppc ) ARCH=ppc ;;
|
---|
95 | powerpc64 | ppc64 ) ARCH=ppc64 ;;
|
---|
96 | sparc64* | ultrasparc* ) ARCH=sparc64 ;;
|
---|
97 | sparc* ) ARCH=sparc ;;
|
---|
98 | s390 ) ARCH=s390 ;;
|
---|
99 | s390x ) ARCH=s390x ;;
|
---|
100 | mips* ) ARCH=mips ;;
|
---|
101 | arm* ) ARCH=arm ;;
|
---|
102 | * ) ARCH=${TGT_ARCH} ;;
|
---|
103 | esac
|
---|
104 |
|
---|
105 | mkdir -p ${KERN_HDR_DIR}/asm
|
---|
106 | yes | cp -Rp include/asm-${ARCH}/* ${KERN_HDR_DIR}/asm
|
---|
107 | # TODO: probably more here to do for arm...
|
---|
108 |
|
---|
109 | # This should be replaced by a var, for the moment defaulting to
|
---|
110 | # ebsa285
|
---|
111 | case ${TGT_ARCH} in
|
---|
112 | arm* ) ln -sf arch-ebsa285 ${KERN_HDR_DIR}/asm/arch ;;
|
---|
113 | esac
|
---|
114 |
|
---|
115 | }
|
---|
116 |
|
---|
117 | yes | cp -Rp include/linux ${KERN_HDR_DIR}
|
---|
118 |
|
---|