Skip to content

Commit

Permalink
builders: imgBuilder: opensbi: enable overlayfs build
Browse files Browse the repository at this point in the history
  • Loading branch information
xieby1 committed Dec 30, 2024
1 parent f3d8116 commit 58d04ae
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions builders/imgBuilder/opensbi/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{ stdenv
, python3
, enableOverlayFS ? true
, fuse-overlayfs
, vmTools

, riscv64-cc
, rmExt
, linux
, dts
, common-build
}@args: stdenv.mkDerivation {
}@args: let overlayfsDisabled = stdenv.mkDerivation {
name = "${rmExt linux.name}.opensbi";

src = common-build;
Expand Down Expand Up @@ -55,7 +58,21 @@
'';

installPhase = ''
# runInLinuxVM will auto create dir $out
rm -rf $out
cp build/platform/generic/firmware/fw_payload.bin $out
'';
passthru = args;
}
};
overlayfsEnabled = vmTools.runInLinuxVM (overlayfsDisabled.overrideAttrs (old: {
unpackPhase = ''
mkdir workdir
mkdir upperdir
mkdir overlaydir
/run/modprobe fuse
${fuse-overlayfs}/bin/fuse-overlayfs -o lowerdir=${old.src},workdir=workdir,upperdir=upperdir overlaydir
cd overlaydir
'';
memSize = 1024;
}));
in if enableOverlayFS then overlayfsEnabled else overlayfsDisabled

0 comments on commit 58d04ae

Please sign in to comment.