pmaports/heimdall/heimdall_flash_kernel.sh
Oliver Smith 1c0ff6aa23 Put postmarketOS aports inside pmbootstrap repo
Later, the aports folder will probably get split up in its own repository.
But right now this is simply convenient.
2017-05-26 22:26:25 +02:00

33 lines
866 B
Bash

#!/bin/sh
set -e
usage()
{
echo "Flash an initramfs file to the recovery partition, and flash a kernel."
echo "The kernel needs to have its own minimal initramfs, that loads the"
echo "real initramfs from the recovery partition (\"isorec\")."
echo ""
echo "Usage: $(basename "$0") <initramfs> <kernel>"
exit 1
}
# Sanity checks
[ "$#" != 2 ] && usage
INITRAMFS="$1"
KERNEL="$2"
for file in "$INITRAMFS" "$KERNEL"; do
[ -e "$file" ] && continue
echo "ERROR: File $file does not exist!"
exit 1
done
echo "(1/2) flash initramfs to recovery partition (isorec-style)"
heimdall_wait_for_device.sh
gunzip -c "$INITRAMFS" | lzop > /tmp/initramfs.lzo
heimdall flash --RECOVERY /tmp/initramfs.lzo
rm /tmp/initramfs.lzo
sleep 20
echo "(2/2) flash kernel (hit ^C if you only wanted to flash initramfs)"
heimdall_wait_for_device.sh
heimdall flash --KERNEL "$KERNEL"