Skip to content

Commit

Permalink
examples/simple: temp hack to get Zig build working
Browse files Browse the repository at this point in the history
Still can't figure out this LazyPath dependency stuff. Very annoying.
  • Loading branch information
Ivan-Velickovic committed Sep 23, 2023
1 parent 0d83b51 commit 06c5acf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/simple/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ pub fn build(b: *std.Build) void {

// For actually compiling the DTS into a DTB
const dts_path = fmtPrint("board/{s}/linux.dts", .{ microkit_board });
const dtb_image_path = "linux.dtb";
const dtc_command = b.addSystemCommand(&[_][]const u8{
"dtc", "-I", "dts", "-O", "dtb", dts_path, "-o"
"dtc", "-I", "dts", "-O", "dtb", dts_path, "-o", dtb_image_path
});
const dtb_image_path = dtc_command.addOutputFileArg("linux.dtb");

// Add microkit.h to be used by the API wrapper.
exe.addIncludePath(.{ .path = sdk_board_include_dir });
Expand All @@ -167,14 +167,15 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
dtb_image_path.addStepDependencies(&guest_images.step);
// We need to produce the DTB from the DTS before doing anything to produce guest_images
guest_images.step.dependOn(&dtc_command.step);

const linux_image_path = fmtPrint("board/{s}/linux", .{ microkit_board });
const kernel_image_arg = fmtPrint("-DGUEST_KERNEL_IMAGE_PATH=\"{s}\"", .{ linux_image_path });

const initrd_image_path = fmtPrint("board/{s}/rootfs.cpio.gz", .{ microkit_board });
const initrd_image_arg = fmtPrint("-DGUEST_INITRD_IMAGE_PATH=\"{s}\"", .{ initrd_image_path });
const dtb_image_arg = fmtPrint("-DGUEST_DTB_IMAGE_PATH=\"{s}\"", .{ dtb_image_path.getPath(b) });
const dtb_image_arg = fmtPrint("-DGUEST_DTB_IMAGE_PATH=\"{s}\"", .{ dtb_image_path });
guest_images.addCSourceFiles(&.{ libvmm_tools ++ "package_guest_images.S" }, &.{
kernel_image_arg,
dtb_image_arg,
Expand Down

0 comments on commit 06c5acf

Please sign in to comment.