sipeed / LicheeRV-Nano-Build

LicheeRV-Nano-Build
88 stars 32 forks source link

GPL compliance: please, provide sources for kernel modules #40

Open krasin opened 1 month ago

krasin commented 1 month ago

Hi LicheeRV Nano team,

thank you for working on supporting this great board!

I am currently trying to get a camera-based solution developed on LicheeRV Nano, and I need to debug kernel modules, in particular, soph_jpeg.ko. Unfortunately, it's only included in the binary form in this repository: https://github.com/sipeed/LicheeRV-Nano-Build/tree/main/osdrv/interdrv/v2/jpeg/phobos_riscv

Can you please provide a link to the sources for this kernel module and the instruction to build it?

Thank you in advance!

krasin commented 1 month ago

My best answer to this question:

  1. No chance of getting sources for the kernel drives posted in this repo.
  2. LicheeRV Nano and MilkV Due 256m are closely related, and there's a lot of progress on getting open source drives in the v2 version of buildroot for MilkV: https://github.com/milkv-duo/duo-buildroot-sdk-v2/tree/develop/osdrv/interdrv/v2/jpeg

Unfortunately, this new version does not work yet (even for MilkV) and then it will take Sipeed time to get these advancements available for LicheeRV Nano.

scpcom commented 4 weeks ago

The driver sources can also be found on the chip vendors git: https://github.com/sophgo/osdrv/tree/sg200x-dev/interdrv/v2/cvi_vc_drv https://github.com/sophgo/osdrv/tree/sg200x-dev/interdrv/v2/jpeg I already successfully integrated them into LicheeRV Nano Build but need to test them before I can say if they work. Did you test the drivers yourself or do you have a link which describes the problem?

krasin commented 4 weeks ago

Thank you so much for your response! I will give them a try.

For some context, I am looking to synchronize multiple LicheeRV Nano cameras together (as best as I could) to record volumetric videos, and that requires a little more tight control over what happens in the camera path.

scpcom commented 1 week ago

Here is the result of my work: https://github.com/sipeed/LicheeRV-Nano-Build/pull/45 It is backward compatible to existing projects. I successfully tested it with NanoKVM lite and full. Next step is testing it with LicheeRV Nano W(E) and camera module if it arrives.

scpcom commented 1 day ago

I tested it now with gc4653 camera module on LicheeRV Nano W(E). I reverted some changes and kept only the source of cvi_vc_drv and jpeg itself and minimal header changes.

I could not find any rtsp demo/sample that works with gc4653, the samples from the current unmodified image did not work.

So I decided to replace pre-built middleware/v2/sample/test_mmf/libmaix_mmf.a with the code found here: https://github.com/sipeed/LicheeRV-Nano-Build/blob/20240515/middleware/v2/sample/test_mmf/sophgo_middleware.c The older version can also be found here: https://github.com/sipeed/MaixCDK/blob/main/components/3rd_party/sophgo-middleware/sophgo-middleware/v2/sample/vio/sophgo_middleware.c The enhanced cpp version is also based on this: https://github.com/sipeed/MaixCDK/tree/main/components/maixcam_lib

There are three places with hardcoded pixel format, I needed to change it to NV21 for gc4653: https://github.com/scpcom/LicheeRV-Nano-Build/commit/20ae1a99def5e1cd1c305c6391323adc4ff8eeac

The updated samples are here: https://github.com/scpcom/LicheeRV-Nano-Build/tree/middleware-maix_mmf camera to jpg file (working headless): /mnt/system/usr/bin/test_mmf 4 camera to h265 rtsp (working headless): /mnt/system/usr/bin/test_mmf 10 camera to h265 rtsp and vo (works only with oled attached, crashes the whole system if not): /mnt/system/usr/bin/test_mmf 12

All together here: https://github.com/scpcom/LicheeRV-Nano-Build/tree/develop

krasin commented 1 day ago

Thank you, @scpcom! I confirm that I can build an image using your repository (https://github.com/scpcom/LicheeRV-Nano-Build/tree/develop) and it boots.

Unfortunately, RNDIS is broken recently (last time it worked was around https://github.com/sipeed/LicheeRV-Nano-Build/commit/378a06730f37ed319eccc09bc748c96683cdd275), and I don't currently have a USB-Serial dongle around. Once I have it, I will try to connect through the serial console and check if everything (modulo RNDIS) is working.

Thanks again for working on this!