gitlab Qemu runtime testing
Subsystems (4)
v5 cover gitlab Qemu runtime testing
This new iteration take into account the previous review with some additional rework [1] [2] [5] [6].
Remove patch already merged.
Based on the Yann's review during the Buildroot Developper meeting FOSDEM 2020 [2], add a tag in each readme file to easily retrieve the qemu command line to be used for runtime testing in gitlab.
This tag is used by a post-image script to generate a script called start-qemu.sh that can be used by users or by a new python script for running the test in gitlab but only when a Qemu defconfig is built.
Finally add this new python script to .gitlab-ci.yml.
This series has been tested on Gitlab [3], please ignore the failing test related to missing host-python3 modules needed by optee-os package [4].
This new iteration has been tested in gitlab [7].
[1] http://lists.busybox.net/pipermail/buildroot/2019-May/249432.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-February/273189.html
[3] https://gitlab.com/kubu93/buildroot/pipelines/116298701
[4] http://lists.busybox.net/pipermail/buildroot/2020-February/273738.html
[5] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
[6] http://lists.busybox.net/pipermail/buildroot/2020-February/273822.html
[7] https://gitlab.com/kubu93/buildroot/pipelines/116967006
Cc: Yann E. MORIN <[email protected]>
Jugurtha BELKALEM (2):
support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system. gitlab.yml.in*: enable Qemu gitlab testing
Romain Naour (3):
board/qemu: add defconfig file name as tag after the qemu command line board/qemu: add post-image script for gitlab qemu testing configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as
argument.
.gitlab-ci.yml | 7 ++ .gitlab-ci.yml.in | 7 ++ board/qemu/aarch64-virt/readme.txt | 2 +- board/qemu/arm-versatile/readme.txt | 4 +- board/qemu/arm-vexpress/readme.txt | 2 +- board/qemu/csky/readme.txt | 11 ++- board/qemu/m68k-mcf5208/readme.txt | 2 +- board/qemu/m68k-q800/readme.txt | 2 +- board/qemu/microblazebe-mmu/readme.txt | 2 +- board/qemu/microblazeel-mmu/readme.txt | 2 +- board/qemu/mips32r2-malta/readme.txt | 2 +- board/qemu/mips32r2el-malta/readme.txt | 2 +- board/qemu/mips32r6-malta/readme.txt | 2 +- board/qemu/mips32r6el-malta/readme.txt | 2 +- board/qemu/mips64-malta/readme.txt | 2 +- board/qemu/mips64el-malta/readme.txt | 2 +- board/qemu/mips64r6-malta/readme.txt | 2 +- board/qemu/mips64r6el-malta/readme.txt | 2 +- board/qemu/nios2-10m50/readme.txt | 2 +- board/qemu/or1k/readme.txt | 2 +- board/qemu/post-image.sh | 50 ++++++++++ board/qemu/ppc-g3beige/readme.txt | 2 +- board/qemu/ppc-mac99/readme.txt | 2 +- board/qemu/ppc-mpc8544ds/readme.txt | 2 +- board/qemu/ppc-virtex-ml507/readme.txt | 2 +- board/qemu/ppc64-e5500/readme.txt | 2 +- board/qemu/ppc64-pseries/readme.txt | 2 +- board/qemu/ppc64le-pseries/readme.txt | 2 +- board/qemu/riscv32-virt/readme.txt | 2 +- board/qemu/riscv64-virt/readme.txt | 2 +- board/qemu/sh4-r2d/readme.txt | 2 +- board/qemu/sh4eb-r2d/readme.txt | 2 +- board/qemu/sparc-ss10/readme.txt | 2 +- board/qemu/sparc64-sun4u/readme.txt | 2 +- board/qemu/x86/readme.txt | 2 +- board/qemu/x86_64/readme.txt | 2 +- board/qemu/xtensa-lx60/readme.txt | 4 +- configs/qemu_aarch64_virt_defconfig | 4 + configs/qemu_arm_versatile_defconfig | 4 + configs/qemu_arm_versatile_nommu_defconfig | 4 + configs/qemu_arm_vexpress_defconfig | 4 + configs/qemu_csky610_virt_defconfig | 4 + configs/qemu_csky807_virt_defconfig | 4 + configs/qemu_csky810_virt_defconfig | 4 + configs/qemu_csky860_virt_defconfig | 4 + configs/qemu_m68k_mcf5208_defconfig | 4 + configs/qemu_m68k_q800_defconfig | 4 + configs/qemu_microblazebe_mmu_defconfig | 4 + configs/qemu_microblazeel_mmu_defconfig | 4 + configs/qemu_mips32r2_malta_defconfig | 4 + configs/qemu_mips32r2el_malta_defconfig | 4 + configs/qemu_mips32r6_malta_defconfig | 4 + configs/qemu_mips32r6el_malta_defconfig | 4 + configs/qemu_mips64_malta_defconfig | 4 + configs/qemu_mips64el_malta_defconfig | 4 + configs/qemu_mips64r6_malta_defconfig | 4 + configs/qemu_mips64r6el_malta_defconfig | 4 + configs/qemu_nios2_10m50_defconfig | 4 + configs/qemu_or1k_defconfig | 4 + configs/qemu_ppc64_e5500_defconfig | 4 + configs/qemu_ppc64_pseries_defconfig | 4 + configs/qemu_ppc64le_pseries_defconfig | 4 + configs/qemu_ppc_g3beige_defconfig | 4 + configs/qemu_ppc_mac99_defconfig | 4 + configs/qemu_ppc_mpc8544ds_defconfig | 4 + configs/qemu_ppc_virtex_ml507_defconfig | 4 + configs/qemu_riscv32_virt_defconfig | 4 + configs/qemu_riscv64_virt_defconfig | 4 + configs/qemu_sh4_r2d_defconfig | 4 + configs/qemu_sh4eb_r2d_defconfig | 4 + configs/qemu_sparc64_sun4u_defconfig | 4 + configs/qemu_sparc_ss10_defconfig | 4 + configs/qemu_x86_64_defconfig | 4 + configs/qemu_x86_defconfig | 4 + configs/qemu_xtensa_lx60_defconfig | 4 + configs/qemu_xtensa_lx60_nommu_defconfig | 4 + support/scripts/boot-qemu-image.py | 105 +++++++++++++++++++++ 77 files changed, 368 insertions(+), 38 deletions(-) create mode 100755 board/qemu/post-image.sh create mode 100755 support/scripts/boot-qemu-image.py
Signature · 1 line
2.24.1
PATCH v5 1/5 board/qemu: add defconfig file name as tag after the qemu command line
This commit add the name of the Qemu defconfig file after each qemu command line in order to retrieve it easily.
Since a readme.txt can be shared between several Qemu defconfig, we need at least one qemu command line in readme.txt for each defconfig.
For now, ignore the qemu_arm_vexpress_tz_defconfig since it fail to build due to python script issue [1]. Anyway the arm vexpress boot is tested with qemu_arm_vexpress_defconfig.
[1] http://lists.busybox.net/pipermail/buildroot/2020-February/273738.html
---
v5: add the tag in a comment after the command line [2] (ThomasP)
[1] http://lists.busybox.net/pipermail/buildroot/2020-February/273189.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
--- board/qemu/aarch64-virt/readme.txt | 2 +- board/qemu/arm-versatile/readme.txt | 4 ++-- board/qemu/arm-vexpress/readme.txt | 2 +- board/qemu/csky/readme.txt | 11 +++++++---- board/qemu/m68k-mcf5208/readme.txt | 2 +- board/qemu/m68k-q800/readme.txt | 2 +- board/qemu/microblazebe-mmu/readme.txt | 2 +- board/qemu/microblazeel-mmu/readme.txt | 2 +- board/qemu/mips32r2-malta/readme.txt | 2 +- board/qemu/mips32r2el-malta/readme.txt | 2 +- board/qemu/mips32r6-malta/readme.txt | 2 +- board/qemu/mips32r6el-malta/readme.txt | 2 +- board/qemu/mips64-malta/readme.txt | 2 +- board/qemu/mips64el-malta/readme.txt | 2 +- board/qemu/mips64r6-malta/readme.txt | 2 +- board/qemu/mips64r6el-malta/readme.txt | 2 +- board/qemu/nios2-10m50/readme.txt | 2 +- board/qemu/or1k/readme.txt | 2 +- board/qemu/ppc-g3beige/readme.txt | 2 +- board/qemu/ppc-mac99/readme.txt | 2 +- board/qemu/ppc-mpc8544ds/readme.txt | 2 +- board/qemu/ppc-virtex-ml507/readme.txt | 2 +- board/qemu/ppc64-e5500/readme.txt | 2 +- board/qemu/ppc64-pseries/readme.txt | 2 +- board/qemu/ppc64le-pseries/readme.txt | 2 +- board/qemu/riscv32-virt/readme.txt | 2 +- board/qemu/riscv64-virt/readme.txt | 2 +- board/qemu/sh4-r2d/readme.txt | 2 +- board/qemu/sh4eb-r2d/readme.txt | 2 +- board/qemu/sparc-ss10/readme.txt | 2 +- board/qemu/sparc64-sun4u/readme.txt | 2 +- board/qemu/x86/readme.txt | 2 +- board/qemu/x86_64/readme.txt | 2 +- board/qemu/xtensa-lx60/readme.txt | 4 +++- 34 files changed, 43 insertions(+), 38 deletions(-)
board/qemu/aarch64-virt/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel output/images/Image -append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -drive file=output/images/rootfs.ext4,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 + qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel output/images/Image -append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -drive file=output/images/rootfs.ext4,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 # qemu_aarch64_virt_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/arm-versatile/readme.txt +2 -2
@@ -1,10 +1,10 @@ Run the emulation with: - qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -drive file=output/images/rootfs.ext2,if=scsi,format=raw -append "rootwait root=/dev/sda console=ttyAMA0,115200" -serial stdio -net nic,model=rtl8139 -net user + qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -drive file=output/images/rootfs.ext2,if=scsi,format=raw -append "rootwait root=/dev/sda console=ttyAMA0,115200" -serial stdio -net nic,model=rtl8139 -net user # qemu_arm_versatile_defconfig Or for the noMMU emulation: - qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -append "console=ttyAMA0,115200" -serial stdio -net user -net nic,model=smc91c111 + qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -append "console=ttyAMA0,115200" -serial stdio -net user -net nic,model=smc91c111 # qemu_arm_versatile_nommu_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer.
board/qemu/arm-vexpress/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-arm -M vexpress-a9 -smp 1 -m 256 -kernel output/images/zImage -dtb output/images/vexpress-v2p-ca9.dtb -drive file=output/images/rootfs.ext2,if=sd,format=raw -append "console=ttyAMA0,115200 rootwait root=/dev/mmcblk0" -serial stdio -net nic,model=lan9118 -net user + qemu-system-arm -M vexpress-a9 -smp 1 -m 256 -kernel output/images/zImage -dtb output/images/vexpress-v2p-ca9.dtb -drive file=output/images/rootfs.ext2,if=sd,format=raw -append "console=ttyAMA0,115200 rootwait root=/dev/mmcblk0" -serial stdio -net nic,model=lan9118 -net user # qemu_arm_vexpress_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer.
board/qemu/csky/readme.txt +7 -4
@@ -1,12 +1,15 @@ Run with qemu: For ck860 smp: - qemu-system-cskyv2 -M virt -cpu ck860 -smp 2 -nographic -kernel vmlinux + qemu-system-cskyv2 -M virt -cpu ck860 -smp 2 -nographic -kernel vmlinux # qemu_csky860_virt_defconfig -For ck810/ck807: - qemu-system-cskyv2 -M virt -nographic -kernel vmlinux +For ck807: + qemu-system-cskyv2 -M virt -nographic -kernel vmlinux # qemu_csky807_virt_defconfig + +For ck810: + qemu-system-cskyv2 -M virt -nographic -kernel vmlinux # qemu_csky810_virt_defconfig For ck610: - qemu-system-cskyv1 -M virt -nographic -kernel vmlinux + qemu-system-cskyv1 -M virt -nographic -kernel vmlinux # qemu_csky610_virt_defconfig The login prompt will appear in the terminal that started Qemu. Username is root and no password.
board/qemu/m68k-mcf5208/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-m68k -M mcf5208evb -cpu m5208 -kernel output/images/vmlinux -nographic + qemu-system-m68k -M mcf5208evb -cpu m5208 -kernel output/images/vmlinux -nographic # qemu_m68k_mcf5208_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/m68k-q800/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-m68k -M q800 -kernel output/images/vmlinux -nographic -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/sda console=ttyS0" + qemu-system-m68k -M q800 -kernel output/images/vmlinux -nographic -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/sda console=ttyS0" # qemu_m68k_q800_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/microblazebe-mmu/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-microblaze -M petalogix-s3adsp1800 -kernel output/images/linux.bin -serial stdio + qemu-system-microblaze -M petalogix-s3adsp1800 -kernel output/images/linux.bin -serial stdio # qemu_microblazebe_mmu_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/microblazeel-mmu/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-microblazeel -M petalogix-s3adsp1800 -kernel output/images/linux.bin -serial stdio + qemu-system-microblazeel -M petalogix-s3adsp1800 -kernel output/images/linux.bin -serial stdio # qemu_microblazeel_mmu_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/mips32r2-malta/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-mips -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user + qemu-system-mips -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user # qemu_mips32r2_malta_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer. No keyboard support has been
board/qemu/mips32r2el-malta/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-mipsel -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user + qemu-system-mipsel -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user # qemu_mips32r2el_malta_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer. No keyboard support has been
board/qemu/mips32r6-malta/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: -qemu-system-mips -M malta -cpu mips32r6-generic -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic + qemu-system-mips -M malta -cpu mips32r6-generic -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic # qemu_mips32r6_malta_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/mips32r6el-malta/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: -qemu-system-mipsel -M malta -cpu mips32r6-generic -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user -nographic + qemu-system-mipsel -M malta -cpu mips32r6-generic -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user -nographic # qemu_mips32r6el_malta_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/mips64-malta/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-mips64 -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" + qemu-system-mips64 -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" # qemu_mips64_malta_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer.
board/qemu/mips64el-malta/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-mips64el -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" + qemu-system-mips64el -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" # qemu_mips64el_malta_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer.
board/qemu/mips64r6-malta/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-mips64 -M malta -cpu I6400 -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic + qemu-system-mips64 -M malta -cpu I6400 -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic # qemu_mips64r6_malta_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/mips64r6el-malta/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-mips64el -M malta -cpu I6400 -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic + qemu-system-mips64el -M malta -cpu I6400 -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic # qemu_mips64r6el_malta_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/nios2-10m50/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-nios2 -kernel output/images/vmlinux -nographic + qemu-system-nios2 -kernel output/images/vmlinux -nographic # qemu_nios2_10m50_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/or1k/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-or1k -kernel output/images/vmlinux -nographic + qemu-system-or1k -kernel output/images/vmlinux -nographic # qemu_or1k_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/ppc-g3beige/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-ppc -M g3beige -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "console=ttyS0 rootwait root=/dev/hda" -serial stdio -net nic,model=rtl8139 -net user + qemu-system-ppc -M g3beige -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "console=ttyS0 rootwait root=/dev/hda" -serial stdio -net nic,model=rtl8139 -net user # qemu_ppc_g3beige_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer.
board/qemu/ppc-mac99/readme.txt +1 -1
@@ -1,5 +1,5 @@ Run the emulation with: - qemu-system-ppc -nographic -vga none -M mac99 -cpu g4 -m 1G -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -net nic,model=sungem -net user -append "root=/dev/sda" + qemu-system-ppc -nographic -vga none -M mac99 -cpu g4 -m 1G -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -net nic,model=sungem -net user -append "root=/dev/sda" # qemu_ppc_mac99_defconfig Tested with QEMU 3.1.0
board/qemu/ppc-mpc8544ds/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-ppc -M mpc8544ds -kernel output/images/vmlinux -serial stdio -net nic,model=e1000 -net user + qemu-system-ppc -M mpc8544ds -kernel output/images/vmlinux -serial stdio -net nic,model=e1000 -net user # qemu_ppc_mpc8544ds_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/ppc-virtex-ml507/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-ppc -M virtex-ml507 -kernel output/images/vmlinux -m 256 -nographic -append "console=ttyS0" -dtb output/images/virtex440-ml507.dtb + qemu-system-ppc -M virtex-ml507 -kernel output/images/vmlinux -m 256 -nographic -append "console=ttyS0" -dtb output/images/virtex440-ml507.dtb # qemu_ppc_virtex_ml507_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/ppc64-e5500/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-ppc64 -M ppce500 -cpu e5500 -m 256 -kernel output/images/uImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "console=ttyS0 rootwait root=/dev/vda" -serial mon:stdio -nographic + qemu-system-ppc64 -M ppce500 -cpu e5500 -m 256 -kernel output/images/uImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "console=ttyS0 rootwait root=/dev/vda" -serial mon:stdio -nographic # qemu_ppc64_e5500_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/ppc64-pseries/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-ppc64 -M pseries -cpu POWER7 -m 256 -kernel output/images/vmlinux -append "console=hvc0 rootwait root=/dev/sda" -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses + qemu-system-ppc64 -M pseries -cpu POWER7 -m 256 -kernel output/images/vmlinux -append "console=hvc0 rootwait root=/dev/sda" -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses # qemu_ppc64_pseries_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/ppc64le-pseries/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: -qemu-system-ppc64 -M pseries -cpu POWER8 -m 256 -kernel output/images/vmlinux -append "console=hvc0 rootwait root=/dev/sda" -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses +qemu-system-ppc64 -M pseries -cpu POWER8 -m 256 -kernel output/images/vmlinux -append "console=hvc0 rootwait root=/dev/sda" -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses # qemu_ppc64le_pseries_defconfig The login prompt will appear in the terminal window.
board/qemu/riscv32-virt/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run Linux in emulation with: - qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80400000 -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic + qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80400000 -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv32_virt_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/riscv64-virt/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run Linux in emulation with: - qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80200000 -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic + qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80200000 -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv64_virt_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/sh4-r2d/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-sh4 -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user + qemu-system-sh4 -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user # qemu_sh4_r2d_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer.
board/qemu/sh4eb-r2d/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-sh4eb -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user + qemu-system-sh4eb -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user # qemu_sh4eb_r2d_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer.
board/qemu/sparc-ss10/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-sparc -M SS-10 -kernel output/images/zImage -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/sda console=ttyS0,115200" -serial stdio -net nic,model=lance -net user + qemu-system-sparc -M SS-10 -kernel output/images/zImage -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/sda console=ttyS0,115200" -serial stdio -net nic,model=lance -net user # qemu_sparc_ss10_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/sparc64-sun4u/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-sparc64 -M sun4u -kernel output/images/vmlinux -append "rootwait root=/dev/sda console=ttyS0,115200" -serial stdio -drive file=output/images/rootfs.ext2,format=raw -net nic,model=e1000 -net user + qemu-system-sparc64 -M sun4u -kernel output/images/vmlinux -append "rootwait root=/dev/sda console=ttyS0,115200" -serial stdio -drive file=output/images/rootfs.ext2,format=raw -net nic,model=e1000 -net user # qemu_sparc64_sun4u_defconfig The login prompt will appear in the terminal that started Qemu.
board/qemu/x86/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-i386 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user + qemu-system-i386 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user # qemu_x86_defconfig Optionally add -smp N to emulate a SMP system with N CPUs.
board/qemu/x86_64/readme.txt +1 -1
@@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user + qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user # qemu_x86_64_defconfig Optionally add -smp N to emulate a SMP system with N CPUs.
board/qemu/xtensa-lx60/readme.txt +3 -1
@@ -1,6 +1,8 @@ Run the emulation with: - qemu-system-xtensa -M lx60 -cpu dc233c -monitor null -nographic -kernel output/images/Image.elf + qemu-system-xtensa -M lx60 -cpu dc233c -monitor null -nographic -kernel output/images/Image.elf # qemu_xtensa_lx60_defconfig + + qemu-system-xtensa -M lx60 -cpu dc233c -monitor null -nographic -kernel output/images/Image.elf # qemu_xtensa_lx60_nommu_defconfig The login prompt will appear in the terminal that started Qemu.
Signature · 1 line
2.24.1
PATCH v5 2/5 board/qemu: add post-image script for gitlab qemu testing
In reply to Romain NaourThis commit add a post-image script to be used by each qemu board defconfig in order to generate start-qemu.sh in BINARIES_DIR. The start-qemu.sh script can be used by Buildroot user to start Qemu or by a gitlab CI.start-qemu.sh is not started automatically at the end of the build.
To find the correct qemu command line, we use the second post script argument which must contain "$(BR2_DEFCONFIG)"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
The post-image script expect something like "/path/to/qemu_aarch64_virt_defconfig" in BR2_DEFCONFIG.
Doing a basename allow to retrieve the name of the defconfig file that should match on on the "tag" previously introduced in readme.txt files.
The script start-qemu.sh is able to modify the qemu command line if CI_JOB_NAME defined in the environment. This allow to disable the graphical output and redirect serial I/Os to console.
Only sh4/sh4eb needs a special handling by adding "-serial stdio -display none" instead of "-display none".
---
v5: update the script after Thomas's review [1] [2]
[1] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-February/273822.html
--- board/qemu/post-image.sh | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 board/qemu/post-image.sh
board/qemu/post-image.sh new file +50 -0
@@ -0,0 +1,50 @@ +#!/bin/bash + +QEMU_BOARD_DIR="$(dirname $0)" +DEFCONFIG_NAME="$(basename $2)" +README_FILES="${QEMU_BOARD_DIR}/*/readme.txt" +START_QEMU_SCRIPT="${BINARIES_DIR}/start-qemu.sh" + +if [[ "${DEFCONFIG_NAME}" =~ ^"qemu_*" ]]; then + # Not a Qemu defconfig, can't test. + exit 0 +fi + +# Search for "# qemu_*_defconfig" tag in all readme.txt files. +# Qemu command line on multilines using back slash are accepted. +QEMU_CMD_LINE=$(sed -r ':a; /\\$/N; s/\\\n//; s/\t/ /; ta; /# '${DEFCONFIG_NAME}'$/!d; s/#.*//' ${README_FILES}) + +if [ -z "$QEMU_CMD_LINE" ]; then + # No Qemu cmd line found, can't test. + exit 0 +fi + +# Replace output/images path by ${IMAGE_DIR} since the script +# will be in the same directory as the kernel and the rootfs images. +QEMU_CMD_LINE=${QEMU_CMD_LINE//output\/images/\${IMAGE_DIR\}} + +# Test if we are running in gitlab +if [ -n "$CI_JOB_NAME" ]; then + # Remove -serial stdio if present + QEMU_CMD_LINE=${QEMU_CMD_LINE//-serial stdio/} + + # Disable graphical output and redirect serial I/Os to console + case ${DEFCONFIG_NAME} in + # Special case for SH4 + qemu_sh4eb_r2d_defconfig | qemu_sh4_r2d_defconfig) + QEMU_CMD_LINE="$QEMU_CMD_LINE -serial stdio -display none" + ;; + *) + QEMU_CMD_LINE="$QEMU_CMD_LINE -nographic" + ;; + esac +fi + +cat << EOF > $START_QEMU_SCRIPT +#!/bin/sh +IMAGE_DIR="\$(dirname \$0)" + +$QEMU_CMD_LINE +EOF + +chmod +x $START_QEMU_SCRIPT
Signature · 1 line
2.24.1
PATCH v5 2/5 board/qemu: add post-image script for gitlab qemu testing
Romain, jugurtha, All,
On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
Quoted 14 lines
This commit add a post-image script to be used by each qemu board defconfig in order to generate
start-qemu.shinBINARIES_DIR. Thestart-qemu.shscript can be used by Buildroot user to start Qemu or by a gitlab CI.start-qemu.shis not started automatically at the end of the build.To find the correct qemu command line, we use the second post script argument which must contain "$(BR2_DEFCONFIG)"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"The post-image script expect something like "/path/to/qemu_aarch64_virt_defconfig" in
BR2_DEFCONFIG.
Quoted 8 lines
Doing a basename allow to retrieve the name of the defconfig file that should match on on the "tag" previously introduced in readme.txt files.
The script
start-qemu.shis able to modify the qemu command line ifCI_JOB_NAMEdefined in the environment. This allow to disable the graphical output and redirect serial I/Os to console.
Like Thomas, I'm not too keen on this gitlab-ci knowledge leaking in there...
I think we can abstract that in the post-build script to just prepare the two sets of options, the default one (graphical), or the serial-only case, and store both sets in start-qemu.sh.
Then start-qemu.sh chooses which to use based on ${1}: if it is 'serial-only' (or whatever), then ti uses the serial-only options, otherwise it uses the graphical options.
I've already hack that: http://code.bulix.org/ip443p-1282035?raw
Of course, whis will require a bit of rewriting in the latter patch that tries to extract the qemu command line to run it in gitlab-ci, but I've anyway already replied to that patch (hint: it would just need to call start-qemu.sh with the new parameter).
I understand this review is coming late, so I'll take on me to apply those changes and respin the series a bit later today...
Regards,
Yann E. MORIN.
Quoted 77 lines
Only sh4/sh4eb needs a special handling by adding "-serial stdio -display none" instead of "-display none".
Signed-off-by Romain Naour <[email protected]>---
v5: update the script after Thomas's review [1] [2][1] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-February/273822.html--- board/qemu/post-image.sh | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 board/qemu/post-image.shboard/qemu/post-image.sh new file +50
-0@@ -0,0 +1,50 @@ +#!/bin/bash + +QEMU_BOARD_DIR="$(dirname $0)" +DEFCONFIG_NAME="$(basename $2)" +README_FILES="${QEMU_BOARD_DIR}/*/readme.txt" +START_QEMU_SCRIPT="${BINARIES_DIR}/start-qemu.sh" + +if [[ "${DEFCONFIG_NAME}" =~ ^"qemu_*" ]]; then + # Not a Qemu defconfig, can't test. + exit 0 +fi + +# Search for "# qemu_*_defconfig" tag in all readme.txt files. +# Qemu command line on multilines using back slash are accepted. +QEMU_CMD_LINE=$(sed -r ':a; /\\$/N; s/\\\n//; s/\t/ /; ta; /# '${DEFCONFIG_NAME}'$/!d; s/#.*//' ${README_FILES}) + +if [ -z "$QEMU_CMD_LINE" ]; then + # No Qemu cmd line found, can't test. + exit 0 +fi + +# Replace output/images path by ${IMAGE_DIR} since the script +# will be in the same directory as the kernel and the rootfs images. +QEMU_CMD_LINE=${QEMU_CMD_LINE//output\/images/\${IMAGE_DIR\}} + +# Test if we are running in gitlab +if [ -n "$CI_JOB_NAME" ]; then + # Remove -serial stdio if present + QEMU_CMD_LINE=${QEMU_CMD_LINE//-serial stdio/} + + # Disable graphical output and redirect serial I/Os to console + case ${DEFCONFIG_NAME} in + # Special case for SH4 + qemu_sh4eb_r2d_defconfig | qemu_sh4_r2d_defconfig) + QEMU_CMD_LINE="$QEMU_CMD_LINE -serial stdio -display none" + ;; + *) + QEMU_CMD_LINE="$QEMU_CMD_LINE -nographic" + ;; + esac +fi + +cat << EOF > $START_QEMU_SCRIPT +#!/bin/sh +IMAGE_DIR="\$(dirname \$0)" + +$QEMU_CMD_LINE +EOF + +chmod +x $START_QEMU_SCRIPTSignature · 6 lines
2.24.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v5 3/5 configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as argument.
In reply to Romain NaourThis commit allow to use the post-image script previously added for each qemu board.
Add "$(BR2_DEFCONFIG)" as post-image script argument to retried the qemu command line.
---
v5: remove qem_arm_vexpress_tz_deconfig change since this defconfig doesn't build.
--- configs/qemu_aarch64_virt_defconfig | 4 ++++ configs/qemu_arm_versatile_defconfig | 4 ++++ configs/qemu_arm_versatile_nommu_defconfig | 4 ++++ configs/qemu_arm_vexpress_defconfig | 4 ++++ configs/qemu_csky610_virt_defconfig | 4 ++++ configs/qemu_csky807_virt_defconfig | 4 ++++ configs/qemu_csky810_virt_defconfig | 4 ++++ configs/qemu_csky860_virt_defconfig | 4 ++++ configs/qemu_m68k_mcf5208_defconfig | 4 ++++ configs/qemu_m68k_q800_defconfig | 4 ++++ configs/qemu_microblazebe_mmu_defconfig | 4 ++++ configs/qemu_microblazeel_mmu_defconfig | 4 ++++ configs/qemu_mips32r2_malta_defconfig | 4 ++++ configs/qemu_mips32r2el_malta_defconfig | 4 ++++ configs/qemu_mips32r6_malta_defconfig | 4 ++++ configs/qemu_mips32r6el_malta_defconfig | 4 ++++ configs/qemu_mips64_malta_defconfig | 4 ++++ configs/qemu_mips64el_malta_defconfig | 4 ++++ configs/qemu_mips64r6_malta_defconfig | 4 ++++ configs/qemu_mips64r6el_malta_defconfig | 4 ++++ configs/qemu_nios2_10m50_defconfig | 4 ++++ configs/qemu_or1k_defconfig | 4 ++++ configs/qemu_ppc64_e5500_defconfig | 4 ++++ configs/qemu_ppc64_pseries_defconfig | 4 ++++ configs/qemu_ppc64le_pseries_defconfig | 4 ++++ configs/qemu_ppc_g3beige_defconfig | 4 ++++ configs/qemu_ppc_mac99_defconfig | 4 ++++ configs/qemu_ppc_mpc8544ds_defconfig | 4 ++++ configs/qemu_ppc_virtex_ml507_defconfig | 4 ++++ configs/qemu_riscv32_virt_defconfig | 4 ++++ configs/qemu_riscv64_virt_defconfig | 4 ++++ configs/qemu_sh4_r2d_defconfig | 4 ++++ configs/qemu_sh4eb_r2d_defconfig | 4 ++++ configs/qemu_sparc64_sun4u_defconfig | 4 ++++ configs/qemu_sparc_ss10_defconfig | 4 ++++ configs/qemu_x86_64_defconfig | 4 ++++ configs/qemu_x86_defconfig | 4 ++++ configs/qemu_xtensa_lx60_defconfig | 4 ++++ configs/qemu_xtensa_lx60_nommu_defconfig | 4 ++++ 39 files changed, 156 insertions(+)
configs/qemu_aarch64_virt_defconfig +4 -0
@@ -11,6 +11,10 @@ BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_arm_versatile_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_arm_versatile_nommu_defconfig +4 -0
@@ -21,6 +21,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_arm_vexpress_defconfig +4 -0
@@ -13,6 +13,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_csky610_virt_defconfig +4 -0
@@ -5,6 +5,10 @@ BR2_ck610=y # System BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # linux kernel header, the same version with linux kernel BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_0=y
configs/qemu_csky807_virt_defconfig +4 -0
@@ -5,6 +5,10 @@ BR2_ck807=y # System BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # linux kernel header, the same version with linux kernel BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_0=y
configs/qemu_csky810_virt_defconfig +4 -0
@@ -5,6 +5,10 @@ BR2_ck810=y # System BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # linux kernel header, the same version with linux kernel BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_0=y
configs/qemu_csky860_virt_defconfig +4 -0
@@ -5,6 +5,10 @@ BR2_ck860=y # System BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # linux kernel header, the same version with linux kernel BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_0=y
configs/qemu_m68k_mcf5208_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_INITRAMFS=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_m68k_q800_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_microblazebe_mmu_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyUL0" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_microblazeel_mmu_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyUL0" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_mips32r2_malta_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_mips32r2el_malta_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_mips32r6_malta_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_mips32r6el_malta_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_mips64_malta_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_mips64el_malta_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_mips64r6_malta_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_mips64r6el_malta_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_nios2_10m50_defconfig +4 -0
@@ -6,6 +6,10 @@ BR2_LINUX_KERNEL_DEFCONFIG="10m50" BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/qemu/nios2-10m50/linux.fragment" BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_or1k_defconfig +4 -0
@@ -5,6 +5,10 @@ BR2_or1k=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4,19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_ppc64_e5500_defconfig +4 -0
@@ -5,6 +5,10 @@ BR2_powerpc_e5500=y # Serial port config BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as the kernel BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_ppc64_pseries_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="hvc0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_ppc64le_pseries_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_ppc_g3beige_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_ppc_mac99_defconfig +4 -0
@@ -25,6 +25,10 @@ BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # host-qemu for gitlab testing BR2_PACKAGE_HOST_QEMU=y BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
configs/qemu_ppc_mpc8544ds_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_ppc_virtex_ml507_defconfig +4 -0
@@ -6,6 +6,10 @@ BR2_powerpc_440=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_riscv32_virt_defconfig +4 -0
@@ -11,6 +11,10 @@ BR2_GLOBAL_PATCH_DIR="board/qemu/riscv32-virt/patches/" # Filesystem BR2_TARGET_ROOTFS_EXT2=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 5.1 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_1=y
configs/qemu_riscv64_virt_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" # Filesystem BR2_TARGET_ROOTFS_EXT2=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 5.1 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_1=y
configs/qemu_sh4_r2d_defconfig +4 -0
@@ -11,6 +11,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttySC1" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_sh4eb_r2d_defconfig +4 -0
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttySC1" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_sparc64_sun4u_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_sparc_ss10_defconfig +4 -0
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0" BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_x86_64_defconfig +4 -0
@@ -11,6 +11,10 @@ BR2_TARGET_ROOTFS_EXT2=y # Image BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh" +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_x86_defconfig +4 -0
@@ -12,6 +12,10 @@ BR2_TARGET_ROOTFS_EXT2=y # Image BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86/post-build.sh" +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_xtensa_lx60_defconfig +4 -0
@@ -11,6 +11,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
configs/qemu_xtensa_lx60_nommu_defconfig +4 -0
@@ -15,6 +15,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ROOTFS_INITRAMFS=y +# Image +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" + # Linux headers same as kernel, a 4.19 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
Signature · 1 line
2.24.1
PATCH v5 4/5 support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
In reply to Romain NaourFrom: Jugurtha BELKALEM <[email protected]>
This script is intended to be used by gitlab CI to test at runtime Qemu images generated by Buildroot's Qemu defconfigs.
This allows to troubleshoot different issues that may be associated with defective builds by lanching a qemu machine, sending root password, waiting for login shell and then perform a shutdown.
This script is inspired by toolchain builder [1] and the Buildroot testing infrastructure.
Usage: boot-qemu-image.py <qemu_arch_defconfig>
The gitlab CI will call this script for each defconfig build but only Qemu defconfig will be runtime tested, all others defconfig are ignored. The script retrieve the qemu command line from start-qemu.sh script. The start-qemu.sh script is no executed directly since we want to handle the serial output with pexpect to detect the shell, enter the password and powerdown the system.
If the script is missing, error out with a message in the log.
The script check is the corresponding Qemu binary (qemu-system) is available, either built by Buildroot or available from the host. Some Qemu defconfig must be used with a specific Qemu version (fork) that is not always available. The script doesn't error out when qemu-system is missing but a message is added in the log.
Finally, the script start Qemu like it's done for the Buildroot testing infrastructure (using pexpect).
Note:
We noticed some timeout issues with pexpect when the Qemu machine is powered off. That's because Qemu process doesn't stop even if the system is halted (after "System halted"). So the script doesn't error out when such timeout occure. The behaviour depends on the architecture emulated by Qemu.
[1] https://github.com/bootlin/toolchains-builder/blob/master/build.sh
---
v5: No Change
--- support/scripts/boot-qemu-image.py | 105 +++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 support/scripts/boot-qemu-image.py
support/scripts/boot-qemu-image.py new file +105 -0
@@ -0,0 +1,105 @@ +#!/usr/bin/env python3 + +# This script expect to run from the Buildroot top directory. + +import pexpect +import sys +import os +import re +import shlex +import shutil +import subprocess + +argc = len(sys.argv) +if not (argc == 2): + print("Error: incorrect number of arguments") + print("""Usage: boot-qemu-image.py <qemu_arch_defconfig>""") + sys.exit(1) + +defconfig_filename = sys.argv[1] + +# Ignore non Qemu defconfig +if defconfig_filename.startswith('qemu_') is False: + sys.exit(0) + +qemu_start_script_filepath = os.path.join(os.getcwd(), 'output/images/start-qemu.sh') + +# Ignore if start-qemu.sh is missing, we can't test. +if not os.path.exists(qemu_start_script_filepath): + print("Error: " + qemu_start_script_filepath) + " file is missing." + sys.exit(1) + +qemu_cmd = "" + +with open(qemu_start_script_filepath, 'r') as script_file: + for line in script_file: + if re.search("qemu-system", line): + qemu_cmd = line + break + +if not qemu_cmd: + print("Error: No QEMU command line found in " + qemu_start_script_filepath) + sys.exit(1) + +# Replace bashism +qemu_cmd = line.replace("${IMAGE_DIR}", "output/images") + +# pexpect needs a list, convert a sting to a list and escape quoted substring. +qemu_cmd = shlex.split(qemu_cmd) + +# Use host Qemu if provided by Buildroot. +os.environ["PATH"] = os.getcwd() + "/output/host/bin" + os.pathsep + os.environ["PATH"] + +# Ignore when no Qemu emulation is available +if not shutil.which(qemu_cmd[0]): + print("No " + qemu_cmd[0] + " binary available, THIS DEFCONFIG CAN NOT BE TESTED!") + sys.exit(0) + + +def main(): + global child + + try: + child.expect(["buildroot login:", pexpect.TIMEOUT], timeout=60) + except pexpect.EOF: + print("Connection problem, exiting.") + sys.exit(1) + except pexpect.TIMEOUT: + print("System did not boot in time, exiting.") + sys.exit(1) + + child.sendline("root\r") + + try: + child.expect(["# ", pexpect.TIMEOUT], timeout=60) + except pexpect.EOF: + print("Cannot connect to shell") + sys.exit(1) + except pexpect.TIMEOUT: + print("Timeout while waiting for shell") + sys.exit(1) + + child.sendline("poweroff\r") + + try: + child.expect(["System halted", pexpect.TIMEOUT], timeout=60) + child.expect(pexpect.EOF) + except pexpect.EOF: + sys.exit(0) + except pexpect.TIMEOUT: + print("Cannot halt machine") + # Qemu may not exit properly after "System halted", ignore. + sys.exit(0) + + +# Log the Qemu version +subprocess.call([qemu_cmd[0], "--version"]) + +# Log the Qemu command line +print(qemu_cmd) + +child = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:], timeout=5, encoding='utf-8', + env={"QEMU_AUDIO_DRV": "none", 'PATH': os.environ["PATH"]}) +# We want only stdout into the log to avoid double echo +child.logfile = sys.stdout +main()
Signature · 1 line
2.24.1
PATCH v5 4/5 support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
Romain, Jugurtha, All,
On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
Quoted 3 lines
From: Jugurtha BELKALEM <[email protected]> This script is intended to be used by gitlab CI to test at runtime Qemu images generated by Buildroot's Qemu defconfigs.
[--SNIP--]
Quoted 38 lines
support/scripts/boot-qemu-image.py new file +32
-0@@ -0,0 +1,105 @@ +#!/usr/bin/env python3 + +# This script expect to run from the Buildroot top directory. + +import pexpect +import sys +import os +import re +import shlex +import shutil +import subprocess + +argc = len(sys.argv) +if not (argc == 2): + print("Error: incorrect number of arguments") + print("""Usage: boot-qemu-image.py <qemu_arch_defconfig>""") + sys.exit(1) + +defconfig_filename = sys.argv[1] + +# Ignore non Qemu defconfig +if defconfig_filename.startswith('qemu_') is False: + sys.exit(0) + +qemu_start_script_filepath = os.path.join(os.getcwd(), 'output/images/start-qemu.sh') + +# Ignore if start-qemu.sh is missing, we can't test. +if not os.path.exists(qemu_start_script_filepath): + print("Error: " + qemu_start_script_filepath) + " file is missing." + sys.exit(1) + +qemu_cmd = ""
support/scripts/boot-qemu-image.py line 42
Quoted 10 lines
support/scripts/boot-qemu-image.py new file +10
-0+ +with open(qemu_start_script_filepath, 'r') as script_file: + for line in script_file: + if re.search("qemu-system", line): + qemu_cmd = line + break + +if not qemu_cmd: + print("Error: No QEMU command line found in " + qemu_start_script_filepath) + sys.exit(1)
Why do you extract the command line, and can't directly run the script?
support/scripts/boot-qemu-image.py line 45
Quoted 2 lines
support/scripts/boot-qemu-image.py new file +2
-0+# Replace bashism +qemu_cmd = line.replace("${IMAGE_DIR}", "output/images")
This would avoid this dance...
support/scripts/boot-qemu-image.py line 48
Quoted 2 lines
support/scripts/boot-qemu-image.py new file +2
-0+# pexpect needs a list, convert a sting to a list and escape quoted substring. +qemu_cmd = shlex.split(qemu_cmd)
... as well as this one.
support/scripts/boot-qemu-image.py line 51
Quoted 2 lines
support/scripts/boot-qemu-image.py new file +2
-0+# Use host Qemu if provided by Buildroot. +os.environ["PATH"] = os.getcwd() + "/output/host/bin" + os.pathsep + os.environ["PATH"]
And this one can be avoided too if the script is called with PATH properly set to include ${HOST_DIR}/bin. This should be easy, as this script is only expected to run from the gitlab-ci pipelines.
support/scripts/boot-qemu-image.py line 60
Quoted 8 lines
support/scripts/boot-qemu-image.py new file +8
-0+# Ignore when no Qemu emulation is available +if not shutil.which(qemu_cmd[0]): + print("No " + qemu_cmd[0] + " binary available, THIS DEFCONFIG CAN NOT BE TESTED!") + sys.exit(0) + + +def main(): + global child
Mixing code at the top-level and in a main() is ugly. Mocve everything to a main (and helper functions if youlike), but don't mix the two.
Quoted 28 lines
support/scripts/boot-qemu-image.py new file +28
-0+ try: + child.expect(["buildroot login:", pexpect.TIMEOUT], timeout=60) + except pexpect.EOF: + print("Connection problem, exiting.") + sys.exit(1) + except pexpect.TIMEOUT: + print("System did not boot in time, exiting.") + sys.exit(1) + + child.sendline("root\r") + + try: + child.expect(["# ", pexpect.TIMEOUT], timeout=60) + except pexpect.EOF: + print("Cannot connect to shell") + sys.exit(1) + except pexpect.TIMEOUT: + print("Timeout while waiting for shell") + sys.exit(1) + + child.sendline("poweroff\r") + + try: + child.expect(["System halted", pexpect.TIMEOUT], timeout=60) + child.expect(pexpect.EOF) + except pexpect.EOF: + sys.exit(0) + except pexpect.TIMEOUT:
support/scripts/boot-qemu-image.py line 99
Quoted 10 lines
support/scripts/boot-qemu-image.py new file +10
-0+ print("Cannot halt machine") + # Qemu may not exit properly after "System halted", ignore. + sys.exit(0) + + +# Log the Qemu version +subprocess.call([qemu_cmd[0], "--version"]) + +# Log the Qemu command line +print(qemu_cmd)
You would not have to do that if you just called the start-qemu.sh script.
Regards,
Yann E. MORIN.
Quoted 12 lines
support/scripts/boot-qemu-image.py new file +5
-0+child = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:], timeout=5, encoding='utf-8', + env={"QEMU_AUDIO_DRV": "none", 'PATH': os.environ["PATH"]}) +# We want only stdout into the log to avoid double echo +child.logfile = sys.stdout +main()Signature · 6 lines
2.24.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v5 4/5 support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
Hi Yann, All,
Le 13/04/2020 ? 09:15, Yann E. MORIN a ?crit?:
Quoted 75 lines
Romain, Jugurtha, All,
On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
Quoted 3 lines
From: Jugurtha BELKALEM <[email protected]> This script is intended to be used by gitlab CI to test at runtime Qemu images generated by Buildroot's Qemu defconfigs.
[--SNIP--]
Quoted 38 lines
support/scripts/boot-qemu-image.py new file +32
-0@@ -0,0 +1,105 @@ +#!/usr/bin/env python3 + +# This script expect to run from the Buildroot top directory. + +import pexpect +import sys +import os +import re +import shlex +import shutil +import subprocess + +argc = len(sys.argv) +if not (argc == 2): + print("Error: incorrect number of arguments") + print("""Usage: boot-qemu-image.py <qemu_arch_defconfig>""") + sys.exit(1) + +defconfig_filename = sys.argv[1] + +# Ignore non Qemu defconfig +if defconfig_filename.startswith('qemu_') is False: + sys.exit(0) + +qemu_start_script_filepath = os.path.join(os.getcwd(), 'output/images/start-qemu.sh') + +# Ignore if start-qemu.sh is missing, we can't test. +if not os.path.exists(qemu_start_script_filepath): + print("Error: " + qemu_start_script_filepath) + " file is missing." + sys.exit(1) + +qemu_cmd = ""support/scripts/boot-qemu-image.py line 42
Quoted 10 lines
support/scripts/boot-qemu-image.py new file +10
-0+ +with open(qemu_start_script_filepath, 'r') as script_file: + for line in script_file: + if re.search("qemu-system", line): + qemu_cmd = line + break + +if not qemu_cmd: + print("Error: No QEMU command line found in " + qemu_start_script_filepath) + sys.exit(1)Why do you extract the command line, and can't directly run the script?
support/scripts/boot-qemu-image.py line 45
Quoted 2 lines
support/scripts/boot-qemu-image.py new file +2
-0+# Replace bashism +qemu_cmd = line.replace("${IMAGE_DIR}", "output/images")This would avoid this dance...
support/scripts/boot-qemu-image.py line 48
Quoted 2 lines
support/scripts/boot-qemu-image.py new file +2
-0+# pexpect needs a list, convert a sting to a list and escape quoted substring. +qemu_cmd = shlex.split(qemu_cmd)... as well as this one.
support/scripts/boot-qemu-image.py line 51
Quoted 2 lines
support/scripts/boot-qemu-image.py new file +2
-0+# Use host Qemu if provided by Buildroot. +os.environ["PATH"] = os.getcwd() + "/output/host/bin" + os.pathsep + os.environ["PATH"]And this one can be avoided too if the script is called with PATH properly set to include ${HOST_DIR}/bin. This should be easy, as this script is only expected to run from the gitlab-ci pipelines.
Quoted 4 lines
support/scripts/boot-qemu-image.py line 56
Quoted 4 lines
support/scripts/boot-qemu-image.py new file +4
-0+# Ignore when no Qemu emulation is available +if not shutil.which(qemu_cmd[0]): + print("No " + qemu_cmd[0] + " binary available, THIS DEFCONFIG CAN NOT BE TESTED!") + sys.exit(0)
Extracting the qemu command line in the boot-qemu-image.py allowed to test if at least one qemu-systemd-<arch> binary is present. Starting start-qemu.sh directly crash the python script.
https://gitlab.com/kubu93/buildroot/-/jobs/509053135/artifacts/file/runtime-test.log
csky and or1k defconfig doesn't select any host-qemu and there is none installed in the Buildroot Docker image used by gitlab CI.
It seems we need to catch the exception while calling pexpect.spawn(qemu_start...)
https://git.buildroot.net/buildroot/tree/support/scripts/boot-qemu-image.py#n22
Or just add this test in start-qemu.sh
Best regards,
Romain
PATCH v5 5/5 gitlab.yml.in*: enable Qemu gitlab testing
In reply to Romain NaourFrom: Jugurtha BELKALEM <[email protected]>
Used to launch qemu tests for various qemu architectures. Neverthless to say that this file skips any other job different from qemu (only qemu configurations are runtime tested).
Add the log generated by Qemu to the build artefacts.
---
v5: No Change
--- .gitlab-ci.yml | 7 +++++++ .gitlab-ci.yml.in | 7 +++++++ 2 files changed, 14 insertions(+)
.gitlab-ci.yml +7 -0
@@ -54,6 +54,12 @@ check-package: tail -200 build.log exit 1 } + - | + ./support/scripts/boot-qemu-image.py "${DEFCONFIG_NAME}" > >(tee runtime-test.log) 2>&1 || { + echo 'Failed runtime test last output' + tail -200 runtime-test.log + exit 1 + } artifacts: when: always expire_in: 2 weeks
@@ -64,6 +70,7 @@ check-package: - output/build/build-time.log - output/build/packages-file-list.txt - output/build/*/.config + - runtime-test.log .defconfig: extends: .defconfig_base
.gitlab-ci.yml.in +7 -0
@@ -54,6 +54,12 @@ check-package: tail -200 build.log exit 1 } + - | + ./support/scripts/boot-qemu-image.py "${DEFCONFIG_NAME}" > >(tee runtime-test.log) 2>&1 || { + echo 'Failed runtime test last output' + tail -200 runtime-test.log + exit 1 + } artifacts: when: always expire_in: 2 weeks
@@ -64,6 +70,7 @@ check-package: - output/build/build-time.log - output/build/packages-file-list.txt - output/build/*/.config + - runtime-test.log .defconfig: extends: .defconfig_base
Signature · 1 line
2.24.1
v5 cover gitlab Qemu runtime testing
In reply to Romain NaourHello,
Quoted 9 lines · On Mon, 17 Feb 2020 21:50:25 +0100 Romain Naour <[email protected]> wrote:
Jugurtha BELKALEM (2):
support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system. gitlab.yml.in*: enable Qemu gitlab testingRomain Naour (3):
board/qemu: add defconfig file name as tag after the qemu command line board/qemu: add post-image script for gitlab qemu testing configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as
argument.
Overall, I am quite happy with the series. There are just two things that I am not entirely sure about:
(1) The logic that tests $CI_JOB_NAME in board/qemu/post-image.sh, to test if we are running under Gitlab CI or not. It feels a bit hackish to me. Should this magic be there, or instead tweaked by the Gitlab CI testing stuff directly ?
(2) We now generate this start-qemu.sh script in $(BINARIES_DIR), but in fact only really use it for Gitlab CI testing. Should we make this start-qemu.sh script more prominently useful ? Or should we instead not have any start-qemu.sh script, and have the Gitlab CI testing logic directly find what the Qemu command line should be ?
That being said, this series has been around for a long time, so unless I get some feedback on these questions, I'm going to apply it as-is, we can always improve on top of that later on.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
v5 cover gitlab Qemu runtime testing
Hi Thomas, All,
Le 12/04/2020 ? 16:11, Thomas Petazzoni a ?crit?:
Quoted 15 lines
Hello,
Quoted 9 lines · On Mon, 17 Feb 2020 21:50:25 +0100 Romain Naour <[email protected]> wrote:
Jugurtha BELKALEM (2):
support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system. gitlab.yml.in*: enable Qemu gitlab testingRomain Naour (3):
board/qemu: add defconfig file name as tag after the qemu command line board/qemu: add post-image script for gitlab qemu testing configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as
argument.
Quoted 7 lines
Overall, I am quite happy with the series. There are just two things that I am not entirely sure about:
(1) The logic that tests $CI_JOB_NAME in
board/qemu/post-image.sh, to test if we are running under Gitlab CI or not. It feels a bit hackish to me. Should this magic be there, or instead tweaked by the Gitlab CI testing stuff directly ?
True, this is how it's done in toolchain-builder project. But the goal here is to provide the start-qemu.sh script at the end of the build, even outside of Gitlab CI.
Quoted 6 lines
(2) We now generate this
start-qemu.shscript in $(BINARIES_DIR), but in fact only really use it for Gitlab CI testing. Should we make thisstart-qemu.shscript more prominently useful ? Or should we instead not have anystart-qemu.shscript, and have the Gitlab CI testing logic directly find what the Qemu command line should be ?
start-qemu.sh can be used outside of Gitlab CI, I'm regularly using Qemu defconfig locally and getting the qemu command line from the readme is not practical. That was the feedback I had from one user on previous iteration.
Quoted 4 lines
That being said, this series has been around for a long time, so unless I get some feedback on these questions, I'm going to apply it as-is, we can always improve on top of that later on.
This series was started by my colleague Jugurtha about one year ago. Since then toolchains update showed that Qemu runtime testing is necessary otherwise we can end up with a non working defconfig (see issue with binutils 2.34 and sh4 kernel).
http://patchwork.ozlabs.org/patch/1216434/
Thanks Yann for the review during the last Buildroot meeting!
Best regards,
Romain
Quoted 5 lines
Best regards,
Thomas
v5 cover gitlab Qemu runtime testing
In reply to Romain NaourRoma, Jugurtha, All,
On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
Quoted 14 lines
This new iteration take into account the previous review with some additional rework [1] [2] [5] [6].
Remove patch already merged.
Based on the Yann's review during the Buildroot Developper meeting FOSDEM 2020 [2], add a tag in each readme file to easily retrieve the qemu command line to be used for runtime testing in gitlab.
This tag is used by a post-image script to generate a script called
start-qemu.shthat can be used by users or by a new python script for running the test in gitlab but only when a Qemu defconfig is built.
Quoted 5 lines
Finally add this new python script to .gitlab-ci.yml.
This series has been tested on Gitlab [3], please ignore the failing test related to missing host-python3 modules needed by optee-os package [4].
I've finally applied this series, after reworking in-depth the two scripts. Please review the commits and watch the pipelines, and yell at me if I broke it too badly... Thanks you!
Regards,
Yann E. MORIN.
Quoted 105 lines
This new iteration has been tested in gitlab [7].
[1] http://lists.busybox.net/pipermail/buildroot/2019-May/249432.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-February/273189.html
[3] https://gitlab.com/kubu93/buildroot/pipelines/116298701
[4] http://lists.busybox.net/pipermail/buildroot/2020-February/273738.html
[5] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
[6] http://lists.busybox.net/pipermail/buildroot/2020-February/273822.html
[7] https://gitlab.com/kubu93/buildroot/pipelines/116967006Cc: Yann E. MORIN <[email protected]>
Jugurtha BELKALEM (2):
support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system. gitlab.yml.in*: enable Qemu gitlab testingRomain Naour (3):
board/qemu: add defconfig file name as tag after the qemu command line board/qemu: add post-image script for gitlab qemu testing configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as
argument..gitlab-ci.yml | 7 ++ .gitlab-ci.yml.in | 7 ++ board/qemu/aarch64-virt/readme.txt | 2 +- board/qemu/arm-versatile/readme.txt | 4 +- board/qemu/arm-vexpress/readme.txt | 2 +- board/qemu/csky/readme.txt | 11 ++- board/qemu/m68k-mcf5208/readme.txt | 2 +- board/qemu/m68k-q800/readme.txt | 2 +- board/qemu/microblazebe-mmu/readme.txt | 2 +- board/qemu/microblazeel-mmu/readme.txt | 2 +- board/qemu/mips32r2-malta/readme.txt | 2 +- board/qemu/mips32r2el-malta/readme.txt | 2 +- board/qemu/mips32r6-malta/readme.txt | 2 +- board/qemu/mips32r6el-malta/readme.txt | 2 +- board/qemu/mips64-malta/readme.txt | 2 +- board/qemu/mips64el-malta/readme.txt | 2 +- board/qemu/mips64r6-malta/readme.txt | 2 +- board/qemu/mips64r6el-malta/readme.txt | 2 +- board/qemu/nios2-10m50/readme.txt | 2 +- board/qemu/or1k/readme.txt | 2 +- board/qemu/post-image.sh | 50 ++++++++++ board/qemu/ppc-g3beige/readme.txt | 2 +- board/qemu/ppc-mac99/readme.txt | 2 +- board/qemu/ppc-mpc8544ds/readme.txt | 2 +- board/qemu/ppc-virtex-ml507/readme.txt | 2 +- board/qemu/ppc64-e5500/readme.txt | 2 +- board/qemu/ppc64-pseries/readme.txt | 2 +- board/qemu/ppc64le-pseries/readme.txt | 2 +- board/qemu/riscv32-virt/readme.txt | 2 +- board/qemu/riscv64-virt/readme.txt | 2 +- board/qemu/sh4-r2d/readme.txt | 2 +- board/qemu/sh4eb-r2d/readme.txt | 2 +- board/qemu/sparc-ss10/readme.txt | 2 +- board/qemu/sparc64-sun4u/readme.txt | 2 +- board/qemu/x86/readme.txt | 2 +- board/qemu/x86_64/readme.txt | 2 +- board/qemu/xtensa-lx60/readme.txt | 4 +- configs/qemu_aarch64_virt_defconfig | 4 + configs/qemu_arm_versatile_defconfig | 4 + configs/qemu_arm_versatile_nommu_defconfig | 4 + configs/qemu_arm_vexpress_defconfig | 4 + configs/qemu_csky610_virt_defconfig | 4 + configs/qemu_csky807_virt_defconfig | 4 + configs/qemu_csky810_virt_defconfig | 4 + configs/qemu_csky860_virt_defconfig | 4 + configs/qemu_m68k_mcf5208_defconfig | 4 + configs/qemu_m68k_q800_defconfig | 4 + configs/qemu_microblazebe_mmu_defconfig | 4 + configs/qemu_microblazeel_mmu_defconfig | 4 + configs/qemu_mips32r2_malta_defconfig | 4 + configs/qemu_mips32r2el_malta_defconfig | 4 + configs/qemu_mips32r6_malta_defconfig | 4 + configs/qemu_mips32r6el_malta_defconfig | 4 + configs/qemu_mips64_malta_defconfig | 4 + configs/qemu_mips64el_malta_defconfig | 4 + configs/qemu_mips64r6_malta_defconfig | 4 + configs/qemu_mips64r6el_malta_defconfig | 4 + configs/qemu_nios2_10m50_defconfig | 4 + configs/qemu_or1k_defconfig | 4 + configs/qemu_ppc64_e5500_defconfig | 4 + configs/qemu_ppc64_pseries_defconfig | 4 + configs/qemu_ppc64le_pseries_defconfig | 4 + configs/qemu_ppc_g3beige_defconfig | 4 + configs/qemu_ppc_mac99_defconfig | 4 + configs/qemu_ppc_mpc8544ds_defconfig | 4 + configs/qemu_ppc_virtex_ml507_defconfig | 4 + configs/qemu_riscv32_virt_defconfig | 4 + configs/qemu_riscv64_virt_defconfig | 4 + configs/qemu_sh4_r2d_defconfig | 4 + configs/qemu_sh4eb_r2d_defconfig | 4 + configs/qemu_sparc64_sun4u_defconfig | 4 + configs/qemu_sparc_ss10_defconfig | 4 + configs/qemu_x86_64_defconfig | 4 + configs/qemu_x86_defconfig | 4 + configs/qemu_xtensa_lx60_defconfig | 4 + configs/qemu_xtensa_lx60_nommu_defconfig | 4 + support/scripts/boot-qemu-image.py | 105 +++++++++++++++++++++ 77 files changed, 368 insertions(+), 38 deletions(-) create mode 100755 board/qemu/post-image.sh create mode 100755 support/scripts/boot-qemu-image.pySignature · 1 line
2.24.1
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
v5 cover gitlab Qemu runtime testing
Hi Yann, All,
Le 13/04/2020 ? 21:56, Yann E. MORIN a ?crit?:
Quoted 19 lines
Roma, Jugurtha, All,
On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
Quoted 16 lines
This new iteration take into account the previous review with some additional rework [1] [2] [5] [6].
Remove patch already merged.
Based on the Yann's review during the Buildroot Developper meeting FOSDEM 2020 [2], add a tag in each readme file to easily retrieve the qemu command line to be used for runtime testing in gitlab.
This tag is used by a post-image script to generate a script called
start-qemu.shthat can be used by users or by a new python script for running the test in gitlab but only when a Qemu defconfig is built.Finally add this new python script to .gitlab-ci.yml.
Quoted 7 lines
Quoted 3 lines
This series has been tested on Gitlab [3], please ignore the failing test related to missing host-python3 modules needed by optee-os package [4].
I've finally applied this series, after reworking in-depth the two scripts. Please review the commits and watch the pipelines, and yell at me if I broke it too badly... Thanks you!
Thanks you too for improving the series!
Best regards,
Romain
Quoted 4 lines
Regards,
Yann E. MORIN.