mirror of
https://github.com/bensuperpc/dockcross.git
synced 2024-12-22 16:24:27 +01:00
Merge pull request #552 from bensuperpc/add_buildroot
Add buildroot and ARM64 image with libraries (OpenSSL, SDL2, Boost, OpenCV ect...)
This commit is contained in:
commit
a42f26cc75
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -48,7 +48,7 @@ jobs:
|
||||
matrix:
|
||||
arch_name: [android-arm, android-arm64, android-x86, android-x86_64,
|
||||
linux-arm64, linux-arm64-musl, linux-armv5, linux-armv5-musl,
|
||||
linux-armv6, linux-armv6-lts, linux-armv6-musl,
|
||||
linux-armv6, linux-armv6-lts, linux-armv6-musl, linux-arm64-full,
|
||||
linux-armv7, linux-armv7a, linux-armv7l-musl,
|
||||
linux-x64-clang, linux-s390x, linux-x64, linux-x86,
|
||||
linux-mips, linux-ppc64le, web-wasm,
|
||||
|
7
Makefile
7
Makefile
@ -14,7 +14,7 @@ BIN = ./bin
|
||||
|
||||
# These images are built using the "build implicit rule"
|
||||
STANDARD_IMAGES = android-arm android-arm64 android-x86 android-x86_64 \
|
||||
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl \
|
||||
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl linux-arm64-full \
|
||||
linux-armv5 linux-armv5-musl linux-m68k-uclibc linux-s390x \
|
||||
linux-armv6 linux-armv6-lts linux-armv6-musl \
|
||||
linux-armv7l-musl linux-armv7 linux-armv7a \
|
||||
@ -24,7 +24,7 @@ STANDARD_IMAGES = android-arm android-arm64 android-x86 android-x86_64 \
|
||||
|
||||
# Generated Dockerfiles.
|
||||
GEN_IMAGES = android-arm android-arm64 \
|
||||
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl \
|
||||
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl linux-arm64-full \
|
||||
manylinux2014-x64 manylinux2014-x86 \
|
||||
web-wasm linux-mips \
|
||||
windows-static-x86 windows-static-x64 windows-static-x64-posix \
|
||||
@ -40,7 +40,7 @@ GEN_IMAGE_DOCKERFILES = $(addsuffix /Dockerfile,$(GEN_IMAGES))
|
||||
NON_STANDARD_IMAGES = manylinux2014-x64 manylinux2014-x86 web-wasm
|
||||
|
||||
# Docker composite files
|
||||
DOCKER_COMPOSITE_SOURCES = common.docker common.debian common.manylinux \
|
||||
DOCKER_COMPOSITE_SOURCES = common.docker common.debian common.manylinux common.buildroot \
|
||||
common.crosstool common.windows common-manylinux.crosstool common.dockcross common.label-and-env
|
||||
DOCKER_COMPOSITE_FOLDER_PATH = common/
|
||||
DOCKER_COMPOSITE_PATH = $(addprefix $(DOCKER_COMPOSITE_FOLDER_PATH),$(DOCKER_COMPOSITE_SOURCES))
|
||||
@ -93,6 +93,7 @@ $(GEN_IMAGE_DOCKERFILES) Dockerfile: %Dockerfile: %Dockerfile.in $(DOCKER_COMPOS
|
||||
-e '/common.debian/ r $(DOCKER_COMPOSITE_FOLDER_PATH)common.debian' \
|
||||
-e '/common.manylinux/ r $(DOCKER_COMPOSITE_FOLDER_PATH)common.manylinux' \
|
||||
-e '/common.crosstool/ r $(DOCKER_COMPOSITE_FOLDER_PATH)common.crosstool' \
|
||||
-e '/common.buildroot/ r $(DOCKER_COMPOSITE_FOLDER_PATH)common.buildroot' \
|
||||
-e '/common-manylinux.crosstool/ r $(DOCKER_COMPOSITE_FOLDER_PATH)common-manylinux.crosstool' \
|
||||
-e '/common.windows/ r $(DOCKER_COMPOSITE_FOLDER_PATH)common.windows' \
|
||||
-e '/common.dockcross/ r $(DOCKER_COMPOSITE_FOLDER_PATH)common.dockcross' \
|
||||
|
30
common/common.buildroot
Normal file
30
common/common.buildroot
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
# Install Debian packages required for `buildroot`.
|
||||
RUN apt-get update --yes && apt-get install --no-install-recommends --yes \
|
||||
gawk \
|
||||
gperf \
|
||||
help2man \
|
||||
python3-dev \
|
||||
texinfo \
|
||||
unzip \
|
||||
libtool \
|
||||
libtool-bin \
|
||||
&& apt-get clean autoclean --yes \
|
||||
&& apt-get autoremove --yes \
|
||||
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||
|
||||
COPY \
|
||||
imagefiles/install-buildroot-toolchain.sh \
|
||||
buildroot.config \
|
||||
/dockcross/
|
||||
|
||||
# Build and install the toolchain, cleaning up artifacts afterwards.
|
||||
RUN mkdir /dockcross/buildroot \
|
||||
&& cd /dockcross/buildroot \
|
||||
&& /dockcross/install-buildroot-toolchain.sh \
|
||||
-c "/dockcross/buildroot.config" \
|
||||
-v "${BR_VERSION}" \
|
||||
&& rm -rf /dockcross/buildroot /dockcross/install-buildroot-toolchain.sh
|
||||
|
||||
# Restore our default workdir (from "dockcross/base").
|
||||
WORKDIR /work
|
@ -48,7 +48,7 @@ RUN mkdir /dockcross/crosstool \
|
||||
&& cd /dockcross/crosstool \
|
||||
&& /dockcross/install-crosstool-ng-toolchain.sh \
|
||||
-p "${XCC_PREFIX}" \
|
||||
-c /dockcross/crosstool-ng.config \
|
||||
-c "/dockcross/crosstool-ng.config" \
|
||||
-v "${CT_VERSION}" \
|
||||
&& rm -rf /dockcross/crosstool /dockcross/install-crosstool-ng-toolchain.sh
|
||||
|
||||
|
43
imagefiles/install-buildroot-toolchain.sh
Executable file
43
imagefiles/install-buildroot-toolchain.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
ROOT=${PWD}
|
||||
|
||||
usage() { echo "Usage: $0 -c <config-path> -v <version>" 1>&2; exit 1; }
|
||||
|
||||
REPO_URL="https://github.com/buildroot/buildroot.git"
|
||||
|
||||
CONFIG_PATH=""
|
||||
REV="2021.08-rc1"
|
||||
while getopts "c:v:" o; do
|
||||
case "${o}" in
|
||||
c)
|
||||
CONFIG_PATH=$(readlink -f ${OPTARG})
|
||||
;;
|
||||
v)
|
||||
REV=${OPTARG}
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ -z ${CONFIG_PATH} ] || [ ! -f ${CONFIG_PATH} ]; then
|
||||
echo "ERROR: Missing config path (-c)."
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -z ${REV} ]; then
|
||||
echo "WARNING: No version selected, use default version: $REV (-v)."
|
||||
fi
|
||||
|
||||
|
||||
git clone "$REPO_URL" --recurse-submodules --remote-submodules #--branch="$REV"
|
||||
cd buildroot
|
||||
git checkout "$REV"
|
||||
cp "$CONFIG_PATH" .config
|
||||
make
|
41
linux-arm64-full/Dockerfile.in
Normal file
41
linux-arm64-full/Dockerfile.in
Normal file
@ -0,0 +1,41 @@
|
||||
FROM dockcross/base:latest
|
||||
|
||||
# This is for 64-bit ARM Linux machine
|
||||
|
||||
# Buildroot version
|
||||
ENV BR_VERSION 2021.08-rc1
|
||||
|
||||
#include "common.buildroot"
|
||||
|
||||
# The cross-compiling emulator
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
qemu-user \
|
||||
qemu-user-static \
|
||||
&& apt-get clean --yes
|
||||
|
||||
# The CROSS_TRIPLE is a configured alias of the "aarch64-buildroot-linux-gnu" target.
|
||||
ENV CROSS_TRIPLE aarch64-buildroot-linux-gnu
|
||||
ENV CROSS_ROOT /buildroot
|
||||
ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \
|
||||
AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ar \
|
||||
CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \
|
||||
CPP=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-cpp \
|
||||
CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++ \
|
||||
LD=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ld \
|
||||
FC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gfortran
|
||||
|
||||
ENV QEMU_LD_PREFIX "${CROSS_ROOT}/${CROSS_TRIPLE}/sysroot"
|
||||
ENV QEMU_SET_ENV "LD_LIBRARY_PATH=${CROSS_ROOT}/lib:${QEMU_LD_PREFIX}"
|
||||
|
||||
COPY Toolchain.cmake ${CROSS_ROOT}/
|
||||
ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake
|
||||
|
||||
#ENV PKG_CONFIG_PATH /usr/lib/aarch64-linux-gnu/pkgconfig
|
||||
|
||||
# Linux kernel cross compilation variables
|
||||
ENV PATH ${PATH}:${CROSS_ROOT}/bin
|
||||
ENV CROSS_COMPILE ${CROSS_TRIPLE}-
|
||||
ENV ARCH arm64
|
||||
|
||||
#include "common.label-and-env"
|
22
linux-arm64-full/Toolchain.cmake
Normal file
22
linux-arm64-full/Toolchain.cmake
Normal file
@ -0,0 +1,22 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
set(cross_triple "aarch64-buildroot-linux-gnu")
|
||||
set(cross_root /buildroot)
|
||||
|
||||
set(CMAKE_C_COMPILER $ENV{CC})
|
||||
set(CMAKE_CXX_COMPILER $ENV{CXX})
|
||||
set(CMAKE_Fortran_COMPILER $ENV{FC})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-I ${cross_root}/include/")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${cross_root} ${cross_root}/${cross_triple})
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
set(CMAKE_SYSROOT ${cross_root}/${cross_triple}/sysroot)
|
||||
|
||||
set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-aarch64)
|
3728
linux-arm64-full/buildroot.config
Normal file
3728
linux-arm64-full/buildroot.config
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user