Building and installing a different kernel

Hello,

I have a driver that requires a kernel version below 5.8. Apparently something changed in the kernel above that version, causing the driver not to work with later versions.

I can build the kernel version 5.8 on the device (which is NanoPi NEO3). The problem I ran into is installing and having the DietPi boot with that kernel version (so that I can use the driver).

When i use the dpkg -i to install the newly built kernel image package, nothing happens. The unit still boots with the original kernel version.

How do I install the new kernel version, so that the DietPi boots with that version?

could you recompile the driver to the new/current dietpi kernel version?

Might see if DKMS might build the module for you (you would need the prerequisites of course for module/kernel building)
KernelDKMS - Debian Wiki

Building Linux Packages For Kernel Drivers! (dkms howto) | xkyle.com

Just to avoid a misunderstanding. DietPi do not have own kernel versions. We use the kernel provided by the base image. And this depends on base image used.

I can recompile the driver (in fact, it needs compiling as it uses kernel headers) but it doesn’t work properly… It’s a known problem, that it doesn’t work properly with kernel versions above 5.8.

And I have the kernel version 5.8 compiled on the device, but I can’t install it the regular way… Apparently DietPi uses different boot scripts/technique, so my question is what do I need to do (edit) to have the DietPi use my compiled kernel image?

@MichaIng can you have a look

as Joulinar said…stock kernels are used…so there should be a way to downgrade to an older kernel…it might cause other apps to have issues if they were designed/built for the newer kernels however

How to downgrade a linux kernel on Debian (okturtles.org)
There has to be plenty of howto’s on downgrading for standard debian distro’s which Dietpi is built around

@WarHawk The problem is that it’s not enough. The last step (grub update) updates grub with new images, but the DietPi doesn’t boot from them. The DietPi boot scripts are different than on standard Debian, so there’s more to be done, but I don’t know what exactly…

On the Neo3, we use Armbian as base image and there should be no grub bootloader at all.

I’m sure you’re right and possibly one of the reasons why the procedure suggested by WarHawk, or installing compiled kernel image with dpkg -i, doesn’t work… DietPi still boots with the original kernel version.

I just searched a little bit, since I’m interested in the topic, but I have no armbian device to test nor experience with downgrading kernel at all.
“Normally” armbian-config is recommended to downgrade the kernel, at least this is the common answer in armbian forums. But I have no clue how this will interact with DietPi.
It should be available via apt on armbian systems, I think.,

ah yeah…armbian boots from u-boot, not 100% certain how to rebuild a kernel or roll back on a u-boot device like that

possibly might build on an armbian build
Building Armbian - Armbian Documentation

Wish I could help more

I would really like to use DietPi, as I find it more optimized and lightweight, than Armbian…

At the end DietPi is not an own operating system. It’s a set of bash script on top of a base image. In your case Armbian is used as base.

1 Like

I believe if you build Armbian server [non desktop] for your board with the bullseye distro/kernel (not sure how to build with the last 5.8.18 kernel[last 5.8 version before they moved to 5.9]) then run the dietpi if it would convert it without issues…I know it did work with a few of the orange pi images I made a while back

I did just compile the latest Armbian for Orange Pi R1+ LTS tonight on my laptop in Virtualbox at work…it does compile, but I pretty much did stock everything across the board, like I said, didn’t try to change it to an older kernel

as stated above, best is to ask @MichaIng on this

I believe if you build Armbian server [non desktop] for your board with the bullseye distro/kernel (not sure how to build with the last 5.8.18 kernel[last 5.8 version before they moved to 5.9]) then run the dietpi if it would convert it without issues…

I tried that already, but in the process it either upgraded the kernel or downloaded the new one…

Thanks @Joulinar

So @MichaIng, can you provide some input on how to make the DietPi boot with the compiled kernel image?

I would really like to make this work…

Ah yeah…it more than likely put the latest and greatest “stock” kernel on the conversion when the script runs…didn’t think of that

Can you show:

ls -l /boot
cat /boot/armbianEnv.txt
cat /boot/boot.cmd

The paths to the Linux image, device tree and initramfs need to be changed in /boot/boot.cmd, and everything related to device tree overlays needs to be removed (unless your kernel build contains some). Then it needs to be compiled to /boot/boot.scr.

In case something goes wrong, do you have another system where you can access this systems ext4 filesystem to restore the original state?