Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(bao_recipes): include support to build the hypervisor with different config files #6

Merged
merged 22 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4f87103
fix(naming): rename nix recipe to build bao w/ local sources
Diogo21Costa Nov 28, 2023
c9e414a
fix(naming): rename nix recipe to build bao w/ remote sources
Diogo21Costa Nov 28, 2023
b493c09
fix(inputs): remove useless build inputs to bao local build
Diogo21Costa Nov 28, 2023
fa38088
fix(pname): rename nix script project name of bao local build
Diogo21Costa Nov 28, 2023
99480c5
feat(config): allow to define bao srcs path to bao local build
Diogo21Costa Nov 28, 2023
fe6b8aa
fix(unpack): avoid copy bao sources to output directory
Diogo21Costa Nov 28, 2023
608b16d
fix(build): remove useless environment variable
Diogo21Costa Nov 28, 2023
a210af2
update(build): allow bao local build to load multiple guests image
Diogo21Costa Nov 28, 2023
64317a3
update(build): allow bao local build to load different config files
Diogo21Costa Nov 28, 2023
734aeec
update(build): update bao local build to decouple from bao demos
Diogo21Costa Nov 28, 2023
ddc9bed
update(install): update bao local build to decouple from bao demos
Diogo21Costa Nov 28, 2023
ef79076
fix(inputs): remove useless build inputs to bao remote build
Diogo21Costa Nov 28, 2023
d08ccb7
fix(pname): rename nix script project name of bao remote build
Diogo21Costa Nov 28, 2023
65ef9f2
fix(build): remove useless environment variable
Diogo21Costa Nov 28, 2023
53c3894
update(build): allow bao remote build to load multiple guests image
Diogo21Costa Nov 28, 2023
469d391
update(build): allow bao remote build to load different config files
Diogo21Costa Nov 28, 2023
133bbcd
update(build): update bao remote build to decouple from bao demos
Diogo21Costa Nov 28, 2023
c479cbc
update(install): update bao remote build to decouple from bao demos
Diogo21Costa Nov 28, 2023
032436b
fix(bao_recipe): split unpack and build phase
Diogo21Costa Feb 22, 2024
6c8c1af
fix(bao_recipe): update local sources variable naming
Diogo21Costa Feb 22, 2024
bd9fbef
feat(config): add support to use the platform name as default config
Diogo21Costa Feb 22, 2024
976032d
ref(bao_recipe): update local/remote srcs assignment
Diogo21Costa Feb 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 44 additions & 21 deletions pkgs/bao/bao.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,70 @@
{ stdenv
, fetchFromGitHub
, fetchurl
, rsync
, toolchain
, guest
, demos
, bao_srcs_path ? " "
, bao_cfg_repo
, bao_cfg
, platform_cfg
, guests
}:

stdenv.mkDerivation rec {
pname = "bao";
# Derivation to build bao to run the bao test framework (as a guest)
# MUT: bao-hypervisor
pname = "bao-local";
version = "1.0.0";

platform = platform_cfg.platform_name;
plat_arch = platform_cfg.platforms-arch.${platform};
plat_toolchain = platform_cfg.platforms-toolchain.${platform};

srcs = fetchFromGitHub {
owner = "bao-project";
repo = "bao-hypervisor";
rev = "0575782359132465128491ab2fa44c16e76b57f8"; # branch: demo
sha256 = "sha256-pCsVpSOuCCQ86HbLbyGpi6nHi5dxa7hbQIuoemE/fSA=";
};
srcs = if bao_srcs_path == " " || bao_srcs_path == null then
fetchFromGitHub {
owner = "bao-project";
repo = "bao-hypervisor";
rev = "0575782359132465128491ab2fa44c16e76b57f8"; # branch: demo
sha256 = "sha256-pCsVpSOuCCQ86HbLbyGpi6nHi5dxa7hbQIuoemE/fSA=";
}
else
bao_srcs_path;


nativeBuildInputs = [ toolchain guest demos]; #build time dependencies
nativeBuildInputs = [ toolchain guests ]; #build time dependencies
buildInputs = [ rsync ];

bao_build_cfg = if bao_cfg == " " then platform else bao_cfg;

unpackPhase = ''
mkdir -p $out
mkdir -p $out/srcs
mkdir -p $out/configs
mkdir -p $out/guests

rsync -r $srcs/ $out/srcs
cp -r ${bao_cfg_repo}/* $out/configs
for guest in ${toString guests}; do
cp $guest/bin/*.bin $out/guests/
done
'';

buildPhase = ''
cd $out/srcs
export ARCH=${plat_arch}
export CROSS_COMPILE=${plat_toolchain}-
export DEMO=baremetal
mkdir -p ./config
cp -L ${demos}/demos/$DEMO/configs/${platform}.c \
./config/$DEMO.c
mkdir -p ./$DEMO
cp -L ${guest}/bin/baremetal.bin ./$DEMO


# Build Bao
make PLATFORM=${platform}\
CONFIG_REPO=./config\
CONFIG=$DEMO\
CPPFLAGS=-DBAO_DEMOS_WRKDIR_IMGS=./$DEMO
CONFIG_REPO=$out/configs\
CONFIG=$bao_build_cfg\
CPPFLAGS=-DBAO_WRKDIR_IMGS=$out/guests
'';

installPhase = ''
mkdir -p $out/bin
cp ./bin/${platform}/$DEMO/bao.bin $out/bin
mkdir -p $out/bao
cp -r ./bin/${platform}/${bao_build_cfg}/bao.bin $out/bao
'';

}
Expand Down
60 changes: 0 additions & 60 deletions pkgs/bao/bao_tf.nix

This file was deleted.

Loading