Skip to content

Commit 85c7958

Browse files
rnavmpe
authored andcommitted
Add support for building architectures other than powerpc and x86
Add a new image 'ubuntu-allcross' that builds atop linuxppc/build:ubuntu and includes cross compilers for a few other architectures. Keeping this image separate allows the more commonly used default image to be small, aiding quick builds for powerpc. Add support for using this new image to build for those architectures.
1 parent 6fb264e commit 85c7958

5 files changed

Lines changed: 80 additions & 7 deletions

File tree

build/Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ KORG_DISTROS := korg@12.1.0 korg@11.1.0 korg@10.3.0 korg@9.3.0 korg@8.1.0 korg@5
1919
ALL_DISTROS := ${UBUNTU_DISTROS} ${KORG_DISTROS} ${FEDORA_DISTROS}
2020
DOCS_DISTRO := docs@${UBUNTU_LATEST}
2121
X86_DISTRO := ubuntu@${UBUNTU_LATEST}
22-
ALIAS_DISTROS := ubuntu fedora
22+
ALIAS_DISTROS := ubuntu ubuntu-allcross fedora
23+
ALLCROSS_DISTROS := ubuntu-allcross@${UBUNTU_LATEST} ubuntu-allcross
24+
ALL_ARCHES := alpha arm arm64 i686 m68k mips mips64 riscv s390 sh sparc x86_64
2325
SUBARCHES := ppc64le ppc64 ppc
2426

2527
VERSION:
@@ -113,6 +115,15 @@ $(foreach distro,${FEDORA_DISTROS}, \
113115
)
114116
endif
115117

118+
$(foreach distro,${ALLCROSS_DISTROS}, \
119+
$(foreach subarch,${ALL_ARCHES}, \
120+
$(eval $(call MAIN_TEMPLATE,${subarch},${distro})) \
121+
) \
122+
$(foreach subarch,${ALL_ARCHES}, \
123+
$(eval $(call KERNEL_TEMPLATE,${subarch},${distro})) \
124+
) \
125+
)
126+
116127
clean: ${CLEAN}
117128
rm -f VERSION
118129

build/scripts/build.sh

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,49 @@ SRC=$(realpath "$SRC")
2222

2323
alternate_binds=$(get_alternate_binds)
2424

25-
arch=powerpc
26-
if [[ "$subarch" == "ppc64le" ]]; then
25+
arch=$subarch
26+
if [[ "$subarch" == "alpha" ]]; then
27+
cross="alpha-linux-gnu-"
28+
elif [[ "$subarch" == "arm" ]]; then
29+
cross="arm-linux-gnueabihf-"
30+
elif [[ "$subarch" == "arm64" ]]; then
31+
cross="aarch64-linux-gnu-"
32+
elif [[ "$subarch" == "i686" ]]; then
33+
cross="i686-linux-gnu-"
34+
arch=x86
35+
elif [[ "$subarch" == "m68k" ]]; then
36+
cross="m68k-linux-gnu-"
37+
elif [[ "$subarch" == "mips64" ]]; then
38+
cross="mips64el-linux-gnuabi64-"
39+
arch=mips
40+
elif [[ "$subarch" == "mips" ]]; then
41+
cross="mipsel-linux-gnu-"
42+
elif [[ "$subarch" == "riscv" ]]; then
43+
cross="riscv64-linux-gnu-"
44+
elif [[ "$subarch" == "s390" ]]; then
45+
cross="s390x-linux-gnu-"
46+
elif [[ "$subarch" == "sh" ]]; then
47+
cross="sh4-linux-gnu-"
48+
elif [[ "$subarch" == "sparc" ]]; then
49+
cross="sparc64-linux-gnu-"
50+
elif [[ "$subarch" == "x86_64" ]]; then
51+
cross="x86_64-linux-gnu-"
52+
arch=x86
53+
elif [[ "$subarch" == "ppc64le" ]]; then
2754
# No cross compiler for fedora ppc64le on ppc64le
2855
if [[ "$distro" != "fedora" || $(uname -m) != "ppc64le" ]]; then
2956
cross="powerpc64le-linux-gnu-"
3057
fi
31-
elif [[ "$subarch" == "x86_64" ]]; then
32-
cross="x86_64-linux-gnu-"
33-
arch=x86
34-
else
58+
arch=powerpc
59+
elif [[ "$subarch" == "ppc64" ]]; then
3560
cross="powerpc64-linux-gnu-"
61+
arch=powerpc
62+
elif [[ "$subarch" == "ppc" ]]; then
63+
cross="powerpc-linux-gnu-"
64+
arch=powerpc
65+
else
66+
echo "Error: unknown subarch: $subarch" >&2
67+
exit 1
3668
fi
3769

3870
cmd="$DOCKER run --rm "

build/scripts/image.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ from="${DOCKER_REGISTRY}$distro:$version"
7272

7373
if [[ "$distro" == "docs" ]]; then
7474
from="${DOCKER_REGISTRY}ubuntu:$version"
75+
elif [[ "$distro" == "ubuntu-allcross" ]]; then
76+
from="${DOCKER_REGISTRY}linuxppc/build:ubuntu-$version-$(uname -m)"
7577
elif [[ "$distro" == "korg" ]]; then
7678
cmd+="--build-arg compiler_version=$version "
7779

build/scripts/lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function get_default_version()
8383

8484
case "$distro" in
8585
ubuntu) latest="$UBUNTU_LATEST" ;;
86+
ubuntu-allcross) latest="$UBUNTU_LATEST" ;;
8687
fedora) latest="$FEDORA_LATEST" ;;
8788
esac
8889

build/ubuntu-allcross/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ARG from
2+
FROM ${from}
3+
4+
USER root
5+
6+
ARG apt_mirror
7+
ENV apt_mirror=${apt_mirror}
8+
RUN [ -n "$apt_mirror" ] && sed -i -e "s|ports.ubuntu.com|$apt_mirror|" /etc/apt/sources.list || true
9+
10+
RUN apt-get -q -y update && \
11+
DEBIAN_FRONTEND=noninteractive \
12+
apt-get -q -y install --no-install-recommends \
13+
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
14+
gcc-alpha-linux-gnu g++-alpha-linux-gnu \
15+
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
16+
gcc-i686-linux-gnu g++-i686-linux-gnu \
17+
gcc-m68k-linux-gnu g++-m68k-linux-gnu \
18+
gcc-mips64el-linux-gnuabi64 g++-mips64el-linux-gnuabi64 \
19+
gcc-mipsel-linux-gnu g++-mipsel-linux-gnu \
20+
gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \
21+
gcc-s390x-linux-gnu g++-s390x-linux-gnu \
22+
gcc-sh4-linux-gnu g++-sh4-linux-gnu \
23+
gcc-sparc64-linux-gnu g++-sparc64-linux-gnu \
24+
&& \
25+
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/dpkg.log
26+
27+
USER linuxppc

0 commit comments

Comments
 (0)