uboot-script-gen: Skip dom0 instead of exiting if DOM0_KERNEL is not set
PATCH 1/2 uboot-script-gen: Skip dom0 instead of exiting if DOM0_KERNEL is not set
When the parameter DOM0_KERNEL is not specified and NUM_DOMUS is not 0, instead of failing the script, just skip any dom0 specific setup. This way the script can be used to boot XEN in dom0less mode.
--- scripts/uboot-script-gen | 60 ++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 17 deletions(-)
scripts/uboot-script-gen +43 -17
@@ -168,10 +168,15 @@ function xen_device_tree_editing() dt_set "/chosen" "#address-cells" "hex" "0x2" dt_set "/chosen" "#size-cells" "hex" "0x2" dt_set "/chosen" "xen,xen-bootargs" "str" "$XEN_CMD" - dt_mknode "/chosen" "dom0" - dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" - dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)" - dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" + + if test "$DOM0_KERNEL" + then + dt_mknode "/chosen" "dom0" + dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" + dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)" + dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" + fi + if test "$DOM0_RAMDISK" && test $ramdisk_addr != "-" then dt_mknode "/chosen" "dom0-ramdisk"
@@ -203,7 +208,10 @@ function xen_device_tree_editing() add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" fi dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" - dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled" + if test "$DOM0_KERNEL" + then + dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled" + fi if test "${DOMU_COLORS[$i]}" then
@@ -433,6 +441,19 @@ function xen_config() DOM0_CMD="$DOM0_CMD root=$root_dev" fi fi + if test -z "$DOM0_KERNEL" + then + if test "$NUM_DOMUS" -eq "0" + then + echo "Neither dom0 or domUs are specified, exiting." + exit 1 + fi + echo "Dom0 kernel is not specified, continue with dom0less setup." + unset DOM0_RAMDISK + # Remove dom0 specific parameters from the XEN command line. + local params=($XEN_CMD) + XEN_CMD="${params[@]/dom0*/}" + fi i=0 while test $i -lt $NUM_DOMUS do
@@ -490,11 +511,13 @@ generate_uboot_images() xen_file_loading() { - check_compressed_file_type $DOM0_KERNEL "executable" - dom0_kernel_addr=$memaddr - load_file $DOM0_KERNEL "dom0_linux" - dom0_kernel_size=$filesize - + if test "$DOM0_KERNEL" + then + check_compressed_file_type $DOM0_KERNEL "executable" + dom0_kernel_addr=$memaddr + load_file $DOM0_KERNEL "dom0_linux" + dom0_kernel_size=$filesize + fi if test "$DOM0_RAMDISK" then check_compressed_file_type $DOM0_RAMDISK "cpio archive"
@@ -597,14 +620,16 @@ bitstream_load_and_config() create_its_file_xen() { - if test "$ramdisk_addr" != "-" + if test "$DOM0_KERNEL" then - load_files="\"dom0_linux\", \"dom0_ramdisk\"" - else - load_files="\"dom0_linux\"" - fi - # xen below - cat >> "$its_file" <<- EOF + if test "$ramdisk_addr" != "-" + then + load_files="\"dom0_linux\", \"dom0_ramdisk\"" + else + load_files="\"dom0_linux\"" + fi + # xen below + cat >> "$its_file" <<- EOF dom0_linux { description = "dom0 linux kernel binary"; data = /incbin/("$DOM0_KERNEL");
@@ -616,6 +641,7 @@ create_its_file_xen() $fit_algo }; EOF + fi # domUs i=0 while test $i -lt $NUM_DOMUS
Signature · 1 line
2.34.1
PATCH 2/2 uboot-script-gen: Enable direct mapping of statically allocated memory
Direct mapping for dom0less VMs is disabled by default in XEN and can be enabled through the 'direct-map' property.
Add a new config parameter DOMU_DIRECT_MAP to be able to enable or disable direct mapping, i.e set to 1 for enabling and to 0 for disabling. This parameter is optional. Direct mapping is enabled by default for all dom0less VMs with static allocation.
The property 'direct-map' is a boolean property. Boolean properties are true if present and false if missing.
Add a new data_type 'bool' in function dt_set() to setup a boolean property.
--- README.md | 4 ++++ scripts/uboot-script-gen | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+)
README.md +4 -0
@@ -168,6 +168,10 @@ Where: if specified, indicates the host physical address regions [baseaddr, baseaddr + size) to be reserved to the VM for static allocation. +- DOMU_DIRECT_MAP[number] can be set to 1 or 0. + If set to 1, the VM is direct mapped. The default is 1. + This is only applicable when DOMU_STATIC_MEM is specified. + - LINUX is optional but specifies the Linux kernel for when Xen is NOT used. To enable this set any LINUX\_\* variables and do NOT set the XEN variable.
scripts/uboot-script-gen +18 -0
@@ -27,6 +27,7 @@ function dt_mknode() # hex # str # str_a +# bool function dt_set() { local path=$1
@@ -49,6 +50,12 @@ function dt_set() array+=" \"$element\"" done echo "fdt set $path $var $array" >> $UBOOT_SOURCE + elif test $data_type = "bool" + then + if test "$data" -eq 1 + then + echo "fdt set $path $var" >> $UBOOT_SOURCE + fi else echo "fdt set $path $var \"$data\"" >> $UBOOT_SOURCE fi
@@ -65,6 +72,12 @@ function dt_set() elif test $data_type = "str_a" then fdtput $FDTEDIT -p -t s $path $var $data + elif test $data_type = "bool" + then + if test "$data" -eq 1 + then + fdtput $FDTEDIT -p $path $var + fi else fdtput $FDTEDIT -p -t s $path $var "$data" fi
@@ -206,6 +219,7 @@ function xen_device_tree_editing() if test "${DOMU_STATIC_MEM[$i]}" then add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" + dt_set "/chosen/domU$i" "direct-map" "bool" "${DOMU_DIRECT_MAP[$i]}" fi dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" if test "$DOM0_KERNEL"
@@ -470,6 +484,10 @@ function xen_config() then DOMU_CMD[$i]="console=ttyAMA0" fi + if test -z "${DOMU_DIRECT_MAP[$i]}" + then + DOMU_DIRECT_MAP[$i]=1 + fi i=$(( $i + 1 )) done }
Signature · 1 line
2.34.1
Re: [ImageBuilder] [PATCH 2/2] uboot-script-gen: Enable direct mapping of statically allocated memory
Quoted 7 lines · Xenia Ragiadakou
Direct mapping for dom0less VMs is disabled by default in XEN and can be enabled through the 'direct-map' property.
Add a new config parameterDOMU_DIRECT_MAPto be able to enable or disable direct mapping, i.e set to 1 for enabling and to 0 for disabling. This parameter is optional. Direct mapping is enabled by default for all dom0less VMs with static allocation.
Quoted 5 lines
The property 'direct-map' is a boolean property. Boolean properties are true if present and false if missing.
Add a newdata_type'bool' in functiondt_set()to setup a boolean property.Signed-off-by Xenia Ragiadakou <[email protected]>
Quoted 80 lines
--- README.md | 4 ++++ scripts/uboot-script-gen | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+)README.md +4
-0@@ -168,6 +168,10 @@ Where: if specified, indicates the host physical address regions [baseaddr, baseaddr + size) to be reserved to the VM for static allocation. +- DOMU_DIRECT_MAP[number] can be set to 1 or 0. + If set to 1, the VM is direct mapped. The default is 1. + This is only applicable when DOMU_STATIC_MEM is specified. + - LINUX is optional but specifies the Linux kernel for when Xen is NOT used. To enable this set any LINUX\_\* variables and do NOT set the XEN variable.scripts/uboot-script-gen +18
-0@@ -27,6 +27,7 @@ function dt_mknode() # hex # str # str_a +# bool function dt_set() { local path=$1@@ -49,6 +50,12 @@ function dt_set() array+=" \"$element\"" done echo "fdt set $path $var $array" >> $UBOOT_SOURCE + elif test $data_type = "bool" + then + if test "$data" -eq 1 + then + echo "fdt set $path $var" >> $UBOOT_SOURCE + fi else echo "fdt set $path $var \"$data\"" >> $UBOOT_SOURCE fi@@ -65,6 +72,12 @@ function dt_set() elif test $data_type = "str_a" then fdtput $FDTEDIT -p -t s $path $var $data + elif test $data_type = "bool" + then + if test "$data" -eq 1 + then + fdtput $FDTEDIT -p $path $var + fi else fdtput $FDTEDIT -p -t s $path $var "$data" fi@@ -206,6 +219,7 @@ function xen_device_tree_editing() if test "${DOMU_STATIC_MEM[$i]}" then add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" + dt_set "/chosen/domU$i" "direct-map" "bool" "${DOMU_DIRECT_MAP[$i]}" fi dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" if test "$DOM0_KERNEL"@@ -470,6 +484,10 @@ function xen_config() then DOMU_CMD[$i]="console=ttyAMA0" fi + if test -z "${DOMU_DIRECT_MAP[$i]}" + then + DOMU_DIRECT_MAP[$i]=1 + fi i=$(( $i + 1 )) done }Signature · 1 line
2.34.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Viryaos-discuss] [ImageBuilder] [PATCH 2/2] uboot-script-gen: Enable direct mapping of statically allocated memory
(Resending mail, as the previous delivery failed)
Quoted 99 lines · Ayan Kumar Halder
Hi,
Quoted 22 lines · Xenia Ragiadakou
Direct mapping for dom0less VMs is disabled by default in XEN and can be enabled through the 'direct-map' property.
Add a new config parameterDOMU_DIRECT_MAPto be able to enable or disable direct mapping, i.e set to 1 for enabling and to 0 for disabling. This parameter is optional. Direct mapping is enabled by default for all dom0less VMs with static allocation.The property 'direct-map' is a boolean property. Boolean properties are true if present and false if missing.
Add a newdata_type'bool' in functiondt_set()to setup a boolean property.Signed-off-by Xenia Ragiadakou <[email protected]>---
README.md | 4 ++++scripts/uboot-script-gen| 18 ++++++++++++++++++2 files changed, 22 insertions(+)README.md +0
-0@@ -168,6 +168,10 @@ Where:Quoted 5 lines
if specified, indicates the host physical address regions [baseaddr, baseaddr + size) to be reserved to the VM for static allocation. +- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
+ If set to 1, the VM is direct mapped. The default is 1.
+ This is only applicable whenDOMU_STATIC_MEMis specified.Can't we just use $DOMU_STATIC_MEM to set "direct-map" in dts ?
Is there a valid use-case for static allocation without direct mapping ? Sorry, it is not very clear to me.
- Ayan
Quoted 62 lines
+
- LINUX is optional but specifies the Linux kernel for when Xen is NOT used. To enable this set any LINUX\_\* variables and do NOT set the XEN variable.scripts/uboot-script-gen +1
-0@@ -27,6 +27,7 @@ function dt_mknode() # hex # str # str_a +# bool function dt_set() {local path=$1
scripts/uboot-script-gen +0
-0@@ -49,6 +50,12 @@ function dt_set()array+=" \"$element\""
done
echo "fdt set $path $var $array" >> $UBOOT_SOURCE + elif test $data_type = "bool"
+ then
+ if test "$data" -eq 1
+ then
+ echo "fdt set $path $var" >> $UBOOT_SOURCE + fi
else
echo "fdt set $path $var \"$data\"" >> $UBOOT_SOURCE fiscripts/uboot-script-gen +0
-0@@ -65,6 +72,12 @@ function dt_set()elif test $data_type = "
str_a"
then
fdtput $FDTEDIT -p -t s $path $var $data + elif test $data_type = "bool"
+ then
+ if test "$data" -eq 1
+ then
+ fdtput $FDTEDIT -p $path $var + fi
else
fdtput $FDTEDIT -p -t s $path $var "$data" fiscripts/uboot-script-gen +0
-0@@ -206,6 +219,7 @@ function xen_device_tree_editing()if test "${DOMU_STATIC_MEM[$i]}"
then
add_device_tree_static_mem"/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" +dt_set"/chosen/domU$i" "direct-map" "bool" "${DOMU_DIRECT_MAP[$i]}"
fi
dt_set"/chosen/domU$i" "vpl011" "hex" "0x1"
if test "$DOM0_KERNEL"scripts/uboot-script-gen +0
-0@@ -470,6 +484,10 @@ function xen_config()then
DOMU_CMD[$i]="console=ttyAMA0"
fi
+ if test -z "${DOMU_DIRECT_MAP[$i]}"
+ then
+ DOMU_DIRECT_MAP[$i]=1
+ fi
i=$(( $i + 1 ))
done
}
Re: [Viryaos-discuss] [ImageBuilder] [PATCH 2/2] uboot-script-gen: Enable direct mapping of statically allocated memory
Hi Ayan!
Quoted 38 lines · Ayan Kumar Halder
(Resending mail, as the previous delivery failed)
Quoted 35 lines · Ayan Kumar Halder
Hi,
Quoted 22 lines · Xenia Ragiadakou
Direct mapping for dom0less VMs is disabled by default in XEN and can be enabled through the 'direct-map' property.
Add a new config parameterDOMU_DIRECT_MAPto be able to enable or disable direct mapping, i.e set to 1 for enabling and to 0 for disabling. This parameter is optional. Direct mapping is enabled by default for all dom0less VMs with static allocation.The property 'direct-map' is a boolean property. Boolean properties are true if present and false if missing.
Add a newdata_type'bool' in functiondt_set()to setup a boolean property.Signed-off-by Xenia Ragiadakou <[email protected]>---
README.md | 4 ++++scripts/uboot-script-gen| 18 ++++++++++++++++++2 files changed, 22 insertions(+)README.md +0
-0@@ -168,6 +168,10 @@ Where:Quoted 5 lines
if specified, indicates the host physical address regions [baseaddr, baseaddr + size) to be reserved to the VM for static allocation. +- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
+ If set to 1, the VM is direct mapped. The default is 1.
+ This is only applicable whenDOMU_STATIC_MEMis specified.Can't we just use $DOMU_STATIC_MEM to set "direct-map" in dts ?
Is there a valid use-case for static allocation without direct mapping ? Sorry, it is not very clear to me.
Thank you for taking the time to review the patch!
I agree with you that static allocation without direct mapping is not a common configuration, that's why, in the script, direct mapping is enabled by default.
My reasoning was that, since direct mapping is not enabled by default in XEN for all domUs with static allocation but instead requires the 'direct-map' property to be present in the domU dt node, then such a configuration is still valid. I thought that with this parameter it is much easier to setup (and test) both configurations.
Xenia
Re: [Viryaos-discuss] [ImageBuilder] [PATCH 2/2] uboot-script-gen: Enable direct mapping of statically allocated memory
Quoted 1 line · xenia
Hi Ayan!
Hi Xenia,
Quoted 38 lines · Ayan Kumar Halder
Quoted 36 lines
(Resending mail, as the previous delivery failed)
Quoted 33 lines · Ayan Kumar Halder
Hi,
Quoted 22 lines · Xenia Ragiadakou
Direct mapping for dom0less VMs is disabled by default in XEN and can be enabled through the 'direct-map' property.
Add a new config parameterDOMU_DIRECT_MAPto be able to enable or disable direct mapping, i.e set to 1 for enabling and to 0 for disabling. This parameter is optional. Direct mapping is enabled by default for all dom0less VMs with static allocation.The property 'direct-map' is a boolean property. Boolean properties are true if present and false if missing.
Add a newdata_type'bool' in functiondt_set()to setup a boolean property.Signed-off-by Xenia Ragiadakou <[email protected]>---
README.md | 4 ++++scripts/uboot-script-gen| 18 ++++++++++++++++++2 files changed, 22 insertions(+)README.md +0
-0@@ -168,6 +168,10 @@ Where:Quoted 5 lines
if specified, indicates the host physical address regions [baseaddr, baseaddr + size) to be reserved to the VM for static allocation. +- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
+ If set to 1, the VM is direct mapped. The default is 1.
+ This is only applicable whenDOMU_STATIC_MEMis specified.Can't we just use $DOMU_STATIC_MEM to set "direct-map" in dts ?
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Is there a valid use-case for static allocation without direct mapping ? Sorry, it is not very clear to me.
Thank you for taking the time to review the patch!
I agree with you that static allocation without direct mapping is not a common configuration, that's why, in the script, direct mapping is enabled by default.
My reasoning was that, since direct mapping is not enabled by default in XEN for all domUs with static allocation but instead requires the 'direct-map' property to be present in the domU dt node, then such a configuration is still valid. I thought that with this parameter it is much easier to setup (and test) both configurations.
Thanks for the explanation. This makes sense to me. :)
In this case, can we remove the below snippet from your patch.
+ if test -z "${DOMU_DIRECT_MAP[$i]}"
+ then
+ DOMU_DIRECT_MAP[$i]=1
+ fi
The reason being if the user wants to set 'direct-map' prop in dts, then the user can specify it in the config. Else, (by default) the direct-map will be set to false. This is inline with XEN's behavior as you described above.
- Ayan
- Ayan
Quoted 4 lines
Xenia
Quoted 5 lines · Xenia Ragiadakou
When the parameter
DOM0_KERNELis not specified andNUM_DOMUSis not 0, instead of failing the script, just skip any dom0 specific setup. This way the script can be used to boot XEN in dom0less mode.Signed-off-by Xenia Ragiadakou <[email protected]>
Quoted 114 lines
--- scripts/uboot-script-gen | 60 ++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 17 deletions(-)scripts/uboot-script-gen +43
-17@@ -168,10 +168,15 @@ function xen_device_tree_editing() dt_set "/chosen" "#address-cells" "hex" "0x2" dt_set "/chosen" "#size-cells" "hex" "0x2" dt_set "/chosen" "xen,xen-bootargs" "str" "$XEN_CMD" - dt_mknode "/chosen" "dom0" - dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" - dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)" - dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" + + if test "$DOM0_KERNEL" + then + dt_mknode "/chosen" "dom0" + dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" + dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)" + dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" + fi + if test "$DOM0_RAMDISK" && test $ramdisk_addr != "-" then dt_mknode "/chosen" "dom0-ramdisk"@@ -203,7 +208,10 @@ function xen_device_tree_editing() add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" fi dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" - dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled" + if test "$DOM0_KERNEL" + then + dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled" + fi if test "${DOMU_COLORS[$i]}" then@@ -433,6 +441,19 @@ function xen_config() DOM0_CMD="$DOM0_CMD root=$root_dev" fi fi + if test -z "$DOM0_KERNEL" + then + if test "$NUM_DOMUS" -eq "0" + then + echo "Neither dom0 or domUs are specified, exiting." + exit 1 + fi + echo "Dom0 kernel is not specified, continue with dom0less setup." + unset DOM0_RAMDISK + # Remove dom0 specific parameters from the XEN command line. + local params=($XEN_CMD) + XEN_CMD="${params[@]/dom0*/}" + fi i=0 while test $i -lt $NUM_DOMUS do@@ -490,11 +511,13 @@ generate_uboot_images() xen_file_loading() { - check_compressed_file_type $DOM0_KERNEL "executable" - dom0_kernel_addr=$memaddr - load_file $DOM0_KERNEL "dom0_linux" - dom0_kernel_size=$filesize - + if test "$DOM0_KERNEL" + then + check_compressed_file_type $DOM0_KERNEL "executable" + dom0_kernel_addr=$memaddr + load_file $DOM0_KERNEL "dom0_linux" + dom0_kernel_size=$filesize + fi if test "$DOM0_RAMDISK" then check_compressed_file_type $DOM0_RAMDISK "cpio archive"@@ -597,14 +620,16 @@ bitstream_load_and_config() create_its_file_xen() { - if test "$ramdisk_addr" != "-" + if test "$DOM0_KERNEL" then - load_files="\"dom0_linux\", \"dom0_ramdisk\"" - else - load_files="\"dom0_linux\"" - fi - # xen below - cat >> "$its_file" <<- EOF + if test "$ramdisk_addr" != "-" + then + load_files="\"dom0_linux\", \"dom0_ramdisk\"" + else + load_files="\"dom0_linux\"" + fi + # xen below + cat >> "$its_file" <<- EOF dom0_linux { description = "dom0 linux kernel binary"; data = /incbin/("$DOM0_KERNEL");@@ -616,6 +641,7 @@ create_its_file_xen() $fit_algo }; EOF + fi # domUs i=0 while test $i -lt $NUM_DOMUSSignature · 1 line
2.34.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
(Resending mail, as the previous delivery failed)
Quoted 151 lines · Ayan Kumar Halder
Hi Xenia,
Thanks for the change. It looks good.
Some points :-
1. In README.md, please mention in '
DOM0_KERNEL' description that it is an optional parameter. When user does not provide this, it generates a dom0less configuration.2. In uboot-script-gen, please provide a check like this :-
if test -z "$DOM0_KERNEL"
then
if test "
DOM0_MEM" || "DOM0_VCPUS" || "DOM0_COLORS" || "DOM0_CMD" || "DOM0_RAMDISK" || "DOM0_ROOTFS"then
echo "For Domoless configuration, "
DOM0_MEM" || "DOM0_VCPUS" || "DOM0_COLORS" || "DOM0_CMD" || "DOM0_RAMDISK" || "DOM0_ROOTFS" should not be definedexit 1
fi
fi
The reason is that user should not be allowed to provide with an incorrect configuration.
3. Please test the patch for both dom0 and dom0less. The reason being such a change might break something. :)
- Ayan
Quoted 118 lines · Xenia Ragiadakou
When the parameter
DOM0_KERNELis not specified andNUM_DOMUSis not 0, instead of failing the script, just skip any dom0 specific setup. This way the script can be used to boot XEN in dom0less mode.Signed-off-by Xenia Ragiadakou <[email protected]>---
scripts/uboot-script-gen| 60 ++++++++++++++++++++++++++++------------1 file changed, 43 insertions(+), 17 deletions(-)scripts/uboot-script-gen +0
-0@@ -168,10 +168,15 @@ function xen_device_tree_editing()
dt_set"/chosen" "#address-cells" "hex" "0x2"
dt_set"/chosen" "#size-cells" "hex" "0x2"
dt_set"/chosen" "xen,xen-bootargs" "str" "$XEN_CMD" -dt_mknode"/chosen" "dom0"
-dt_set"/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module"
-dt_set"/chosen/dom0" "reg" "hex" "0x0$dom0_kernel_addr0x0$(printf "0x%x" $dom0_kernel_size)"
-dt_set"/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" +
+ if test "$DOM0_KERNEL"
+ then
+dt_mknode"/chosen" "dom0"
+dt_set"/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module"
+dt_set"/chosen/dom0" "reg" "hex" "0x0$dom0_kernel_addr0x0$(printf "0x%x" $dom0_kernel_size)"
+dt_set"/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" + fi
+
if test "$DOM0_RAMDISK" && test $ramdisk_addr != "-" then
dt_mknode"/chosen" "dom0-ramdisk"scripts/uboot-script-gen +0
-0@@ -203,7 +208,10 @@ function xen_device_tree_editing()
add_device_tree_static_mem"/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" fi
dt_set"/chosen/domU$i" "vpl011" "hex" "0x1"
-dt_set"/chosen/domU$i" "xen,enhanced" "str" "enabled"
+ if test "$DOM0_KERNEL"
+ then
+dt_set"/chosen/domU$i" "xen,enhanced" "str" "enabled"
+ fi
if test "${DOMU_COLORS[$i]}"
thenscripts/uboot-script-gen +0
-0@@ -433,6 +441,19 @@ function xen_config()DOM0_CMD="$DOM0_CMD root=$root_dev"
fi
fi
+ if test -z "$DOM0_KERNEL"
+ then
+ if test "$NUM_DOMUS" -eq "0"
+ then
+ echo "Neither dom0 or domUs are specified, exiting." + exit 1
+ fi
+ echo "Dom0 kernel is not specified, continue with dom0less setup."
+ unsetDOM0_RAMDISK
+ # Remove dom0 specific parameters from the XEN command line. + local params=($XEN_CMD)
+ XEN_CMD="${params[@]/dom0*/}"
+ fi
i=0
while test $i -lt $NUM_DOMUS
doscripts/uboot-script-gen +7
-5@@ -490,11 +511,13 @@ generate_uboot_images() xen_file_loading() { - check_compressed_file_type $DOM0_KERNEL "executable" - dom0_kernel_addr=$memaddr - load_file $DOM0_KERNEL "dom0_linux" - dom0_kernel_size=$filesize - + if test "$DOM0_KERNEL" + then + check_compressed_file_type $DOM0_KERNEL "executable" + dom0_kernel_addr=$memaddr + load_file $DOM0_KERNEL "dom0_linux" + dom0_kernel_size=$filesize + fiif test "$DOM0_RAMDISK"
then
check_compressed_file_type$DOM0_RAMDISK "cpio archive"scripts/uboot-script-gen +1
-1@@ -597,14 +620,16 @@ bitstream_load_and_config() create_its_file_xen() { - if test "$ramdisk_addr" != "-" + if test "$DOM0_KERNEL"then
- load_files="\"dom0_linux\", \"dom0_ramdisk\"" - else
- load_files="\"dom0_linux\""
- fi
- # xen below
- cat >> "$its_file" <<- EOF
+ if test "$ramdisk_addr" != "-"
+ then
+ load_files="\"dom0_linux\", \"dom0_ramdisk\"" + else
+ load_files="\"dom0_linux\""
+ fi
+ # xen below
+ cat >> "$its_file" <<- EOF
dom0_linux{
description = "dom0 linux kernel binary"; data = /incbin/("$DOM0_KERNEL");scripts/uboot-script-gen +0
-0@@ -616,6 +641,7 @@ create_its_file_xen()$fit_algo
};
EOF
+ fi
# domUs
i=0
while test $i -lt $NUM_DOMUS
Quoted 4 lines · Ayan Kumar Halder
(Resending mail, as the previous delivery failed)
Quoted 1 line · Ayan Kumar Halder
1. In README.md, please mention in '
DOM0_KERNEL' description that it is an optional parameter. When user does not provide this, it generates a dom0less configuration.
Sure. This patch has been already merged upstream so I will do with a follow-on patch.
Quoted 13 lines
Quoted 13 lines
2. In uboot-script-gen, please provide a check like this :-
if test -z "$DOM0_KERNEL"
then
if test "
DOM0_MEM" || "DOM0_VCPUS" || "DOM0_COLORS" || "DOM0_CMD" || "DOM0_RAMDISK" || "DOM0_ROOTFS"then
echo "For Domoless configuration, "
DOM0_MEM" || "DOM0_VCPUS" || "DOM0_COLORS" || "DOM0_CMD" || "DOM0_RAMDISK" || "DOM0_ROOTFS" should not be defined
Quoted 8 lines
Quoted 8 lines
exit 1
fi
fi
The reason is that user should not be allowed to provide with an incorrect configuration.
Sure. I will do with a follow-on patch.
Quoted 124 lines
Quoted 124 lines
3. Please test the patch for both dom0 and dom0less. The reason being such a change might break something. :)
- Ayan
Quoted 119 lines · Xenia Ragiadakou
When the parameter
DOM0_KERNELis not specified andNUM_DOMUSis not 0, instead of failing the script, just skip any dom0 specific setup. This way the script can be used to boot XEN in dom0less mode.Signed-off-by Xenia Ragiadakou <[email protected]>---
scripts/uboot-script-gen| 60
++++++++++++++++++++++++++++------------1 file changed, 43 insertions(+), 17 deletions(-)scripts/uboot-script-gen +0
-0@@ -168,10 +168,15 @@ function xen_device_tree_editing()
dt_set"/chosen" "#address-cells" "hex" "0x2"dt_set"/chosen" "#size-cells" "hex" "0x2"
dt_set"/chosen" "xen,xen-bootargs" "str" "$XEN_CMD" -dt_mknode"/chosen" "dom0"
-dt_set"/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module"
-dt_set"/chosen/dom0" "reg" "hex" "0x0$dom0_kernel_addr0x0$(printf "0x%x" $dom0_kernel_size)"
-dt_set"/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" +
+ if test "$DOM0_KERNEL"
+ then
+dt_mknode"/chosen" "dom0"
+dt_set"/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" +dt_set"/chosen/dom0" "reg" "hex" "0x0$dom0_kernel_addr0x0$(printf "0x%x" $dom0_kernel_size)"
+dt_set"/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" + fi
+
if test "$DOM0_RAMDISK" && test $ramdisk_addr != "-" then
dt_mknode"/chosen" "dom0-ramdisk"scripts/uboot-script-gen +0
-0@@ -203,7 +208,10 @@ function xen_device_tree_editing()
add_device_tree_static_mem"/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" fi
dt_set"/chosen/domU$i" "vpl011" "hex" "0x1"
-dt_set"/chosen/domU$i" "xen,enhanced" "str" "enabled"
+ if test "$DOM0_KERNEL"
+ then
+dt_set"/chosen/domU$i" "xen,enhanced" "str" "enabled"
+ fi
if test "${DOMU_COLORS[$i]}"
thenscripts/uboot-script-gen +0
-0@@ -433,6 +441,19 @@ function xen_config()DOM0_CMD="$DOM0_CMD root=$root_dev"
fi
fi
+ if test -z "$DOM0_KERNEL"
+ then
+ if test "$NUM_DOMUS" -eq "0"
+ then
+ echo "Neither dom0 or domUs are specified, exiting." + exit 1
+ fi
+ echo "Dom0 kernel is not specified, continue with dom0less setup."
+ unsetDOM0_RAMDISK
+ # Remove dom0 specific parameters from the XEN command line. + local params=($XEN_CMD)
+ XEN_CMD="${params[@]/dom0*/}"
+ fi
i=0
while test $i -lt $NUM_DOMUS
doscripts/uboot-script-gen +7
-5@@ -490,11 +511,13 @@ generate_uboot_images() xen_file_loading() { - check_compressed_file_type $DOM0_KERNEL "executable" - dom0_kernel_addr=$memaddr - load_file $DOM0_KERNEL "dom0_linux" - dom0_kernel_size=$filesize - + if test "$DOM0_KERNEL" + then + check_compressed_file_type $DOM0_KERNEL "executable" + dom0_kernel_addr=$memaddr + load_file $DOM0_KERNEL "dom0_linux" + dom0_kernel_size=$filesize + fiif test "$DOM0_RAMDISK"
then
check_compressed_file_type$DOM0_RAMDISK "cpio archive"scripts/uboot-script-gen +1
-1@@ -597,14 +620,16 @@ bitstream_load_and_config() create_its_file_xen() { - if test "$ramdisk_addr" != "-" + if test "$DOM0_KERNEL"then
- load_files="\"dom0_linux\", \"dom0_ramdisk\"" - else
- load_files="\"dom0_linux\""
- fi
- # xen below
- cat >> "$its_file" <<- EOF
+ if test "$ramdisk_addr" != "-"
+ then
+ load_files="\"dom0_linux\", \"dom0_ramdisk\"" + else
+ load_files="\"dom0_linux\""
+ fi
+ # xen below
+ cat >> "$its_file" <<- EOF
dom0_linux{
description = "dom0 linux kernel binary"; data = /incbin/("$DOM0_KERNEL");scripts/uboot-script-gen +0
-0@@ -616,6 +641,7 @@ create_its_file_xen()$fit_algo
};
EOF
+ fi
# domUs
i=0
while test $i -lt $NUM_DOMUS