From 21f681ffd8cfb62b0a5bf0b4cfd7a6f11da022ac Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Thu, 12 Nov 2020 12:41:02 -0500 Subject: revamp solib selection, remove load-random-seed --- Makefile | 2 +- cpio_list.txt | 4 +--- init | 4 ---- make | 11 +++++++---- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 1db17f7..fc325b3 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ install: initramfs.img mv /boot/initramfs.img.new /boot/initramfs.img clean: - rm -f initramfs.img initramfs.d gen_init_cpio load-random-seed modules.dep + rm -f initramfs.img initramfs.d gen_init_cpio modules.dep -include initramfs.d diff --git a/cpio_list.txt b/cpio_list.txt index d4dc126..5bf99aa 100644 --- a/cpio_list.txt +++ b/cpio_list.txt @@ -4,10 +4,8 @@ # basic directories. note that all required parent directories will be # auto-generated by make, and everything will be sorted afterwards dir /dev 0755 0 0 -dir /efivars 0755 0 0 dir /mnt 0755 0 0 dir /proc 0755 0 0 -dir /run 0755 0 0 dir /run/cryptsetup 0755 0 0 # kernel does /init <>/dev/console and fails if it doesn't exist in initramfs @@ -30,6 +28,7 @@ file /etc/modules ./modules 0644 0 0 # executables file /bin/busybox /bin/busybox 0755 0 0 file /init ./init 0755 0 0 +file /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 0755 0 0 # firmware file /lib/firmware/amdgpu/polaris10_ce_2.bin /lib/firmware/amdgpu/polaris10_ce_2.bin 0644 0 0 @@ -53,7 +52,6 @@ file /etc/passwd ./passwd 0644 0 0 file /etc/motd ./motd 0644 0 0 file /lib64/libnss_files.so.2 /lib64/libnss_files.so.2 0755 0 0 file /root/.ssh/authorized_keys ./authorized_keys 0600 0 0 -file /sbin/load-random-seed ./load-random-seed 0755 0 0 file /sbin/unlock ./unlock 0755 0 0 file /usr/share/udhcpc/default.script /usr/share/udhcpc/default.script 0755 0 0 file /var/log/lastlog /dev/null 0644 0 0 diff --git a/init b/init index 3b58e88..a627297 100644 --- a/init +++ b/init @@ -18,10 +18,6 @@ while read -r line; do esac done < /etc/modules -mount -t efivarfs efivarfs /efivars -load-random-seed /efivars/LoaderRandomSeed-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f -umount /efivars - ( ip link set eth0 up udhcpc -i eth0 diff --git a/make b/make index 6aadbe8..440b851 100755 --- a/make +++ b/make @@ -17,7 +17,7 @@ gen_cmd() { # ignore builtins [ "$cmd" != "$cmdp" ] || return printf 'file %s %s 0755 0 0\n' "$cmdp" "$cmdp" - ldd "$cmdp" | awk '/\// { if ($1~/^\//) file=$1; else file=$3; print "file " file " " file " 0755 0 0" }' + ldd "$cmdp" | awk '/=>/ { print "file /lib64/" $1 " " $3 " 0755 0 0" }' } # generate the main file list @@ -27,7 +27,7 @@ gen_cpio_list() { gen_cmd e2fsck gen_cmd dropbear gen_cmd cryptsetup - ldconfig -p | awk '$1 == "libgcc_s.so.1" { print "file " $4 " " $4 " 0755 0 0" }' + ldconfig -p | awk '$1 == "libgcc_s.so.1" && $2 ~ /x86-64/ { print "file " $4 " " $4 " 0755 0 0" }' } # filter the list and insert parent directory entries @@ -37,8 +37,11 @@ gen_dir_ents() { # filter the list and generate the make dependency file gen_depfile() { - deps='cpio_list.txt make' - awk -v d=/dev/fd/3 '{print} $1 == "file" { deps=deps " " $3; print $3 ":" > d } END { print "initramfs.img:" deps > d }' + awk -v f=/dev/fd/3 -v deps="cpio_list.txt make" ' + { print } + $1 == "file" { deps=deps " " $3; print $3 ":" > f } + END { print "initramfs.img: " deps > f } + ' } if ! [ -e cpio_list.txt ] || ! [ -e gen_init_cpio ]; then -- cgit v1.2.3-70-g09d2