2021-11-26 18:37:42 +00:00
|
|
|
disable_cma() {
|
|
|
|
if [[ -f /boot/config.txt && $(grep '^cma' /boot/config.txt) != '' ]]; then
|
2023-12-13 11:33:44 +00:00
|
|
|
cat <<END
|
|
|
|
|
|
|
|
>>> You appear to have dynamic memory (CMA) enabled, which is currently broken
|
|
|
|
in newer kernels and will cause many issues if left enabled. Disabling that
|
|
|
|
for you now.
|
|
|
|
|
|
|
|
END
|
2021-11-26 18:37:42 +00:00
|
|
|
sed -i 's/^cma_/#cma_/g' /boot/config.txt
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
correct_fstab() {
|
|
|
|
# starting with v5.10.y, fstab requires a padded zero in the path to /boot
|
|
|
|
if [[ -f /etc/fstab ]]; then
|
|
|
|
if grep -q mmcblk1p1 /etc/fstab; then
|
2021-11-29 07:01:05 +00:00
|
|
|
sed -i 's/mmcblk1p1/mmcblk0p1/' /etc/fstab
|
2021-11-26 18:37:42 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-12-13 11:33:44 +00:00
|
|
|
advertise_rpi5() {
|
|
|
|
if [[ -f /sys/firmware/devicetree/base/model ]]; then
|
|
|
|
if grep -a -q 5 /sys/firmware/devicetree/base/model; then
|
|
|
|
cat <<END
|
2021-11-29 07:01:05 +00:00
|
|
|
|
2024-05-16 14:16:03 +00:00
|
|
|
>>> For 16 KB pages on RPi5, consider installing the linux-rpi-16k kernel
|
|
|
|
>>> package instead of linux-rpi which only use 4 KB pages. Note that some
|
|
|
|
>>> software is incompatible with larger pages.
|
2021-11-26 18:37:42 +00:00
|
|
|
|
2023-12-13 11:33:44 +00:00
|
|
|
END
|
2021-11-26 18:37:42 +00:00
|
|
|
fi
|
|
|
|
fi
|
2023-12-13 11:33:44 +00:00
|
|
|
}
|
2021-11-26 18:37:42 +00:00
|
|
|
|
2023-12-13 11:33:44 +00:00
|
|
|
post_install () {
|
|
|
|
post_upgrade
|
|
|
|
}
|
|
|
|
|
|
|
|
post_upgrade() {
|
|
|
|
advertise_rpi5
|
|
|
|
correct_fstab
|
2021-11-26 18:37:42 +00:00
|
|
|
disable_cma
|
|
|
|
|
2023-12-13 11:33:44 +00:00
|
|
|
if grep "^[^#]*[[:space:]]/boot" etc/fstab 2>&1 >/dev/null; then
|
|
|
|
if ! grep "[[:space:]]/boot" etc/mtab 2>&1 >/dev/null; then
|
|
|
|
cat <<END
|
2021-11-26 18:37:42 +00:00
|
|
|
|
2023-12-13 11:33:44 +00:00
|
|
|
>>> WARNING: /boot appears to be a separate partition but is not mounted.
|
|
|
|
You probably just broke your system. Congratulations.
|
|
|
|
|
|
|
|
END
|
|
|
|
fi
|
2021-11-26 18:37:42 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
post_remove() {
|
|
|
|
rm -f boot/initramfs-linux.img
|
|
|
|
}
|