2017-10-14 23:17:49 +00:00
|
|
|
#!/bin/ash
|
|
|
|
# shellcheck shell=dash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
--help|-h|'')
|
|
|
|
echo "Usage: pmos-update-kernel [flavor]"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-10-26 11:55:43 +00:00
|
|
|
# Declare used deviceinfo variables to pass shellcheck
|
|
|
|
deviceinfo_append_dtb=""
|
|
|
|
|
2017-10-14 23:17:49 +00:00
|
|
|
# shellcheck disable=SC1091
|
|
|
|
. /etc/deviceinfo
|
|
|
|
|
|
|
|
FLAVOR=$1
|
2017-12-21 22:12:52 +00:00
|
|
|
METHOD=${deviceinfo_flash_method:?}
|
2017-10-14 23:17:49 +00:00
|
|
|
case $METHOD in
|
|
|
|
fastboot|heimdall-bootimg)
|
|
|
|
BOOT_PARTITION=$(findfs PARTLABEL="boot")
|
|
|
|
echo "Flashing boot.img..."
|
|
|
|
dd if=/boot/boot.img-"$FLAVOR" of="$BOOT_PARTITION" bs=1M
|
|
|
|
;;
|
|
|
|
heimdall-isorec)
|
|
|
|
KERNEL_PARTITION=$(findfs PARTLABEL="${deviceinfo_flash_heimdall_partition_kernel:?}")
|
|
|
|
INITFS_PARTITION=$(findfs PARTLABEL="${deviceinfo_flash_heimdall_partition_initfs:?}")
|
2020-10-26 11:55:43 +00:00
|
|
|
|
|
|
|
KERNEL="vmlinuz-$FLAVOR"
|
|
|
|
if [ "${deviceinfo_append_dtb}" = "true" ]; then
|
|
|
|
KERNEL="$KERNEL-dtb"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Flashing kernel ($KERNEL)..."
|
|
|
|
dd if=/boot/"$KERNEL" of="$KERNEL_PARTITION" bs=1M
|
|
|
|
|
2017-10-14 23:17:49 +00:00
|
|
|
echo "Flashing initramfs..."
|
|
|
|
gunzip -c /boot/initramfs-"$FLAVOR" | lzop | dd of="$INITFS_PARTITION" bs=1M
|
|
|
|
;;
|
2017-10-30 19:56:38 +00:00
|
|
|
0xffff)
|
2017-10-14 23:17:49 +00:00
|
|
|
echo -n "No need to use this utility, since uboot loads the kernel directly from"
|
|
|
|
echo " the boot partition. Your kernel should be updated already."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Devices with flash method: $METHOD are not supported."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "Done."
|