At present, the update script exits cleanly in the case it finds itself
run on Pi hardware prior to the 4/CM4/400, but if installed on non-Pi
hardware exits with various slightly cryptic errors (missing vcgencmd
and some subsequent math errors from trying to bit-shift the empty
BOARD_INFO variable).
This patch adds a similar exit to the non-Pi 4 case, with a slightly
more useful message.
Display a warning if the bootloader version is downgraded. This can
happen when swapping boot-media and the bootloader configuration is
changed from an OS with an old version of the rpi-eeprom package.
Remove the duplicated "update pending" and "to cancel update" messages.
Add a new flag '-s' which init scripts should specify to indicate that
the bootloader is running silently to do an automatic update. If '-s'
is specified and the 'default' release is specified then the bootloader
is only updated if it is older than the minimum version number specified
within this script.
This allows the default release to be updated to support new hardware
without forcing updates for existing users. However, if the
configuration is updated then the latest release should be used.
E.g. If network boot is selected via raspi-config or the Raspberry Pi
Imager then it's desirable to get the latest production release to
benefit from any bug fixes. However, a bootloader updated to support
new hardware (e.g. CM4) should not require Pi4B users to to upgrade
their bootloader.
The min-version is set to pieeprom-2020-09-03.
The 'strings' utility is installed by binutils whereas 'tr' belongs with
coreutils. Minimal systems will only contain the latter, due to binutils'
size (20-50 MB). So, convert all uses of 'strings' to 'tr' so as to
avoid the package dependency.
The second 'tr' usage converts non-ASCII characters into newlines so as
to isolate the "BUILD_TIMESTAMP=1234567890" statement (similar to what
'strings' does). There is no need for this in the first one: non-ASCII
characters are simply discarded as DT aliases have a fixed one line
format.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Move to to the old directory now that it's no longer referenced by rpi-eeprom-update.
Add a dependency check for 'lspci' which is normally provided by
pciutils or busybox and remove the failover to the vl805 helper.
Tweak the failure messages for missing dependencies to be slightly less
OS specific.
The muxing of the SPI EEPROM and analog audio pins makes flashrom
usage unreliable and having two flashing mechanisms adds unnecessary
complexity to this script.
The bootloader supports EEPROM updates from USB-MSD, Network
and rpiboot there is no real need to support flashrom within this
utility. Therefore, the option to use flashrom can be removed from this
script.
Some users might forcibly install this on a board that isn't an rpi4.
Exit early, and explain why the program can't be run.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Update the human readable version of the version information to indicate
that raspi-config may be used to change the release type.
raspi-config can be replaced with other program names if necessary.
Change default FIRMWARE_RELEASE_STATUS variable to 'default' rather
than 'critical'.
Update the built in help for new release names which align the
rpi-eeprom release names with raspi-config documentation.
Move all package checksum related operations to the subshell and check
the old rpi-eeprom-images packages if rpi-eeprom contains no .bin
files.
The rpi-eeprom-config --edit and --apply option passes the -i flag so
checksums should have been skipped anyway.
Add the -l option to return the latest bootloader EEPROM image. This
will be used by rpi-eeprom-config to provide a more convenient mechanism
for quick config changes.
This command pipeline:
printf '00000000000000000000000000000000' | od -An -t x1 | tr -d ' '
produces this output:
30303030303030303030303030303030
*
Add a `-v` to od and a `\n` to the tr arg like so:
printf '00000000000000000000000000000000' | od -v -An -t x1 | tr -d ' \n'
to instead produce this output:
3030303030303030303030303030303030303030303030303030303030303030
Although it's unlikely that the revision value would generate multiple
lines or contain duplicate lines, it's better to be safe than sorry
especially since the changes to do so do not introduce any extra overhead
and use only POSIX-specified options/arguments.
It's also possible this code fragment could be copied and pasted elsewhere
to provide a "hexdump" of something that might be expected to generate
multiple lines and which may potentially contain duplicates. By fixing
the code here any breakage caused by such copying and pasting is avoided.
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Normally BOOTFS is a local FAT partition but with NFS it's possible
that the NFS mount of /boot is not setup to have the equivalent
permissions as /boot. Set the .upd,.sig files to be readable by
all users to to avoid the case where the file is visible to root on the
Pi but is not readable by the TFTP daemon on the server.
Originally, rpi-eeprom-update was only for critically important
security or hardware compatibility requirements. Change the
text of rpi-eeprom-update to indicate that an update is available
rather than being required.
N.B. The systemd service runs with the -a flag which automatically
applies available updates because most users just use the release
folder which is only updated for major/critical updates.
Use `-lt` rather than `\<` so that, for example, this:
[ 2 -lt 17 ]
is true (whereas with `\<` in place of `-lt` it's false).
Also change an `=` comparison to `-eq` to be technically correct.
Helped-by: Tim Gover <tim.gover@raspberrypi.org>
Helped-by: MilhouseVH <milhouseVH.github@nmacleod.com>
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Newer board revisions do not have a dedicated VL805 EEPROM. Instead,
the VL805 firmware is loaded from the bootloader EEPROM.
Update the version check to ignore standalone VL805 update files
on boards without a dedicated VL805 EEPROM.