cva6-sdk icon indicating copy to clipboard operation
cva6-sdk copied to clipboard

Add application to the rootfs

Open mathmax12 opened this issue 6 years ago • 8 comments

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?

mathmax12 avatar Oct 11 '19 07:10 mathmax12

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.

Moschn avatar Oct 11 '19 09:10 Moschn

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 .

mathmax12 avatar Oct 11 '19 17:10 mathmax12

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.

Moschn avatar Oct 14 '19 07:10 Moschn

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?

mathmax12 avatar Oct 14 '19 23:10 mathmax12

Your process seems to be correct.

Can you post your bbl file?

Moschn avatar Oct 15 '19 15:10 Moschn

Thanks. Here it is:

bbl.zip

mathmax12 avatar Oct 15 '19 22:10 mathmax12

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

Moschn avatar Oct 16 '19 07:10 Moschn

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.

mathmax12 avatar Oct 16 '19 17:10 mathmax12