tools: docker: Bump up QEMU version to 6.1.0
PATCH 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. Hence my custom repo is used that contains this fix on top of the v6.1.0 release tag at the time being. We should switch to QEMU official repo once the fix is merged in next release.
[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/
---
tools/docker/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/docker/Dockerfile +3 -2
@@ -76,6 +76,7 @@ RUN apt-get update && apt-get install -y \ mount \ mtd-utils \ mtools \ + ninja-build \ openssl \ picocom \ parted \
@@ -163,10 +164,10 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ true && \ rm -rf /tmp/grub -RUN git clone git://git.qemu.org/qemu.git /tmp/qemu && \ +RUN git clone https://gitlab.com/lbmeng/qemu.git /tmp/qemu && \ cd /tmp/qemu && \ git submodule update --init dtc && \ - git checkout v4.2.0 && \ + git checkout v6.1.0-u-boot && \ ./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
PATCH 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
---
tools/docker/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/docker/Dockerfile +9 -0
@@ -60,6 +60,7 @@ RUN apt-get update && apt-get install -y \ iasl \ imagemagick \ iputils-ping \ + libconfuse-dev \ libgit2-dev \ libguestfs-tools \ liblz4-tool \
@@ -172,6 +173,14 @@ RUN git clone https://gitlab.com/lbmeng/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 /opt -xJ && \ + cd /opt/genimage-14 && \ + ./configure && \ + make -j$(nproc) && \ + make install && \ + rm -rf /opt/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
Re: [PATCH 2/4] tools: docker: Build and install genimage
Quoted 26 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
Signed-off-by Bin Meng <[email protected]>---
tools/docker/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+)tools/docker/Dockerfile +1
-0@@ -60,6 +60,7 @@ RUN apt-get update && apt-get install -y \ iasl \ imagemagick \ iputils-ping \ + libconfuse-dev \ libgit2-dev \ libguestfs-tools \ liblz4-tool \@@ -172,6 +173,14 @@ RUN git clone https://gitlab.com/lbmeng/qemu.git /tmp/qemu && \ make -j$(nproc) all install && \
tools/docker/Dockerfile RUN git clone https://gitlab.com/lbmeng/qemu.git /tmp/qemu && \ · line 183
Quoted 10 lines
tools/docker/Dockerfile +8
-0rm -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 /opt -xJ && \ + cd /opt/genimage-14 && \ + ./configure && \ + make -j$(nproc) && \ + make install && \ + rm -rf /opt/genimage-14 +
If we're building, we should do it in /tmp like the rest of the recipe does.
Signature · 1 line
Tom
PATCH 3/4 riscv: sifive: unleashed: Add genimage config files
In reply to Bin MengThis 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
---
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
@@ -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
@@ -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
PATCH 4/4 azure/gitlab: Add tests for SiFive Unleashed board
In reply to Bin MengThis 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.
---
.azure-pipelines.yml | 20 +++++++++++++++++++- .gitlab-ci.yml | 26 +++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-)
.azure-pipelines.yml +19 -1
@@ -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
@@ -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
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 7 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. Hence my custom repo is used that contains this fix on top of the v6.1.0 release tag at the time being. We should switch to QEMU official repo once the fix is merged in next release.
[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/
Can we cherry-pick this from upstream? How long is it likely to take before say 6.1.1 is out?
Signature · 1 line
Tom
Quoted 14 lines · Tom Rini
Quoted 11 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. Hence my custom repo is used that contains this fix on top of the v6.1.0 release tag at the time being. We should switch to QEMU official repo once the fix is merged in next release.
Quoted 4 lines
Can we cherry-pick this from upstream? How long is it likely to take before say 6.1.1 is out?
There is probably no 6.1.1 per QEMU release cadence. The fix has not been applied yet, so we cannot cherry pick it up now.
If using a custom repo is a problem, how about "wget <patch> from patchwork" and "git am" on top of the official repo?
Regards,
Bin
Quoted 17 lines · Bin Meng
Quoted 16 lines · Tom Rini
Quoted 12 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. Hence my custom repo is used that contains this fix on top of the v6.1.0 release tag at the time being. We should switch to QEMU official repo once the fix is merged in next release.
[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/
Quoted 8 lines
Quoted 2 lines
Can we cherry-pick this from upstream? How long is it likely to take before say 6.1.1 is out?
There is probably no 6.1.1 per QEMU release cadence. The fix has not been applied yet, so we cannot cherry pick it up now.
If using a custom repo is a problem, how about "wget <patch> from patchwork" and "git am" on top of the official repo?
Yeah, I think that would be a good alternative.
Signature · 1 line
Tom