mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-07-16 15:57:19 +00:00
33f5505b58
add the do_write_fvpboot_conf function into IMAGE_POSTPROCESS_COMMAND so that this function can be called after the build system created the final image output files. It's possible that bitbake doesn't run start from the do_rootfs task but run start from do_image_<type> at the stage of image generation. For example, there are multiple partitions in the wic file and the grub.cfg file is placed to the first partition and the rootfs is placed to the second partition. At this time, if we change the content of the grub.cfg file resided in the related recipe's directory and build, the do_rootfs task won't be run by bitbake but a new wic file will be generated. In this situation, the fvpconf file also won't be updated and the 'bp.virtioblockdevice.image_path' is still pointing to a old image file. Issue-Id: SCM-3724 Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com> Change-Id: I7a41afa1d7471d09b60d118c4a6c99c57a6b548c Signed-off-by: Jon Mason <jon.mason@arm.com>
82 lines
2.9 KiB
Plaintext
82 lines
2.9 KiB
Plaintext
# Image class to write .fvpconf files for use with runfvp. If this is desired
|
|
# then add fvpboot to IMAGE_CLASSES, and set the variables below in your machine
|
|
# configuration as appropriate.
|
|
|
|
# Name of recipe providing FVP executable. If unset then the executable must be installed on the host.
|
|
FVP_PROVIDER ?= ""
|
|
# Name of FVP executable to run
|
|
FVP_EXE ?= ""
|
|
# Flags for --parameter/-C
|
|
FVP_CONFIG ?= ""
|
|
# Flags for --data
|
|
FVP_DATA ?= ""
|
|
# Flags for --application
|
|
FVP_APPLICATIONS ?= ""
|
|
# Flags to name serial terminals. Flag name is the terminal id (such as
|
|
# terminal_0), value is a human-readable name. If the name is not set
|
|
# then runfvp will hide the terminal.
|
|
FVP_TERMINALS ?= ""
|
|
# What terminal should be considered the primary console
|
|
FVP_CONSOLE ?= ""
|
|
# Arbitrary extra arguments
|
|
FVP_EXTRA_ARGS ?= ""
|
|
|
|
EXTRA_IMAGEDEPENDS += "${FVP_PROVIDER}"
|
|
|
|
inherit image-artifact-names
|
|
|
|
IMAGE_POSTPROCESS_COMMAND += "do_write_fvpboot_conf;"
|
|
python do_write_fvpboot_conf() {
|
|
# Note that currently this JSON file is in development and the format may
|
|
# change at any point, so it should always be used with a matching runfvp.
|
|
|
|
import json, shlex
|
|
|
|
if not d.getVar("FVP_EXE"):
|
|
return
|
|
|
|
conffile = os.path.join(d.getVar("IMGDEPLOYDIR"), d.getVar("IMAGE_NAME") + ".fvpconf")
|
|
conffile_link = os.path.join(d.getVar("IMGDEPLOYDIR"), d.getVar("IMAGE_LINK_NAME") + ".fvpconf")
|
|
|
|
data = {}
|
|
provider = d.getVar("FVP_PROVIDER")
|
|
if provider:
|
|
data["provider"] = provider
|
|
data["fvp-bindir"] = os.path.join(d.getVar("COMPONENTS_DIR"),
|
|
d.getVar("BUILD_ARCH"),
|
|
provider,
|
|
"usr", "bin")
|
|
|
|
def getFlags(varname):
|
|
flags = d.getVarFlags(varname)
|
|
# For unexplained reasons, getVarFlags() returns None if there are no flags
|
|
if flags is None:
|
|
return {}
|
|
# For other reasons, you can't pass expand=True
|
|
return {key: d.expand(value) for key, value in flags.items()}
|
|
|
|
data["exe"] = d.getVar("FVP_EXE")
|
|
data["parameters"] = getFlags("FVP_CONFIG")
|
|
data["data"] = shlex.split(d.getVar("FVP_DATA") or "")
|
|
data["applications"] = getFlags("FVP_APPLICATIONS")
|
|
data["console"] = d.getVar("FVP_CONSOLE")
|
|
data["terminals"] = getFlags("FVP_TERMINALS")
|
|
data["args"] = shlex.split(d.getVar("FVP_EXTRA_ARGS") or "")
|
|
|
|
os.makedirs(os.path.dirname(conffile), exist_ok=True)
|
|
with open(conffile, "wt") as f:
|
|
json.dump(data, f)
|
|
|
|
if conffile_link != conffile:
|
|
if os.path.lexists(conffile_link):
|
|
os.remove(conffile_link)
|
|
os.symlink(os.path.basename(conffile), conffile_link)
|
|
}
|
|
|
|
def fvpboot_vars(d):
|
|
vars = ['DEPLOY_DIR_IMAGE', 'IMAGE_NAME', 'IMAGE_LINK_NAME', 'COMPONENTS_DIR', 'BUILD_ARCH']
|
|
vars.extend((k for k in d.keys() if k.startswith('FVP_')))
|
|
return " ".join(vars)
|
|
|
|
do_write_fvpboot_conf[vardeps] += "${@fvpboot_vars(d)}"
|