Skip to content

Commit

Permalink
Install kernel headers with ct-ng
Browse files Browse the repository at this point in the history
  • Loading branch information
theopolis committed Jun 29, 2019
1 parent 291e68b commit d594b66
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 70 deletions.
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ These scripts build a toolchain/runtime that runs on almost every Linux distribu
At a very high level:

- Use Crosstool-NG to build **gcc 8.2.0** linked against a **glibc 2.13**.
- Use Crosstool-NG to build **gcc 8.3.0** linked against a **glibc 2.13**.
- Build an older **zlib 1.2.11** to link against.
- Build **Clang/LLVM 8.0.0** with the new GCC also linked against a **glibc 2.13**.
- Kernel headers for **Linux 4.7** are included as they have certain bpf macros.
- You can use the clang/gcc compiler anywhere.
- You can use either clang or gcc's compiler runtime; recommend using linking flags to link these statically.
- You can use either libstdc++ or libc++; recommended linking these statically.
Expand All @@ -30,24 +31,25 @@ This will create several output files/directories in `/opt/build`, at the end th

```
$ du -h --max-depth=2 /opt/build/x86_64-anywhere-linux-gnu
44M /opt/build/x86_64-anywhere-linux-gnu/bin
4.0K /opt/build/x86_64-anywhere-linux-gnu/include
54M /opt/build/x86_64-anywhere-linux-gnu/libexec/gcc
54M /opt/build/x86_64-anywhere-linux-gnu/libexec
4.0K /opt/build/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/bin
11M /opt/build/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/include
48K /opt/build/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/lib64
710M /opt/build/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/sysroot
4.0K /opt/build/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/lib
4.0K /opt/build/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/debug-root
720M /opt/build/x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu
1.5M /opt/build/x86_64-anywhere-linux-gnu/lib/ldscripts
9.8M /opt/build/x86_64-anywhere-linux-gnu/lib/gcc
12M /opt/build/x86_64-anywhere-linux-gnu/lib
120K /opt/build/x86_64-anywhere-linux-gnu/share/gcc-8.2.0
1.7M /opt/build/x86_64-anywhere-linux-gnu/share/licenses
1.8M /opt/build/x86_64-anywhere-linux-gnu/share
831M /opt/build/x86_64-anywhere-linux-gnu
44M x86_64-anywhere-linux-gnu/bin
4.0K x86_64-anywhere-linux-gnu/include
20K x86_64-anywhere-linux-gnu/scripts
54M x86_64-anywhere-linux-gnu/libexec/gcc
54M x86_64-anywhere-linux-gnu/libexec
4.0M x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/bin
11M x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/include
48K x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/lib64
708M x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/sysroot
4.0K x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/lib
4.0K x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu/debug-root
718M x86_64-anywhere-linux-gnu/x86_64-anywhere-linux-gnu
1.5M x86_64-anywhere-linux-gnu/lib/ldscripts
9.8M x86_64-anywhere-linux-gnu/lib/gcc
12M x86_64-anywhere-linux-gnu/lib
1.5M x86_64-anywhere-linux-gnu/share/licenses
120K x86_64-anywhere-linux-gnu/share/gcc-8.3.0
1.7M x86_64-anywhere-linux-gnu/share
829M x86_64-anywhere-linux-gnu
```

**Remember** you can build this once and run it from any directory on any x86_64 Linux created in 2011 or newer.
Expand Down
13 changes: 0 additions & 13 deletions build-anywhere.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,6 @@ CC=gcc CXX=g++ $SCRIPT_DIR/install-clang.sh $OPT -j 6 -t $DIR/$TUPLE -s $SYSROOT
rm libc++*.so*; \
rm libunwind*.so* )

# Install linux 4.7 headers into the sysroot.
if [[ ! -d $DIR/linux-${LINUX_HEADERS_VER} ]]; then
( cd $DIR; \
wget $LINUX_HEADERS_URL; \
echo "${LINUX_HEADERS_SHA} linux-${LINUX_HEADERS_VER}.tar.xz" | sha256sum -c; \
tar xf linux-${LINUX_HEADERS_VER}.tar.xz )
fi

if [[ ! -e $PREFIX/include/linux/bpf.h ]]; then
( cd $DIR/linux-${LINUX_HEADERS_VER}; \
make headers_install INSTALL_HDR_PATH=$PREFIX )
fi

# Install our helper / debugging scripts.
cp -R $SCRIPT_DIR/overlay/* $DIR/$TUPLE

Expand Down
46 changes: 8 additions & 38 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ CT_LINUX_PATCH_ORDER="global"
# CT_LINUX_V_4_10 is not set
# CT_LINUX_V_4_9 is not set
# CT_LINUX_V_4_8 is not set
# CT_LINUX_V_4_7 is not set
CT_LINUX_V_4_7=y
# CT_LINUX_V_4_6 is not set
# CT_LINUX_V_4_5 is not set
# CT_LINUX_V_4_4 is not set
Expand All @@ -268,7 +268,7 @@ CT_LINUX_PATCH_ORDER="global"
# CT_LINUX_V_3_5 is not set
# CT_LINUX_V_3_4 is not set
# CT_LINUX_V_3_3 is not set
CT_LINUX_V_3_2=y
# CT_LINUX_V_3_2 is not set
# CT_LINUX_V_3_1 is not set
# CT_LINUX_V_3_0 is not set
# CT_LINUX_V_2_6_39 is not set
Expand All @@ -280,16 +280,16 @@ CT_LINUX_V_3_2=y
# CT_LINUX_V_2_6_33 is not set
# CT_LINUX_V_2_6_32 is not set
# CT_LINUX_NO_VERSIONS is not set
CT_LINUX_VERSION="3.2.101"
CT_LINUX_VERSION="4.7.10"
CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})"
CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}"
CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}"
CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz"
CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign"
CT_LINUX_4_8_or_older=y
CT_LINUX_older_than_4_8=y
CT_LINUX_3_7_or_older=y
CT_LINUX_older_than_3_7=y
CT_LINUX_later_than_3_7=y
CT_LINUX_3_7_or_later=y
CT_LINUX_later_than_3_2=y
CT_LINUX_3_2_or_later=y
CT_KERNEL_LINUX_VERBOSITY_0=y
Expand Down Expand Up @@ -450,7 +450,7 @@ CT_GLIBC_FORCE_UNWIND=y
# CT_GLIBC_KERNEL_VERSION_NONE is not set
CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y
# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set
CT_GLIBC_MIN_KERNEL="3.2.101"
CT_GLIBC_MIN_KERNEL="4.7.10"
CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC"
CT_LIBC_SUPPORT_THREADS_ANY=y
CT_LIBC_SUPPORT_THREADS_NATIVE=y
Expand Down Expand Up @@ -746,38 +746,8 @@ CT_NCURSES=y
# Companion tools
#
# CT_COMP_TOOLS_FOR_HOST is not set
CT_COMP_TOOLS_AUTOCONF=y
CT_COMP_TOOLS_AUTOCONF_PKG_KSYM="AUTOCONF"
CT_AUTOCONF_DIR_NAME="autoconf"
CT_AUTOCONF_PKG_NAME="autoconf"
CT_AUTOCONF_SRC_RELEASE=y
CT_AUTOCONF_PATCH_ORDER="global"
CT_AUTOCONF_V_2_69=y
# CT_AUTOCONF_V_2_65 is not set
# CT_AUTOCONF_NO_VERSIONS is not set
CT_AUTOCONF_VERSION="2.69"
CT_AUTOCONF_MIRRORS="$(CT_Mirrors GNU autoconf)"
CT_AUTOCONF_ARCHIVE_FILENAME="@{pkg_name}-@{version}"
CT_AUTOCONF_ARCHIVE_DIRNAME="@{pkg_name}-@{version}"
CT_AUTOCONF_ARCHIVE_FORMATS=".tar.xz .tar.gz"
CT_AUTOCONF_SIGNATURE_FORMAT="packed/.sig"
CT_COMP_TOOLS_AUTOMAKE=y
CT_COMP_TOOLS_AUTOMAKE_PKG_KSYM="AUTOMAKE"
CT_AUTOMAKE_DIR_NAME="automake"
CT_AUTOMAKE_PKG_NAME="automake"
CT_AUTOMAKE_SRC_RELEASE=y
CT_AUTOMAKE_PATCH_ORDER="global"
CT_AUTOMAKE_V_1_16=y
# CT_AUTOMAKE_V_1_15 is not set
# CT_AUTOMAKE_V_1_14 is not set
# CT_AUTOMAKE_V_1_11 is not set
# CT_AUTOMAKE_NO_VERSIONS is not set
CT_AUTOMAKE_VERSION="1.16.1"
CT_AUTOMAKE_MIRRORS="$(CT_Mirrors GNU automake)"
CT_AUTOMAKE_ARCHIVE_FILENAME="@{pkg_name}-@{version}"
CT_AUTOMAKE_ARCHIVE_DIRNAME="@{pkg_name}-@{version}"
CT_AUTOMAKE_ARCHIVE_FORMATS=".tar.xz .tar.gz"
CT_AUTOMAKE_SIGNATURE_FORMAT="packed/.sig"
# CT_COMP_TOOLS_AUTOCONF is not set
# CT_COMP_TOOLS_AUTOMAKE is not set
# CT_COMP_TOOLS_BISON is not set
# CT_COMP_TOOLS_DTC is not set
# CT_COMP_TOOLS_LIBTOOL is not set
Expand Down

0 comments on commit d594b66

Please sign in to comment.