diff options
Diffstat (limited to 'sys-boot/myinitramfs/files')
-rw-r--r-- | sys-boot/myinitramfs/files/baselist | 21 | ||||
-rw-r--r-- | sys-boot/myinitramfs/files/exelist | 2 | ||||
-rwxr-xr-x | sys-boot/myinitramfs/files/gen.sh | 47 | ||||
-rw-r--r-- | sys-boot/myinitramfs/files/list | 35 |
4 files changed, 70 insertions, 35 deletions
diff --git a/sys-boot/myinitramfs/files/baselist b/sys-boot/myinitramfs/files/baselist new file mode 100644 index 0000000..ee06cf5 --- /dev/null +++ b/sys-boot/myinitramfs/files/baselist @@ -0,0 +1,21 @@ +# Dirs +dir /bin 755 0 0 +dir /dev 755 0 0 +dir /etc 755 0 0 +dir /lib 755 0 0 +dir /lib64 755 0 0 +dir /mnt 755 0 0 +dir /mnt/root 755 0 0 +dir /proc 755 0 0 +dir /root 755 0 0 +dir /sbin 755 0 0 +dir /sys 755 0 0 +dir /usr 755 0 0 +dir /usr/lib64 755 0 0 + +# Ld +file /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 755 0 0 + +# Busybox +file /bin/busybox /bin/busybox 755 0 0 + diff --git a/sys-boot/myinitramfs/files/exelist b/sys-boot/myinitramfs/files/exelist new file mode 100644 index 0000000..39329f9 --- /dev/null +++ b/sys-boot/myinitramfs/files/exelist @@ -0,0 +1,2 @@ +cryptsetup +btrfs diff --git a/sys-boot/myinitramfs/files/gen.sh b/sys-boot/myinitramfs/files/gen.sh new file mode 100755 index 0000000..3341d93 --- /dev/null +++ b/sys-boot/myinitramfs/files/gen.sh @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +OUT="$(readlink -f "$1")" +shift + +cd "$(dirname "$(readlink -f "$0")")" + +INIT="./init.plain" + +while [ $# -gt 0 ]; do + case "$1" in + encrypted) + INIT="./init.enc" + ;; + esac + shift +done + +LIST="$(mktemp)" + +# Base list +cp baselist "$LIST" +# Init script +echo "file /init $INIT 755 0 0" >> "$LIST" +echo >> "$LIST" +# Executables +while read EXE; do + P="$(which "$EXE")" + echo "# $EXE" >> "$LIST" + echo "file $P $P 755 0 0" >> "$LIST" + ldd "$P" | awk '{ print $3 }' | sed -n '/^[^ ]\+$/p' | while read LIB; do + echo "file $LIB $LIB 755 0 0" >> "$LIST" + done +done <exelist + +# Print current list +cat "$LIST" + +# Buld initramfs +CPIO="$(mktemp)" +gen_init_cpio "$LIST" > "$CPIO" +gzip "$CPIO" +mv "$CPIO.gz" "$OUT" + +# Cleaup +rm "$LIST" diff --git a/sys-boot/myinitramfs/files/list b/sys-boot/myinitramfs/files/list deleted file mode 100644 index 9645521..0000000 --- a/sys-boot/myinitramfs/files/list +++ /dev/null @@ -1,35 +0,0 @@ -# Dirs -dir /bin 755 0 0 -dir /dev 755 0 0 -dir /etc 755 0 0 -dir /lib 755 0 0 -dir /lib64 755 0 0 -dir /mnt 755 0 0 -dir /mnt/root 755 0 0 -dir /proc 755 0 0 -dir /root 755 0 0 -dir /sbin 755 0 0 -dir /sys 755 0 0 - -# Binaries -file /bin/busybox /bin/busybox 755 0 0 -file /sbin/cryptsetup /sbin/cryptsetup 755 0 0 -file /sbin/btrfs /sbin/btrfs 755 0 0 - -# Ld -file /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 755 0 0 -# Libraries -file /lib64/libblkid.so.1 /lib64/libblkid.so.1 755 0 0 -file /lib64/libc.so.6 /lib64/libc.so.6 755 0 0 -file /lib64/libdevmapper.so.1.02 /lib64/libdevmapper.so.1.02 755 0 0 -file /lib64/liblzo2.so.2 /lib64/liblzo2.so.2 755 0 0 -file /lib64/libm.so.6 /lib64/libm.so.6 755 0 0 -file /lib64/libpthread.so.0 /lib64/libpthread.so.0 755 0 0 -file /lib64/librt.so.1 /lib64/librt.so.1 755 0 0 -file /lib64/libudev.so.1 /lib64/libudev.so.1 755 0 0 -file /lib64/libuuid.so.1 /lib64/libuuid.so.1 755 0 0 -file /lib64/libz.so.1 /lib64/libz.so.1 755 0 0 -file /lib64/libcryptsetup.so.4 /usr/lib64/libcryptsetup.so.4 755 0 0 -file /lib64/libgcrypt.so.20 /usr/lib64/libgcrypt.so.20 755 0 0 -file /lib64/libgpg-error.so.0 /usr/lib64/libgpg-error.so.0 755 0 0 -file /lib64/libpopt.so.0 /usr/lib64/libpopt.so.0 755 0 0 |