Jump to content

Recommended Posts

Posted (edited)

This will cause update-grub to add the following a devicetree line to all menu entries. This example is based on Debian Trixie's grub-efi.

 

This example will expect dtb directories (or links) to be in the /boot directory, using the convention that I've seen Armbian use. Here is an example of a /boot directory listing for (pure) Debian Trixie with two kernels:

-rw-r--r-- 1 root root   336036 Aug 27 04:10 config-6.12.43+deb13-arm64
-rw-r--r-- 1 root root   343394 Sep  6 12:48 config-6.16.3+deb13-arm64
lrwxrwxrwx 1 root root       42 Sep 20 16:17 dtb -> ../usr/lib/linux-image-6.16.3+deb13-arm64/
lrwxrwxrwx 1 root root       43 Sep 20 16:17 dtb-6.12.43+deb13-arm64 -> ../usr/lib/linux-image-6.12.43+deb13-arm64/
lrwxrwxrwx 1 root root       42 Sep 20 16:18 dtb-6.16.3+deb13-arm64 -> ../usr/lib/linux-image-6.16.3+deb13-arm64/
drwxr-xr-x 3 root root     4096 Sep 20 15:13 efi
drwxr-xr-x 5 root root     4096 Sep 20 16:26 grub
lrwxrwxrwx 1 root root       29 Sep 15 21:30 initrd.img -> initrd.img-6.16.3+deb13-arm64
-rw------- 1 root root 42521317 Sep 20 16:26 initrd.img-6.12.43+deb13-arm64
-rw------- 1 root root 43760872 Sep 20 16:25 initrd.img-6.16.3+deb13-arm64
lrwxrwxrwx 1 root root       30 Sep 15 20:38 initrd.img.old -> initrd.img-6.12.43+deb13-arm64
-rw-r--r-- 1 root root       83 Aug 27 04:10 System.map-6.12.43+deb13-arm64
-rw-r--r-- 1 root root       92 Sep  6 12:48 System.map-6.16.3+deb13-arm64
lrwxrwxrwx 1 root root       26 Sep 15 21:30 vmlinuz -> vmlinuz-6.16.3+deb13-arm64
-rw-r--r-- 1 root root 37449664 Aug 27 04:10 vmlinuz-6.12.43+deb13-arm64
-rw-r--r-- 1 root root 41507328 Sep  6 12:48 vmlinuz-6.16.3+deb13-arm64
lrwxrwxrwx 1 root root       27 Sep 15 20:38 vmlinuz.old -> vmlinuz-6.12.43+deb13-arm64

Note: The relative pathways of the dtb links above assume that the /boot directory is part of the main OS partition, not on its own boot partition. Otherwise you'd need to copy those directories to /boot/ as Armbian does.

 

 

For The Current Partition's OS Entries (each devicetree will be specific to the respective kernel)

1. Open the file with a text/source editor (using sudo):

/etc/grub.d/10_linux

 

2. Find every line that looks something like this (currently on my system, there is only one, and it's line 189)

linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}

 

3. Just above it, add your own system's version of this line:

devicetree ${rel_dirname}/dtb-${version}/[VENDOR SUB-DIRECTORY]/[SBC PRODUCT].dtb

 

Specific Example: OrangePI-5-Plus

devicetree ${rel_dirname}/dtb-${version}/rockchip/rk3588-orangepi-5-plus.dtb

 

Specific Example from the resulting grub.cfg, of the current trixie-backport kernel, again on the OrangePI-5-Plus:

devicetree /boot/dtb-6.16.3+deb13-arm64/rockchip/rk3588-orangepi-5-plus.dtb

 

 

For Other Partitions' OS Entries, via os-prober (I'm unfamiliar with the variables in this so each devicetree will be the same generic path, regardless of kernel)

1. Open the file with a text/source editor (using sudo):

 /etc/grub.d/30_os-prober

 

2. Find every line that looks something like this (currently on my system, there are two, lines 277 and 297)

linux ${LKERNEL} ${LPARAMS}

 

3. Just above it, add your own system's version of this line:

devicetree /boot/dtb/[VENDOR SUB-DIRECTORY]/[SBC PRODUCT].dtb

 

Specific Example: OrangePI-5-Plus

devicetree /boot/dtb/rockchip/rk3588-orangepi-5-plus.dtb

 

 

Then run update-grub, and take a look at the resulting /boot/grub/grub.cfg

 

 

 

Edited by The Tall Man
Posted (edited)

Addendum: How To Include Devicetree Overlays

Since Grub does not have devicetree overlay support, we need to merge the desired overlay(s) in with the main devicetree (.dtb) file we're using.

 

Part of the device-tree-compiler package is this command:

fdtoverlay

 

An example from Armbian 25.8.1 Trixie running on the Orange Pi 5 Plus, to enable GPU acceleration in the Vendor (6.1) kernel. In sudo:

cd /boot/dtb-6.1.115-vendor-rk35xx/rockchip
fdtoverlay -i rk3588-orangepi-5-plus.dtb -o rk3588-orangepi-5-plus-panthor.dtb overlay/rockchip-rk3588-panthor-gpu.dtbo

 

Of course, to have that load automatically from grub using the modification above, you'll need to rename (or move) the original .dtb to something else, then rename the one with the -panthor suffix to the original name to take its place.

Edited by The Tall Man

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines