From 6e1ece2b59a0b8037f4244a3df2b50534eae2942 Mon Sep 17 00:00:00 2001 From: Brian Woods Date: Tue, 27 Oct 2020 17:08:07 -0700 Subject: Add options for Xen and Dom0 CMD arguments Both XEN_CMD and DOM0_CMD are optional settings in the config file that set Xen's and Dom0's command line arguments. If not set, a default value will be used. Also, for Dom0's command line arguments, if root isn't set in it, it will determine the best option based on the load argument. Signed-off-by: Brian Woods Reviewed-by: Stefano Stabellini --- README.md | 9 +++++++++ scripts/uboot-script-gen | 25 ++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f688f28..8aa33a3 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,9 @@ MEMORY_END="0x80000000" DEVICE_TREE="mpsoc.dtb" XEN="xen" +XEN_CMD="console=dtuart dtuart=serial0 dom0_mem=1G dom0_max_vcpus=1 bootscrub=0 vwfi=native sched=null" DOM0_KERNEL="Image-dom0" +DOM0_CMD="console=hvc0 earlycon=xen earlyprintk=xen clk_ignore_unused" DOM0_RAMDISK="dom0-ramdisk.cpio" NUM_DOMUS=2 @@ -53,8 +55,15 @@ Where: - XEN specifies the Xen hypervisor binary to load. Note that it has to be a regular Xen binary, not a u-boot binary. +- XEN_CMD specifies the command line arguments used for Xen. If not + set, the default one will be used. + - DOM0_KERNEL specifies the Dom0 kernel file to load. +- DOM0_CMD specifies the command line arguments for Dom0's Linux + kernel. If "root=" isn't set, imagebuilder will try to determine it. + If not set at all, the default one is used. + - DOM0_RAMDISK specifies the Dom0 ramdisk to use. Note that it should be a regular ramdisk cpio.gz file, not a u-boot binary. diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index db194fe..f176e1a 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -62,13 +62,13 @@ function device_tree_editing() echo "fdt resize 1024" >> $UBOOT_SOURCE echo "fdt set /chosen \#address-cells <0x2>" >> $UBOOT_SOURCE echo "fdt set /chosen \#size-cells <0x2>" >> $UBOOT_SOURCE - echo "fdt set /chosen xen,xen-bootargs \"console=dtuart dtuart=serial0 dom0_mem=1G dom0_max_vcpus=1 bootscrub=0 vwfi=native sched=null\"" >> $UBOOT_SOURCE + echo "fdt set /chosen xen,xen-bootargs \"$XEN_CMD\"" >> $UBOOT_SOURCE echo "fdt mknod /chosen dom0" >> $UBOOT_SOURCE echo "fdt set /chosen/dom0 compatible \"xen,linux-zimage\" \"xen,multiboot-module\"" >> $UBOOT_SOURCE echo "fdt set /chosen/dom0 reg <0x0 "$dom0_kernel_addr" 0x0 "$dom0_kernel_size">" >> $UBOOT_SOURCE if test "$LOAD_CMD" = "tftpb" then - echo "fdt set /chosen xen,dom0-bootargs \"console=hvc0 earlycon=xen earlyprintk=xen clk_ignore_unused root=/dev/ram0\"" >> $UBOOT_SOURCE + echo "fdt set /chosen xen,dom0-bootargs \"$DOM0_CMD\"" >> $UBOOT_SOURCE if test $dom0_ramdisk_addr != "-" then echo "fdt mknod /chosen dom0-ramdisk" >> $UBOOT_SOURCE @@ -76,7 +76,7 @@ function device_tree_editing() echo "fdt set /chosen/dom0-ramdisk reg <0x0 "$dom0_ramdisk_addr" 0x0 "$dom0_ramdisk_size">" >> $UBOOT_SOURCE fi else - echo "fdt set /chosen xen,dom0-bootargs \"console=hvc0 earlycon=xen earlyprintk=xen root=/dev/sda2\"" >> $UBOOT_SOURCE + echo "fdt set /chosen xen,dom0-bootargs \"$DOM0_CMD\"" >> $UBOOT_SOURCE fi i=0 @@ -261,6 +261,25 @@ then UBOOT_SOURCE="$UBOOT_SCRIPT_ARG".source fi +if [ -z "$XEN_CMD" ] +then + XEN_CMD="console=dtuart dtuart=serial0 dom0_mem=1G dom0_max_vcpus=1 bootscrub=0 vwfi=native sched=null" +fi + +if [ -z "$DOM0_CMD" ] +then + DOM0_CMD="console=hvc0 earlycon=xen earlyprintk=xen clk_ignore_unused" +fi +if [[ ! $DOM0_CMD =~ root= ]] +then + if test "$LOAD_CMD" = "tftpb" + then + DOM0_CMD="$DOM0_CMD root=/dev/ram0" + else + DOM0_CMD="$DOM0_CMD root=/dev/sda2" + fi +fi + # the cd is needed so that the relative paths will match once we use # tftp or move the files to a partition cd "$uboot_dir" -- cgit v1.2.3