From d3d7b6caffc1e48b257072e242becfd55abeba86 Mon Sep 17 00:00:00 2001 From: ading2210 Date: Mon, 2 Oct 2023 12:17:59 -0700 Subject: [PATCH] fix initramfs patching script --- README.md | 4 +++- bootloader/bin/{init.sh => init} | 0 build.sh | 4 +++- patch_initramfs.sh | 11 ++++++----- 4 files changed, 12 insertions(+), 7 deletions(-) rename bootloader/bin/{init.sh => init} (100%) diff --git a/README.md b/README.md index 4d94406..bf54b4a 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -todo \ No newline at end of file +# Chrome OS RMA Shim Bootloader + +This is a set of scripts for patching a Chrome OS RMA shim to serve as a bootloader for a standard Linux disto. \ No newline at end of file diff --git a/bootloader/bin/init.sh b/bootloader/bin/init similarity index 100% rename from bootloader/bin/init.sh rename to bootloader/bin/init diff --git a/build.sh b/build.sh index fa9c224..931a869 100755 --- a/build.sh +++ b/build.sh @@ -7,6 +7,8 @@ if [ "$DEBUG" ]; then set -x fi +. ./patch_initramfs.sh + print_help() { echo "Usage: ./build.sh path_to_shim" } @@ -79,7 +81,7 @@ echo "shim initramfs extracted to ${initramfs_dir}" cd $previous_dir echo "patching initramfs" -exec ./patch_initramfs.sh $initramfs_dir +patch_initramfs $initramfs_dir echo "cleaning up loop devices" losetup -d $shim_loop \ No newline at end of file diff --git a/patch_initramfs.sh b/patch_initramfs.sh index 173de45..a840758 100755 --- a/patch_initramfs.sh +++ b/patch_initramfs.sh @@ -7,10 +7,11 @@ if [ "$DEBUG" ]; then set -x fi -initramfs_path=$(realpath $1) +patch_initramfs() { + initramfs_path=$(realpath $1) -rm "${initramfs_path}/init" -f -cp bootloader/init.sh "${initramfs_path}/bin/init" -cp bootloader/bootstrap.sh "${initramfs_path}/bin/bootstrap.sh" + rm "${initramfs_path}/init" -f + cp -r bootloader/* "${initramfs_path}/" -find ${initramfs_path}/bin -name "*" -exec chmod +x {} \; \ No newline at end of file + find ${initramfs_path}/bin -name "*" -exec chmod +x {} \; +}