Skip to content

Commit

Permalink
vng: run: support KBUILD_OUTPUT
Browse files Browse the repository at this point in the history
If this env var is set, and O= is not set, use this as the kernel build
dir.

Follow the same logic as in configkernel: only use it if set and
pointing to a valid directory.

While at it, also harmonise the code in configkernel around this env
var.

Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe committed Feb 6, 2025
1 parent fcb8a09 commit 2a8d1ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions virtme/commands/configkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ def do_it():
makef = "Makefile"

# Check if KBUILD_OUTPUT is defined and if it's a directory
config_dir = os.environ.get("KBUILD_OUTPUT", "")
if config_dir and os.path.isdir(config_dir):
config_dir = os.environ.get("KBUILD_OUTPUT")
if config_dir is not None and os.path.isdir(config_dir):
config = os.path.join(config_dir, config)
makef = os.path.join(config_dir, makef)

Expand Down
5 changes: 4 additions & 1 deletion virtme_ng/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,10 @@ def _get_virtme_run(self, args):
else:
self.virtme_param["kdir"] = "--kimg " + args.run
elif self.virtme_param.get("kdir") is None:
self.virtme_param["kdir"] = "--kdir ./"
kbuild_dir = os.environ.get("KBUILD_OUTPUT")
if kbuild_dir is None or not os.path.isdir(kbuild_dir):
kbuild_dir = "./"
self.virtme_param["kdir"] = "--kdir " + kbuild_dir

def _get_virtme_mods(self, args):
if args.skip_modules or platform.system() != "Linux":
Expand Down

0 comments on commit 2a8d1ab

Please sign in to comment.