Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change some project branches to upstream branches #6

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

17 changes: 7 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
46 changes: 33 additions & 13 deletions scripts/start_uefi_sct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

5 changes: 0 additions & 5 deletions src/brs-buildroot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
4 changes: 2 additions & 2 deletions src/brs-linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ SHELL = /bin/bash

BRS_LINUX_CROSS_COMPILE = riscv64-linux-gnu-
BRS_LINUX_TARGET = brs-linux
BRS_LINUX_REPOURL = [email protected]:vlsunil/linux.git
BRS_LINUX_REPOURL = [email protected]: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
Expand Down
2 changes: 1 addition & 1 deletion src/brs-opensbi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BRS_OPENSBI_CROSS_COMPILE = riscv64-linux-gnu-
BRS_OPENSBI_TARGET = brs-opensbi
BRS_OPENSBI_REPOURL = [email protected]: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
Expand Down
8 changes: 2 additions & 6 deletions src/brs-qemu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ SHELL = /bin/bash

# BRS_QEMU_CROSS_COMPILE = riscv64-linux-gnu-
BRS_QEMU_TARGET = brs-qemu
BRS_QEMU_REPOURL = [email protected]:vlsunil/qemu.git
BRS_QEMU_REPOURL = [email protected]: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
Expand All @@ -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..."
Expand Down
9 changes: 4 additions & 5 deletions src/brs-sbi-test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ 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:
@echo "Building 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
Expand Down