Add chroot depmod for proper module dependencies in initramfs
- Added chroot + depmod -a step in setup-initramfs.sh before cpio creation - Generates module dependencies within the actual initramfs environment - Includes bind mounting of /proc, /sys, /dev for proper chroot operation - Ensures TUN module and all network modules have correct dependencies - Complements existing build-time depmod in install-firmware-minimal.sh
This commit is contained in:
@@ -270,6 +270,30 @@ rm -rf run
|
||||
ln -sf ../run run || true
|
||||
cd "$INITRAMFS_ROOT"
|
||||
|
||||
# Generate module dependencies within the initramfs environment
|
||||
echo " Generating module dependencies in chroot environment..."
|
||||
KERNEL_VERSION=$(cat /build/configs/kernel-version)
|
||||
if [ -d "$INITRAMFS_ROOT/lib/modules/${KERNEL_VERSION}-Zero-OS" ]; then
|
||||
# Bind mount necessary filesystems for chroot
|
||||
mount --bind /proc "$INITRAMFS_ROOT/proc" 2>/dev/null || true
|
||||
mount --bind /sys "$INITRAMFS_ROOT/sys" 2>/dev/null || true
|
||||
mount --bind /dev "$INITRAMFS_ROOT/dev" 2>/dev/null || true
|
||||
|
||||
# Run depmod in chroot to generate dependencies
|
||||
if chroot "$INITRAMFS_ROOT" /sbin/depmod -a "${KERNEL_VERSION}-Zero-OS" 2>/dev/null; then
|
||||
echo " ✓ Module dependencies generated successfully"
|
||||
else
|
||||
echo " Warning: Failed to generate module dependencies in chroot"
|
||||
fi
|
||||
|
||||
# Cleanup bind mounts
|
||||
umount "$INITRAMFS_ROOT/proc" 2>/dev/null || true
|
||||
umount "$INITRAMFS_ROOT/sys" 2>/dev/null || true
|
||||
umount "$INITRAMFS_ROOT/dev" 2>/dev/null || true
|
||||
else
|
||||
echo " Warning: No kernel modules directory found, skipping depmod"
|
||||
fi
|
||||
|
||||
# Create initramfs archive
|
||||
echo "[+] Creating initramfs archive..."
|
||||
cd "$INITRAMFS_ROOT"
|
||||
|
||||
Reference in New Issue
Block a user