diff --git a/packages/sysutils/busybox/scripts/init b/packages/sysutils/busybox/scripts/init index c1587abb10..8936ba7993 100755 --- a/packages/sysutils/busybox/scripts/init +++ b/packages/sysutils/busybox/scripts/init @@ -574,10 +574,13 @@ mount_flash() { cleanup_flash() { progress "Cleaning up flash (if required)" - if [ -f /flash/pieeprom.upd ]; then + if [ -f /flash/pieeprom.bin -o -f /flash/pieeprom.upd -o -f /flash/vl805.bin ]; then mount -o remount,rw /flash - rm -f /flash/pieeprom.bin /flash/pieeprom.upd + + rm -f /flash/pieeprom.bin /flash/pieeprom.upd /flash/pieeprom.sig + rm -f /flash/vl805.bin /flash/vl805.sig rm -f /flash/recovery.bin /flash/recovery.[0-9][0-9][0-9] /flash/RECOVERY.[0-9][0-9][0-9] + mount -o remount,ro /flash fi } diff --git a/packages/sysutils/busybox/scripts/rpi-flash-firmware b/packages/sysutils/busybox/scripts/rpi-flash-firmware index 42f91098ae..d519209f80 100755 --- a/packages/sysutils/busybox/scripts/rpi-flash-firmware +++ b/packages/sysutils/busybox/scripts/rpi-flash-firmware @@ -9,51 +9,30 @@ FLAG_FILE="/storage/.rpi_flash_firmware" hidecursor -if ! mount -o remount,rw /flash 2>/dev/null; then - # Remove flag file and bail out - rm -f "${FLAG_FILE}" - sync - - echo "ERROR: Unable to mount /flash as a read/write file system." - echo - echo "Aborting Flash update process - please proceed with a manual update." - echo - - StartProgress countdown "Rebooting in 15s... " 15 "NOW" -fi - if [ -f "${FLAG_FILE}" ]; then . ${FLAG_FILE} + rm -f "${FLAG_FILE}" - # Prepare flashing environment - if [ "${MODE}" = "init" ]; then - # Install new SPI bootloader files to /flash (if required) - if [ "${BOOTLOADER}" = "yes" ]; then - USE_FLASHROM=0 /usr/bin/.rpi-eeprom-update.real -a - fi + if ! mount -o remount,rw /flash 2>/dev/null; then + echo "ERROR: Unable to mount /flash as a read/write file system." + echo + echo "Aborting Flash update process - please proceed with a manual update." + echo - # Bump process to next step - sed -e 's/^MODE=.*/MODE="update"/' -i "${FLAG_FILE}" - sync - else - rm -f "${FLAG_FILE}" - sync + StartProgress countdown "Rebooting in 15s... " 15 "NOW" + reboot -f &>/dev/null + fi - if [ "${MODE}" = "update" ]; then - # Display current bootloader status - if [ "${BOOTLOADER}" = "yes" ]; then - USE_FLASHROM=0 /usr/bin/.rpi-eeprom-update.real - fi + # Install new bootloader and/or USB3 firmware files to /flash + # Firmware flashing will occur during the next boot, after + # which the system will again reboot. + # Old firmware files will be automatically removed by init. + CMD_ARGS="" + [ "${BOOTLOADER}" = "yes" ] && CMD_ARGS="${CMD_ARGS} -A bootloader" + [ "${VL805}" = "yes" ] && CMD_ARGS="${CMD_ARGS} -A vl805" - # Apply VIA USB3 update -# if [ "${USB3}" = "yes" ]; then -# /usr/bin/vl805 -# fi - - sync - echo "" - StartProgress countdown "Rebooting in 15s... " 15 "NOW" - fi + if [ -n "${CMD_ARGS}" ]; then + USE_FLASHROM=0 /usr/bin/.rpi-eeprom-update.real ${CMD_ARGS} fi sync diff --git a/packages/tools/rpi-eeprom/package.mk b/packages/tools/rpi-eeprom/package.mk index 3adf7a6eb1..328d183a7f 100644 --- a/packages/tools/rpi-eeprom/package.mk +++ b/packages/tools/rpi-eeprom/package.mk @@ -19,17 +19,26 @@ makeinstall_target() { _dirs="critical" [ "$LIBREELEC_VERSION" = "devel" ] && _dirs+=" beta" for _dir in ${_dirs}; do - if [ -n "$(ls -1 ${PKG_BUILD}/firmware/${_dir}/pieeprom-* 2>/dev/null)" ]; then - mkdir -p ${DESTDIR}/${_dir} - cp -PRv $(ls -1 ${PKG_BUILD}/firmware/${_dir}/pieeprom-* | tail -1) ${DESTDIR}/${_dir} - cp -PRv ${PKG_BUILD}/firmware/${_dir}/recovery.bin ${DESTDIR}/${_dir} - fi + mkdir -p ${DESTDIR}/${_dir} + cp -PRv ${PKG_BUILD}/firmware/${_dir}/recovery.bin ${DESTDIR}/${_dir} + + # Bootloader SPI + PKG_FW_FILE="$(ls -1 ${PKG_BUILD}/firmware/${_dir}/pieeprom-* 2>/dev/null | tail -1)" + [ -n "${PKG_FW_FILE}" ] && cp -PRv "${PKG_FW_FILE}" ${DESTDIR}/${_dir} + + # VIA USB3 + if [ -f ${PKG_BUILD}/firmware/${_dir}/vl805.latest ]; then + PKG_FW_FILE="$(tail -1 ${PKG_BUILD}/firmware/${_dir}/vl805.latest)" + cp -PRv ${PKG_BUILD}/firmware/${_dir}/vl805-${PKG_FW_FILE}.bin ${DESTDIR}/${_dir} + cp -PRv ${PKG_BUILD}/firmware/${_dir}/vl805.latest ${DESTDIR}/${_dir} + fi done mkdir -p ${INSTALL}/usr/bin cp -PRv ${PKG_DIR}/source/rpi-eeprom-update ${INSTALL}/usr/bin cp -PRv ${PKG_BUILD}/rpi-eeprom-update ${INSTALL}/usr/bin/.rpi-eeprom-update.real cp -PRv ${PKG_BUILD}/rpi-eeprom-config ${INSTALL}/usr/bin + cp -PRv ${PKG_BUILD}/vl805 ${INSTALL}/usr/bin mkdir -p ${INSTALL}/etc/default cp -PRv ${PKG_DIR}/config/* ${INSTALL}/etc/default