1 # Teach the kernel how to run armv7l and aarch64-linux binaries,
2 # and run GNU Hello for these architectures.
4 { system ? builtins.currentSystem,
6 pkgs ? import ../.. { inherit system config; }
9 with import ../lib/testing-python.nix { inherit system pkgs; };
12 expectArgv0 = xpkgs: xpkgs.runCommandCC "expect-argv0" {
13 src = pkgs.writeText "expect-argv0.c" ''
17 int main(int argc, char **argv) {
18 fprintf(stderr, "Our argv[0] is %s\n", argv[0]);
20 if (strcmp(argv[0], argv[1])) {
21 fprintf(stderr, "ERROR: argv[0] is %s, should be %s\n", argv[0], argv[1]);
33 name = "systemd-binfmt";
35 boot.binfmt.emulatedSystems = [
42 helloArmv7l = pkgs.pkgsCross.armv7l-hf-multiplatform.hello;
43 helloAarch64 = pkgs.pkgsCross.aarch64-multiplatform.hello;
47 assert "world" in machine.succeed(
48 "${helloArmv7l}/bin/hello"
51 assert "world" in machine.succeed(
52 "${helloAarch64}/bin/hello"
57 preserveArgvZero = makeTest {
58 name = "systemd-binfmt-preserve-argv0";
60 boot.binfmt.emulatedSystems = [
65 testAarch64 = expectArgv0 pkgs.pkgsCross.aarch64-multiplatform;
68 machine.succeed("exec -a meow ${testAarch64} meow")
72 ldPreload = makeTest {
73 name = "systemd-binfmt-ld-preload";
75 boot.binfmt.emulatedSystems = [
80 helloAarch64 = pkgs.pkgsCross.aarch64-multiplatform.hello;
81 libredirectAarch64 = pkgs.pkgsCross.aarch64-multiplatform.libredirect;
85 assert "error" not in machine.succeed(
86 "LD_PRELOAD='${libredirectAarch64}/lib/libredirect.so' ${helloAarch64}/bin/hello 2>&1"