Skip to content

Commit cacd97c

Browse files
committed
ci: build armv7 without io-uring bindgen
Signed-off-by: Sam Day <me@samcday.com>
1 parent 84d69b5 commit cacd97c

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

.cargo/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ rustflags = ["--cfg=web_sys_unstable_apis"]
33

44
[alias]
55
gadget-musl-aarch64 = ["build", "-p", "smoo-gadget-cli", "--release", "--target", "aarch64-unknown-linux-musl"]
6-
gadget-musl-armv7 = ["build", "-p", "smoo-gadget-cli", "--release", "--target", "armv7-unknown-linux-musleabihf", "--features", "smoo-gadget-cli/apkbuild"]
6+
gadget-musl-armv7 = ["build", "-p", "smoo-gadget-cli", "--release", "--target", "armv7-unknown-linux-musleabihf"]
77
gadget-musl-x86_64 = ["build", "-p", "smoo-gadget-cli", "--release", "--target", "x86_64-unknown-linux-musl"]
88
xtask = ["run", "--quiet", "--package", "xtask", "--"]
99

@@ -13,7 +13,7 @@ rustflags = ["-C", "target-feature=+crt-static"]
1313

1414
[target.armv7-unknown-linux-musleabihf]
1515
linker = "rust-lld"
16-
rustflags = ["-C", "target-feature=+crt-static"]
16+
rustflags = ["-C", "target-feature=+crt-static", "--cfg=io_uring_skip_arch_check"]
1717

1818
[target.x86_64-unknown-linux-musl]
1919
linker = "rust-lld"

.github/workflows/build.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,25 @@ jobs:
5454
runner: ubuntu-24.04
5555
target: x86_64-unknown-linux-musl
5656
build_args: "--bins"
57+
extra_packages: ""
58+
rustflags: ""
59+
bindgen_extra_clang_args: ""
5760
upload_host: true
5861
- name: aarch64
5962
runner: ubuntu-24.04-arm
6063
target: aarch64-unknown-linux-musl
6164
build_args: "--bins"
65+
extra_packages: ""
66+
rustflags: ""
67+
bindgen_extra_clang_args: ""
6268
upload_host: true
6369
- name: armv7
6470
runner: ubuntu-24.04
6571
target: armv7-unknown-linux-musleabihf
66-
build_args: "-p smoo-gadget-cli --features smoo-gadget-cli/apkbuild"
72+
build_args: "-p smoo-gadget-cli"
73+
extra_packages: "libc6-dev-armhf-cross"
74+
rustflags: "--cfg=io_uring_skip_arch_check"
75+
bindgen_extra_clang_args: "--sysroot=/usr/arm-linux-gnueabihf"
6776
upload_host: false
6877

6978
steps:
@@ -77,7 +86,7 @@ jobs:
7786
- name: Install musl toolchain
7887
run: |
7988
sudo apt-get update
80-
sudo apt-get install -y musl-tools linux-libc-dev
89+
sudo apt-get install -y musl-tools linux-libc-dev ${{ matrix.extra_packages }}
8190
8291
- name: Set up musl kernel headers
8392
run: |
@@ -89,9 +98,15 @@ jobs:
8998
sudo ln -sf /usr/include/$(uname -m)-linux-gnu/asm /usr/include/$(uname -m)-linux-musl/asm
9099
elif [ -d /usr/include/asm ]; then
91100
sudo ln -sf /usr/include/asm /usr/include/$(uname -m)-linux-musl/asm
101+
else
102+
sudo ln -sf /usr/include/asm-generic /usr/include/$(uname -m)-linux-musl/asm
103+
sudo ln -sf /usr/include/asm-generic /usr/include/asm
92104
fi
93105
94106
- name: Build (static musl)
107+
env:
108+
RUSTFLAGS: "-D warnings ${{ matrix.rustflags }}"
109+
BINDGEN_EXTRA_CLANG_ARGS: ${{ matrix.bindgen_extra_clang_args }}
95110
run: |
96111
cargo build \
97112
${{ matrix.build_args }} \

crates/smoo-gadget-ublk/build.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ fn add_serialize(outdir: &std::path::Path) -> anyhow::Result<i32> {
1818
regex::Regex::new(r"#\s*\[\s*derive\s*\((?P<d>[^)]+)\)\s*\]\s*pub\s*(?P<s>struct|enum)")?
1919
.replace_all(&res, "#[derive($d, Serialize, Deserialize)] pub $s")
2020
)
21-
.replace(
22-
"#[derive(Copy, Clone, Serialize, Deserialize)] pub struct ublksrv_io_desc",
23-
"#[derive(Copy, Clone)] pub struct ublksrv_io_desc",
24-
)
25-
.replace(
26-
"#[derive(Copy, Clone, Serialize, Deserialize)] pub struct ublksrv_io_cmd",
27-
"#[derive(Copy, Clone)] pub struct ublksrv_io_cmd",
28-
);
21+
.to_string();
22+
let data = regex::Regex::new(
23+
r"#\s*\[\s*derive\s*\(\s*Copy\s*,\s*Clone\s*,\s*Serialize\s*,\s*Deserialize\s*\)\s*\]\s*pub\s+struct\s+(?P<name>ublksrv_io_desc|ublksrv_io_cmd)",
24+
)?
25+
.replace_all(&data, "#[derive(Copy, Clone)] pub struct $name")
26+
.to_string();
2927
let mut fd = File::create(outdir.join("ublk_cmd.rs"))?;
3028
fd.write_all(data.as_bytes())?;
3129

0 commit comments

Comments
 (0)