Docker-Ify
This commit is contained in:
parent
ea522c03bf
commit
0cbcc6ba5e
1
.dockerignore
Symbolic link
1
.dockerignore
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
.gitignore
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/workspace
|
/workspace
|
||||||
|
/out
|
||||||
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM buildpack-deps:bullseye
|
||||||
|
|
||||||
|
# Install Dependencies
|
||||||
|
RUN \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
g++-aarch64-linux-gnu \
|
||||||
|
flex \
|
||||||
|
texinfo \
|
||||||
|
help2man \
|
||||||
|
gawk \
|
||||||
|
libtool-bin \
|
||||||
|
bison && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy Files
|
||||||
|
COPY . /data
|
||||||
|
|
||||||
|
# Prepare
|
||||||
|
RUN /data/scripts/prepare.sh
|
||||||
|
CMD ["/data/scripts/build.sh"]
|
12
build.sh
12
build.sh
@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
|
|
||||||
# Build
|
|
||||||
cd workspace/build
|
|
||||||
for type in */; do
|
|
||||||
cd "${type}"
|
|
||||||
../../crosstool-ng/bin/ct-ng build
|
|
||||||
cd ../
|
|
||||||
done
|
|
20
run.sh
Executable file
20
run.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
# Build Image
|
||||||
|
TAG='arm-toolchain-build'
|
||||||
|
docker buildx build --tag "${TAG}" .
|
||||||
|
|
||||||
|
# Run
|
||||||
|
rm -rf out
|
||||||
|
mkdir out
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
-u "$(id -u):$(id -g)" \
|
||||||
|
-v "$(pwd)/out:/data/out" \
|
||||||
|
"${TAG}"
|
||||||
|
|
||||||
|
# Clean Up
|
||||||
|
docker image rm "${TAG}"
|
18
scripts/build.sh
Executable file
18
scripts/build.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$0")/../"
|
||||||
|
|
||||||
|
# Store Output
|
||||||
|
OUT="$(pwd)/out"
|
||||||
|
mkdir -p "${OUT}"
|
||||||
|
|
||||||
|
# Build
|
||||||
|
cd workspace/build
|
||||||
|
for type in *; do
|
||||||
|
cd "${type}"
|
||||||
|
../../crosstool-ng/ct-ng build
|
||||||
|
# Compress
|
||||||
|
tar -cJf "${out}/arm-toolchain-${type}.tar.xz" out
|
||||||
|
cd ../
|
||||||
|
done
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")/../"
|
||||||
|
|
||||||
# Check
|
# Check
|
||||||
if [ "$(uname -m)" != 'x86_64' ]; then
|
if [ "$(uname -m)" != 'x86_64' ]; then
|
||||||
@ -10,8 +10,8 @@ if [ "$(uname -m)" != 'x86_64' ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Versions
|
# Versions
|
||||||
CT_NAME="crosstool-ng"
|
CT_NAME='crosstool-ng'
|
||||||
CT_VERSION="1.27.0"
|
CT_VERSION='1.27.0'
|
||||||
CT="${CT_NAME}-${CT_VERSION}"
|
CT="${CT_NAME}-${CT_VERSION}"
|
||||||
|
|
||||||
# Source Files
|
# Source Files
|
||||||
@ -28,19 +28,16 @@ WORKSPACE="$(pwd)"
|
|||||||
|
|
||||||
# Build crosstools-ng
|
# Build crosstools-ng
|
||||||
dir "${CT_NAME}"
|
dir "${CT_NAME}"
|
||||||
PREFIX="$(pwd)"
|
|
||||||
dir src
|
|
||||||
wget "https://github.com/${CT_NAME}/${CT_NAME}/releases/download/${CT}/${CT}.tar.xz"
|
wget "https://github.com/${CT_NAME}/${CT_NAME}/releases/download/${CT}/${CT}.tar.xz"
|
||||||
tar -xJf "${CT}.tar.xz" --strip-components=1
|
tar -xJf "${CT}.tar.xz" --strip-components=1
|
||||||
./configure \
|
./configure \
|
||||||
"--prefix=${PREFIX}" \
|
--enable-local \
|
||||||
--enable-silent-rules \
|
--enable-silent-rules \
|
||||||
--quiet
|
--quiet
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
make install > /dev/null
|
|
||||||
|
|
||||||
# Add Patch
|
# Add Patch
|
||||||
cd "${PREFIX}/share/crosstool-ng/packages/binutils"
|
cd packages/binutils
|
||||||
patch() {
|
patch() {
|
||||||
for version in */; do
|
for version in */; do
|
||||||
cp "${SRC}/$1" "${version}"
|
cp "${SRC}/$1" "${version}"
|
||||||
@ -49,8 +46,8 @@ patch() {
|
|||||||
patch 9999-change-page-size.patch
|
patch 9999-change-page-size.patch
|
||||||
|
|
||||||
# Configure Toolchain
|
# Configure Toolchain
|
||||||
export PATH="${PREFIX}/bin:${PATH}"
|
|
||||||
cd "${WORKSPACE}"
|
cd "${WORKSPACE}"
|
||||||
|
export PATH="$(pwd)/${CT_NAME}:${PATH}"
|
||||||
dir build
|
dir build
|
||||||
prepare() {
|
prepare() {
|
||||||
dir "$1"
|
dir "$1"
|
||||||
@ -58,6 +55,7 @@ prepare() {
|
|||||||
printf "$2" >> defconfig
|
printf "$2" >> defconfig
|
||||||
ct-ng defconfig
|
ct-ng defconfig
|
||||||
ct-ng show-config
|
ct-ng show-config
|
||||||
|
chmod -R o+rw .
|
||||||
cd ../
|
cd ../
|
||||||
}
|
}
|
||||||
prepare x86_64 ''
|
prepare x86_64 ''
|
Loading…
x
Reference in New Issue
Block a user