How to compile stuff (in my case Wifi module) on the VF2?

Hello all,

my experiences with this WIFI key -

Dowloaded libc, image, headers and firmware from Damian’s Github location.
Firmware went into the correct location and the other stuff above was installed with dpkg.

Reboot (with the wifi inserted), dead in the water, no screen, mouse etc.
Reboot without wifi key, everything seems to be fine.
Insert wifi key and then the wierdness starts, see attached ring buffer extract.

Anyone any ideas?

Aubrey
Kernel_Auszug.txt (19.0 KB)

Hello Aubrey,

Glad you could get the board booting for you!

I had similar dmesg output as i tried to use the precompiled kernel and modules

In the end i ended up compiling my own kernel and the wifi module.

Now it loads but does not connect. But i guess this is because its made for Wifi6 and im still useing 2.4 ghz. Maybe some settings are missing or something.

I’m still trying to get this to work but in the meantime i compiled support in it for an EDIMAX Wifi module (used heavily with the Raspi) and this works for me now as a temp solution.

I made a guide for me.
Its a bit rough but useable. Basicly just do all the commands from top to bottom.

PS: you can also try downloading and useing my kernel. Its in the Repo.

Thanks Manux for the tips.
I am trying to avoid compiling anything on this small machine for obvious reasons.
I would prefer to wait until the kernel binaries and the firmware blobs for the wifi stick ( ESWIN 6600U) are ready for plug and play operation.
I have done a lot of kernel compiles on RPI4B machines before, not a pretty thing. Nevermind the environment and energy used.

Aubrey

To be honest the compile was quite fast with around 1 hour. Downloading the kernel takes more time…

1 Like

That’s one way of seeing it, but for this kind of new and exotic system it makes everything very difficult, because most features need patches to run properly. In time it will not be a problem anymore, but right now it’s still bleeding edge.

I compiled the kernel again earlier with a few config changes (DVB disabled, network bridging, IPv6, and BTRFS enabled) and it actually took less than half an hour:

time sh -c "mount /boot; make -j4 && make modules_install && cp arch/riscv/boot/Image.gz /boot/boot/Image_5.15.0.gz"
...
sh -c   6003.75s user 328.50s system 385% cpu 27:24.17 total
3 Likes

hello;
a quick feedback from my experience and steps to use wifi dongle ESWIN 6600U (option proposed on Kickstarter along the VisionFive2 board) :
From forum topics, I understood i need to re compile first the kernel 5.15.0 and then the Wfifi USB dongle driver from sources, so finally i followed the clear steps from (Chinese) page : Wifi dongle tutorial use
(You just have to follow the part for this dongle). You can use Chrome to translate that page and see clear steps.
I first got the error of “invalid format” at first attemps to load the driver wlan_ecr6600u_usb.ko after compil because i did not first install and use the freshly recompiled kernel … but as soon as i was booting on that kernel the load of the driver using insmod cmd worked perfectly, and was connected on WIFI 2.4 GHZ with no problem.
Also, i used exactly the same command to compile the kernel AND to compile the USB driver (in the chinese page, compil is invoked using "make CROSS_COMPILE=riscv-linux-gnu- ARCH=riscv " and defnitely forgeting this while compiling the WIFI module later resulted in a warning saying i was not using the same compiler as for the kernel…
Also, i compiled on the board, BOTH the kernel and the wifi driver.
For the moment i still have to load manually the driver after each boot (no yet succeeded to make it auto loading even after copying wlan_ecr6600u_usb.ko to /lib/modules/5.15.0/ (as 5.15.0 is the kernel i use) and added wlan_ecr6600u_usb into /etc/modules ).
I hope this could help anyone trying to set up the WIFI module.

Normally a modified

/etc/modules-load.d/modules.conf

which contains

wlan_ecr6600u_usb

and a following

sudo depmod

should do its job.

Anybody an idea to recompile

jpu
vdec
venc

can be done?

1 Like

Hello there :wave:

I’m running the starfive-jh7110-202306-SD-minimal-desktop image, running with the Linux starfive 5.15.0-starfive #1 SMP Sun Jun 11 07:48:39 UTC 2023 riscv64 GNU/Linux kernel.

I’m trying to build a WiFi kernel module for my USB dongle, but I can’t get it to compile.

I’ve cloned the Linux kernel repo, checked out the 5.15.0 kernel, and ran make -j$(nproc) headers_install.
I know I should have gotten the authentic kernel sources for the board, and/or a package, but I haven’t been able (yet) to find them.

I may have failed at various levels for this one…

 sudo ./install-driver.sh
[sudo] password for user:
: ---------------------------
: install-driver.sh v20230227
: riscv64 (architecture)
: 4/4 (in-use/total processing units)
: 8116020 (total system memory)
: 5.15.0-starfive (kernel version)
: gcc (Debian 12.2.0-10) 12.2.0
: dkms-3.0.9
: ---------------------------

Checking for previously installed drivers.
: ---------------------------

Starting installation.
Installing 8821cu.conf to /etc/modprobe.d
The dkms installation routines are in use.
Copying source files to /usr/src/rtl8821cu-5.12.0.4
Creating symlink /var/lib/dkms/rtl8821cu/5.12.0.4/source -> /usr/src/rtl8821cu-5.12.0.4
The driver was added to dkms successfully.
: ---------------------------
Sign command: /lib/modules/5.15.0-starfive/build/scripts/sign-file
Binary /lib/modules/5.15.0-starfive/build/scripts/sign-file not found, modules won't be signed

Building module:
Cleaning build area...
./dkms-make.sh...(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.15.0-starfive (riscv64)
Consult /var/lib/dkms/rtl8821cu/5.12.0.4/build/make.log for more information.
An error occurred. dkms build error:  10
Please report this error.
Please copy all screen output and paste it into the problem report.
Run the following before reattempting installation.
$ sudo ./remove-driver.sh

Can anyone spot the most obvious error I have made?

Thanks.

That files does not exist, so the install script is looking to sign the module.but it can not because there is no file to sign the module.

I speed read the `install-driver.sh script. And the logic looks fine:

In my mind it should not be attempting to sign the module unless three conditions are satisfied.

  1. You are not booting up using U-Boot, you are in fact booting up using EDK II
  2. Within UEFI EDK II secure boot is enabled
  3. Within the OS some command like “sudo apt install mokutil -y” was ran ?

What is the output for the following on your machine (if you have mokutil installed) ?

$ mokutil --sb-state
EFI variables are not supported on this system

(The Above is what is returned on mine)

Does the output on your machine mention the word “enabled”

If it returns the keyword “enabled” then you have five options:

  1. Find somewhere in UEFI EDK II, where secure boot is enabled and disable it.
  2. Change from UEFI EDK II back to Das U-Boot
  3. sudo apt remove mokutil
  4. Edit/Hack “install-driver.sh” and remove/disable the parts that use mokutil
  5. recompile EVERYTHING, the kernel and every module to support secure boot. Here would be a good place to start reading.

EDIT: Thinking about it more you could always just generate a signature file to allow that one module to be signed. And since the kernel was not compiled to support signing it would just load the signed module anyhow, ignoring the signature altogether.

user@starfive:~$ zgrep -i CONFIG_MODULE_SIG /proc/config.gz
# CONFIG_MODULE_SIG is not set

Thanks @mzs for your help. :pray:

mokutil --sb-state
EFI variables are not supported on this system
zgrep -i CONFIG_MODULE_SIG /proc/config.gz
# CONFIG_MODULE_SIG is not set

Now I am confused. and if you sudo apt remove mokutil, will it compile. The script appears to say that if it can not find mokutil, that it will not attempt to sign the kernel module.

Maybe edit the first line of the script and change it from:
#!/bin/sh
to
#!/bin/sh -x
( -x xtrace Write each command to standard error (preceded by a '+ ') before it is executed. Useful for debugging.)

And paste the full output to https://paste.ee and post a link here.

I’m afraid I get the same result:

sudo ./install-driver.sh 
: ---------------------------
: install-driver.sh v20230227
: riscv64 (architecture)
: 4/4 (in-use/total processing units)
: 8116020 (total system memory)
: 5.15.0-starfive (kernel version)
: gcc (Debian 12.2.0-10) 12.2.0
: dkms-3.0.9
: ---------------------------

Checking for previously installed drivers.
rtl8821cu/5.12.0.4: added
: ---------------------------

Removing a dkms installation.
Deleting module rtl8821cu-5.12.0.4 completely from the DKMS tree.
Removing 8821cu.conf from /etc/modprobe.d
Removing source files from /usr/src/rtl8821cu-5.12.0.4
Removal complete.
: ---------------------------

Starting installation.
Installing 8821cu.conf to /etc/modprobe.d
The dkms installation routines are in use.
Copying source files to /usr/src/rtl8821cu-5.12.0.4
Creating symlink /var/lib/dkms/rtl8821cu/5.12.0.4/source -> /usr/src/rtl8821cu-5.12.0.4
The driver was added to dkms successfully.
: ---------------------------
Sign command: /lib/modules/5.15.0-starfive/build/scripts/sign-file
Binary /lib/modules/5.15.0-starfive/build/scripts/sign-file not found, modules won't be signed

Building module:
Cleaning build area...
./dkms-make.sh...(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.15.0-starfive (riscv64)
Consult /var/lib/dkms/rtl8821cu/5.12.0.4/build/make.log for more information.
An error occurred. dkms build error:  10
Please report this error.
Please copy all screen output and paste it into the problem report.
Run the following before reattempting installation.
$ sudo ./remove-driver.sh

The log file contains:

DKMS make.log for rtl8821cu-5.12.0.4 for kernel 5.15.0-starfive (riscv64)
Mon Jul 31 19:33:44 UTC 2023
make ARCH=riscv64 CROSS_COMPILE= -C /lib/modules/5.15.0-starfive/build M=/var/lib/dkms/rtl8821cu/5.12.0.4/build  modules
make[1]: Entering directory '/usr/src/linux-5.15.0-starfive'
make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory '/usr/src/linux-5.15.0-starfive'
make: *** [Makefile:2501: modules] Error 2

My /usr/src/linux-5.15.0-starfive dir may not contain what the script is looking for… :thinking:

Here is a cheat, edit the Makefile and change this line from “sign install” to be “install” and then run the script :slight_smile:

So even when told to sign the kernel module it will not, it will just generate a normal module

2 Likes

Thanks a lot for your insights.
Unfortunately, it did not work for me.
I think I do have a problem with the way the kernel headers are installed. :person_shrugging:

1 Like