|
3 | 3 | "rust_binary",
|
4 | 4 | "rust_library",
|
5 | 5 | )
|
6 |
| -load(":testutil.bzl", "initrd", "qemu_exec") |
| 6 | +load(":testutil.bzl", "freebsd_rootfs", "linux_rootfs", "qemu_exec") |
7 | 7 |
|
8 | 8 | sh_binary(
|
9 |
| - name = "build_initrd", |
10 |
| - srcs = ["build_initrd.sh"], |
| 9 | + name = "build_linux_rootfs", |
| 10 | + srcs = ["build_linux_rootfs.sh"], |
11 | 11 | )
|
12 | 12 |
|
13 |
| -config_setting( |
14 |
| - name = "cfg_armv7-linux", |
15 |
| - constraint_values = [ |
16 |
| - "@platforms//cpu:armv7", |
17 |
| - "@platforms//os:linux", |
18 |
| - ], |
| 13 | +linux_rootfs( |
| 14 | + name = "linux_rootfs", |
| 15 | + busybox = select({ |
| 16 | + "@platforms//cpu:armv7": "@busybox_multiarch//:busybox-armv7l", |
| 17 | + "@platforms//cpu:x86_64": "@busybox_multiarch//:busybox-x86_64", |
| 18 | + }), |
| 19 | + kernel = select({ |
| 20 | + "@platforms//cpu:armv7": "@linux_kernel//:arch/arm/boot/bzImage", |
| 21 | + "@platforms//cpu:x86_64": "@linux_kernel//:arch/x86_64/boot/bzImage", |
| 22 | + }), |
19 | 23 | )
|
20 | 24 |
|
21 |
| -config_setting( |
22 |
| - name = "cfg_x86_64-linux", |
23 |
| - constraint_values = [ |
24 |
| - "@platforms//cpu:x86_64", |
25 |
| - "@platforms//os:linux", |
26 |
| - ], |
| 25 | +sh_binary( |
| 26 | + name = "build_freebsd_rootfs", |
| 27 | + srcs = ["build_freebsd_rootfs.sh"], |
27 | 28 | )
|
28 | 29 |
|
29 |
| -initrd( |
30 |
| - name = "initrd", |
31 |
| - busybox = select({ |
32 |
| - "cfg_armv7-linux": "@busybox_multiarch//:busybox-armv7l", |
33 |
| - "cfg_x86_64-linux": "@busybox_multiarch//:busybox-x86_64", |
| 30 | +freebsd_rootfs( |
| 31 | + name = "freebsd_rootfs", |
| 32 | + freebsd = select({ |
| 33 | + "@platforms//cpu:x86_64": "@freebsd_amd64_v12.2//:freebsd", |
34 | 34 | }),
|
35 | 35 | )
|
36 | 36 |
|
37 | 37 | qemu_exec(
|
38 | 38 | name = "qemu_exec",
|
39 |
| - kernel = select({ |
40 |
| - "cfg_armv7-linux": "@linux_kernel//:arch/arm/boot/bzImage", |
41 |
| - "cfg_x86_64-linux": "@linux_kernel//:arch/x86_64/boot/bzImage", |
| 39 | + cpu = select({ |
| 40 | + "@platforms//cpu:armv7": "armv7", |
| 41 | + "@platforms//cpu:x86_64": "x86_64", |
| 42 | + }), |
| 43 | + os = select({ |
| 44 | + "@platforms//os:linux": "linux", |
| 45 | + "@platforms//os:freebsd": "freebsd", |
| 46 | + }), |
| 47 | + rootfs = select({ |
| 48 | + "@platforms//os:linux": ":linux_rootfs", |
| 49 | + "@platforms//os:freebsd": ":freebsd_rootfs", |
42 | 50 | }),
|
43 | 51 | )
|
44 | 52 |
|
45 | 53 | rust_binary(
|
46 | 54 | name = "qemu_exec_helper",
|
47 | 55 | srcs = ["qemu_exec_helper.rs"],
|
48 | 56 | deps = [
|
| 57 | + "@rust_base64//:base64", |
49 | 58 | "@rust_json//:json",
|
50 | 59 | ],
|
51 | 60 | )
|
0 commit comments