[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/20210823020813.25192-2-...
Signed-off-by: Bin Meng bmeng.cn@gmail.com
---
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(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 0195456dfe..4d7c3c6679 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -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 u-boot@denx.de && \ + # 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/20210823020813.25192-2-... | 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

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 bmeng.cn@gmail.com
---
Changes in v2: - Build genimage in the /tmp directory, just like others
tools/docker/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 4d7c3c6679..dfc4c6e91b 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -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.ta... | 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

On Thu, Aug 26, 2021 at 11:33:33PM +0800, Bin Meng wrote:
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 bmeng.cn@gmail.com
Reviewed-by: Tom Rini trini@konsulko.com

On Thu, Aug 26, 2021 at 11:33:33PM +0800, Bin Meng wrote:
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 bmeng.cn@gmail.com Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/next, thanks!

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
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
(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
diff --git a/board/sifive/unleashed/genimage_sdcard.cfg b/board/sifive/unleashed/genimage_sdcard.cfg new file mode 100644 index 0000000000..91c53bf855 --- /dev/null +++ b/board/sifive/unleashed/genimage_sdcard.cfg @@ -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 + } +} diff --git a/board/sifive/unleashed/genimage_spi-nor.cfg b/board/sifive/unleashed/genimage_spi-nor.cfg new file mode 100644 index 0000000000..2e5d89bfe8 --- /dev/null +++ b/board/sifive/unleashed/genimage_spi-nor.cfg @@ -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 + } +}

On Thu, Aug 26, 2021 at 11:33:34PM +0800, Bin Meng wrote:
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
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Applied to u-boot/next, thanks!

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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
---
(no changes since v1)
.azure-pipelines.yml | 20 +++++++++++++++++++- .gitlab-ci.yml | 26 +++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 15507a7357..2e9c1fb4fd 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -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.t... | 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.t... | 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 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ffdeaae5a8..599de6e506 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ stages: wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.t... | 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.t... | 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"

On Thu, Aug 26, 2021 at 11:33:35PM +0800, Bin Meng wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Reviewed-by: Tom Rini trini@konsulko.com

On Thu, Aug 26, 2021 at 11:33:35PM +0800, Bin Meng wrote:
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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/next, thanks!

On Thu, Aug 26, 2021 at 11:33:32PM +0800, Bin Meng wrote:
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/20210823020813.25192-2-...
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Reviewed-by: Tom Rini trini@konsulko.com

On Fri, Aug 27, 2021 at 10:54 AM Tom Rini trini@konsulko.com wrote:
On Thu, Aug 26, 2021 at 11:33:32PM +0800, Bin Meng wrote:
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/20210823020813.25192-2-...
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Reviewed-by: Tom Rini trini@konsulko.com
Ping?

On Sat, Sep 11, 2021 at 10:33:07PM +0800, Bin Meng wrote:
On Fri, Aug 27, 2021 at 10:54 AM Tom Rini trini@konsulko.com wrote:
On Thu, Aug 26, 2021 at 11:33:32PM +0800, Bin Meng wrote:
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/20210823020813.25192-2-...
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Reviewed-by: Tom Rini trini@konsulko.com
Ping?
On my TODO list, sorry for the delay.

On Thu, Aug 26, 2021 at 11:33:32PM +0800, Bin Meng wrote:
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/20210823020813.25192-2-...
Signed-off-by: Bin Meng bmeng.cn@gmail.com Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/next, thanks!
participants (2)
-
Bin Meng
-
Tom Rini