-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalizes the creation of toolchains where the image platform and the toolchain target match, rather than hard-code only using a native toolchain targeting `x86_64-unknown-linux-gnu` (which fails if the image platform is not `linux/amd64`).
- Loading branch information
1 parent
557bac5
commit 25e592e
Showing
11 changed files
with
242 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "internal", | ||
"description": "use a generic dockerfiles for when the toolchain and image platfom match." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM ubuntu:20.04 | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
COPY common.sh lib.sh / | ||
RUN /common.sh | ||
|
||
COPY cmake.sh / | ||
RUN /cmake.sh | ||
|
||
COPY xargo.sh / | ||
RUN /xargo.sh | ||
|
||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
ARG CROSS_TRIPLE | ||
|
||
COPY qemu.sh native-qemu.sh / | ||
RUN /native-qemu.sh | ||
|
||
COPY dropbear.sh / | ||
RUN /dropbear.sh | ||
|
||
COPY linux-image.sh native-linux-image.sh / | ||
RUN /native-linux-image.sh | ||
|
||
COPY linux-runner native-linux-runner / | ||
|
||
ENV CROSS_TARGETARCH=$TARGETARCH | ||
ENV CROSS_TARGETVARIANT=$TARGETVARIANT | ||
ENV CARGO_TARGET_${CROSS_TRIPLE}_RUNNER="/native-linux-runner" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set -eo pipefail | ||
|
||
# shellcheck disable=SC1091 | ||
. lib.sh | ||
|
||
main() { | ||
local arch | ||
arch=$(docker_to_linux_arch "${TARGETARCH}" "${TARGETVARIANT}") | ||
/linux-image.sh "${arch}" | ||
rm "${0}" | ||
} | ||
|
||
main "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
# shellcheck disable=SC1091 | ||
. lib.sh | ||
|
||
main() { | ||
local arch | ||
arch=$(docker_to_linux_arch "${CROSS_TARGETARCH}" "${CROSS_TARGETVARIANT}") | ||
exec /linux-runner "${arch}" "${@}" | ||
} | ||
|
||
main "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set -euo pipefail | ||
|
||
# shellcheck disable=SC1091 | ||
. lib.sh | ||
|
||
main() { | ||
local arch | ||
arch=$(docker_to_qemu_arch "${TARGETARCH}") | ||
/qemu.sh "${arch}" softmmu | ||
rm "${0}" | ||
} | ||
|
||
main "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fn main() { | ||
let target = std::env::var("TARGET").expect("rustc must set the TARGET environment variable"); | ||
println!("cargo:rustc-cfg=cross_triple=\"{target}\"",); | ||
println!("cargo:rustc-env=CROSS_TRIPLE=\"{target}\"",); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters