diff --git a/README.md b/README.md index 37f25ed..079ec8e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,40 @@ -# riscv-brs-tests -RISC-V Boot and Runtime Services Test Suite +# RISC-V Boot and Runtime Services Test Suite. + +For more information on The Boot and Runtime Services(BRS) please see:[RISC-V Boot and Runtime Services (BRS) Specification](https://github.com/riscv-non-isa/riscv-brs). + +This project is an automated detection suite designed to simplify the construction process of related test projects. Currently, the included test projects are [edk2-test](https://github.com/tianocore/edk2-test) and [SBI-test](https://gitlab.com/kvm-unit-tests/kvm-unit-tests.git). + +To prevent potential issues, please build on Ubuntu 22.04 and ensure at least 30GB of free disk space. At the same time, make sure that the following software is installed:curl mtools gdisk gcc openssl automake autotools-dev libtool bison flex bc uuid-dev python3 libglib2.0-dev libssl-dev autopoint gcc-riscv64-unknown-elf gcc g++ + +## Construct + +``` +git clone https://github.com/riscv-software-src/riscv-brs-tests.git + +cd riscv-brs-tests && ./build.sh +``` + +The build.sh script will execute the Makefiles in each directory under /src one by one and build the image. The sources of these components are as follows: + +| project | source | tag/branch | +| --------- | ------------------------------------------------- | ---------------------------------------- | +| buildroot | https://github.com/buildroot/buildroot.git | 2023.11 | +| edk2-test | https://github.com/tianocore/edk2-test.git | 81dfa8d53d4290366ae41e1f4c2ed6d6c5016c07 | +| edk2 | https://github.com/tianocore/edk2.git | edk2-stable202308 | +| grub | https://git.savannah.gnu.org/git/grub.git | grub-2.12 | +| linux | https://github.com/torvalds/linux.git | v6.12 | +| opensbi | https://github.com/riscv-software-src/opensbi.git | v1.4 | +| qemu | https://github.com/qemu/qemu.git | v9.0.0 | +| SBI-test | https://gitlab.com/kvm-unit-tests/kvm-unit-tests.git | v2024-01-08 | +| | | | + +The built image is located at /target/brs_live_image.img. + +``` +./target/start_uefi_sct.sh +``` +This script starts qemu and automatically performs edk2-test and sbi-test tests. + +## License +Licensed under the Apache License v2.0. + diff --git a/build.sh b/build.sh index fdfc9f3..251d128 100755 --- a/build.sh +++ b/build.sh @@ -71,31 +71,25 @@ brs_compile() make popd - # 5. compile edk2-test-parser - echo "Compiling edk2-test-parser..." - pushd $SRC_DIR/brs-edk2-test-parser - make - popd - - # 6. compile buildroot + # 5. compile buildroot echo "Compiling buildroot..." pushd $SRC_DIR/brs-buildroot make popd - # 7. compile opensbi + # 6. compile opensbi echo "Compiling opensbi..." pushd $SRC_DIR/brs-opensbi make popd - # 8. compile sbi-test + # 7. compile sbi-test echo "Compiling sbi-test..." pushd $SRC_DIR/brs-sbi-test make popd - # 9. compile qemu + # 8. compile qemu echo "Compiling Qemu..." pushd $SRC_DIR/brs-qemu make @@ -218,6 +212,9 @@ brs_install() # install scripts cp $SCRIPTS_DIR/start_uefi_sct.sh $TARGET_DIR/ + # install sbi test + cp $SRC_DIR/brs-sbi-test/sbi-test/riscv/sbi.flat $TARGET_DIR/ + } brs_clean() diff --git a/scripts/start_uefi_sct.sh b/scripts/start_uefi_sct.sh index a82408a..e00d5ae 100755 --- a/scripts/start_uefi_sct.sh +++ b/scripts/start_uefi_sct.sh @@ -35,18 +35,38 @@ else exit 1 fi +if [ -z "$1" ]; then + echo "1 : EDK2-TEST" + echo "2 : SIB-TEST" + exit 1 +fi + echo "Starting rv64 qemu... press Ctrl+A, X to exit qemu" sleep 2 -$BRS_QEMU_RISCV64 -nographic \ - -machine virt,aia=aplic-imsic,pflash0=pflash0,pflash1=pflash1 \ - -cpu rv64 -m 4G -smp 2 \ - -bios $BRS_BIOS \ - -drive file=$BRS_IMAGE,if=none,format=raw,id=drv1 -device virtio-blk-device,drive=drv1 \ - -blockdev node-name=pflash0,driver=file,read-only=on,filename=$BRS_RISCV_VIRT_CODE_FD \ - -blockdev node-name=pflash1,driver=file,filename=$BRS_RISCV_VIRT_VARS_FD \ - -device e1000,netdev=net0 \ - -device virtio-gpu-pci \ - -netdev type=user,id=net0 \ - -device qemu-xhci \ - -device usb-mouse \ - -device usb-kbd +if [ "$1" -eq 1 ]; then + $BRS_QEMU_RISCV64 -nographic \ + -machine virt,aia=aplic-imsic,pflash0=pflash0,pflash1=pflash1 \ + -cpu rv64 -m 4G -smp 2 \ + -bios $BRS_BIOS \ + -drive file=$BRS_IMAGE,if=none,format=raw,id=drv1 -device virtio-blk-device,drive=drv1 \ + -blockdev node-name=pflash0,driver=file,read-only=on,filename=$BRS_RISCV_VIRT_CODE_FD \ + -blockdev node-name=pflash1,driver=file,filename=$BRS_RISCV_VIRT_VARS_FD \ + -device e1000,netdev=net0 \ + -device virtio-gpu-pci \ + -netdev type=user,id=net0 \ + -device qemu-xhci \ + -device usb-mouse \ + -device usb-kbd + +elif [ "$1" -eq 2 ]; then + $BRS_QEMU_RISCV64 -nodefaults -nographic \ + -serial mon:stdio \ + -machine virt \ + -accel tcg \ + -cpu max \ + -kernel ./sbi.flat +else + echo "Invalid argument." + exit 1 +fi + diff --git a/src/brs-buildroot/Makefile b/src/brs-buildroot/Makefile index 48c8794..d03207e 100644 --- a/src/brs-buildroot/Makefile +++ b/src/brs-buildroot/Makefile @@ -40,15 +40,10 @@ brs-buildroot: exit 1 fi - stg init - stg import -s ../patches/series - popd fi pushd buildroot - @echo "Installing fwts patches..." - cp ../patches/fwts/*.patch package/fwts/ @echo "Configuring Buildroot..." cp ../config/buildroot_defconfig configs/ diff --git a/src/brs-linux/Makefile b/src/brs-linux/Makefile index 78bd139..e6691a5 100644 --- a/src/brs-linux/Makefile +++ b/src/brs-linux/Makefile @@ -18,9 +18,9 @@ SHELL = /bin/bash BRS_LINUX_CROSS_COMPILE = riscv64-linux-gnu- BRS_LINUX_TARGET = brs-linux -BRS_LINUX_REPOURL = git@github.com:vlsunil/linux.git +BRS_LINUX_REPOURL = git@github.com:torvalds/linux.git BRS_LINUX_BRANCH = brs-test -BRS_LINUX_BRANCH_REMOTE = origin/acpi_b2_v2_riscv_aia_v11 +BRS_LINUX_BRANCH_REMOTE = v6.12 # BRS_LINUX_COMMIT = ac5e19d018afa8a37761510bd233ca319a763c42 .PHONY: brs-linux diff --git a/src/brs-opensbi/Makefile b/src/brs-opensbi/Makefile index ca03d98..1905c99 100644 --- a/src/brs-opensbi/Makefile +++ b/src/brs-opensbi/Makefile @@ -20,7 +20,7 @@ BRS_OPENSBI_CROSS_COMPILE = riscv64-linux-gnu- BRS_OPENSBI_TARGET = brs-opensbi BRS_OPENSBI_REPOURL = git@github.com:riscv-software-src/opensbi.git BRS_OPENSBI_BRANCH = brs-test -BRS_OPENSBI_TAG = v1.3.1 +BRS_OPENSBI_TAG = v1.4 # BRS_OPENSBI_COMMIT = 057eb10b6d523540012e6947d5c9f63e95244e94 .PHONY: brs-opensbi diff --git a/src/brs-qemu/Makefile b/src/brs-qemu/Makefile index ee04202..7bb8614 100644 --- a/src/brs-qemu/Makefile +++ b/src/brs-qemu/Makefile @@ -18,9 +18,9 @@ SHELL = /bin/bash # BRS_QEMU_CROSS_COMPILE = riscv64-linux-gnu- BRS_QEMU_TARGET = brs-qemu -BRS_QEMU_REPOURL = git@github.com:vlsunil/qemu.git +BRS_QEMU_REPOURL = git@github.com:qemu/qemu.git BRS_QEMU_BRANCH = brs-test -BRS_QEMU_BRANCH_REMOTE = origin/riscv_acpi_b2_v7 +BRS_QEMU_BRANCH_REMOTE = v9.0.0 # BRS_QEMU_COMMIT = 15ecd5f3774b63a5893adb0c0ff657a9b316cb56 .PHONY: brs-qemu @@ -38,14 +38,10 @@ brs-qemu: echo "stg command not found. Please install stgit to apply patches." exit 1 fi - - stg init - stg import -s ../patches/series popd fi pushd qemu - @git submodule update --init --recursive --progress @if [ ! -d "roms/edk2" ]; then echo "Copying edk2 source..." diff --git a/src/brs-sbi-test/Makefile b/src/brs-sbi-test/Makefile index 95ef000..067fb1c 100644 --- a/src/brs-sbi-test/Makefile +++ b/src/brs-sbi-test/Makefile @@ -18,10 +18,10 @@ SHELL = /bin/bash BRS_SBI_TEST_CROSS_COMPILE = riscv64-linux-gnu- BRS_SBI_TEST_TARGET = brs-sbi-test -BRS_SBI_TEST_REPOURL = https://gitlab.com/jones-drew/kvm-unit-tests.git +BRS_SBI_TEST_REPOURL = https://gitlab.com/kvm-unit-tests/kvm-unit-tests.git BRS_SBI_TEST_BRANCH = brs-test -BRS_SBI_TEST_BRANCH_REMOTE = riscv/x-tests -# BRS_SBI_TEST_COMMIT = bbd7e8faa2b31ebb44c54fa6e5d7ee371c56cd11 +#BRS_SBI_TEST_BRANCH_REMOTE = riscv/x-tests +BRS_SBI_TEST_COMMIT = 0ed2cdf3c80ee803b9150898e687e77e4d6f5db2 .PHONY: brs-sbi-test brs-sbi-test: @@ -29,8 +29,7 @@ brs-sbi-test: @if [ ! -d "sbi-test" ]; then \ git clone --progress $(BRS_SBI_TEST_REPOURL) sbi-test; pushd sbi-test - @git checkout -b $(BRS_SBI_TEST_BRANCH) - @git branch --set-upstream-to=origin/$(BRS_SBI_TEST_BRANCH_REMOTE) $(BRS_SBI_TEST_BRANCH) + @git checkout -b $(BRS_SBI_TEST_BRANCH) $(BRS_SBI_TEST_COMMIT) @git pull --rebase popd