mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-04-20 11:29:54 +00:00
Added task "do_deploy_xenguestenv" to xenguest_image.bbclass which creates intermediary files for each recipe that inherits xenguest_image. These files are merged into the main xenguest.env file in DEPLOY_DIR_IMAGE by the task "do_merge_xenguestenv" in image_types_xenguest.bbclass, which has a dependency on all do_deploy_xenguestenv in recipes it depends on. Variables to write to the file are listed in XENGUEST_IMAGE_VARS, and any extra variables in child recipes should be added to XENGUEST_IMAGE_VARS_EXTRA xenguest-image had to be renamed xenguest_image to use EXPORT, since dash is illegal in bash function names. Issue-Id: SCM-2035 Signed-off-by: Nathan Dunne <Nathan.Dunne@arm.com> Change-Id: I6fe45b8a5db6eb7a757c6150515da0b4de8a7205 Signed-off-by: Jon Mason <jon.mason@arm.com>
124 lines
4.7 KiB
Plaintext
124 lines
4.7 KiB
Plaintext
# This class must be used to extend the xenguest image
|
|
# It provides variables to add init scripts, a dtb, xen files or disk files.
|
|
#
|
|
# The class is extending deploy function so you recipe must inherit deploy and
|
|
# have a do_deploy function (even if it is empty)
|
|
|
|
# Add a variable name to XENGUEST_IMAGE_VARS_EXTRA if you want it to
|
|
# appear in xenguest.env when the image is deployed
|
|
|
|
# Use standard xenguest_image
|
|
inherit xenguest_image
|
|
|
|
# Add a DTB file for the guest
|
|
# Only one file should be added, if this is set multiple times or in several
|
|
# recipes, the last recipe setting it will prevail.
|
|
XENGUEST_EXTRA_DTB ??= ""
|
|
|
|
# Add a ramdisk file for the guest
|
|
# Only one file should be added, if this is set multiple times or in several
|
|
# recipes, the last recipe setting it will prevail.
|
|
XENGUEST_EXTRA_RAMDISK ??= ""
|
|
|
|
# Append something to the guest xen configuration
|
|
# All files here will be merged together in the final xen configuration
|
|
# This can contain several files or be used in several recipes
|
|
XENGUEST_EXTRA_XENCONFIG ??= ""
|
|
|
|
# Add a xenguest init, init-pre or init-post script
|
|
XENGUEST_EXTRA_INIT_PRE ??= ""
|
|
XENGUEST_EXTRA_INIT ??= ""
|
|
XENGUEST_EXTRA_INIT_POST ??= ""
|
|
|
|
# Add xenguest files, (to be used in extra xen config for example)
|
|
# several files may be added, space separated, the path will be kept on the
|
|
# generated xenguest image (if dir1/file1 is added, it can be used as
|
|
# dir1/file1 file in the xen configuration).
|
|
XENGUEST_EXTRA_FILES ??= ""
|
|
|
|
# Add xenguest disk files (to be used as disk partition content)
|
|
# several files may be added, space separated, the path will be kept on the
|
|
# generated xenguest image (if dir1/file1 is added, it can be used as
|
|
# dir1/file1 file in the disk content parameters).
|
|
XENGUEST_EXTRA_DISK_FILES ??= ""
|
|
|
|
# Extra vars to be written to xenguest.env
|
|
XENGUEST_IMAGE_VARS_EXTRA += "\
|
|
XENGUEST_EXTRA_DTB XENGUEST_EXTRA_RAMDISK XENGUEST_EXTRA_XENCONFIG \
|
|
XENGUEST_EXTRA_INIT_PRE XENGUEST_EXTRA_INIT XENGUEST_EXTRA_INIT_POST \
|
|
XENGUEST_EXTRA_FILES XENGUEST_EXTRA_DISK_FILES"
|
|
|
|
do_deploy_append() {
|
|
if [ -z "${XENGUEST_IMAGE_DEPLOY_DIR}" -o \
|
|
-z "${XENGUEST_IMAGE_DEPLOY_SUBDIR}" ]; then
|
|
die "Configuration error: XENGUEST_IMAGE_DEPLOY_DIR or XENGUEST_IMAGE_DEPLOY_SUBDIR is empty"
|
|
fi
|
|
rm -rf ${XENGUEST_IMAGE_DEPLOY_DIR}/${XENGUEST_IMAGE_DEPLOY_SUBDIR}
|
|
mkdir -p ${XENGUEST_IMAGE_DEPLOY_DIR}/${XENGUEST_IMAGE_DEPLOY_SUBDIR}
|
|
|
|
if [ -n "${XENGUEST_EXTRA_DTB}" ]; then
|
|
if [ ! -f ${XENGUEST_EXTRA_DTB} ]; then
|
|
die "xenguest_image: DTB file ${XENGUEST_EXTRA_DTB} does not exist"
|
|
fi
|
|
call_xenguest_mkimage partial --xen-device-tree=${XENGUEST_EXTRA_DTB}
|
|
fi
|
|
|
|
if [ -n "${XENGUEST_EXTRA_RAMDISK}" ]; then
|
|
if [ ! -f ${XENGUEST_EXTRA_RAMDISK} ]; then
|
|
die "xenguest_image: DTB file ${XENGUEST_EXTRA_RAMDISK} does not exist"
|
|
fi
|
|
call_xenguest_mkimage partial --xen-ramdisk=${XENGUEST_EXTRA_RAMDISK}
|
|
fi
|
|
|
|
if [ -n "${XENGUEST_EXTRA_XENCONFIG}" ]; then
|
|
for f in ${XENGUEST_EXTRA_XENCONFIG}; do
|
|
if [ ! -f $f ]; then
|
|
die "xenguest_image: Xen config $f does not exist"
|
|
fi
|
|
call_xenguest_mkimage partial --xen-append=$f
|
|
done
|
|
fi
|
|
|
|
if [ -n "${XENGUEST_EXTRA_INIT_PRE}" ]; then
|
|
if [ ! -f ${XENGUEST_EXTRA_INIT_PRE} ]; then
|
|
die "xenguest_image: Init script ${XENGUEST_EXTRA_INIT_PRE} does not exist"
|
|
fi
|
|
call_xenguest_mkimage partial --init-pre=${XENGUEST_EXTRA_INIT_PRE}
|
|
fi
|
|
|
|
if [ -n "${XENGUEST_EXTRA_INIT}" ]; then
|
|
if [ ! -f ${XENGUEST_EXTRA_INIT} ]; then
|
|
die "xenguest_image: Init script ${XENGUEST_EXTRA_INIT} does not exist"
|
|
fi
|
|
call_xenguest_mkimage partial --init-script=${XENGUEST_EXTRA_INIT}
|
|
fi
|
|
|
|
if [ -n "${XENGUEST_EXTRA_INIT_POST}" ]; then
|
|
if [ ! -f ${XENGUEST_EXTRA_INIT_POST} ]; then
|
|
die "xenguest_image: Init script ${XENGUEST_EXTRA_INIT_POST} does not exist"
|
|
fi
|
|
call_xenguest_mkimage partial --init-post=${XENGUEST_EXTRA_INIT_POST}
|
|
fi
|
|
|
|
if [ -n "${XENGUEST_EXTRA_FILES}" ]; then
|
|
for f in ${XENGUEST_EXTRA_FILES}; do
|
|
if [ ! -f $f ]; then
|
|
die "xenguest_image: Xen file $f does not exist"
|
|
fi
|
|
call_xenguest_mkimage partial --xen-add-file=$f
|
|
done
|
|
fi
|
|
|
|
if [ -n "${XENGUEST_EXTRA_DISK_FILES}" ]; then
|
|
for f in ${XENGUEST_EXTRA_DISK_FILES}; do
|
|
if [ ! -f $f ]; then
|
|
die "xenguest_image: Disk file $f does not exist"
|
|
fi
|
|
call_xenguest_mkimage partial --disk-add-file=$f
|
|
done
|
|
fi
|
|
}
|
|
# Need to have xenguest_image tool
|
|
do_deploy[depends] += "xenguest-base-image:do_deploy"
|
|
|