[u-boot-test-hooks PATCH] travis-ci: Add SiFive Unleashed QEMU targets

Bin Meng bmeng.cn at gmail.com
Sun Aug 22 07:01:23 CEST 2021


Add support for testing sifive_unleashed_defconfig via QEMU.
QEMU supports booting exact the same images as used on the real
hardware out of the box, that U-Boot SPL loads U-Boot proper
from either an SD card or the SPI NOR flash, hence we can easily
set up CI to cover these 2 boot flows of SiFive Unleashed board.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>

---

 bin/travis-ci/conf.sifive_unleashed_sdcard_qemu       | 11 +++++++++++
 bin/travis-ci/conf.sifive_unleashed_spi-nor_qemu      | 11 +++++++++++
 .../u_boot_boardenv_sifive_unleashed_sdcard_qemu.py   | 10 ++++++++++
 .../u_boot_boardenv_sifive_unleashed_spi-nor_qemu.py  | 10 ++++++++++
 4 files changed, 42 insertions(+)
 create mode 100644 bin/travis-ci/conf.sifive_unleashed_sdcard_qemu
 create mode 100644 bin/travis-ci/conf.sifive_unleashed_spi-nor_qemu
 create mode 100644 py/travis-ci/u_boot_boardenv_sifive_unleashed_sdcard_qemu.py
 create mode 100644 py/travis-ci/u_boot_boardenv_sifive_unleashed_spi-nor_qemu.py

diff --git a/bin/travis-ci/conf.sifive_unleashed_sdcard_qemu b/bin/travis-ci/conf.sifive_unleashed_sdcard_qemu
new file mode 100644
index 0000000..f3c3da1
--- /dev/null
+++ b/bin/travis-ci/conf.sifive_unleashed_sdcard_qemu
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: MIT
+#
+# Copyright (c) 2021 Bin Meng <bmeng.cn at gmail.com>
+
+console_impl=qemu
+qemu_machine="sifive_u,msel=11"
+qemu_binary="qemu-system-riscv64"
+qemu_extra_args="-smp 5 -m 8G -nographic -nic user,tftp=${UBOOT_TRAVIS_BUILD_DIR}"
+qemu_kernel_args="-bios ${U_BOOT_BUILD_DIR}/spl/u-boot-spl.bin -drive file=${U_BOOT_BUILD_DIR}/sdcard.img,if=sd"
+reset_impl=none
+flash_impl=none
diff --git a/bin/travis-ci/conf.sifive_unleashed_spi-nor_qemu b/bin/travis-ci/conf.sifive_unleashed_spi-nor_qemu
new file mode 100644
index 0000000..e28bfc4
--- /dev/null
+++ b/bin/travis-ci/conf.sifive_unleashed_spi-nor_qemu
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: MIT
+#
+# Copyright (c) 2021 Bin Meng <bmeng.cn at gmail.com>
+
+console_impl=qemu
+qemu_machine="sifive_u,msel=6"
+qemu_binary="qemu-system-riscv64"
+qemu_extra_args="-smp 5 -m 8G -nographic -nic user,tftp=${UBOOT_TRAVIS_BUILD_DIR}"
+qemu_kernel_args="-bios ${U_BOOT_BUILD_DIR}/spl/u-boot-spl.bin -drive file=${U_BOOT_BUILD_DIR}/spi-nor.img,if=mtd"
+reset_impl=none
+flash_impl=none
diff --git a/py/travis-ci/u_boot_boardenv_sifive_unleashed_sdcard_qemu.py b/py/travis-ci/u_boot_boardenv_sifive_unleashed_sdcard_qemu.py
new file mode 100644
index 0000000..a86e0bd
--- /dev/null
+++ b/py/travis-ci/u_boot_boardenv_sifive_unleashed_sdcard_qemu.py
@@ -0,0 +1,10 @@
+import os
+import travis_tftp
+
+env__net_dhcp_server = True
+env__net_tftp_readable_file = travis_tftp.file2env('u-boot')
+env__efi_loader_helloworld_file = travis_tftp.file2env('lib/efi_loader/helloworld.efi')
+env__efi_loader_grub_file = travis_tftp.file2env('grub_riscv64.efi')
+env__efi_fit_tftp_file = {
+    "dn" : os.environ['UBOOT_TRAVIS_BUILD_DIR'],
+}
diff --git a/py/travis-ci/u_boot_boardenv_sifive_unleashed_spi-nor_qemu.py b/py/travis-ci/u_boot_boardenv_sifive_unleashed_spi-nor_qemu.py
new file mode 100644
index 0000000..a86e0bd
--- /dev/null
+++ b/py/travis-ci/u_boot_boardenv_sifive_unleashed_spi-nor_qemu.py
@@ -0,0 +1,10 @@
+import os
+import travis_tftp
+
+env__net_dhcp_server = True
+env__net_tftp_readable_file = travis_tftp.file2env('u-boot')
+env__efi_loader_helloworld_file = travis_tftp.file2env('lib/efi_loader/helloworld.efi')
+env__efi_loader_grub_file = travis_tftp.file2env('grub_riscv64.efi')
+env__efi_fit_tftp_file = {
+    "dn" : os.environ['UBOOT_TRAVIS_BUILD_DIR'],
+}
-- 
2.25.1



More information about the U-Boot mailing list