diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2022-05-09 11:57:05 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2022-05-09 12:22:11 -0400 |
| commit | 27e5ade0abc2660226389b8b62ef07d85f4b8758 (patch) | |
| tree | 3d37ab6e263c0cc6c4290e3c85e5f1b5a79a794e | |
| parent | bd66956ceb4f13fae1dd67a16c4f310e1c860210 (diff) | |
| download | meta-virtualization-27e5ade0abc2660226389b8b62ef07d85f4b8758.tar.gz | |
Revert "qemuboot, xen-image-minimal: enable runqemu for qemuarm Xen images"
This reverts commit 1c746a976830ebaf85c7c8c25612bea349b0a7c5.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rw-r--r-- | classes/qemuboot-xen-defaults.bbclass | 26 | ||||
| -rw-r--r-- | classes/qemuboot-xen-u-boot.bbclass | 128 | ||||
| -rw-r--r-- | conf/distro/include/meta-virt-xen.inc | 1 | ||||
| -rw-r--r-- | recipes-extended/images/xen-image-minimal.bb | 4 |
4 files changed, 7 insertions, 152 deletions
diff --git a/classes/qemuboot-xen-defaults.bbclass b/classes/qemuboot-xen-defaults.bbclass index 62bbf8fd..c7e74c3e 100644 --- a/classes/qemuboot-xen-defaults.bbclass +++ b/classes/qemuboot-xen-defaults.bbclass | |||
| @@ -10,37 +10,21 @@ DOM0_KERNEL ??= "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}" | |||
| 10 | DOM0_KERNEL_LOAD_ADDR ??= "0x45000000" | 10 | DOM0_KERNEL_LOAD_ADDR ??= "0x45000000" |
| 11 | QB_XEN_DOMAIN_MODULES ??= "${DOM0_KERNEL}:${DOM0_KERNEL_LOAD_ADDR}:multiboot,kernel" | 11 | QB_XEN_DOMAIN_MODULES ??= "${DOM0_KERNEL}:${DOM0_KERNEL_LOAD_ADDR}:multiboot,kernel" |
| 12 | 12 | ||
| 13 | # Qemuboot for 32-bit Arm loads Xen via device loader parameter rather than | ||
| 14 | # kernel and boots using u-boot as bios | ||
| 15 | XEN_BINARY ??= "${DEPLOY_DIR_IMAGE}/xen-${MACHINE}" | ||
| 16 | QB_XEN_LOAD_ADDR ??= "0x46000000" | ||
| 17 | QB_OPT_APPEND:append:qemuarm = " \ | ||
| 18 | -device loader,file=${XEN_BINARY},addr=${QB_XEN_LOAD_ADDR},force-raw=on \ | ||
| 19 | -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \ | ||
| 20 | -bios ${DEPLOY_DIR_IMAGE}/u-boot.bin \ | ||
| 21 | " | ||
| 22 | QB_DEFAULT_KERNEL:qemuarm = "none" | ||
| 23 | |||
| 24 | # Qemuboot for 64-bit Arm uses the QB_DEFAULT_KERNEL method to load Xen | 13 | # Qemuboot for 64-bit Arm uses the QB_DEFAULT_KERNEL method to load Xen |
| 25 | # and the device loader option for the dom0 kernel: | 14 | # and the device loader option for the dom0 kernel: |
| 26 | QB_OPT_APPEND:append:qemuarm64 = " \ | 15 | QB_OPT_APPEND:append:aarch64 = " \ |
| 27 | -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \ | 16 | -device loader,file=${DOM0_KERNEL},addr=${DOM0_KERNEL_LOAD_ADDR} \ |
| 28 | " | 17 | " |
| 29 | QB_DEFAULT_KERNEL:qemuarm64 = "xen-${MACHINE}" | 18 | QB_DEFAULT_KERNEL:aarch64 = "xen-${MACHINE}" |
| 30 | 19 | ||
| 31 | # 32-bit Arm: gic version 2 | ||
| 32 | QB_MACHINE:qemuarm = "-machine virt -machine virtualization=true" | ||
| 33 | # 64-bit Arm: gic version 3 | 20 | # 64-bit Arm: gic version 3 |
| 34 | QB_MACHINE:qemuarm64 = "-machine virt,gic-version=3 -machine virtualization=true" | 21 | QB_MACHINE:aarch64 = "-machine virt,gic-version=3 -machine virtualization=true" |
| 35 | 22 | ||
| 36 | # Increase the default qemu memory allocation to allow for the hypervisor. | 23 | # Increase the default qemu memory allocation to allow for the hypervisor. |
| 37 | # Use a weak assignment to allow for change of default and override elsewhere. | 24 | # Use a weak assignment to allow for change of default and override elsewhere. |
| 38 | QB_MEM_VALUE ??= "512" | 25 | QB_MEM_VALUE ??= "512" |
| 39 | QB_MEM = "-m ${QB_MEM_VALUE}" | 26 | QB_MEM = "-m ${QB_MEM_VALUE}" |
| 40 | 27 | ||
| 41 | # 32-bit Arm: qemuboot with a u-boot script image | ||
| 42 | QB_XEN_U_BOOT_SCR:qemuarm = "boot.scr.uimg" | ||
| 43 | |||
| 44 | # 64-bit Arm: qemuboot with a device tree binary | 28 | # 64-bit Arm: qemuboot with a device tree binary |
| 45 | QB_DTB:qemuarm64 = "${IMAGE_NAME}.qemuboot.dtb" | 29 | QB_DTB:aarch64 = "${IMAGE_NAME}.qemuboot.dtb" |
| 46 | QB_DTB_LINK:qemuarm64 = "${IMAGE_LINK_NAME}.qemuboot.dtb" | 30 | QB_DTB_LINK:aarch64 = "${IMAGE_LINK_NAME}.qemuboot.dtb" |
diff --git a/classes/qemuboot-xen-u-boot.bbclass b/classes/qemuboot-xen-u-boot.bbclass deleted file mode 100644 index 4401eba2..00000000 --- a/classes/qemuboot-xen-u-boot.bbclass +++ /dev/null | |||
| @@ -1,128 +0,0 @@ | |||
| 1 | # Enable booting Xen with qemuboot / runqemu: u-boot configuration | ||
| 2 | # | ||
| 3 | # Copyright (c) 2021-2022 Star Lab Corp. All rights reserved. | ||
| 4 | # | ||
| 5 | # Author: Christopher Clark <christopher.clark@starlab.io> | ||
| 6 | |||
| 7 | # Interface variables: | ||
| 8 | # | ||
| 9 | # QB_XEN_U_BOOT_SCR : | ||
| 10 | # If this variable is set, this class will generate the u-boot script image file | ||
| 11 | # It must be set to the name of the compiled command file that u-boot will tftp | ||
| 12 | # from the image deploy directory during boot, currently: "boot.scr.uimg" | ||
| 13 | # | ||
| 14 | # QB_XEN_CMDLINE_EXTRA : | ||
| 15 | # A string to be appended to the default Xen hypervisor boot command line, | ||
| 16 | # for supplying Xen boot options. | ||
| 17 | # The device tree that this bbclass generates will contain Xen command | ||
| 18 | # line options to connect the Xen console to the Qemu serial port. | ||
| 19 | # | ||
| 20 | # QB_XEN_LOAD_ADDR : | ||
| 21 | # The hypervisor load address | ||
| 22 | # | ||
| 23 | # QB_XEN_DOM0_BOOTARGS : | ||
| 24 | # A string for specifying Dom0 boot options for the Xen section of the device | ||
| 25 | # tree. | ||
| 26 | # | ||
| 27 | # QB_XEN_UBOOT_SCR_TASK_DEPENDS: | ||
| 28 | # The task dependencies for the u-boot script generation. A default is provided. | ||
| 29 | # | ||
| 30 | # QB_XEN_DOMAIN_MODULES: | ||
| 31 | # A space-separated list of colon-separated entries: | ||
| 32 | # "<file for the module>:<load memory address>:<module compatibility string>" | ||
| 33 | |||
| 34 | # Set the default value for this variable to empty: no file generated. | ||
| 35 | QB_XEN_U_BOOT_SCR ??= "" | ||
| 36 | |||
| 37 | write_add_chosen_module() { | ||
| 38 | CMD_FILE="$1" | ||
| 39 | ADDR="$2" | ||
| 40 | SIZE="$3" | ||
| 41 | MODULE_TYPE="$4" | ||
| 42 | cat <<EOF >>"${CMD_FILE}" | ||
| 43 | fdt mknod /chosen module@${ADDR} | ||
| 44 | fdt set /chosen/module@${ADDR} compatible "multiboot,module" "${MODULE_TYPE}" | ||
| 45 | fdt set /chosen/module@${ADDR} reg <${ADDR} ${SIZE}> | ||
| 46 | EOF | ||
| 47 | } | ||
| 48 | |||
| 49 | generate_xen_u_boot_conf() { | ||
| 50 | CMD_FILE="${B}/qemuboot-xen.cmd" | ||
| 51 | cat <<EOF >"${CMD_FILE}" | ||
| 52 | echo "Running u-boot launch script" | ||
| 53 | fdt addr 0x40000000 | ||
| 54 | fdt resize | ||
| 55 | echo "Device tree resized" | ||
| 56 | |||
| 57 | fdt set /chosen \#address-cells <1> | ||
| 58 | fdt set /chosen \#size-cells <1> | ||
| 59 | |||
| 60 | fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/pl011@9000000 ${QB_XEN_CMDLINE_EXTRA}" | ||
| 61 | fdt set /chosen xen,dom0-bootargs "${QB_XEN_DOM0_BOOTARGS}" | ||
| 62 | EOF | ||
| 63 | |||
| 64 | if [ -z "${QB_XEN_DOMAIN_MODULES}" ]; then | ||
| 65 | bbwarn "No domain modules: please set QB_XEN_DOMAIN_MODULES" | ||
| 66 | fi | ||
| 67 | |||
| 68 | for DOMAIN_MODULE in ${QB_XEN_DOMAIN_MODULES} | ||
| 69 | do | ||
| 70 | MODULE_FILE="$(echo ${DOMAIN_MODULE} | cut -f1 -d:)" | ||
| 71 | ADDR="$(echo ${DOMAIN_MODULE} | cut -f2 -d:)" | ||
| 72 | MODULE_TYPE="$(echo ${DOMAIN_MODULE} | cut -f3 -d:)" | ||
| 73 | RESOLVED_FILE="$(readlink -f ${MODULE_FILE})" | ||
| 74 | SIZE=$(printf '0x%x\n' $(stat -c '%s' "${RESOLVED_FILE}")) | ||
| 75 | [ "x${SIZE}" != "x0x0" ] || bbfatal No module: "${MODULE_FILE}" | ||
| 76 | write_add_chosen_module "${CMD_FILE}" "${ADDR}" "${SIZE}" "${MODULE_TYPE}" | ||
| 77 | done | ||
| 78 | |||
| 79 | cat <<EOF >>"${CMD_FILE}" | ||
| 80 | fdt print /chosen | ||
| 81 | |||
| 82 | echo Boot Xen | ||
| 83 | bootz ${QB_XEN_LOAD_ADDR} - 0x40000000 | ||
| 84 | EOF | ||
| 85 | |||
| 86 | uboot-mkimage -A "${UBOOT_ARCH}" -T script -C none \ | ||
| 87 | -a 0x20000 -e 0x20000 \ | ||
| 88 | -d "${CMD_FILE}" "${CMD_FILE}.uimg" | ||
| 89 | |||
| 90 | # u-boot tftps this filename from DEPLOY_DIR_IMAGE: | ||
| 91 | install -m 0644 "${CMD_FILE}.uimg" "${DEPLOY_DIR_IMAGE}/${QB_XEN_U_BOOT_SCR}" | ||
| 92 | } | ||
| 93 | |||
| 94 | do_write_qemuboot_xen_u_boot_conf() { | ||
| 95 | # Not all architectures qemuboot with u-boot, so check to see if this | ||
| 96 | # is needed. This allows this bbclass file to be used in the same image | ||
| 97 | # recipe for multiple architectures. | ||
| 98 | |||
| 99 | if [ -n "${QB_XEN_U_BOOT_SCR}" ] && [ -n "${QB_SYSTEM_NAME}" ] ; then | ||
| 100 | generate_xen_u_boot_conf | ||
| 101 | fi | ||
| 102 | } | ||
| 103 | |||
| 104 | addtask do_write_qemuboot_xen_u_boot_conf after do_write_qemuboot_conf before do_image | ||
| 105 | # Task dependency: | ||
| 106 | # An expected common case is that the kernel for at least one of the initial | ||
| 107 | # domains (eg. dom0) is deployed from the virtual/kernel recipe, so | ||
| 108 | # add that as a task dependency here since the kernel size needs to be known | ||
| 109 | # for generating the device tree. | ||
| 110 | # Dependencies are only introduced if a device tree will be generated. | ||
| 111 | QB_XEN_UBOOT_SCR_TASK_DEPENDS ?= " \ | ||
| 112 | ${@[ ' \ | ||
| 113 | u-boot-tools-native:do_populate_sysroot \ | ||
| 114 | u-boot:do_deploy \ | ||
| 115 | virtual/kernel:do_deploy \ | ||
| 116 | ', ''][d.getVar('QB_XEN_U_BOOT_SCR') == '']} \ | ||
| 117 | " | ||
| 118 | do_write_qemuboot_xen_u_boot_conf[depends] = "${QB_XEN_UBOOT_SCR_TASK_DEPENDS}" | ||
| 119 | |||
| 120 | def qemuboot_xen_u_boot_vars(d): | ||
| 121 | build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE', | ||
| 122 | 'KERNEL_IMAGETYPE', 'IMAGE_NAME', 'IMAGE_LINK_NAME', | ||
| 123 | 'STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE', | ||
| 124 | 'STAGING_DIR_HOST', 'SERIAL_CONSOLES'] | ||
| 125 | return build_vars + [k for k in d.keys() if k.startswith('QB_')] | ||
| 126 | |||
| 127 | do_write_qemuboot_xen_u_boot[vardeps] += "${@' '.join(qemuboot_xen_u_boot_vars(d))}" | ||
| 128 | do_write_qemuboot_xen_u_boot[vardepsexclude] += "TOPDIR" | ||
diff --git a/conf/distro/include/meta-virt-xen.inc b/conf/distro/include/meta-virt-xen.inc index 89f98f28..5fbb57f8 100644 --- a/conf/distro/include/meta-virt-xen.inc +++ b/conf/distro/include/meta-virt-xen.inc | |||
| @@ -12,5 +12,4 @@ include ${@bb.utils.contains('MACHINE', 'raspberrypi4-64', \ | |||
| 12 | '${XEN_RPI4_64_CONFIG_PATH}', '', d)} | 12 | '${XEN_RPI4_64_CONFIG_PATH}', '', d)} |
| 13 | 13 | ||
| 14 | # Set serial for working qemuboot console | 14 | # Set serial for working qemuboot console |
| 15 | SERIAL_CONSOLES:qemuarm ?= "115200;ttyAMA0" | ||
| 16 | SERIAL_CONSOLES:qemuarm64 ?= "115200;ttyAMA0" | 15 | SERIAL_CONSOLES:qemuarm64 ?= "115200;ttyAMA0" |
diff --git a/recipes-extended/images/xen-image-minimal.bb b/recipes-extended/images/xen-image-minimal.bb index dd5b39d8..7f10b1d6 100644 --- a/recipes-extended/images/xen-image-minimal.bb +++ b/recipes-extended/images/xen-image-minimal.bb | |||
| @@ -36,10 +36,10 @@ LICENSE = "MIT" | |||
| 36 | 36 | ||
| 37 | QB_NETWORK_XEN_BRIDGE = "1" | 37 | QB_NETWORK_XEN_BRIDGE = "1" |
| 38 | 38 | ||
| 39 | inherit core-image | 39 | inherit core-image qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-testimage-network |
| 40 | # Only inherit the qemuboot classes when building for a qemu machine | 40 | # Only inherit the qemuboot classes when building for a qemu machine |
| 41 | QB_QEMU_CLASSES = "" | 41 | QB_QEMU_CLASSES = "" |
| 42 | QB_QEMU_CLASSES:qemuall = "qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-xen-u-boot qemuboot-testimage-network" | 42 | QB_QEMU_CLASSES:qemuall = "qemuboot-xen-defaults qemuboot-xen-dtb qemuboot-testimage-network" |
| 43 | inherit ${QB_QEMU_CLASSES} | 43 | inherit ${QB_QEMU_CLASSES} |
| 44 | 44 | ||
| 45 | do_check_xen_state() { | 45 | do_check_xen_state() { |
