From ec441a8eedb5900c2417559ef80ab78bffa5c4e1 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 29 Sep 2023 13:28:00 +0100 Subject: [PATCH] rpi-update: More complete Pi 5 support Signed-off-by: Phil Elwell --- rpi-update | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/rpi-update b/rpi-update index 05dedf3..b4872e2 100755 --- a/rpi-update +++ b/rpi-update @@ -179,6 +179,11 @@ function update_modules { continue; fi fi + if [[ ${WANT_PI5} -ne 1 ]]; then + if [[ "${VERSION}" == "v8_16k+" ]]; then + continue; + fi + fi cp -R "${DIR}" "${FW_MODPATH}/" echo " *** depmod ${BASEDIR}" depmod -b "${ROOT_PATH}" -a "${BASEDIR}" @@ -326,6 +331,7 @@ function show_notice { } function check_partition { + mbs=$1 if [[ ${SKIP_CHECK_PARTITION} -ne 0 ]]; then return fi @@ -338,10 +344,10 @@ function check_partition { fi fi fi - if [ $PARTSIZE -ne 0 ] && [ $PARTSIZE -lt $(( 256*1024*1024 )) ]; then - echo "Partition size $(( $PARTSIZE >> 20 ))M may not be sufficient for new Pi4 files" + if [ $PARTSIZE -ne 0 ] && [ $PARTSIZE -lt $(( mbs*1024*1024 )) ]; then + echo "Partition size $(( $PARTSIZE >> 20 ))M may not be sufficient for all firmware files" echo "This could result in a system that will not boot." - echo "256M FAT partition is recommended. Ensure you have a backup if continuing." + echo "${mbs}M FAT partition is recommended. Ensure you have a backup if continuing." if [[ ${SKIP_WARNING} -ne 0 ]]; then return fi @@ -400,6 +406,9 @@ function update_firmware { if [[ ${WANT_64BIT} -eq 1 ]]; then [[ -e "${FW_REPOLOCAL}/"kernel8.img ]] && cp "${FW_REPOLOCAL}/"kernel8.img "${FW_PATH}/" fi + if [[ ${WANT_PI5} -eq 1 ]]; then + [[ -e "${FW_REPOLOCAL}/"kernel_2712.img ]] && cp "${FW_REPOLOCAL}/"kernel_2712.img "${FW_PATH}/" + fi if [[ -n $(shopt -s nullglob; echo "${FW_REPOLOCAL}/"*.dtb*) ]]; then cp "${FW_REPOLOCAL}/"*.dtb* "${FW_PATH}/" fi @@ -477,12 +486,18 @@ function do_update { if [ -f ${FW_PATH}/start4.elf ] || [ -f ${BOOT_PATH}/start4.elf ]; then WANT_PI4=${WANT_PI4:-1} fi + if [ -f ${FW_PATH}/kernel_2712.img ]; then + WANT_PI5=${WANT_PI5:-1} + fi WANT_32BIT=${WANT_32BIT:-0} WANT_64BIT=${WANT_64BIT:-0} WANT_PI4=${WANT_PI4:-0} - echo "WANT_32BIT:${WANT_32BIT} WANT_64BIT:${WANT_64BIT} WANT_PI4:${WANT_PI4}" - if [[ ${WANT_PI4} -eq 1 ]]; then - check_partition + WANT_PI5=${WANT_PI5:-0} + echo "WANT_32BIT:${WANT_32BIT} WANT_64BIT:${WANT_64BIT} WANT_PI4:${WANT_PI4} WANT_PI5:${WANT_PI5}" + if [[ ${WANT_PI5} -eq 1 ]]; then + check_partition 512 + elif [[ ${WANT_PI4} -eq 1 ]]; then + check_partition 256 fi check_initramfs check_eeprom_version