NovKernel 6.12.y (for uConsole CM5) - #178

Custom Kernel for uConsole CM5


The goal of this kernel is implement pm_suspend mode
and performance improvement functions.

Working

  • Wireless
    • WiFi
    • Bluetooth
  • RP1 Audio
  • Display
    • Panel
    • Backlight
  • Interface
    • HDMI
    • USB
  • Power
    • Charging (w/ led)
    • Battery Monitor

Not working

  • Force off (wip)
  • 4G LTE Expansion

Kernel Feature

  • Transparent huge page Enabled
6 Likes

I had tested with @Rex 's Bookworm image

Installation


1. Update EEPROM for CM5 Lite

$ sudo rpi-eeprom-update
$ sudo rpi-eeprom-config -e

[all]
BOOT_UART=1

# Switch off PMIC outputs on HALT
POWER_OFF_ON_HALT=1

# Try boot on SDCard repeatly
BOOT_ORDER=0xf1
SD_BOOT_MAX_RETRIES=2

# Slow down SDCard SDR Mode on bootloader (IMPORTANT to boot into linux)
SD_QUIRKS=1

2. Update config.txt (Make sure it is correct) – IMPORTANT

$ sudo nano /boot/firmware/config.txt # or any editor

[cm5]
dtoverlay=clockworkpi-uconsole-cm5
dtoverlay=vc4-kms-v3d-pi5,cma-384
dtparam=pciex1=off
dtoverlay=audremap-pi5,pins_12_13
dtparam=drm_fb0_rp1_dsi1
initial_turbo=0

[all]
ignore_lcd=1
max_framebuffers=2
disable_overscan=1
display_auto_detect=0
dtoverlay=dwc2,dr_mode=host
dtparam=ant2

3-a. Install kernel (Debian)

$ sudo dpkg -i ./novkernel-*.deb
# `/boot/firmware.version.bak` as backup every installation

3-b. Install kernel (Manual)

$ tar -xzvf novkernel-6.12.17-v8-16k-nov_169.tar.gz
$ sudo ./install.sh

Remove unused Package (if you use rex’s bookworm old version)

sudo apt remove clockworkpi-backlight
4 Likes

ChangeLog


Source


Download


CAUTION

I don’t guarantee your data. Be sure to back up the data before installing. You must have knowledge of kernel installation and recovery.

2 Likes

Todo list (Number is priority)


  1. Suspend to RAM (include wakeup interrupt)
  2. Force power off behavior (may be hardware restrictions, in my opinion)
  3. USB new device reset behavior
2 Likes

great idea!

this is reserved post too.

1 Like

#159

Full Changelog : nov-108…nov-159

1 Like

You can add a uconsole group ID to a post.:blush:

1 Like

Oh I forgot it Thank you!

When I install this deb file, my system get’s angry that I’m uninstalling the following:

┌──(root㉿cpi-kali)-[/home/kali]
└─# apt install ./novkernel-6.12.17-v8-16k-nov_159.deb
Note, selecting 'novkernel-6.12.17-v8-16k-nov' instead of './novkernel-6.12.17-v8-16k-nov_159.deb'
Installing:
  novkernel-6.12.17-v8-16k-nov

REMOVING:
  clockworkpi-cm-firmware  clockworkpi-kernel  linux-libc-dev

Summary:
  Upgrading: 0, Installing: 1, Removing: 3, Not Upgrading: 186
  Download size: 0 B / 48.6 MB
  Freed space: 10.8 MB

which then results in my apt being broken as linux-libc-dev is apparently needed to do anything

┌──(root㉿cpi-kali)-[/boot]
└─# dpkg -i ./novkernel-6.12.17-v8-16k-nov_159.deb
dpkg: regarding .../novkernel-6.12.17-v8-16k-nov_159.deb containing novkernel-6.12.17-v8-16k-nov:
 novkernel-6.12.17-v8-16k-nov breaks linux-libc-dev
  linux-libc-dev (version 6.12.13-1kali1) is present and installed.

dpkg: error processing archive ./novkernel-6.12.17-v8-16k-nov_159.deb (--install):
 installing novkernel-6.12.17-v8-16k-nov would break linux-libc-dev, and
 deconfiguration is not permitted (--auto-deconfigure might help)
Errors were encountered while processing:
 ./novkernel-6.12.17-v8-16k-nov_159.deb

┌──(root㉿cpi-kali)-[/boot]
└─# apt install ./novkernel-6.12.17-v8-16k-nov_159.deb
Note, selecting 'novkernel-6.12.17-v8-16k-nov' instead of './novkernel-6.12.17-v8-16k-nov_159.deb'
Installing:
  novkernel-6.12.17-v8-16k-nov

REMOVING:
  linux-libc-dev

Summary:
  Upgrading: 0, Installing: 1, Removing: 1, Not Upgrading: 186
  Download size: 0 B / 48.6 MB
  Freed space: 10.8 MB

Continue? [Y/n]

1 Like

can you try to remove novkernel-6.12.17-v8-16k-nov first then install ?

I fresh installed Kali and then tried this kernel when I got the above error

I also tried previously on debian but also got the same error and assumed it was from running your earlier kernel builds, but it persists on Kali.

┌──(root㉿cpi-kali)-[/boot]
└─# apt remove novkernel-6.12.17-v8-16k-nov
Package 'novkernel-6.12.17-v8-16k-nov' is not installed, so not removed
You might want to run 'apt --fix-broken install' to correct these.
Unsatisfied dependencies:
 libc6-dev : Depends: linux-libc-dev but it is not going to be installed
Error: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
┌──(root㉿cpi-kali)-[/boot]
└─# apt --fix-broken install
Correcting dependencies... Done
Installing dependencies:
  linux-libc-dev

Summary:
  Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 186
  Download size: 2,515 kB
  Space needed: 10.8 MB / 39.5 GB available

Continue? [Y/n]
Get:1 http://kali.download/kali kali-rolling/main arm64 linux-libc-dev all 6.12.13-1kali1 [2,515 kB]
Fetched 2,515 kB in 0s (8,055 kB/s)
Selecting previously unselected package linux-libc-dev.
(Reading database ... 443589 files and directories currently installed.)
Preparing to unpack .../linux-libc-dev_6.12.13-1kali1_all.deb ...
Unpacking linux-libc-dev (6.12.13-1kali1) ...
Setting up linux-libc-dev (6.12.13-1kali1) ...
1 Like

Ok hold on i fixing this issue now. I need to change package dependency.

1 Like

I think Kali might be a bad choice for testing this kernel, there’s no /boot/firmware/, only /boot/*

┌──(root㉿cpi-kali)-[/boot]
└─# ls
bcm2710-rpi-2-b.dtb       bcm2712-rpi-500.dtb         config.txt        LICENCE.broadcom
bcm2710-rpi-3-b.dtb       bcm2712-rpi-5-b.dtb         config.txt.bak    novkernel-6.12.17-v8-16k-nov_159.deb
bcm2710-rpi-3-b-plus.dtb  bcm2712-rpi-cm5-cm4io.dtb   firmware.159.bak  overlays
bcm2710-rpi-cm3.dtb       bcm2712-rpi-cm5-cm5io.dtb   fixup4cd.dat      start4cd.elf
bcm2710-rpi-zero-2.dtb    bcm2712-rpi-cm5l-cm4io.dtb  fixup4.dat        start4db.elf
bcm2710-rpi-zero-2-w.dtb  bcm2712-rpi-cm5l-cm5io.dtb  fixup4db.dat      start4.elf
bcm2711-rpi-400.dtb       bcm2837-rpi-3-a-plus.dtb    fixup4x.dat       start4x.elf
bcm2711-rpi-4-b.dtb       bcm2837-rpi-3-b.dtb         fixup_cd.dat      start_cd.elf
bcm2711-rpi-cm4.dtb       bcm2837-rpi-3-b-plus.dtb    fixup.dat         start_db.elf
bcm2711-rpi-cm4-io.dtb    bcm2837-rpi-cm3-io3.dtb     fixup_db.dat      start.elf
bcm2711-rpi-cm4s.dtb      bcm2837-rpi-zero-2-w.dtb    fixup_x.dat       start_x.elf
bcm2712d0-rpi-5-b.dtb     bootcode.bin                kernel_2712.img
bcm2712-d-rpi-5-b.dtb     cmdline.txt                 kernel8.img

┌──(root㉿cpi-kali)-[/boot]
└─# ls /boot/firmware.159.bak
overlays

┌──(root㉿cpi-kali)-[/boot]
└─#

when installing the novkernel.deb I also saw this

Preparing to unpack .../novkernel-6.12.17-v8-16k-nov_159.deb ...
cp: cannot stat '/boot/firmware/bcm2837-rpi-zero-2-w.dtb': No such file or directory
1 Like

oh… I didn’t even think that. I need to make a package even if it’s not common. I’ll add a new package later. Thank you!

1 Like

Also, do you have a buymeacoffee or something? I wanna support you if possible :slight_smile:

1 Like

Not yet, I’ll add the link later :slight_smile:

3 Likes

#171
Full Changelog : nov-159…nov-171

  • Merge raspberrypi/linux
  • Add manual installer for non-debian distro
  • Fix dependency for debian package
    • if there’s no /boot/firmware directory then use the manual installer. for a while.

Looking at your commits you have put a large amount of work into this kernal. I must say, thank you! I have my CM5 lite coming here in a few weeks and cannot wait to try this out. You and Rex both blow me away with what you have done for this community. I’ll keep following your progress in the meantime, you’ll have some coffee coming from me!

1 Like

#177
Full Changelog : nov-171…nov-177

  • There are no changes on this version.
  • Improved installation on distributions using the /boot as firmware path or vmlinuz as kernel image

I don’t know if the latest was supposed to work on Kali, but i tried the .deb anyways on a fresh install of Kali, it fails towards the end with this

Unpacking novkernel-6.12.17-v8-16k-nov (177) ...
Replacing files in old package clockworkpi-kernel (6.12.16-v8-16k+) ...
Replacing files in old package linux-libc-dev (6.12.13-1kali1) ...
Setting up novkernel-6.12.17-v8-16k-nov (177) ...
update-initramfs: Generating /boot/initrd.img-6.12.17-v8-16k-nov
cryptsetup: ERROR: Couldn't resolve device /dev/root
cryptsetup: WARNING: Couldn't determine root device
Detect boot sturucture...
'/boot' found.
cp: cannot stat '/boot/firmware/kernel_2712.img': No such file or directory
dpkg: error processing package novkernel-6.12.17-v8-16k-nov (--configure):
 installed novkernel-6.12.17-v8-16k-nov package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 novkernel-6.12.17-v8-16k-nov
Notice: Download is performed unsandboxed as root as file '/home/kali/novkernel-6.12.17-v8-16k-nov_177.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
Error: Sub-process /usr/bin/dpkg returned an error code (1)

The manual install.sh also does something similar

┌──(kali㉿kali-raspberry-pi)-[~]
└─$ sudo ./install.sh
##################################
### NovKernel for uConsole CM5 ###
##################################


Press any key to install kernel...

Detect boot sturucture...
'/boot' found.



Backup current kernel...

Unpacking included dependencies...

Installing included dependencies...
Dependencies installed successfully.

Installing included firmwares...
Firmwares installed successfully.
update-initramfs: Generating /boot/initrd.img-6.12.17-v8-16k-nov
cryptsetup: ERROR: Couldn't resolve device /dev/root
cryptsetup: WARNING: Couldn't determine root device

Applying boot kernel...
cp: cannot stat '/boot/firmware/kernel_2712.img': No such file or directory

But my boot looks like this

┌──(kali㉿kali-raspberry-pi)-[~]
└─$ ls -lah /boot
total 109M
drwxr-xr-x  4 root root 5.0K Jan  1  1970 .
drwxr-xr-x 18 root root 4.0K Jan 23 15:18 ..
-rwxr-xr-x  1 root root  32K Mar  5 19:25 bcm2710-rpi-2-b.dtb
-rwxr-xr-x  1 root root  34K Mar  5 19:25 bcm2710-rpi-3-b.dtb
-rwxr-xr-x  1 root root  35K Mar  5 19:25 bcm2710-rpi-3-b-plus.dtb
-rwxr-xr-x  1 root root  32K Mar  5 19:25 bcm2710-rpi-cm3.dtb
-rwxr-xr-x  1 root root  33K Mar  5 19:25 bcm2710-rpi-zero-2.dtb
-rwxr-xr-x  1 root root  33K Mar  5 19:25 bcm2710-rpi-zero-2-w.dtb
-rwxr-xr-x  1 root root  55K Mar  5 19:25 bcm2711-rpi-400.dtb
-rwxr-xr-x  1 root root  55K Mar  5 19:25 bcm2711-rpi-4-b.dtb
-rwxr-xr-x  1 root root  56K Mar  5 19:25 bcm2711-rpi-cm4.dtb
-rwxr-xr-x  1 root root  39K Mar  5 19:25 bcm2711-rpi-cm4-io.dtb
-rwxr-xr-x  1 root root  53K Mar  5 19:25 bcm2711-rpi-cm4s.dtb
-rwxr-xr-x  1 root root  76K Mar  5 19:25 bcm2712d0-rpi-5-b.dtb
-rwxr-xr-x  1 root root  76K Mar  5 19:25 bcm2712-d-rpi-5-b.dtb
-rwxr-xr-x  1 root root  76K Mar  5 19:25 bcm2712-rpi-500.dtb
-rwxr-xr-x  1 root root  76K Mar  5 19:25 bcm2712-rpi-5-b.dtb
-rwxr-xr-x  1 root root  77K Mar  5 19:25 bcm2712-rpi-cm5-cm4io.dtb
-rwxr-xr-x  1 root root  77K Mar  5 19:25 bcm2712-rpi-cm5-cm5io.dtb
-rwxr-xr-x  1 root root  77K Mar  5 19:25 bcm2712-rpi-cm5l-cm4io.dtb
-rwxr-xr-x  1 root root  77K Mar  5 19:25 bcm2712-rpi-cm5l-cm5io.dtb
-rwxr-xr-x  1 root root  21K Mar  5 19:25 bcm2837-rpi-3-a-plus.dtb
-rwxr-xr-x  1 root root  22K Mar  5 19:25 bcm2837-rpi-3-b.dtb
-rwxr-xr-x  1 root root  22K Mar  5 19:25 bcm2837-rpi-3-b-plus.dtb
-rwxr-xr-x  1 root root  21K Mar  5 19:25 bcm2837-rpi-cm3-io3.dtb
-rwxr-xr-x  1 root root  21K Mar  5 19:25 bcm2837-rpi-zero-2-w.dtb
-rwxr-xr-x  1 root root  52K Feb 28 04:53 bootcode.bin
-rwxr-xr-x  1 root root  153 Jan 23 15:18 cmdline.txt
-rwxr-xr-x  1 root root 241K Mar  5 19:25 config-6.12.17-v8-16k-nov
-rwxr-xr-x  1 root root  291 Mar  5 19:22 config.txt
drwxr-xr-x  3 root root 2.5K Mar  5 19:23 firmware.177.bak
-rwxr-xr-x  1 root root 3.2K Feb 28 04:53 fixup4cd.dat
-rwxr-xr-x  1 root root 5.4K Feb 28 04:53 fixup4.dat
-rwxr-xr-x  1 root root 8.3K Feb 28 04:53 fixup4db.dat
-rwxr-xr-x  1 root root 8.3K Feb 28 04:53 fixup4x.dat
-rwxr-xr-x  1 root root 3.2K Feb 28 04:53 fixup_cd.dat
-rwxr-xr-x  1 root root 7.2K Feb 28 04:53 fixup.dat
-rwxr-xr-x  1 root root  11K Feb 28 04:53 fixup_db.dat
-rwxr-xr-x  1 root root  11K Feb 28 04:53 fixup_x.dat
-rwxr-xr-x  1 root root  21M Mar  5 19:25 initrd.img-6.12.17-v8-16k-nov
-rwxr-xr-x  1 root root  27M Mar  5 19:25 kernel_2712.img
-rwxr-xr-x  1 root root  26M Feb 27 03:43 kernel8.img
-rwxr-xr-x  1 root root 1.6K Feb 28 04:53 LICENCE.broadcom
drwxr-xr-x  2 root root  38K Mar  5 19:23 overlays
-rwxr-xr-x  1 root root 795K Feb 28 04:53 start4cd.elf
-rwxr-xr-x  1 root root 3.6M Feb 28 04:53 start4db.elf
-rwxr-xr-x  1 root root 2.2M Feb 28 04:53 start4.elf
-rwxr-xr-x  1 root root 2.9M Feb 28 04:53 start4x.elf
-rwxr-xr-x  1 root root 795K Feb 28 04:53 start_cd.elf
-rwxr-xr-x  1 root root 4.7M Feb 28 04:53 start_db.elf
-rwxr-xr-x  1 root root 2.9M Feb 28 04:53 start.elf
-rwxr-xr-x  1 root root 3.6M Feb 28 04:53 start_x.elf
-rwxr-xr-x  1 root root 4.1M Mar  5 19:25 System.map-6.12.17-v8-16k-nov
-rwxr-xr-x  1 root root 9.4M Mar  5 19:25 vmlinuz-6.12.17-v8-16k-nov

After editing the install.sh I did get it to boot though.

┌──(kali㉿kali-raspberry-pi)-[~]
└─$ uname -r
6.12.17-v8-16k-nov

Here’s what I removed to get past the cp: cannot stat '/boot/firmware/kernel_2712.img': No such file or directory errors

echo ""
echo "Applying boot kernel..."
#if [ -e "/boot/firmware/kernel_2712.img" ]; then
#    echo "Boot kernel applied successfully on /boot/firmware/kernel_2712.img"
#fi
#if [ -e "/boot/kernel_2712.img" ]; then
#    cp -rf "/boot/firmware/kernel_2712.img" "/boot/kernel_2712.img"
#    echo "Boot kernel applied successfully on /boot/kernel_2712.img"
#fi
if [ -e "/boot/firmware/vmlinuz" ]; then
    cp -rf "/boot/vmlinuz-6.12.17-v8-16k-nov" "/boot/firmware/vmlinuz"
    echo "Boot kernel applied successfully on /boot/firmware/vmlinuz"
fi
if [ -e "/boot/vmlinuz" ]; then
    cp -rf "/boot/vmlinuz-6.12.17-v8-16k-nov" "/boot/vmlinuz"
    echo "Boot kernel applied successfully on /boot/vmlinuz"
fi
if [ -e "/boot/firmware/initrd.img" ]; then
    cp -rf "/boot/initrd.img-6.12.17-v8-16k-nov" "/boot/firmware/initrd.img"
    echo "Boot Kernel initramfs applied successfully on /boot/firmware/initrd.img"
fi
if [ -e "/boot/initrd.img" ]; then
    cp -rf "/boot/initrd.img-6.12.17-v8-16k-nov" "/boot/initrd.img"
    echo "Boot Kernel initramfs applied successfully on /boot/initrd.img"
fi

I don’t have the time to dig into it right now, but I think there’s a problem with those first 2 if statements.

thanks for the hard work, I’m excited to experiment with this.

1 Like