HOW TO - add modules to initramfs
#1
Perhaps the harder part of this is to explain WHY you would want to do this. And HOW to identify the modules.

In my life this all started trying to put rootfs on my NVMe with 4.18.0-rc8 kernel. I could boot 4.18 from an SDcard and see the NVMe after boot. But the PCIe and NVMe initialisation were after rootfs was mounted during boot. And so any attempt to define the NVMe as rootfs caused a hang in the boot sequence as it was not available when required.

I was pretty unsuccesful trying to identify which modules were loaded during initramfs time and which were loaded after rootfs. lsmod showed the same results whether I had the PCIe card plugged in or not. So I got lucky and decided to try with the "likely candidates", pcie_rockchip_host and phy_rockchip_pcie.

The initramfs can be tweaked using the 3 text files in /etc/initramfs-tools/

I made no changes to initramfs.conf

I added the 2 modules to modules, now looks like

Code:
# List of modules that you want to include in your initramfs.
# They will be loaded at boot time in the order below.
#
# Syntax:  module_name [args ...]
#
# You must run update-initramfs(8) to effect this change.
#
pcie_rockchip_host
phy_rockchip_pcie


I changed update-initramfs.conf to give me a backup, so now looks like

Code:
#
# Configuration file for update-initramfs(8)
#

#
# update_initramfs [ yes | all | no ]
#
# Default is yes
# If set to all update-initramfs will update all initramfs
# If set to no disables any update to initramfs beside kernel upgrade

update_initramfs=yes

#
# backup_initramfs [ yes | no ]
#
# Default is no
# If set to no leaves no .bak backup files.

backup_initramfs=yes

At which stage a quick

Code:
sudo update-initramfs -u -k $(uname -r)

gave me a new /boot/initrd.img-4.18.0-rc8-1060-ayufan-g45828c4db727 as well as a .bak. (Note - this all assumes you are running the target OS from an SDcard)


And then copy the altered bits of /boot to the NVMe, adjust the kernel command line to pickup the NVMe for root and everything was great.
  • ROCKPro64 v2.1 2GB, 16Gb eMMC for rootfs, SX8200Pro 512GB NVMe for /home, HDMI video & sound, Bluetooth keyboard & mouse. Arch (6.2 kernel, Openbox desktop) for general purpose daily PC.
  • PinePhone Pro Explorer Edition, daily driver, rk2aw & U-boot on SPI, Arch/SXMO & Arch/phosh on eMMC
  • PinePhone BraveHeart now v1.2b 3/32Gb, Tow-boot with Arch/SXMO on eMMC


Messages In This Thread
HOW TO - add modules to initramfs - by dukla2000 - 08-15-2018, 03:54 PM
RE: HOW TO - add modules to initramfs - by Luke - 08-16-2018, 04:33 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)