rm firmware
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
runCommand,
|
runCommand,
|
||||||
|
symlinkJoin,
|
||||||
makeInitrdNG,
|
makeInitrdNG,
|
||||||
uutils-coreutils-noprefix,
|
uutils-coreutils-noprefix,
|
||||||
bash,
|
bash,
|
||||||
@@ -16,7 +17,8 @@
|
|||||||
writeScript,
|
writeScript,
|
||||||
kmod,
|
kmod,
|
||||||
linuxPackages_latest,
|
linuxPackages_latest,
|
||||||
linux-firmware,
|
glibc,
|
||||||
|
gcc-unwrapped,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@@ -25,19 +27,22 @@ let
|
|||||||
#!${bash}/bin/bash
|
#!${bash}/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Mount essential filesystems
|
# Set up PATH first
|
||||||
${util-linux}/bin/mount -t proc proc /proc
|
|
||||||
${util-linux}/bin/mount -t sysfs sys /sys
|
|
||||||
${util-linux}/bin/mount -t devtmpfs dev /dev
|
|
||||||
|
|
||||||
# Set up environment
|
|
||||||
export PATH=/bin
|
export PATH=/bin
|
||||||
export HOME=/root
|
export HOME=/root
|
||||||
export TERM=linux
|
export TERM=linux
|
||||||
|
|
||||||
|
# Create mount points
|
||||||
|
mkdir -p /proc /sys /dev /run /tmp
|
||||||
|
|
||||||
|
# Mount essential filesystems
|
||||||
|
mount -t proc proc /proc
|
||||||
|
mount -t sysfs sys /sys
|
||||||
|
mount -t devtmpfs dev /dev
|
||||||
|
|
||||||
# Load essential kernel modules for hardware support
|
# Load essential kernel modules for hardware support
|
||||||
echo "Loading kernel modules..."
|
echo "Loading kernel modules..."
|
||||||
${kmod}/bin/modprobe -a \
|
modprobe -a \
|
||||||
nvme sd_mod usb_storage ata_piix ahci \
|
nvme sd_mod usb_storage ata_piix ahci \
|
||||||
ext4 vfat btrfs xfs \
|
ext4 vfat btrfs xfs \
|
||||||
e1000e igb r8169 virtio_net \
|
e1000e igb r8169 virtio_net \
|
||||||
@@ -57,12 +62,12 @@ let
|
|||||||
echo " Text: vim, grep, find, head, tail"
|
echo " Text: vim, grep, find, head, tail"
|
||||||
echo " System: ps, kill, chmod, chown"
|
echo " System: ps, kill, chmod, chown"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Kernel modules and firmware included."
|
echo "Kernel modules included."
|
||||||
echo "Type 'exit' or Ctrl+D to reboot"
|
echo "Type 'exit' or Ctrl+D to reboot"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Drop to rescue shell
|
# Drop to rescue shell
|
||||||
exec ${bash}/bin/bash
|
exec /bin/bash
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Package binaries to include
|
# Package binaries to include
|
||||||
@@ -174,6 +179,15 @@ let
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Merge glibc and gcc libraries into one directory
|
||||||
|
mergedLibs = symlinkJoin {
|
||||||
|
name = "merged-libs";
|
||||||
|
paths = [
|
||||||
|
glibc
|
||||||
|
gcc-unwrapped.lib
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Generate binary entries for makeInitrdNG
|
# Generate binary entries for makeInitrdNG
|
||||||
binaryEntries = lib.flatten (
|
binaryEntries = lib.flatten (
|
||||||
map (
|
map (
|
||||||
@@ -201,16 +215,21 @@ let
|
|||||||
source = init;
|
source = init;
|
||||||
target = "/init";
|
target = "/init";
|
||||||
}
|
}
|
||||||
|
# Merged C libraries (glibc + gcc)
|
||||||
|
{
|
||||||
|
source = "${mergedLibs}/lib";
|
||||||
|
target = "/lib";
|
||||||
|
}
|
||||||
|
# Dynamic linker (also at /lib64 for compatibility)
|
||||||
|
{
|
||||||
|
source = "${mergedLibs}/lib/ld-linux-x86-64.so.2";
|
||||||
|
target = "/lib64/ld-linux-x86-64.so.2";
|
||||||
|
}
|
||||||
# Kernel modules
|
# Kernel modules
|
||||||
{
|
{
|
||||||
source = "${linuxPackages_latest.kernel.modules}/lib/modules";
|
source = "${linuxPackages_latest.kernel.modules}/lib/modules";
|
||||||
target = "/lib/modules";
|
target = "/lib/modules";
|
||||||
}
|
}
|
||||||
# Linux firmware
|
|
||||||
{
|
|
||||||
source = "${linux-firmware}/lib/firmware";
|
|
||||||
target = "/lib/firmware";
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
++ binaryEntries;
|
++ binaryEntries;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user