Jump to content

How to add a specific single file in the initrd.img (ideally automatically with update-initramfs)


Recommended Posts

Posted (edited)

I am having trouble with my SPI LCD, which uses driver panel-mipi-dbi

 

It works great when I use a minimal Armbian image, but with a desktop image it doesn't work. This is because package "plymouth" does something in the ko loading order: it loads panel-mipi-dbi too early.

 

Plymouth provides a graphical boot animation.

 

The driver depends on a binary file /lib/firmware/panel-mipi-dbi-spi.bin (but the file name could change depending on the DTS)

 

At boot time, I saw that the panel-mipi-dbi.ko is loaded BEFORE the EXT4 in the microSD is mounted... and the binary file is not in the initrd.img-version (checked with lsinitramfs)

 

Is it possible to add something in /etc/initramfs-tools/ to include /lib/firmware/panel-mipi-dbi-spi.bin ?

 

 

 

With my Raspberry Pi (Raspbian) I don't have this problem, because the panel-mipi-dbi driver is loaded AFTER EXT4-fs (and it also uses plymouth)

 

I found that when plymouth is not installed, usr/lib/modules/6.15.0-edge-sunxi64/modules.dep doesn't have this line

kernel/drivers/gpu/drm/tiny/panel-mipi-dbi.ko: kernel/drivers/gpu/drm/drm_mipi_dbi.ko

 

Also, in Raspbian, the same file has the dependency line, but changed with 5 more dependencies

kernel/drivers/gpu/drm/tiny/panel-mipi-dbi.ko: kernel/drivers/gpu/drm/drm_dma_helper.ko kernel/drivers/gpu/drm/drm_mipi_dbi.ko kernel/drivers/gpu/drm/drm_kms_helper.ko kernel/drivers/gpu/drm/drm.ko kernel/drivers/gpu/drm/drm_panel_orientation_quirks.ko kernel/drivers/video/backlight/backlight.ko

 

And this is confirmed with modinfo drm_mipi_dbi: 1 dependency in armbian and 5 dependencies in raspbian... could this be the reason why the ko is loading too early?

Edited by robertoj
Posted

Currently trying to follow the manual

https://manpages.ubuntu.com/manpages/bionic/man8/initramfs-tools.8.html#configuration hook scripts

 

I want to include this file:

Spoiler

roberto@orangepizero3:/etc/initramfs-tools/hooks$ ls -l /lib/firmware/panel-mipi-dbi-spi.bin
-rw-r--r-- 1 root root 100 Dec 25  2024 /lib/firmware/panel-mipi-dbi-spi.bin

 

Creating this file:

Spoiler
roberto@orangepizero3:/etc/initramfs-tools/hooks$ cat include-lcd-bin.sh
#!/bin/sh
PREREQ=""
prereqs()
{
     echo "$PREREQ"
}

case $1 in
prereqs)
     prereqs
     exit 0
     ;;
esac
. /usr/share/initramfs-tools/hook-functions
# Begin real processing below this line
copy_exec /lib/firmware/panel-mipi-dbi-spi.bin

 

 

chmod +x include-lcd-bin.sh

 

Then I updated the initrd:

Spoiler

roberto@orangepizero3:/etc/initramfs-tools/hooks$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-6.13.7-edge-sunxi64
update-initramfs: Armbian: Converting to u-boot format: /boot/uInitrd-6.13.7-edge-sunxi64
Image Name:   uInitrd
Created:      Tue Jul  8 08:48:49 2025
Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
Data Size:    12430475 Bytes = 12139.14 KiB = 11.85 MiB
Load Address: 00000000
Entry Point:  00000000
update-initramfs: Armbian: Symlinking /boot/uInitrd-6.13.7-edge-sunxi64 to /boot/uInitrd
'/boot/uInitrd' -> 'uInitrd-6.13.7-edge-sunxi64'
update-initramfs: Armbian: done.

 

Then I checked, and the desired file was included :)

Spoiler

roberto@orangepizero3:/etc/initramfs-tools/hooks$ lsinitramfs -l /boot/initrd.img-6.13.7-edge-sunxi64 |grep panel
-rw-r--r--   1 root     root          100 Dec 25  2024 usr/lib/firmware/panel-mipi-dbi-spi.bin
drwxr-xr-x   2 root     root            0 Jul  8 08:48 usr/lib/modules/6.13.7-edge-sunxi64/kernel/drivers/gpu/drm/panel
-rw-r--r--   1 root     root        58928 Mar 31 20:06 usr/lib/modules/6.13.7-edge-sunxi64/kernel/drivers/gpu/drm/panel/panel-edp.ko
-rw-r--r--   1 root     root       136552 Mar 31 20:06 usr/lib/modules/6.13.7-edge-sunxi64/kernel/drivers/gpu/drm/panel/panel-simple.ko

I will repeat this with the actual armbian OS with plymouth, tomorrow.

Posted

I am checking now :)

 

Before installing plymouth, I checked that panel-mipi-dbi-spi is still loaded late:

Spoiler

roberto@orangepizero3:~$ dmesg|grep panel
[    1.811708] panel@0 enforce active low on GPIO handle
[    7.677563] panel-mipi-dbi-spi spi1.0: supply power not found, using dummy regulator
[    7.677805] panel-mipi-dbi-spi spi1.0: supply io not found, using dummy regulator
[    7.854434] [drm] Initialized panel-mipi-dbi 1.0.0 for spi1.0 on minor 1
[    8.613814] panel-mipi-dbi-spi spi1.0: [drm] fb0: panel-mipi-dbid frame buffer device

 

I added the include-lcd-bin.sh and installed plymouth:

Spoiler

roberto@orangepizero3:~$ sudo apt install plymouth
[sudo] password for roberto:
Installing:                     
  plymouth

Installing dependencies:
  libplymouth5

Suggested packages:
  desktop-base  plymouth-themes

Summary:
  Upgrading: 0, Installing: 2, Removing: 0, Not Upgrading: 0
  Download size: 254 kB
  Space needed: 1,708 kB / 58.8 GB available

Continue? [Y/n] Y
Get:1 http://deb.debian.org/debian trixie/main arm64 libplymouth5 arm64 24.004.60-5 [119 kB]
Get:2 http://deb.debian.org/debian trixie/main arm64 plymouth arm64 24.004.60-5 [135 kB]
Fetched 254 kB in 0s (909 kB/s)   
Selecting previously unselected package libplymouth5:arm64.
(Reading database ... 29860 files and directories currently installed.)
Preparing to unpack .../libplymouth5_24.004.60-5_arm64.deb ...
Unpacking libplymouth5:arm64 (24.004.60-5) ...
Selecting previously unselected package plymouth.
Preparing to unpack .../plymouth_24.004.60-5_arm64.deb ...
Unpacking plymouth (24.004.60-5) ...
Setting up libplymouth5:arm64 (24.004.60-5) ...
Setting up plymouth (24.004.60-5) ...
update-initramfs: Generating /boot/initrd.img-6.15.0-edge-sunxi64
update-initramfs: Armbian: Converting to u-boot format: /boot/uInitrd-6.15.0-edge-sunxi64
Image Name:   uInitrd
Created:      Tue Jul  8 09:01:32 2025
Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
Data Size:    18468072 Bytes = 18035.23 KiB = 17.61 MiB
Load Address: 00000000
Entry Point:  00000000
update-initramfs: Armbian: Symlinking /boot/uInitrd-6.15.0-edge-sunxi64 to /boot/uInitrd
'/boot/uInitrd' -> 'uInitrd-6.15.0-edge-sunxi64'
update-initramfs: Armbian: done.
Processing triggers for man-db (2.13.1-1) ...
Processing triggers for libc-bin (2.41-9) ...

 

Checking that my bin file is there:

Spoiler

roberto@orangepizero3:~$ lsinitramfs /boot/initrd.img-6.15.0-edge-sunxi64 |grep panel
usr/lib/firmware/panel-mipi-dbi-spi.bin
usr/lib/modules/6.15.0-edge-sunxi64/kernel/drivers/gpu/drm/panel
usr/lib/modules/6.15.0-edge-sunxi64/kernel/drivers/gpu/drm/panel/panel-abt-y030xx067a.ko
usr/lib/modules/6.15.0-edge-sunxi64/kernel/drivers/gpu/drm/panel/panel-arm-versatile.ko
usr/lib/modules/6.15.0-edge-sunxi64/kernel/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.ko

.... 60 kernel modules that have the word "panel"

 

The LCD works with plymouth: it starts the LCD earlier, with a smaller font, then switches to normal font, showing all the boot messages

 

My armbian is not setup yet with lightdm+openbox (x11) or greetd+gtkgreet+labwc (wayland)... I will continue tomorrow

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