mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
init: add rpi-flash-firmware service
This commit is contained in:
parent
3e32f390db
commit
72e19ccae8
@ -138,6 +138,10 @@ makeinstall_target() {
|
||||
sed -e "s/@DISTRONAME@/$DISTRONAME/g" \
|
||||
-i $INSTALL/usr/lib/libreelec/fs-resize
|
||||
|
||||
if listcontains "${FIRMWARE}" "rpi-eeprom"; then
|
||||
cp $PKG_DIR/scripts/rpi-flash-firmware $INSTALL/usr/lib/libreelec
|
||||
fi
|
||||
|
||||
mkdir -p $INSTALL/etc
|
||||
cp $PKG_DIR/config/profile $INSTALL/etc
|
||||
cp $PKG_DIR/config/inputrc $INSTALL/etc
|
||||
@ -183,6 +187,7 @@ post_install() {
|
||||
enable_service var.mount
|
||||
enable_service var-log-debug.service
|
||||
enable_service fs-resize.service
|
||||
listcontains "${FIRMWARE}" "rpi-eeprom" && enable_service rpi-flash-firmware.service
|
||||
|
||||
# cron support
|
||||
if [ "$CRON_SUPPORT" = "yes" ] ; then
|
||||
|
@ -1123,17 +1123,16 @@ if [ "$STORAGE_NETBOOT" = "yes" ]; then
|
||||
echo "" > /sysroot/dev/.storage_netboot
|
||||
fi
|
||||
|
||||
BACKUP_FILE=$(ls -1 /sysroot/storage/.restore/??????????????.tar 2>/dev/null | head -n 1)
|
||||
|
||||
if [ -f /sysroot/storage/.please_resize_me ]; then
|
||||
INIT_UNIT="--unit=fs-resize.target"
|
||||
fi
|
||||
|
||||
BACKUP_FILE=$(ls -1 /sysroot/storage/.restore/??????????????.tar 2>/dev/null | head -n 1)
|
||||
if [ -f "$BACKUP_FILE" ]; then
|
||||
INIT_UNIT="--unit=backup-restore.target"
|
||||
fi
|
||||
|
||||
if [ -f /sysroot/storage/.cache/reset_oe -o -f /sysroot/storage/.cache/reset_xbmc ]; then
|
||||
elif [ -f /sysroot/storage/.cache/reset_oe -o -f /sysroot/storage/.cache/reset_xbmc ]; then
|
||||
INIT_UNIT="--unit=factory-reset.target"
|
||||
elif [ -f "$BACKUP_FILE" ]; then
|
||||
INIT_UNIT="--unit=backup-restore.target"
|
||||
elif [ -f /sysroot/storage/.rpi_flash_firmware ]; then
|
||||
INIT_UNIT="--unit=rpi-flash-firmware.target"
|
||||
fi
|
||||
|
||||
# switch to new sysroot and start real init
|
||||
|
66
packages/sysutils/busybox/scripts/rpi-flash-firmware
Executable file
66
packages/sysutils/busybox/scripts/rpi-flash-firmware
Executable file
@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
FLAG_FILE="/storage/.rpi_flash_firmware"
|
||||
|
||||
. /usr/lib/libreelec/functions
|
||||
|
||||
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}
|
||||
|
||||
# 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 -a
|
||||
fi
|
||||
|
||||
# Bump process to next step
|
||||
sed -e 's/^MODE=.*/MODE="update"/' -i "${FLAG_FILE}"
|
||||
sync
|
||||
else
|
||||
rm -f "${FLAG_FILE}"
|
||||
sync
|
||||
|
||||
if [ "${MODE}" = "update" ]; then
|
||||
# Cleanup SPI bootloader files and show current version
|
||||
if [ "${BOOTLOADER}" = "yes" ]; then
|
||||
rm -f /flash/pieeprom.bin /flash/pieeprom.upd
|
||||
rm -f /flash/recovery.bin /flash/recovery.[0-9][0-9][0-9] /flash/RECOVERY.[0-9][0-9][0-9]
|
||||
# Display current bootloader status
|
||||
USE_FLASHROM=0 /usr/bin/rpi-eeprom-update
|
||||
fi
|
||||
|
||||
# Apply VIA USB3 update
|
||||
# if [ "${USB3}" = "yes" ]; then
|
||||
# /usr/bin/vl805
|
||||
# fi
|
||||
|
||||
sync
|
||||
echo ""
|
||||
StartProgress countdown "Rebooting in 15s... " 15 "NOW"
|
||||
fi
|
||||
fi
|
||||
|
||||
sync
|
||||
mount -o remount,ro /flash
|
||||
fi
|
||||
|
||||
reboot -f &>/dev/null
|
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=RPi Flash Firmware
|
||||
Requires=tmp.mount var.mount sys-kernel-config.mount kernel-overlays.service
|
||||
After=tmp.mount var.mount sys-kernel-config.mount kernel-overlays.service
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=idle
|
||||
ExecStart=/usr/lib/libreelec/rpi-flash-firmware
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
@ -0,0 +1,5 @@
|
||||
[Unit]
|
||||
Description=RPi Flash Firmware target
|
||||
Requires=rpi-flash-firmware.service
|
||||
After=rpi-flash-firmware.service
|
||||
AllowIsolate=yes
|
Loading…
x
Reference in New Issue
Block a user