mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-06-01 13:10:04 +00:00
arm-autonomy: rework initramfs support in xenguest FSTYPE
Rework the initramfs support in xenguest FSTYPE to be compatible with Dunfell and remove an error with non existing recipeinfo during build. - remove initramfs support in FSTYPE and do_deploy function - create a KERNEL CLASS to create a xenguest image containing the kernel bundle with initramfs during kernel compilation (only done if FSTYPE contain xenguest and initramfs bundle is activated) - add kernel-xenguest to KERNEL_CLASSES when autonomy-guest DISTRO_FEATURE is activated - remove unused parameters from xenguest-image class Change-Id: If163aa74a2bbbd4f22651abefe8d2ab4677e82b0 Issue-Id: SCM-990 Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com> Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
committed by
Jon Mason
parent
ad58d4ea81
commit
2ed1b36c56
@@ -1,7 +1,7 @@
|
|||||||
# Create a xenguest image with kernel and filesystem produced by Yocto
|
# Create a xenguest image with kernel and filesystem produced by Yocto
|
||||||
# This will create a .xenguest file that the xenguest-manager can use.
|
# This will create a .xenguest file that the xenguest-manager can use.
|
||||||
|
|
||||||
inherit xenguest-image deploy
|
inherit xenguest-image
|
||||||
|
|
||||||
# We are creating our guest in a local subdirectory
|
# We are creating our guest in a local subdirectory
|
||||||
# force the value so that we are not impacted if the user is changing it
|
# force the value so that we are not impacted if the user is changing it
|
||||||
@@ -10,9 +10,6 @@ XENGUEST_IMAGE_DEPLOY_DIR = "${WORKDIR}/tmp-xenguest"
|
|||||||
# Name of deployed file (keep standard image name and add .xenguest)
|
# Name of deployed file (keep standard image name and add .xenguest)
|
||||||
XENGUEST_IMAGE_DEPLOY ??= "${IMAGE_NAME}"
|
XENGUEST_IMAGE_DEPLOY ??= "${IMAGE_NAME}"
|
||||||
|
|
||||||
# Deployed file when building with initramfs
|
|
||||||
XENGUEST_IMAGE_INITRAMFS_DEPLOY ??= "Image-initramfs-${MACHINE}"
|
|
||||||
|
|
||||||
# Add kernel XENGUEST_IMAGE_KERNEL from DEPLOY_DIR_IMAGE to image
|
# Add kernel XENGUEST_IMAGE_KERNEL from DEPLOY_DIR_IMAGE to image
|
||||||
xenguest_image_add_kernel() {
|
xenguest_image_add_kernel() {
|
||||||
srcfile="${1:-}"
|
srcfile="${1:-}"
|
||||||
@@ -36,20 +33,6 @@ xenguest_image_pack() {
|
|||||||
${IMGDEPLOYDIR}/${XENGUEST_IMAGE_DEPLOY}.xenguest
|
${IMGDEPLOYDIR}/${XENGUEST_IMAGE_DEPLOY}.xenguest
|
||||||
}
|
}
|
||||||
|
|
||||||
# do_deploy is used for initramfs to pack the kernel initramfs in an image
|
|
||||||
do_deploy() {
|
|
||||||
# Add kernel
|
|
||||||
xenguest_image_add_kernel
|
|
||||||
|
|
||||||
# Pack the image in deploydir
|
|
||||||
mkdir -p ${DEPLOYDIR}
|
|
||||||
rm -f ${DEPLOYDIR}/${XENGUEST_IMAGE_INITRAMFS_DEPLOY}.xenguest
|
|
||||||
call_xenguest_mkimage pack \
|
|
||||||
${DEPLOYDIR}/${XENGUEST_IMAGE_INITRAMFS_DEPLOY}.xenguest
|
|
||||||
}
|
|
||||||
do_deploy[depends] += "${PN}:do_bootimg_xenguest"
|
|
||||||
do_deploy[depends] += "virtual/kernel:do_deploy"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Task finishing the bootimg
|
# Task finishing the bootimg
|
||||||
# We need this task to actually create the symlinks
|
# We need this task to actually create the symlinks
|
||||||
@@ -88,28 +71,24 @@ python __anonymous() {
|
|||||||
rootfs_needed = False
|
rootfs_needed = False
|
||||||
rootfs_file = ''
|
rootfs_file = ''
|
||||||
kernel_needed = False
|
kernel_needed = False
|
||||||
initramfs_needed = False
|
|
||||||
|
|
||||||
rootfs_file = xenguest_image_rootfs_file(d)
|
rootfs_file = xenguest_image_rootfs_file(d)
|
||||||
if rootfs_file:
|
if rootfs_file:
|
||||||
rootfs_needed = True
|
rootfs_needed = True
|
||||||
|
|
||||||
if d.getVar('XENGUEST_IMAGE_KERNEL'):
|
if d.getVar('XENGUEST_IMAGE_KERNEL') and not d.getVar('INITRAMFS_IMAGE'):
|
||||||
|
# If INITRAMFS_IMAGE is set, even if INITRAMFS_IMAGE_BUNDLE is not
|
||||||
|
# set to 1 to bundle the initramfs with the kernel, kernel.bbclass
|
||||||
|
# is setting a dependency on ${PN}:do_image_complete. We cannot
|
||||||
|
# in this case depend on do_deploy as it would create a circular
|
||||||
|
# dependency:
|
||||||
|
# do_image_complete would depend on kernel:do_deploy which would
|
||||||
|
# depend on ${PN}:do_image_complete
|
||||||
|
# In the case INITRAMFS_IMAGE_BUNDLE = 1, the kernel-xenguest class
|
||||||
|
# will handle the creation of a xenguest image with the kernel.
|
||||||
|
# In the other case the kernel can be added manually to the image.
|
||||||
kernel_needed = True
|
kernel_needed = True
|
||||||
|
|
||||||
if d.getVar('INITRAMFS_IMAGE'):
|
|
||||||
if int(d.getVar('INITRAMFS_IMAGE_BUNDLE')) != 1:
|
|
||||||
bb.error("xenguest-fstype: INITRAMFS_IMAGE is set but INITRAMFS_IMAGE_BUNDLE is set to 0.\n")
|
|
||||||
bb.fatal("xenguest-fstype: This configuration is not supported by xenguest image type\n")
|
|
||||||
initramfs_needed = True
|
|
||||||
|
|
||||||
if initramfs_needed and rootfs_needed:
|
|
||||||
bb.warn("xenguest-fstype: Final image will use an initramfs kernel and rootfs in disk.\n")
|
|
||||||
bb.warn("xenguest-fstype: rootfs.tar.%s should be removed from XENGUEST_IMAGE_DISK_PARTITIONS.\n")
|
|
||||||
|
|
||||||
if not initramfs_needed and not rootfs_needed and not kernel_needed:
|
|
||||||
bb.warn("xenguest-fstype: Generated image will have no kernel and no rootfs.\n")
|
|
||||||
|
|
||||||
bb.build.addtask('do_bootimg_xenguest', 'do_image_complete', None, d)
|
bb.build.addtask('do_bootimg_xenguest', 'do_image_complete', None, d)
|
||||||
|
|
||||||
if rootfs_needed:
|
if rootfs_needed:
|
||||||
@@ -121,12 +100,9 @@ python __anonymous() {
|
|||||||
d.setVar('IMAGE_TYPEDEP_xenguest', 'tar' + (rootfs_file.split('.tar', 1)[1] or ''))
|
d.setVar('IMAGE_TYPEDEP_xenguest', 'tar' + (rootfs_file.split('.tar', 1)[1] or ''))
|
||||||
|
|
||||||
if kernel_needed:
|
if kernel_needed:
|
||||||
if initramfs_needed:
|
# Tell do_bootimg_xenguest to call xenguest_image_add_kernel
|
||||||
bb.build.addtask('do_deploy', 'do_build', None, d)
|
d.appendVarFlag('do_bootimg_xenguest', 'subtasks', ' xenguest_image_add_kernel')
|
||||||
else:
|
# we will need kernel do_deploy
|
||||||
# Tell do_bootimg_xenguest to call xenguest_image_add_kernel
|
d.appendVarFlag('do_bootimg_xenguest', 'depends', ' virtual/kernel:do_deploy')
|
||||||
d.appendVarFlag('do_bootimg_xenguest', 'subtasks', ' xenguest_image_add_kernel')
|
|
||||||
# we will need kernel do_deploy
|
|
||||||
d.appendVarFlag('do_bootimg_xenguest', 'depends', ' virtual/kernel:do_deploy')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Create a xenguest image containing the kernel with initramfs when
|
||||||
|
# initramfs is activated
|
||||||
|
# This is done using kernel-fitimage as model
|
||||||
|
# To activate this, kernel-xenguest must be added to KERNEL_CLASSES
|
||||||
|
|
||||||
|
inherit xenguest-image
|
||||||
|
|
||||||
|
# use a local copy to pack all together
|
||||||
|
XENGUEST_IMAGE_DEPLOY_DIR = "${WORKDIR}/tmp-xenguest"
|
||||||
|
|
||||||
|
python __anonymous () {
|
||||||
|
# only if xenguest image type is present
|
||||||
|
if bb.utils.contains('IMAGE_FSTYPES', 'xenguest', '1', '0', d):
|
||||||
|
# only if initramfs bundle is activated
|
||||||
|
if d.getVar('INITRAMFS_IMAGE') and d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
|
||||||
|
if not bb.utils.contains('KERNEL_IMAGETYPES', 'Image', '1', '0', d):
|
||||||
|
bb.fatal("xenguest image type with initramfs require Image kernel image type")
|
||||||
|
bb.build.addtask('do_assemble_xenguest_initramfs', 'do_deploy', 'do_bundle_initramfs', d)
|
||||||
|
}
|
||||||
|
|
||||||
|
do_assemble_xenguest_initramfs() {
|
||||||
|
xenguest_image_clone
|
||||||
|
call_xenguest_mkimage partial --xen-kernel=${B}/${KERNEL_OUTPUT_DIR}/Image.initramfs
|
||||||
|
rm -f ${B}/${KERNEL_OUTPUT_DIR}/Image-initramfs.xenguest
|
||||||
|
call_xenguest_mkimage pack ${B}/${KERNEL_OUTPUT_DIR}/Image-initramfs.xenguest
|
||||||
|
}
|
||||||
|
do_assemble_xenguest_initramfs[depends] += "${INITRAMFS_IMAGE}:do_image_complete"
|
||||||
|
|
||||||
|
kernel_do_deploy_append() {
|
||||||
|
if [ -f "${B}/${KERNEL_OUTPUT_DIR}/Image-initramfs.xenguest" ]; then
|
||||||
|
install -m 0644 ${B}/${KERNEL_OUTPUT_DIR}/Image-initramfs.xenguest "$deployDir/Image-${INITRAMFS_NAME}.xenguest"
|
||||||
|
ln -snf Image-${INITRAMFS_NAME}.xenguest $deployDir/Image-${INITRAMFS_LINK_NAME}.xenguest
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -36,11 +36,8 @@ XENGUEST_IMAGE_EXTRA_CMD ??= ""
|
|||||||
# Kernel binary
|
# Kernel binary
|
||||||
# This value is used by the xenguest image type but is declared here to have
|
# This value is used by the xenguest image type but is declared here to have
|
||||||
# all variables in the same place
|
# all variables in the same place
|
||||||
# Default value is:
|
|
||||||
# - Image if INITRAMFS_IMAGE is not set
|
|
||||||
# - Image-initramfs-${MACHINE}.bin if INITRAMFS_IMAGE is set
|
|
||||||
# If this value is empty no kernel will be added to the image
|
# If this value is empty no kernel will be added to the image
|
||||||
XENGUEST_IMAGE_KERNEL ??= "${@ 'Image' if not d.getVar('INITRAMFS_IMAGE') else 'Image-initramfs-${MACHINE}.bin'}"
|
XENGUEST_IMAGE_KERNEL ??= "Image"
|
||||||
|
|
||||||
# Size of the disk to create (if 0 no disk will be created and rootfs will not
|
# Size of the disk to create (if 0 no disk will be created and rootfs will not
|
||||||
# be included in the xenguest image)
|
# be included in the xenguest image)
|
||||||
|
|||||||
@@ -7,3 +7,5 @@ DISTRO_FEATURES_append = " ipv4"
|
|||||||
IMAGE_CLASSES += "image_types_xenguest"
|
IMAGE_CLASSES += "image_types_xenguest"
|
||||||
IMAGE_FSTYPES += "xenguest"
|
IMAGE_FSTYPES += "xenguest"
|
||||||
|
|
||||||
|
# xenguest kernel extension to handle initramfs
|
||||||
|
KERNEL_CLASSES += "kernel-xenguest"
|
||||||
|
|||||||
Reference in New Issue
Block a user