From 04f503477ced16176f7db24f363e6378c2ac528b Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Fri, 30 Oct 2020 15:55:23 -0700 Subject: Add DOMU_MEM and DOMU_VCPUS Add two new config file parameters to configure the amount of memory and the number of vcpus of dom0less VMs. Signed-off-by: Stefano Stabellini Reviewed-by: Brian Woods --- README.md | 6 ++++++ scripts/uboot-script-gen | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8aa33a3..0df4e4b 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ DOMU_RAMDISK[0]="zynqmp-dom1/domU-ramdisk.cpio" DOMU_PASSTHROUGH_DTB[0]="zynqmp-dom1/passthrough-example-part.dtb" DOMU_KERNEL[1]="zynqmp-dom2/Image-domU" DOMU_RAMDISK[1]="zynqmp-dom2/domU-ramdisk.cpio" +DOMU_MEM[1]=512 +DOMU_VCPUS[1]=1 UBOOT_SOURCE="boot.source" UBOOT_SCRIPT="boot.scr" @@ -76,6 +78,10 @@ Where: - DOMU_PASSTHROUGH_DTB[number] specifies the device assignment configuration, see xen.git:docs/misc/arm/passthrough.txt +- DOMU_MEM[number] is the amount of memory for the VM in MB, default 512MB + +- DOMU_VCPUS[number] is the number of vcpus for the VM, default 1 + - UBOOT_SOURCE and UBOOT_SCRIPT specify the output. They are optional as you can pass -o FILENAME to uboot-script-gen as a command line parameter diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index f176e1a..ef26da1 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -86,8 +86,8 @@ function device_tree_editing() echo "fdt set /chosen/domU$i compatible \"xen,domain\"" >> $UBOOT_SOURCE echo "fdt set /chosen/domU$i \#address-cells <0x2>" >> $UBOOT_SOURCE echo "fdt set /chosen/domU$i \#size-cells <0x2>" >> $UBOOT_SOURCE - echo "fdt set /chosen/domU$i memory <0x0 0x40000>" >> $UBOOT_SOURCE - echo "fdt set /chosen/domU$i cpus <0x1>" >> $UBOOT_SOURCE + echo "fdt set /chosen/domU$i memory <0x0 "${DOMU_MEM[$i]}">" >> $UBOOT_SOURCE + echo "fdt set /chosen/domU$i cpus <"${DOMU_VCPUS[$i]}">" >> $UBOOT_SOURCE echo "fdt set /chosen/domU$i vpl011 <0x1>" >> $UBOOT_SOURCE add_device_tree_kernel "/chosen/domU$i" ${domU_kernel_addr[$i]} ${domU_kernel_size[$i]} if test "${domU_ramdisk_addr[$i]}" @@ -279,6 +279,20 @@ then DOM0_CMD="$DOM0_CMD root=/dev/sda2" fi fi +i=0 +while test $i -lt $NUM_DOMUS +do + if test -z "${DOMU_MEM[$i]}" + then + DOMU_MEM[$i]=512 + fi + DOMU_MEM[$i]=$((${DOMU_MEM[$i]} * 1024)) + if test -z "${DOMU_VCPUS[$i]}" + then + DOMU_VCPUS[$i]=1 + fi + i=$(( $i + 1 )) +done # the cd is needed so that the relative paths will match once we use # tftp or move the files to a partition -- cgit v1.2.3