Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4436

Advanced users • preparing initramfs image and execution

$
0
0
I am trying to netboot Pi4 and I have unpacked the existing initramfs8 and added some custom scripts in scripts/init-top.

I unpacked using the command:

Code:

zstd -d ../initramfs8 -o initramfs8.cpio      cpio -idmv < initramfs8.cpio
Then added following code in scripts/init-top/overlayfs

Code:

#!/bin/shset -eecho "==> Setting up OverlayFS for /etc via NFS..."# Get machine MAC address (assumes eth0; adjust if needed)MAC_ADDR=$(cat /sys/class/net/eth0/address | tr -d ':')echo "Detected MAC address: $MAC_ADDR"# NFS server and base path for per-machine dirsNFS_SERVER="192.168.0.139"# Machine-specific directory on the NFS serverNFS_MACHINE_PATH="/mnt/zfs_pool/nfs_data/per_machine_netboot_filesystem/aa5e7587/etc"# Mount NFS directory to a temporary locationmkdir -p /mnt/nfs_etcecho "==> Mounting NFS /etc for ${MAC_ADDR} from ${NFS_SERVER}:${NFS_MACHINE_PATH}"mount -o nolock,vers=3 ${NFS_SERVER}:${NFS_MACHINE_PATH} /mnt/nfs_etc# Ensure upper and work dirs exist in the NFS share (created on first boot)mkdir -p /mnt/nfs_etc/uppermkdir -p /mnt/nfs_etc/work# Prepare overlay mount pointmkdir -p /overlay/etc# Mount overlayfs for /etcmount -t overlay overlay \    -o lowerdir=/etc,upperdir=/mnt/nfs_etc/upper,workdir=/mnt/nfs_etc/work \    /overlay/etc# Switch /etc to the new overlaymount --move /overlay/etc /etcecho "==> OverlayFS for /etc mounted successfully."
And then packed it again using commands:

Code:

find . -print0 | cpio --null -o --format=newc | zstd -19 -o ../initramfs8.new
Renamed the file and change the config.txt to initramfs initramfs.img. However, its not clear that initramfs is being run during boot.
In dmesg all i can see is :
all i get is Trying to unpack rootfs image as initramfs.
. Any idea of how to debug/fix this?

Statistics: Posted by dreamlax007 — Mon Mar 03, 2025 10:39 am — Replies 0 — Views 17



Viewing all articles
Browse latest Browse all 4436

Trending Articles