source: scripts/cross-scripts/cross-san-kern-hdrs.sh @ def3913

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since def3913 was def3913, checked in by Jim Gifford <clfs@…>, 18 years ago

r621@server (orig r619): ryan | 2005-08-07 03:50:46 -0700
Fix issues with sys/types.h and asm-x86_64/types.h


Comment from script


# ARGHHH, asm-x86_64/types.h conflicts with sys/types.h with regards to
# s64 and u64. llh defines them as long long, glibc as long.
# On amd64 long and long long are both 8bytes. Here we edit asm_x86_64
# to define s64 and u64 as type long


What a pain in the arse......


Note: This should also make the hack patch to DirectFB redundant.



  • Property mode set to 100755
File size: 3.4 KB
Line 
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
13cd ${SRC}
14LOG=sanitised-kernel-headers.log
15unpack_tarball linux-libc-headers-${LINUX_LIBC_HDRS_VER} &&
16cd ${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
24find . -type d | xargs chmod 755
25find . -type f | xargs chmod 644
26
27max_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
34if [ "${USE_SYSROOT}" = "Y" ]; then
35   INSTALL_PREFIX="${LFS}/usr"
36else
37   INSTALL_PREFIX="${TGT_TOOLS}"
38fi
39KERN_HDR_DIR=${INSTALL_PREFIX}/include
40
41# ARGHHH, asm-x86_64/types.h conflicts with sys/types.h with regards to
42# __s64 and __u64. llh defines them as long long, glibc as long.
43# On amd64 long and long long are both 8bytes. Here we edit asm_x86_64
44# to define __s64 and __u64 as type long
45sed -i -e 's@long long@long@g' \
46   include/asm-x86_64/types.h
47
48# If we are doing a biarch build we will need the kernel headers for
49# both architectures and will have to create stub headers in include/asm
50
51test "Y" = "${MULTIARCH}" &&
52{
53   case ${TGT_ARCH} in
54      x86_64 | x86-64 )
55         ARCH1_SWITCH=__x86_64__
56         ARCH1=x86_64
57         ARCH2=i386
58      ;;
59      sparc* | ultrasparc* )
60         ARCH1_SWITCH=__arch64__
61         ARCH1=sparc64
62         ARCH2=sparc
63      ;;
64      ppc* | powerpc* )
65         ARCH1_SWITCH=__powerpc64__
66         ARCH1=ppc64
67         ARCH2=ppc
68      ;;
69      s390* )
70         ARCH1_SWITCH=__s390x__
71         ARCH1=s390x
72         ARCH2=s390
73      ;;
74      mips* )
75         ARCH1=mips
76      ;;
77   esac
78
79   # TODO: This needs to be done better
80   #       Here we are handling the case of mips, where only the one set of
81   #       asm headers are provided (and needed) for multi-arch.
82   if [ -z "${ARCH1_SWITCH}" ]; then
83      mkdir -p ${KERN_HDR_DIR}/asm
84      yes | cp -Rp include/asm-${ARCH1}/* ${KERN_HDR_DIR}/asm
85   else
86      mkdir -p ${KERN_HDR_DIR}/asm
87      yes | cp -Rp include/asm-${ARCH1} ${KERN_HDR_DIR}
88      yes | cp -Rp include/asm-${ARCH2} ${KERN_HDR_DIR}
89
90      # Create stubs ( see build-init.x.x.x.sh )
91      create_kernel_stubs ${ARCH1} ${ARCH1_SWITCH} ${ARCH2} ${KERN_HDR_DIR}
92   fi
93   
94} || {
95   # Install kernel headers in
96   #  ${TGT_TOOLS}/include
97   # TODO: this needs to be done better...
98   case ${TGT_ARCH} in
99      i?86 )                   ARCH=i386    ;;
100      x86_64 | x86-64 )        ARCH=x86_64  ;;
101      powerpc | ppc )          ARCH=ppc     ;;
102      powerpc64 | ppc64 )      ARCH=ppc64   ;;
103      sparc64* | ultrasparc* ) ARCH=sparc64 ;;
104      sparc* )                 ARCH=sparc   ;;
105      s390 )                   ARCH=s390    ;;
106      s390x )                  ARCH=s390x   ;;
107      mips* )                  ARCH=mips    ;;
108      arm* )                   ARCH=arm     ;;
109      * )                      ARCH=${TGT_ARCH} ;;
110   esac
111
112   mkdir -p ${KERN_HDR_DIR}/asm
113   yes | cp -Rp include/asm-${ARCH}/* ${KERN_HDR_DIR}/asm
114   # TODO: probably more here to do for arm...
115
116   # This should be replaced by a var, for the moment defaulting to
117   # ebsa285
118   case ${TGT_ARCH} in
119      arm* )  ln -sf arch-ebsa285 ${KERN_HDR_DIR}/asm/arch ;;
120   esac
121
122}
123
124yes | cp -Rp include/linux ${KERN_HDR_DIR}
125
Note: See TracBrowser for help on using the repository browser.