Thanks for pointing us in the right direction armuseru! I also have a Hisense Chromebook C11 (Veyron Jerry) that failed to boot after the 5.16.x kernel update due to the larger kernel size.
Your kernel.its file is exactly correct. The kernelinst script, however, needs to be slightly different. Here's the slightly modded script that worked for me:
- Code: Select all
#!/bin/bash
if [ "$(whoami)" == "root" ]; then
# resign kernel
echo "
You may re-sign kernel and customize kernel boot string.
Regular user do not need it, so it is safe to press n.
Do you want to do this? (y/n)
"
read -r tmpvar1
if $(echo $tmpvar1 | grep -q [Yy]); then
bootcmd='console=tty0 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootwait rw noinitrd'
echo "default bootcmd is
$bootcmd
Be very careful, without init=/sbin/init root=PARTUUID=%U/PARTNROFF=1
or something like that your could get a bootfail.
Now you may specify a new one or just press Enter"
tmpvar2=""
read -r tmpvar2
if [ ! -z "$tmpvar2" ]; then
bootcmd="$tmpvar2"
else
echo "Will be used default boot string
"
fi
#
mkimage -D "-I dts -O dtb -p 2048" -f /boot/reflash/kernel.its /tmp/vmlinux.uimg
# make empty bootloader
dd if=/dev/zero of=/tmp/bootloader.bin bs=512 count=1
echo $bootcmd > /tmp/cmdline
# backup default vmlinux.kpart
mv -f /boot/vmlinux.kpart /boot/vmlinux.old
# final step
vbutil_kernel \
--pack /boot/vmlinux.kpart \
--version 1 \
--vmlinuz /tmp/vmlinux.uimg \
--arch arm \
--keyblock /boot/reflash/kernel.keyblock \
--signprivate /boot/reflash/kernel_data_key.vbprivk \
--config /tmp/cmdline \
--bootloader /tmp/bootloader.bin
# clear used files
rm -f /tmp/vmlinux.uimg /tmp/cmdline /tmp/bootloader.bin
fi
# flash kernel
krnprts=""
krnprtc=0
for i in $(ls /dev | grep -x --regexp="mmcblk[0-9]" --regexp="sd[a-z]" --regexp="vd[a-z]"); do
if $(cgpt show /dev/$i | grep Label | grep -q [Kk]ernel); then
if $(echo $i | grep -q mmcblk); then
krnprts+="$i""p$(cgpt show /dev/$i | grep Label | grep [Kk]ernel -m 1 | sed 's/ / /g' | sed 's/ / /g' | sed 's/ La.*//g' | sed 's/.* //g') "
else
krnprts+="$i$(cgpt show /dev/$i | grep Label | grep [Kk]ernel -m 1 | sed 's/ / /g' | sed 's/ / /g' | sed 's/ La.*//g' | sed 's/.* //g') "
fi
krnprtc=$(($krnprtc+1))
fi
done
echo ""
if [ "$krnprtc" -eq 0 ]; then
echo "Chrome OS kernel partition did not detected."
echo "You must reflash kernel manually."
elif [ "$krnprtc" -eq 1 ]; then
echo "Finded ChromeOs kernel partition - $krnprts"
echo "Do you want to flash a new kernel to it? (y/n)"
read -r shouldwe
if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
dd if=/boot/vmlinux.kpart of=/dev/$krnprts
sync
else
echo "You may flash kernel manually like:"
echo "dd if=/boot/vmlinux.kpart of=/dev/$krnprts"
fi
else
echo "Finded more than one Chrome OS kernel partition."
echo "You need to select next action
"
echo "0 for do not flash"
numpart=0
for i in $krnprts; do
numpart=$(($numpart+1))
echo "$numpart for flash $i partition"
done
echo ""
echo "Wrong partition may lead to bootfail. Be aware!"
read -r shouldwe
if [ $shouldwe -gt 0 ]&&[ $shouldwe -le $numpart ]; then
numpart=0
for i in $krnprts; do
numpart=$(($numpart+1))
if [ $numpart -eq $shouldwe ]; then
dd if=/boot/vmlinux.kpart of=/dev/$i
sync
fi
done
fi
fi
else
echo superuser rights required
fi
I can confirm it works both within Arch (if you remember to run it before rebooting after a kernel update), and in a chroot from ChromeOS (which is where you'll do it when you invariably forget lol).
I'm now happily running the 5.16.13 kernel with this patch. I'm having issues with RTL-SDR dongles, but I think that's unrelated.
Thanks again!