2017-05-26 20:26:25 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
2017-07-10 18:17:31 +00:00
|
|
|
echo "Flash initramfs and kernel to separate partitions."
|
2017-05-26 20:26:25 +00:00
|
|
|
echo "The kernel needs to have its own minimal initramfs, that loads the"
|
2017-07-10 18:17:31 +00:00
|
|
|
echo "real initramfs from the other partition (\"isorec\")."
|
2017-05-26 20:26:25 +00:00
|
|
|
echo ""
|
2017-07-10 18:17:31 +00:00
|
|
|
echo "Usage: $(basename "$0") <initfs> <initfs partition> <kernel> <kernel partition>"
|
2017-05-26 20:26:25 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Sanity checks
|
2017-07-10 18:17:31 +00:00
|
|
|
[ "$#" != 4 ] && usage
|
|
|
|
INITFS="$1"
|
|
|
|
INITFS_PARTITION="$2"
|
|
|
|
KERNEL="$3"
|
|
|
|
KERNEL_PARTITION="$4"
|
|
|
|
for file in "$INITFS" "$KERNEL"; do
|
2017-05-26 20:26:25 +00:00
|
|
|
[ -e "$file" ] && continue
|
|
|
|
echo "ERROR: File $file does not exist!"
|
|
|
|
exit 1
|
|
|
|
done
|
|
|
|
|
2017-07-14 20:35:59 +00:00
|
|
|
echo "Flash initramfs to the '$INITFS_PARTITION' partition (isorec-style) and"
|
|
|
|
echo "kernel to the '$KERNEL_PARTITION' partition"
|
2017-05-26 20:26:25 +00:00
|
|
|
heimdall_wait_for_device.sh
|
2017-07-10 18:17:31 +00:00
|
|
|
gunzip -c "$INITFS" | lzop > /tmp/initramfs.lzo
|
2017-07-14 20:35:59 +00:00
|
|
|
heimdall flash --"$INITFS_PARTITION" /tmp/initramfs.lzo --"$KERNEL_PARTITION" "$KERNEL"
|
2017-05-26 20:26:25 +00:00
|
|
|
rm /tmp/initramfs.lzo
|