openhwgroup / cva6-sdk

CVA6 SDK containing RISC-V tools and Buildroot
60 stars 65 forks source link

Add application to the rootfs #25

Open mathmax12 opened 5 years ago

mathmax12 commented 5 years ago

Hi, I tried to add an application to the rootfs, by doing which when the Linux system boot up the binary file of the application can be found and executed.

I notice the Line 92 in Makefile gives such an example.

So after compiled my application with riscv64-unknown-linux-gnu-gcc I got a binary file. Then I copied this binary file to the ./rootfs, which is used to overlay the rootfs generated in the Buildroot.

After run the ""make vmlinux" and "make bbl.bin" I got bbl. But after the linux OS boot up using this bbl, I can not find the binary file that I put to the rootfs. However, the tetris and cachtest are in the system.

Did I do something wrong?

Moschn commented 5 years ago

Your steps should work... did you run make clean before? maybe he uses a cached rootfs.cpio

If you want to put your own executable onto the fpga you could also just put it into the second partition of the FPGA. The second partition should get mounted on boot.

mathmax12 commented 5 years ago

I am booting from the flash. I checked the buildroot/output/images/rootfs.cpio generated from buildroot. I can see my application is there sdf But after the bbl used for the system booting, I didn't find that application in the system on ariane: sadf .

Moschn commented 5 years ago

Are you sure you are booting the correct bbl? If you want you could boot your vmlinux using spike or qemu and then check there if your executable is there. I suspect that somehow you are not booting the correct image.

mathmax12 commented 5 years ago

The correct bbl is used. Confirmed that! I wonder the process of adding a new application to the rootfs is

  1. cross-compile the application go generate the binary file
  2. copy the binary file to the roofs which will be used to overlay the rootfs from the Buildroot.

Do we need anything else?

Moschn commented 5 years ago

Your process seems to be correct.

Can you post your bbl file?

mathmax12 commented 5 years ago

Thanks. Here it is:

bbl.zip

Moschn commented 5 years ago

You seem to have made multiple changes to the build image. I cannot boot it in qemu or spike. It hangs at ifconfig: SIOCSIFHWADDR: No such device.

I know that the flow in this repo did not work for you before but I cannot really help you with the lowrisc flow. I am preparing an update to the ariane-sdk repo though so maybe it will work then

mathmax12 commented 5 years ago

The bbl that I send to you gave me the same issue hangs at ifconfig: SIOCSIFHWADDR: No such device. But I am sure the enthernet is fine. After I add the crossed-compiled binary file to the rootfs, which is used to overlay the rootfs from buildroot, there will be such an issue. But after I removed the binary file then it will work.

Ok I will try with the new one. Thanks.