linux-wasm/tools/make-initramfs-base.sh
2025-10-31 18:37:02 +01:00

20 lines
485 B
Bash
Executable File

#!/bin/bash
# This script creates an initial cpio file suitable to use as a base for initramfs cpio archives.
# The reason to split it up is because mknod requires the user to be root (see sudo below).
set -e
cd "$(dirname "$0")/../patches/initramfs"
rm -rf initramfs/
mkdir -p initramfs/{bin,dev,etc,home,mnt,proc,sys,usr}
sudo mknod initramfs/dev/console c 5 1
(
cd initramfs/
find . -print0 | cpio --null -ov --format=newc > ../initramfs-base.cpio
)
rm -rf initramfs/