initramfs

Hello, I was wondering if there is support for initramfs for uboot, if so, how will I go about doing it? I want to mount a partion before boot for /usr /var /etc /home

Hm, i’m trying with grinch kernel to use initramfs

As root:

update-initramfs -k 3.10.40-grinch-21.3.4 -c
update-initramfs: Generating /boot/initrd.img-3.10.40-grinch-21.3.4
grep: /boot/config-3.10.40-grinch-21.3.4: No such file or directory
cryptsetup: WARNING: could not determine root device from /etc/fstab

it will generate initrd.img-3.10.40-grinch-21.3.4 in /boot:

ls -o /boot/initrd.img-3.10.40-grinch-21.3.4 
-rw-r--r-- 1 root 15229697 May  1 12:03 /boot/initrd.img-3.10.40-grinch-21.3.4

Now, i’m add INITRD file to /boot/extlinux/extlinux.conf:

TIMEOUT 30
DEFAULT primary

MENU TITLE Jetson-TK1 eMMC boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/zImage
      INITRD /boot/initrd.img-3.10.40-grinch-21.3.4
      FDT /boot/tegra124-jetson_tk1-pm375-000-c00-00.dtb
      APPEND console=ttyS0,115200n8 console=tty1 no_console_suspend=1 lp0_vec=2064@0xf46ff000 mem=2015M@2048M memtype=255 ddr_die=2048M@2048M section=256M pmuboard=0x0177:0x0000:0x02:0x43:0x00 tsec=32M@3913M otf_key=c75e5bb91eb3bd947560357b64422f85 usbcore.old_scheme_first=1 core_edp_mv=1150 core_edp_ma=4000 tegraid=40.1.1.0.0 debug_uartport=lsport,3 power_supply=Adapter audio_codec=rt5640 modem_id=0 android.kerneltype=normal fbcon=map:1 commchip_id=0 usb_port_owner_info=0 lane_owner_info=6 emc_max_dvfs=0 touch_id=0@0 board_info=0x0177:0x0000:0x02:0x43:0x00 root=/dev/mmcblk0p1 rw rootwait tegraboot=sdmmc gpt

Reboot, Some logs:

Jetson-TK1 eMMC boot options                                                                                                                                                                                                                                                     
1:      primary kernel                                                                                                                                                                                                                                                           
Enter choice: 1                                                                                                                                                                                                                                                                  
1:      primary kernel                                                                                                                                                                                                                                                           
Retrieving file: /boot/initrd.img-3.10.40-grinch-21.3.4                                                                                                                                                                                                                          
15229697 bytes read in 679 ms (21.4 MiB/s)                                                                                                                                                                                                                                       
Retrieving file: /boot/zImage                                                                                                                                                                                                                                                    
5925768 bytes read in 189 ms (29.9 MiB/s)

dmesg:

dmesg |grep initr
[    0.849250] Unpacking initramfs...
[    1.834564] Freeing initrd memory: 14872K (c2100000 - c2f86000)

These instructions worked great, with one small snag:
update-initramfs doesn’t copy one of the firmwares necessary for USB to work, even after booting. The effect is that even if you have an initrd that doesn’t do anything, USB will be borked permanently.

The fix for this is to, BEFORE running update-initramfs:

sudo su
cd /etc/initramfs-tools/hooks/
touch __addfirmware.sh
chmod 744 __addfirmware.sh

nano __addfirmware.sh

ADD THE FOLLOWING:

#!/bin/sh

PREREQ=""

prereqs()
{
        echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
        prereqs
        exit 0
        ;;
esac

. /usr/share/initramfs-tools/hook-functions

mkdir -p ${DESTDIR}/lib/firmware || true
cp -rpnL /lib/firmware/* ${DESTDIR}/lib/firmware/
chmod 644 ${DESTDIR}/lib/firmware

Ctrl-x to quit, and save.

NOW you can run update-initramfs as described above, and it will copy the needed firmware (ALL of the firmware, actually).