mirror of
https://github.com/raspberrypi/rpi-eeprom.git
synced 2026-01-20 21:13:36 +08:00
8
debian/changelog
vendored
8
debian/changelog
vendored
@@ -1,3 +1,11 @@
|
|||||||
|
rpi-eeprom (11.6-1) buster; urgency=medium
|
||||||
|
|
||||||
|
[ Nicolas Saenz Julienne ]
|
||||||
|
* rpi-eeprom-update: Get bootloader configuration from DT
|
||||||
|
* rpi-eeprom-config: Properly decode sysfs binary files
|
||||||
|
|
||||||
|
-- Serge Schneider <serge@raspberrypi.com> Thu, 28 Jan 2021 11:57:59 +0000
|
||||||
|
|
||||||
rpi-eeprom (11.5-1) buster; urgency=medium
|
rpi-eeprom (11.5-1) buster; urgency=medium
|
||||||
|
|
||||||
[ Tim Gover ]
|
[ Tim Gover ]
|
||||||
|
|||||||
@@ -138,8 +138,7 @@ def edit_config(eeprom=None):
|
|||||||
image = BootloaderImage(pending)
|
image = BootloaderImage(pending)
|
||||||
current_config = image.get_config().decode('utf-8')
|
current_config = image.get_config().decode('utf-8')
|
||||||
else:
|
else:
|
||||||
config_src = 'vcgencmd bootloader_config'
|
current_config, config_src = read_current_config()
|
||||||
current_config = read_current_config()
|
|
||||||
|
|
||||||
create_tempdir()
|
create_tempdir()
|
||||||
tmp_conf = os.path.join(TEMP_DIR, 'boot.conf')
|
tmp_conf = os.path.join(TEMP_DIR, 'boot.conf')
|
||||||
@@ -160,7 +159,17 @@ def read_current_config():
|
|||||||
"""
|
"""
|
||||||
Reads the configuration used by the current bootloader.
|
Reads the configuration used by the current bootloader.
|
||||||
"""
|
"""
|
||||||
return shell_cmd(['vcgencmd', 'bootloader_config'])
|
fw_base = "/sys/firmware/devicetree/base/"
|
||||||
|
nvmem_base = "/sys/bus/nvmem/devices/"
|
||||||
|
|
||||||
|
if os.path.exists(fw_base + "/aliases/blconfig"):
|
||||||
|
with open(fw_base + "/aliases/blconfig", "rb") as f:
|
||||||
|
nvmem_ofnode_path = fw_base + f.read().decode('utf-8')
|
||||||
|
for d in os.listdir(nvmem_base):
|
||||||
|
if os.path.realpath(nvmem_base + d + "/of_node") in os.path.normpath(nvmem_ofnode_path):
|
||||||
|
return (open(nvmem_base + d + "/nvmem", "rb").read().decode('utf-8'), "blconfig device")
|
||||||
|
|
||||||
|
return (shell_cmd(['vcgencmd', 'bootloader_config']), "vcgencmd bootloader_config")
|
||||||
|
|
||||||
class BootloaderImage(object):
|
class BootloaderImage(object):
|
||||||
def __init__(self, filename, output=None):
|
def __init__(self, filename, output=None):
|
||||||
@@ -293,6 +302,7 @@ Operating modes:
|
|||||||
it must be run as root.
|
it must be run as root.
|
||||||
|
|
||||||
The configuration file will be taken from:
|
The configuration file will be taken from:
|
||||||
|
* The blconfig reserved memory nvmem device
|
||||||
* The cached bootloader configuration 'vcgencmd bootloader_config'
|
* The cached bootloader configuration 'vcgencmd bootloader_config'
|
||||||
* The current pending update - typically /boot/pieeprom.upd
|
* The current pending update - typically /boot/pieeprom.upd
|
||||||
|
|
||||||
@@ -336,7 +346,7 @@ images.
|
|||||||
else:
|
else:
|
||||||
image.read()
|
image.read()
|
||||||
elif args.config is None and args.eeprom is None:
|
elif args.config is None and args.eeprom is None:
|
||||||
current_config = read_current_config()
|
current_config, config_src = read_current_config()
|
||||||
if args.out is not None:
|
if args.out is not None:
|
||||||
open(args.out, 'w').write(current_config)
|
open(args.out, 'w').write(current_config)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -104,6 +104,34 @@ die() {
|
|||||||
exit ${EXIT_FAILED}
|
exit ${EXIT_FAILED}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBootloaderConfig() {
|
||||||
|
# Prefer extracting bootloader's config from DT.
|
||||||
|
#
|
||||||
|
# In order to find the right nvmem device, we build the sysfs path of the
|
||||||
|
# bootloader reserved memory DT node to then match that path against all
|
||||||
|
# nvmem device's ofnode path.
|
||||||
|
#
|
||||||
|
# If the path isn't there, default to using vcgencmd.
|
||||||
|
|
||||||
|
local blconfig_alias="/sys/firmware/devicetree/base/aliases/blconfig"
|
||||||
|
local blconfig_nvmem_path=""
|
||||||
|
|
||||||
|
if [ -f "${blconfig_alias}" ]; then
|
||||||
|
local blconfig_ofnode_path="/sys/firmware/devicetree/base"$(strings "${blconfig_alias}")""
|
||||||
|
local blconfig_ofnode_link=$(find -L /sys/bus/nvmem -samefile "${blconfig_ofnode_path}" 2>/dev/null)
|
||||||
|
|
||||||
|
if [ -e "${blconfig_ofnode_link}" ]; then
|
||||||
|
blconfig_nvmem_path=$(dirname "${blconfig_ofnode_link}")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${blconfig_nvmem_path}" ]; then
|
||||||
|
cat "${blconfig_nvmem_path}"/nvmem
|
||||||
|
else
|
||||||
|
vcgencmd bootloader_config
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
prepareImage()
|
prepareImage()
|
||||||
{
|
{
|
||||||
[ -f "${BOOTLOADER_UPDATE_IMAGE}" ] || die "EEPROM image '${BOOTLOADER_UPDATE_IMAGE}' not found"
|
[ -f "${BOOTLOADER_UPDATE_IMAGE}" ] || die "EEPROM image '${BOOTLOADER_UPDATE_IMAGE}' not found"
|
||||||
@@ -114,7 +142,7 @@ prepareImage()
|
|||||||
mkdir -p "${FIRMWARE_BACKUP_DIR}"
|
mkdir -p "${FIRMWARE_BACKUP_DIR}"
|
||||||
|
|
||||||
# Backup the configuration of the currently loaded bootloader
|
# Backup the configuration of the currently loaded bootloader
|
||||||
vcgencmd bootloader_config > "${TMP_EEPROM_CONFIG}"
|
getBootloaderConfig > "${TMP_EEPROM_CONFIG}"
|
||||||
backup="${FIRMWARE_BACKUP_DIR}/pieeprom-backup-$(date +%Y%m%d-%H%M%S).conf"
|
backup="${FIRMWARE_BACKUP_DIR}/pieeprom-backup-$(date +%Y%m%d-%H%M%S).conf"
|
||||||
cp -f "${TMP_EEPROM_CONFIG}" "${backup}"
|
cp -f "${TMP_EEPROM_CONFIG}" "${backup}"
|
||||||
|
|
||||||
@@ -355,8 +383,8 @@ checkDependencies() {
|
|||||||
FIRMWARE_IMAGE_DIR="${FIRMWARE_IMAGE_DIR}-${BOARD_INFO}"
|
FIRMWARE_IMAGE_DIR="${FIRMWARE_IMAGE_DIR}-${BOARD_INFO}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if vcgencmd bootloader_config | grep -qi "Command not registered"; then
|
if ! getBootloaderConfig > /dev/null; then
|
||||||
die "vcgencmd: 'bootloader_config' command not supported. Please update VC firmware and reboot."
|
die "Unable to get bootloader config, please update VC firmware and reboot."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v sha256sum > /dev/null; then
|
if ! command -v sha256sum > /dev/null; then
|
||||||
@@ -800,7 +828,7 @@ done
|
|||||||
|
|
||||||
checkDependencies
|
checkDependencies
|
||||||
if [ "${AUTO_UPDATE_BOOTLOADER}" = 1 ] || [ "${AUTO_UPDATE_VL805}" = 1 ]; then
|
if [ "${AUTO_UPDATE_BOOTLOADER}" = 1 ] || [ "${AUTO_UPDATE_VL805}" = 1 ]; then
|
||||||
if vcgencmd bootloader_config | grep FREEZE_VERSION=1; then
|
if getBootloaderConfig | grep FREEZE_VERSION=1; then
|
||||||
echo "EEPROM version is frozen. Skipping update"
|
echo "EEPROM version is frozen. Skipping update"
|
||||||
exit ${EXIT_EEPROM_FROZEN}
|
exit ${EXIT_EEPROM_FROZEN}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user