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
#2
Many thanks for this!
You can find me on IRC, Discord and Twitter


#3
@dukla2000: THANK YOU!!  Works!!
Sorry for any mistakes. English is not my native language

1. Quartz64 Model B, 4GB RAM

2. Quartz64 Model A, 4GB RAM

3. RockPro64 v2.1

https://linux-nerds.org/
#4
Thanks for the update
#5
With Kernel


Code:
Linux rockpro64v2_0 4.19.0-rc4-1065-ayufan-g72e04c7b3e06 #1 SMP PREEMPT Sat Sep 29 21:27:52 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux


i don't need this  Huh


Code:
rock64@rockpro64v2_0:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1,9G     0  1,9G   0% /dev
tmpfs           388M  608K  387M   1% /run
/dev/nvme0n1    229G  8,1G  209G   4% /
tmpfs           1,9G     0  1,9G   0% /dev/shm
tmpfs           5,0M     0  5,0M   0% /run/lock
tmpfs           1,9G     0  1,9G   0% /sys/fs/cgroup
/dev/mmcblk0p6  112M   28K  112M   1% /boot/efi
/dev/sda1       916G  174G  696G  20% /mnt/backup
tmpfs           388M     0  388M   0% /run/user/1000

iozone


Code:
rock64@rockpro64v2_0:~$ sudo iozone -e -I -a -s 100M -r 4k -r 16k -r 512k -r 1024k -r 16384k -i 0 -i 1 -i 2
    Iozone: Performance Test of File I/O
            Version $Revision: 3.429 $
        Compiled for 64 bit mode.
        Build: linux

    Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
                 Al Slater, Scott Rhine, Mike Wisner, Ken Goss
                 Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
                 Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
                 Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
                 Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
                 Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
                 Vangel Bojaxhi, Ben England, Vikentsi Lapa.

    Run began: Sun Sep 30 11:00:30 2018

    Include fsync in write timing
    O_DIRECT feature enabled
    Auto Mode
    File size set to 102400 kB
    Record Size 4 kB
    Record Size 16 kB
    Record Size 512 kB
    Record Size 1024 kB
    Record Size 16384 kB
    Command line used: iozone -e -I -a -s 100M -r 4k -r 16k -r 512k -r 1024k -r 16384k -i 0 -i 1 -i 2
    Output is in kBytes/sec
    Time Resolution = 0.000001 seconds.
    Processor cache size set to 1024 kBytes.
    Processor cache line size set to 32 bytes.
    File stride size set to 17 * record size.
                                                             random    random     bkwd    record    stride                                    
             kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
         102400       4    94816   146795   159030   159656    54653   143233                                                          
         102400      16   299647   411046   438669   442937   194936   404928                                                          
         102400     512  1023181  1024309   960772   982149   800280  1032060                                                          
         102400    1024  1116173  1168683  1112536  1140780  1004678  1178748                                                          
         102400   16384   927019  1387086  1435659  1485404  1470077  1379217                                                          

iozone test complete.
Sorry for any mistakes. English is not my native language

1. Quartz64 Model B, 4GB RAM

2. Quartz64 Model A, 4GB RAM

3. RockPro64 v2.1

https://linux-nerds.org/
#6
(09-30-2018, 03:17 AM)Bullet64 Wrote: With Kernel


Code:
Linux rockpro64v2_0 4.19.0-rc4-1065-ayufan-g72e04c7b3e06 #1 SMP PREEMPT Sat Sep 29 21:27:52 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux


i don't need this  Huh
I think it is just persistent since you previously edited /etc/initramfs-tools/modules
On my system I have re-installed and have a standard (effectively null) modules. When I installed 4.19.0-rc4 my NVMe failed to initialise at all. Indeed even when I swapped rootfs back to the SDcard it did not initialise so I have not played any more with 4.19.
  • 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


Forum Jump:


Users browsing this thread: 2 Guest(s)