fix initramfs patching script

This commit is contained in:
ading2210 2023-10-02 12:17:59 -07:00
parent 8f412ba1b1
commit d3d7b6caff
4 changed files with 12 additions and 7 deletions

View File

@ -1 +1,3 @@
todo # 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.

View File

@ -7,6 +7,8 @@ if [ "$DEBUG" ]; then
set -x set -x
fi fi
. ./patch_initramfs.sh
print_help() { print_help() {
echo "Usage: ./build.sh path_to_shim" echo "Usage: ./build.sh path_to_shim"
} }
@ -79,7 +81,7 @@ echo "shim initramfs extracted to ${initramfs_dir}"
cd $previous_dir cd $previous_dir
echo "patching initramfs" echo "patching initramfs"
exec ./patch_initramfs.sh $initramfs_dir patch_initramfs $initramfs_dir
echo "cleaning up loop devices" echo "cleaning up loop devices"
losetup -d $shim_loop losetup -d $shim_loop

View File

@ -7,10 +7,11 @@ if [ "$DEBUG" ]; then
set -x set -x
fi fi
patch_initramfs() {
initramfs_path=$(realpath $1) initramfs_path=$(realpath $1)
rm "${initramfs_path}/init" -f rm "${initramfs_path}/init" -f
cp bootloader/init.sh "${initramfs_path}/bin/init" cp -r bootloader/* "${initramfs_path}/"
cp bootloader/bootstrap.sh "${initramfs_path}/bin/bootstrap.sh"
find ${initramfs_path}/bin -name "*" -exec chmod +x {} \; find ${initramfs_path}/bin -name "*" -exec chmod +x {} \;
}