diff mbox series

[v2,06/10] automation: qemu-smoke-arm32.sh: Modify script to use ImageBuilder

Message ID 20220926110423.26030-7-michal.orzel@amd.com (mailing list archive)
State Superseded
Headers show
Series GitLab CI cleanup & improvements for Arm | expand

Commit Message

Orzel, Michal Sept. 26, 2022, 11:04 a.m. UTC
Take an example from arm64 qemu test scripts and use ImageBuilder
to generate u-boot script automatically. Calculating the addresses
manually is quite error prone and also we will be able to benefit
from using ImageBuilder when adding domUs to this test in the future.

Install and use u-boot from the debian package.
Modify the script so that binaries are loaded from u-boot via tftp.
Remove dtuart=/pl011@9000000 because stdout-path in QEMU dtb is always
set to pl011 node path.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
Changes in v2:
- add explanation in commit msg why we remove dtuart path
---
 automation/scripts/qemu-smoke-arm32.sh | 57 ++++++++++++--------------
 1 file changed, 27 insertions(+), 30 deletions(-)

Comments

Luca Fancellu Sept. 26, 2022, 12:03 p.m. UTC | #1
> On 26 Sep 2022, at 12:04, Michal Orzel <michal.orzel@amd.com> wrote:
> 
> Take an example from arm64 qemu test scripts and use ImageBuilder
> to generate u-boot script automatically. Calculating the addresses
> manually is quite error prone and also we will be able to benefit
> from using ImageBuilder when adding domUs to this test in the future.
> 
> Install and use u-boot from the debian package.
> Modify the script so that binaries are loaded from u-boot via tftp.
> Remove dtuart=/pl011@9000000 because stdout-path in QEMU dtb is always
> set to pl011 node path.
> 
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> ---
> Changes in v2:
> - add explanation in commit msg why we remove dtuart path
> ---

Hi Michal,

This looks good to me

Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Stewart Hildebrand Sept. 26, 2022, 2:46 p.m. UTC | #2
On 9/26/22 07:04, Michal Orzel wrote:
> Take an example from arm64 qemu test scripts and use ImageBuilder
> to generate u-boot script automatically. Calculating the addresses
> manually is quite error prone and also we will be able to benefit
> from using ImageBuilder when adding domUs to this test in the future.
> 
> Install and use u-boot from the debian package.
> Modify the script so that binaries are loaded from u-boot via tftp.
> Remove dtuart=/pl011@9000000 because stdout-path in QEMU dtb is always
> set to pl011 node path.
> 
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> ---
> Changes in v2:
> - add explanation in commit msg why we remove dtuart path
> ---
>   automation/scripts/qemu-smoke-arm32.sh | 57 ++++++++++++--------------
>   1 file changed, 27 insertions(+), 30 deletions(-)
> 
> diff --git a/automation/scripts/qemu-smoke-arm32.sh b/automation/scripts/qemu-smoke-arm32.sh
> index 530f3892fdd3..765facbe4d66 100755
> --- a/automation/scripts/qemu-smoke-arm32.sh
> +++ b/automation/scripts/qemu-smoke-arm32.sh
> @@ -4,7 +4,9 @@ set -ex
>   
>   export DEBIAN_FRONTENT=noninteractive

While you are here, there's a typo. s/DEBIAN_FRONTENT/DEBIAN_FRONTEND/
Orzel, Michal Sept. 26, 2022, 2:59 p.m. UTC | #3
Hi Stewart,

On 26/09/2022 16:46, Stewart Hildebrand wrote:
> 
> 
> On 9/26/22 07:04, Michal Orzel wrote:
>> Take an example from arm64 qemu test scripts and use ImageBuilder
>> to generate u-boot script automatically. Calculating the addresses
>> manually is quite error prone and also we will be able to benefit
>> from using ImageBuilder when adding domUs to this test in the future.
>>
>> Install and use u-boot from the debian package.
>> Modify the script so that binaries are loaded from u-boot via tftp.
>> Remove dtuart=/pl011@9000000 because stdout-path in QEMU dtb is always
>> set to pl011 node path.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
>> ---
>> Changes in v2:
>> - add explanation in commit msg why we remove dtuart path
>> ---
>>   automation/scripts/qemu-smoke-arm32.sh | 57 ++++++++++++--------------
>>   1 file changed, 27 insertions(+), 30 deletions(-)
>>
>> diff --git a/automation/scripts/qemu-smoke-arm32.sh b/automation/scripts/qemu-smoke-arm32.sh
>> index 530f3892fdd3..765facbe4d66 100755
>> --- a/automation/scripts/qemu-smoke-arm32.sh
>> +++ b/automation/scripts/qemu-smoke-arm32.sh
>> @@ -4,7 +4,9 @@ set -ex
>>
>>   export DEBIAN_FRONTENT=noninteractive
> 
> While you are here, there's a typo. s/DEBIAN_FRONTENT/DEBIAN_FRONTEND/

This is a good catch. Thanks!
It looks like all the Arm scripts use FRONTENT instead of FRONTEND. This is clearly incorrect.
I will need to fix all the occurrences as part of this cleanup series.

~Michal
Stefano Stabellini Sept. 26, 2022, 10:52 p.m. UTC | #4
On Mon, 26 Sep 2022, Michal Orzel wrote:
> Hi Stewart,
> 
> On 26/09/2022 16:46, Stewart Hildebrand wrote:
> > 
> > 
> > On 9/26/22 07:04, Michal Orzel wrote:
> >> Take an example from arm64 qemu test scripts and use ImageBuilder
> >> to generate u-boot script automatically. Calculating the addresses
> >> manually is quite error prone and also we will be able to benefit
> >> from using ImageBuilder when adding domUs to this test in the future.
> >>
> >> Install and use u-boot from the debian package.
> >> Modify the script so that binaries are loaded from u-boot via tftp.
> >> Remove dtuart=/pl011@9000000 because stdout-path in QEMU dtb is always
> >> set to pl011 node path.
> >>
> >> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> >> ---
> >> Changes in v2:
> >> - add explanation in commit msg why we remove dtuart path
> >> ---
> >>   automation/scripts/qemu-smoke-arm32.sh | 57 ++++++++++++--------------
> >>   1 file changed, 27 insertions(+), 30 deletions(-)
> >>
> >> diff --git a/automation/scripts/qemu-smoke-arm32.sh b/automation/scripts/qemu-smoke-arm32.sh
> >> index 530f3892fdd3..765facbe4d66 100755
> >> --- a/automation/scripts/qemu-smoke-arm32.sh
> >> +++ b/automation/scripts/qemu-smoke-arm32.sh
> >> @@ -4,7 +4,9 @@ set -ex
> >>
> >>   export DEBIAN_FRONTENT=noninteractive
> > 
> > While you are here, there's a typo. s/DEBIAN_FRONTENT/DEBIAN_FRONTEND/
> 
> This is a good catch. Thanks!
> It looks like all the Arm scripts use FRONTENT instead of FRONTEND. This is clearly incorrect.
> I will need to fix all the occurrences as part of this cleanup series.

For this specific patch, given that it is not changing DEBIAN_FRONTENT:

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Please send a separate patch to address the DEBIAN_FRONTENT issue, and I
think that should target 4.17 (so it should be the first patch of the
series next time.)
diff mbox series

Patch

diff --git a/automation/scripts/qemu-smoke-arm32.sh b/automation/scripts/qemu-smoke-arm32.sh
index 530f3892fdd3..765facbe4d66 100755
--- a/automation/scripts/qemu-smoke-arm32.sh
+++ b/automation/scripts/qemu-smoke-arm32.sh
@@ -4,7 +4,9 @@  set -ex
 
 export DEBIAN_FRONTENT=noninteractive
 apt-get -qy update
-apt-get -qy install --no-install-recommends device-tree-compiler \
+apt-get -qy install --no-install-recommends u-boot-qemu \
+                                            u-boot-tools \
+                                            device-tree-compiler \
                                             curl \
                                             cpio
 
@@ -20,10 +22,6 @@  tar xvzf ../initrd.tar.gz
 find . | cpio -H newc -o | gzip > ../initrd.gz
 cd ..
 
-kernel=`stat -L --printf="%s" vmlinuz`
-initrd=`stat -L --printf="%s" initrd.gz`
-
-# For Xen, we need a couple of more node. Dump the DT from QEMU and add them
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
 curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
 ./qemu-system-arm \
@@ -36,31 +34,31 @@  curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
    -display none \
    -machine dumpdtb=virt.dtb
 
-dtc -I dtb -O dts virt.dtb > virt.dts
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0x80000000"
+
+DEVICE_TREE="virt.dtb"
+XEN="xen"
+DOM0_KERNEL="vmlinuz"
+DOM0_RAMDISK="initrd.gz"
+DOM0_CMD="console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/bin/sh"
+XEN_CMD="console=dtuart dom0_mem=512M bootscrub=0"
+
+NUM_DOMUS=0
+
+LOAD_CMD="tftpb"
+BOOT_CMD="bootm"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > config
 
-cat >> virt.dts << EOF
-/ {
-	chosen {
-		#address-cells = <0x2>;
-		#size-cells = <0x2>;
-		stdout-path = "/pl011@9000000";
-        xen,xen-bootargs = "console=dtuart dtuart=/pl011@9000000 dom0_mem=512M bootscrub=0";
-		xen,dom0-bootargs = "console=tty0 console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/bin/sh";
-		dom0 {
-			compatible = "xen,linux-zimage", "xen,multiboot-module";
-			reg = <0x0 0x1000000 0x0 $kernel>;
-		};
-        dom0-ramdisk {
-			compatible = "xen,linux-initrd", "xen,multiboot-module";
-			reg = <0x0 0x3200000 0x0 $initrd>;
-		};
-	};
-};
-EOF
-dtc -I dts -O dtb virt.dts > virt.dtb
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f smoke.serial
 set +e
+echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
 timeout -k 1 240 \
 ./qemu-system-arm \
    -machine virt \
@@ -70,11 +68,10 @@  timeout -k 1 240 \
    -serial stdio \
    -monitor none \
    -display none \
-   -dtb virt.dtb \
    -no-reboot \
-   -kernel ./xen \
-   -device loader,file=./vmlinuz,addr=0x1000000 \
-   -device loader,file=./initrd.gz,addr=0x3200000 |& tee smoke.serial
+   -device virtio-net-pci,netdev=n0 \
+   -netdev user,id=n0,tftp=./ \
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee smoke.serial
 
 set -e
 (grep -q "^/ #" smoke.serial) || exit 1