Permission denied error when adding packge to ISO

DKMS compiles the module for the kernel and the build environment is not prepared for that I assume.

Edit 2025-04-14: build image process is working again. Editing below instructions

And now the little how-to:

Have a look in vyos-build/scripts/package-build/linux-kernel, there are a few scripts to compile the kernel and additional modules. There is a Python script to compile the Realtek 8152 driver. I added the r8126 driver in similar fashion.

All the necessary changes are pushed to GitHub - boretom/vyos-build at feature/add-realtek-8126 . git cherry-pick or git rebase should work fine.

It downloads the driver archive from my site (unmodified archive) since you have to solve a riddle to be able to download it from Realtek. I’m sure that’s not legal (maybe it is) but maybe ok for testing.

## checkout vyos-build, checkout branch current
## skip this step if you already have it checked-out
$ git clone --single-branch --branch current https://github.com/vyos/vyos-build
$ cd vyos-build
## add my r8126 repo and fetch it
$ git remote add boretom https://github.com/boretom/vyos-build
$ git fetch boretom
## git cherry-pick the latest from the `feature/add-realtek-8126` branch
## add `-n` to `cherry-pick` to _not_ commit the changes to your local git repo
## but just have them in the working copy. 
$ git cherry-pick -n boretom/feature/add-realtek-8126
## fire up the build docker image however you like
## change into the linux-build package build directory
vyos_bld@...:/vyos$ cd scripts/package-build/linux-kernel
## build the kernel and the Realtek 8126 module
vyos_bld@...:/vyos/scripts/package-build/linux-kernel$ ./build.py --config package.toml --packages linux-kernel realtek-r8126
## copy the resulting `*.deb` file from this directory into /vyos/packages

The resulting kernel and module are signed. If you make changes to the kernel and/or compile it again, the keys may change (not sure) and you would have to rebuild the module.

Edit: Had a brain outage, corrected the above steps.
A side-note about building the Realtek module: it should be possible to build the kernel and the driver in one go, like:
removed the result of the brain outage…
But the code in ./build.py does after all just run build-realtek-r8126.py, running it manually is fine.

1 Like