Nuclei-Software / nuclei-linux-sdk

Nuclei RISC-V Linux Software Development Kit
Apache License 2.0
38 stars 9 forks source link

OP-TEE build does not continue after OpenSBI #25

Closed swidi closed 2 months ago

swidi commented 2 months ago

Hello,

I am currently working on a research project that involves OP-TEE on RISC-V. Your project would serve as a great starting point, however I cannot get it to run.

I have used your docker image: sudo docker run -it nucleisoftware/linuxsdk:optee

And then followed the advice here: https://hub.docker.com/r/nucleisoftware/linuxsdk

# cd linux sdk workspace
cd nuclei-linux-sdk
# see commit log of last one
git log -1
# fetch latest commits if needs
git fetch
# pull latest changes if needs
git pull 
# do submodule updates 
git submodule update
# build project just follow https://github.com/Nuclei-Software/nuclei-linux-sdk#show-help in each branch
# run qemu for SOC=evalsoc CORE=ux900fd
make run_qemu

Unfortunately, the boot process never continues after OpenSBI:

[...]
/home/nuclei/nuclei-linux-sdk/work/demosoc/buildroot_initramfs/host/bin/riscv-nuclei-linux-gnu-objcopy /home/nuclei/nuclei-linux-sdk/work/demosoc/freeloader/freeloader.elf -O binary /home/nuclei/nuclei-linux-sdk/work/demosoc/freeloader/freeloader.bin
/home/nuclei/nuclei-linux-sdk/work/demosoc/buildroot_initramfs/host/bin/riscv-nuclei-linux-gnu-objdump -d /home/nuclei/nuclei-linux-sdk/work/demosoc/freeloader/freeloader.elf > /home/nuclei/nuclei-linux-sdk/work/demosoc/freeloader/freeloader.dasm
make[1]: Leaving directory '/home/nuclei/nuclei-linux-sdk/freeloader'
Run on qemu for simulation
qemu-system-riscv64 -M nuclei_u,download=flashxip -smp 8 -m 256M -cpu nuclei-ux600,ext= -bios /home/nuclei/nuclei-linux-sdk/work/demosoc/freeloader/freeloader.elf -nographic -drive file=/home/nuclei/nuclei-linux-sdk/work/demosoc/disk.img,if=sd,format=raw

OpenSBI v0.9
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : Nuclei Demo SoC
Platform Features         : timer,mfdeleg
Platform HART Count       : 8
Firmware Base             : 0xa0000000
Firmware Size             : 184 KB
Runtime SBI Version       : 0.2

Domain0 Name              : root
Domain0 Boot HART         : 0
Domain0 HARTs             : 0*,1*,2*,3*,4*,5*,6*,7*
Domain0 Region00          : 0x00000000a0000000-0x00000000a003ffff ()
Domain0 Region01          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x00000000a0200000
Domain0 Next Arg1         : 0x00000000a8000000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 0
Boot HART Domain          : root
Boot HART ISA             : rv64imafdcsu
Boot HART Features        : scounteren,mcounteren,time
Boot HART PMP Count       : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count      : 0
Boot HART MHPM Count      : 0
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109
~ stop ~

Since I believe I have followed every step as indicated, could it be that the docker image is no longer compatible with the latest commits? Or any other idea that could point me in the right direction? Thanks!

fanghuaqi commented 2 months ago

Hi @swidi , see #8 we have mentioned which branch has enabled docker support. please follow this https://github.com/Nuclei-Software/nuclei-linux-sdk/blob/feature/optee_5.10/optee/README_en.md to run it.

fanghuaqi commented 2 months ago

There is also a quick guide here https://github.com/Nuclei-Software/nuclei-linux-sdk/issues/13 attached with run log

fanghuaqi commented 2 months ago

For your case, I think this is wrong

# build project just follow https://github.com/Nuclei-Software/nuclei-linux-sdk#show-help in each branch
# run qemu for SOC=evalsoc CORE=ux900fd
make run_qemu # wrong
make SOC=evalsoc CORE=ux900fd run_qemu # correct
fanghuaqi commented 2 months ago

Other people already repeat it, see https://github.com/Nuclei-Software/nuclei-linux-sdk/discussions/16

swidi commented 2 months ago

Wonderful. make SOC=evalsoc CORE=ux900fd run_qemu # correct was indeed the solution. Thank you!