Compiling and installing Kernel to install 3rd party wifi dongle RTL8822bu (D-Link DWA-182)

Hello there,
Im trying to compile a new kernel for my brand new visionfive 2 board but ends up failed. This is the steps i taken to install the kernel, i followed the official documentation for visionfive 2 board as well as this tutorial by HonestQiao 星光2之USB无线网卡使用教程【新增RTL8832AU WiFi6双频无线网卡】.

1: Flashing sd card


i downloaded the image from this onedrive (debian.starfivetech.com) located inside the sd folder and flash it to my sd card using balena etcher, all works well. I use two version of the os which is 202311 (first try) and 202405 (second try) which both failed.

  1. After flashing the card, i insert the sd card into the visionfive 2 board and turned it on, seems well also.

  2. Extend partition on SD Card
    This part also seems to work well.

  3. Install packages


    I used the above commands to install the packages. The output however i forgot to screenshot but it seems to work well.

  4. Prepare Environment
    After done installing the packages, i straight go to the tutorial by HonestQiao to which firstly ask me to prepare the environment by installing useful resources/tools.

From the commands above, i got this output:

  1. Compile basic kernel


    From the commands above, i got the output more or less like HonetsQiao’s output but longer, about 45min. However i didnt capture the result.

  2. Next is i follow these commands:
    time make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv -j4

make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv INSTALL_PATH=~/repos/compiled/ zinstall -j4

ls -lh arch/riscv/boot/Image.gz arch/riscv/boot/dts/starfive/jh7110-visionfive-v2*.dtb ~/repos/compiled/

Here is my output:


As you can see here, the output is quite different from HonestQiao’s one.

  1. But i still proceed with the next command:
    sudo mkdir /boot/boot/dtbs/new
    sudo mkdir /boot/boot/dtbs/new/starfive
    sudo cp arch/riscv/boot/dts/starfive/jh7110-visionfive-v2*.dtb /boot/boot/dtbs/new/starfive/
    sudo cp -r arch/riscv/boot/dts/starfive/vf2-overlay /boot/boot/dtbs/new/starfive/
    sudo cp ~/repos/compiled/vmlinuz-5.15.0_for_HonestQiao /boot/boot/vmlinuz-5.15.0_for_HonestQiao
    tree /boot/boot/dtbs/new/

to get this output:

this is the content inside my arch/riscv/boot/dts/starfive:

i replaced some of the commands following the naming convention of the files inside my board.

  1. And lastly, after editing the /boot/extlinux/extlinux.conf as below:

or


(Note: first image is first try and second image is second try)

and restarting to install the kernel, here is what shown on screen:
first try:

second try:

(Note: for second try my tree /boot/dtbs/new/ looks like below)

What did i do wrong? The reason i build the kernel is to install a third party wifi dongle RTL8822bu (D-Link DWA-182), by following the steps provided above by nugu53 in 【Good news】I successfully use five wireless dongles of 4 chips on VisionFive 2 - #9 by danielktdoranie but i still couldnt manage to do it. Can anyone please help me please… :dizzy_face:

Try to re-generate a new initrd.img .
Or , you can try remove the initrd line in extlinux.conf.

PS:

??? /boot/boot/ ??? :face_with_raised_eyebrow:

1 Like

Will try it soon. Hope it will run smoothly.

For the /boot/boot/dtbs/new, so sorry i put it wrong. I copy paste directly from the tutorial by HonestQiao, i actually used “sudo mkdir /boot/dtbs/new” command

Hello there, its been quite some time. Just found some free time to do this. So, I followed your suggestion to remove the initrd line from extlinux.conf. like picture below:

I also copied some more dtb files from the downloaded linux folder from Github (GitHub - starfive-tech/linux) to /boot/dtbs/new/starfive following the content inside the existing /boot/dtbs/5.15.0/starfive:

After done all and reboot the system, i still got the same error:

I think its quite complicated to build the new kernel and install it. Is there a possible way to install 3rd party WIFI module, specifically for RTL8822bu (D-Link DWA-182) without installing new kernel? maybe used the existing kernel?

Where is the system installed? It is seems filesystem have some issue.
Because you are removed initrd, the output is all run with rootfs.

Or , the filesystem issue is procfs/sysfs/tmpfs ? Your kernel config have some wrong.
Are all modules in /lib/modules/<version> directory?

Try ctrl+F2/F3/F4 to switch tty. If it work, you will got a cli login prompt.

Am I understanding correctly, that you are compiling the kernel ON the Visionfive 2? If so, I’d like to point out, that the guide you’re following seems to be on cross compiling the kernel from a non-riscv PC. That onto itself shouldn’t be an issue (i think), but maybe the guide makes the implicit assumption that you are not on a riscv device somewhere, that leads to an issue.
I’m sorry, I cannot verify that for myself, as I (sadly) cannot read Chinese.

I’m only doing it because I want to use a 3rd party Wi-Fi dongle [RTL8822bu (D-Link DWA-182) on the VisionFive 2 board itself as I didn’t manage to get the official WIFI dongle. Do you have any idea on doing it other than cross compiling the kernel?

You can actually translate the page to English for better understanding. Right click on the page and select translate to English (that’s what I did), and it will look something like this:

Sadly, Firefox does not have that nifty translation feature, and Google Translate’s dedicated page translator reports the page as private…

As for how to do this (if you’re not cross compiling), the steps are usually

  • make menuconfig to configure
  • make to compile the kernel
  • sudo make modules_install to install the modules
  • sudo make install to install the kernel
  • regenerate the initramfs with something like dracut or mkinitcpio
  • adjust the extlinux.conf file

But I assume this doesn’t really help you much as that is probably what the guide told you to do. Going through the guide, I did notice he’s likely running on the VF2 aswell (by the honestqiao@starfive bash prompt), so my original guess is likely not an issue…