Skip to contentSkip to conversation

tools: docker: Bump up QEMU version to 6.1.0

PATCH In review Bin Meng 2 participants 13 messages Aug 26, 2021 – Sep 11, 2021 SiFive drivers

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH v2 1/4 tools: docker: Bump up QEMU version to 6.1.0

At present U-Boot CI testing is still using QEMU 4.2.0 which is pretty old. Let's bump up to QEMU 6.1.0.

ninja-build is added as the prerequisite required by QEMU 6.1.0.

Note there is a bug in QEMU 6.1.0 Xilinx Zynq UART emulation codes. A quick fix [1] was posted on QEMU mailing list but it it too late for 6.1.0 release. Let's manually apply the bug fix on top of the v6.1.0 release tag at the time being.

[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/

---

Changes in v2:
- Use QEMU official git repo, and 'git am' the bug fix manually

 tools/docker/Dockerfile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tools/docker/Dockerfile +7 -1
index 0195456dfe..4d7c3c6679 100644
@@ -76,6 +76,7 @@ RUN apt-get update && apt-get install -y \
 	mount \
 	mtd-utils \
 	mtools \
+	ninja-build \
 	openssl \
 	picocom \
 	parted \
@@ -166,7 +167,12 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
 RUN git clone git://git.qemu.org/qemu.git /tmp/qemu && \
 	cd /tmp/qemu && \
 	git submodule update --init dtc && \
-	git checkout v4.2.0 && \
+	git checkout v6.1.0 && \
+	# config user.name and user.email to make 'git am' happy
+	git config user.name u-boot && \
+	git config user.email [email protected] && \
+	# manually apply the bug fix for QEMU 6.1.0 Xilinx Zynq UART emulation codes
+	wget -O - http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/mbox/ | git am && \
 	./configure --prefix=/opt/qemu --target-list="aarch64-softmmu,arm-softmmu,i386-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,ppc-softmmu,riscv32-softmmu,riscv64-softmmu,sh4-softmmu,x86_64-softmmu,xtensa-softmmu" && \
 	make -j$(nproc) all install && \
 	rm -rf /tmp/qemu
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 2/4 tools: docker: Build and install genimage

genimage [1] is a tool to create flash/disk images. This is required by some targets, e.g.: sifive_unleashed, to generate sdcard or spi-nor images for real hardware, as well as U-Boot CI testing.

[1] https://github.com/pengutronix/genimage

---

Changes in v2:
- Build genimage in the /tmp directory, just like others

 tools/docker/Dockerfile | 9 +++++++++
 1 file changed, 9 insertions(+)
tools/docker/Dockerfile +9 -0
index 4d7c3c6679..dfc4c6e91b 100644
@@ -60,6 +60,7 @@ RUN apt-get update && apt-get install -y \
 	iasl \
 	imagemagick \
 	iputils-ping \
+	libconfuse-dev \
 	libgit2-dev \
 	libguestfs-tools \
 	liblz4-tool \
@@ -177,6 +178,14 @@ RUN git clone git://git.qemu.org/qemu.git /tmp/qemu && \
 	make -j$(nproc) all install && \
 	rm -rf /tmp/qemu
 
+# Build genimage (required by some targets to generate disk images)
+RUN wget -O - https://github.com/pengutronix/genimage/releases/download/v14/genimage-14.tar.xz | tar -C /tmp -xJ && \
+	cd /tmp/genimage-14 && \
+	./configure && \
+	make -j$(nproc) && \
+	make install && \
+	rm -rf /tmp/genimage-14
+
 # Create our user/group
 RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot
 RUN useradd -m -U uboot
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH v2 2/4] tools: docker: Build and install genimage

In reply to Bin Meng
Quoted 8 lines · Bin Meng

genimage [1] is a tool to create flash/disk images. This is required by some targets, e.g.: sifive_unleashed, to generate sdcard or spi-nor images for real hardware, as well as U-Boot CI testing.

[1] https://github.com/pengutronix/genimage

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
author
#4 lore raw

PATCH v2 3/4 riscv: sifive: unleashed: Add genimage config files

In reply to Bin Meng

This adds genimage [1] config files for generating SD card and spi-nor images, which can be programmed to an SD card or SPI flash and boot from there.

The same images will be used for U-Boot CI testing for this board.

[1] https://github.com/pengutronix/genimage

---

(no changes since v1)

 board/sifive/unleashed/genimage_sdcard.cfg  | 19 +++++++++++++++++++
 board/sifive/unleashed/genimage_spi-nor.cfg | 19 +++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 board/sifive/unleashed/genimage_sdcard.cfg
 create mode 100644 board/sifive/unleashed/genimage_spi-nor.cfg
board/sifive/unleashed/genimage_sdcard.cfg new file +19 -0
new file mode 100644
index 0000000000..91c53bf855
@@ -0,0 +1,19 @@
+image sdcard.img {
+	size = 128M
+
+	hdimage {
+		gpt = true
+	}
+
+	partition u-boot-spl {
+		image = "u-boot-spl.bin"
+		offset = 17K
+		partition-type-uuid = 5B193300-FC78-40CD-8002-E86C45580B47
+	}
+
+	partition u-boot {
+		image = "u-boot.itb"
+		offset = 1041K
+		partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985
+	}
+}
board/sifive/unleashed/genimage_spi-nor.cfg new file +19 -0
new file mode 100644
index 0000000000..2e5d89bfe8
@@ -0,0 +1,19 @@
+image spi-nor.img {
+	size = 32M
+
+	hdimage {
+		gpt = true
+	}
+
+	partition u-boot-spl {
+		image = "u-boot-spl.bin"
+		offset = 20K
+		partition-type-uuid = 5B193300-FC78-40CD-8002-E86C45580B47
+	}
+
+	partition u-boot {
+		image = "u-boot.itb"
+		offset = 1044K
+		partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985
+	}
+}
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH v2 3/4] riscv: sifive: unleashed: Add genimage config files

Quoted 9 lines · Bin Meng

This adds genimage [1] config files for generating SD card and spi-nor images, which can be programmed to an SD card or SPI flash and boot from there.

The same images will be used for U-Boot CI testing for this board.

[1] https://github.com/pengutronix/genimage

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
author
#6 lore raw

PATCH v2 4/4 azure/gitlab: Add tests for SiFive Unleashed board

In reply to Bin Meng

This adds CI tests for SiFive Unleashed board.

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.

With this, now we can have regression testing of mmc-spi-slot and sifive spi drivers, as well as mmc and spi-nor subsystems.

---

(no changes since v1)

 .azure-pipelines.yml | 20 +++++++++++++++++++-
 .gitlab-ci.yml       | 26 +++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 2 deletions(-)
.azure-pipelines.yml +19 -1
index 15507a7357..2e9c1fb4fd 100644
@@ -254,6 +254,12 @@ jobs:
         r2dplus_tulip:
           TEST_PY_BD: "r2dplus"
           TEST_PY_ID: "--id tulip_qemu"
+        sifive_unleashed_sdcard:
+          TEST_PY_BD: "sifive_unleashed"
+          TEST_PY_ID: "--id sdcard_qemu"
+        sifive_unleashed_spi-nor:
+          TEST_PY_BD: "sifive_unleashed"
+          TEST_PY_ID: "--id spi-nor_qemu"
         xilinx_zynq_virt:
           TEST_PY_BD: "xilinx_zynq_virt"
           TEST_PY_ID: "--id qemu"
@@ -289,7 +295,7 @@ jobs:
               wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
               export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
           fi
-          if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
+          if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
               wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
               export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
           fi
@@ -302,6 +308,18 @@ jobs:
           cp /opt/grub/grubriscv64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi
           cp /opt/grub/grubaa64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi
           cp /opt/grub/grubarm.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi
+          # create sdcard / spi-nor images for sifive unleashed using genimage
+          if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
+              mkdir -p root;
+              cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .;
+              cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .;
+              rm -rf tmp;
+              genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg;
+              cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/;
+              rm -rf tmp;
+              genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg;
+              cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/;
+          fi
           virtualenv -p /usr/bin/python3 /tmp/venv
           . /tmp/venv/bin/activate
           pip install -r test/py/requirements.txt
.gitlab-ci.yml +25 -1
index ffdeaae5a8..599de6e506 100644
@@ -23,7 +23,7 @@ stages:
         wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
         export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
       fi
-    - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
+    - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
         wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
         export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
       fi
@@ -40,6 +40,18 @@ stages:
     - cp /opt/grub/grubriscv64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv64.efi
     - cp /opt/grub/grubaa64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi
     - cp /opt/grub/grubarm.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi
+    # create sdcard / spi-nor images for sifive unleashed using genimage
+    - if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
+        mkdir -p root;
+        cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .;
+        cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .;
+        rm -rf tmp;
+        genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg;
+        cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/;
+        rm -rf tmp;
+        genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg;
+        cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/;
+      fi
     - virtualenv -p /usr/bin/python3 /tmp/venv
     - . /tmp/venv/bin/activate
     - pip install -r test/py/requirements.txt
@@ -317,6 +329,18 @@ r2dplus_tulip test.py:
     TEST_PY_ID: "--id tulip_qemu"
   <<: *buildman_and_testpy_dfn
 
+sifive_unleashed_sdcard test.py:
+  variables:
+    TEST_PY_BD: "sifive_unleashed"
+    TEST_PY_ID: "--id sdcard_qemu"
+  <<: *buildman_and_testpy_dfn
+
+sifive_unleashed_spi-nor test.py:
+  variables:
+    TEST_PY_BD: "sifive_unleashed"
+    TEST_PY_ID: "--id spi-nor_qemu"
+  <<: *buildman_and_testpy_dfn
+
 xilinx_zynq_virt test.py:
   variables:
     TEST_PY_BD: "xilinx_zynq_virt"
Signature · 1 line
2.25.1
Reviewed-by on v2 4/4
#7 lore raw

Re: [PATCH v2 4/4] azure/gitlab: Add tests for SiFive Unleashed board

Quoted 7 lines · Bin Meng

This adds CI tests for SiFive Unleashed board.

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.

Quoted 5 lines

With this, now we can have regression testing of mmc-spi-slot and sifive spi drivers, as well as mmc and spi-nor subsystems.

Signature · 1 line
Tom
#8 lore raw

Re: [PATCH v2 4/4] azure/gitlab: Add tests for SiFive Unleashed board

In reply to Bin Meng
Quoted 7 lines · Bin Meng

This adds CI tests for SiFive Unleashed board.

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.

Quoted 5 lines

With this, now we can have regression testing of mmc-spi-slot and sifive spi drivers, as well as mmc and spi-nor subsystems.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
Reviewed-by on v2 1/4
#9 lore raw
In reply to Bin Meng
Quoted 5 lines · Bin Meng

At present U-Boot CI testing is still using QEMU 4.2.0 which is pretty old. Let's bump up to QEMU 6.1.0.

ninja-build is added as the prerequisite required by QEMU 6.1.0.

Quoted 9 lines

Note there is a bug in QEMU 6.1.0 Xilinx Zynq UART emulation codes. A quick fix [1] was posted on QEMU mailing list but it it too late for 6.1.0 release. Let's manually apply the bug fix on top of the v6.1.0 release tag at the time being.

[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/

Signature · 1 line
Tom
author
#10 lore raw
Quoted 13 lines · Tom Rini
Quoted 10 lines · Bin Meng

At present U-Boot CI testing is still using QEMU 4.2.0 which is pretty old. Let's bump up to QEMU 6.1.0.

ninja-build is added as the prerequisite required by QEMU 6.1.0.

Note there is a bug in QEMU 6.1.0 Xilinx Zynq UART emulation codes. A quick fix [1] was posted on QEMU mailing list but it it too late for 6.1.0 release. Let's manually apply the bug fix on top of the v6.1.0 release tag at the time being.

Quoted 7 lines
Quoted 4 lines

[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/

Ping?

#11 lore raw
Quoted 14 lines · Bin Meng
Quoted 13 lines · Tom Rini
Quoted 10 lines · Bin Meng

At present U-Boot CI testing is still using QEMU 4.2.0 which is pretty old. Let's bump up to QEMU 6.1.0.

ninja-build is added as the prerequisite required by QEMU 6.1.0.

Note there is a bug in QEMU 6.1.0 Xilinx Zynq UART emulation codes. A quick fix [1] was posted on QEMU mailing list but it it too late for 6.1.0 release. Let's manually apply the bug fix on top of the v6.1.0 release tag at the time being.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/

Ping?

On my TODO list, sorry for the delay.

Signature · 1 line
Tom
#12 lore raw
In reply to Bin Meng
Quoted 10 lines · Bin Meng

At present U-Boot CI testing is still using QEMU 4.2.0 which is pretty old. Let's bump up to QEMU 6.1.0.

ninja-build is added as the prerequisite required by QEMU 6.1.0.

Note there is a bug in QEMU 6.1.0 Xilinx Zynq UART emulation codes. A quick fix [1] was posted on QEMU mailing list but it it too late for 6.1.0 release. Let's manually apply the bug fix on top of the v6.1.0 release tag at the time being.

Quoted 4 lines

[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/

Applied to u-boot/next, thanks!

Signature · 1 line
Tom