Commit Graph

93 Commits

Author SHA1 Message Date
Tim Gover
2efe9daef6 rpi-eeprom-update: Mention rpiboot in the CM4 not supported error message 2022-09-30 10:52:44 +01:00
Tim Gover
4cbc4bc1c5 rpi-eeprom-update: Avoid using recovery.bin if the current bootloader supports self-update
Self-update is preferred to using recovery.bin because it avoids modifiy the
boot partition in order to rename recovery.bin after use. Since the 2711 ROM
does not support network or USB MSD loading of recovery.bin self-update has to
be used with other boot modes anyway.

If RPI_EEPROM_SELF_UPDATE=1 then avoid installing recovery.bin so long as the
current bootloader version supports self-update from SD/MMC and that doesn't
look as though SELF_UPDATE has been disable in the EEPROM config.
2022-05-11 14:06:13 +01:00
Tim Gover
34b790407c rpi-eeprom-digest: Add to test/install and specify -o in rpi-eeprom-update 2021-11-22 14:29:59 +00:00
Tim Gover
43610e19ec rpi-eeprom-update: Use rpi-eeprom-digest to generate the .sig files 2021-11-13 15:50:23 +00:00
Tim Gover
95e04c9910 Update a few more URLs to raspberrypi.com 2021-10-13 08:27:20 +01:00
Tim Gover
949e9c49f8 Merge pull request #343 from waveform80/ignore-non-pi
Add a test to cause the script to exit cleanly on non-Pi hardware
2021-06-11 11:51:18 +01:00
Dave Jones
71ef83abbc Add a test to cause the script to exit cleanly on non-Pi hardware
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.
2021-06-10 10:04:13 +01:00
Dave Jones
6a310b5d4d Remove redundant vcmailbox reference
The vcmailbox binary is no longer used (like flashrom), hence there's little point in keeping the configuration variable for it
2021-06-09 17:48:09 +01:00
Tim Gover
34aa94bdd2 Merge pull request #337 from timg236/pieeprom-2021-05-19
Pieeprom 2021 05 19
2021-05-20 14:12:11 +01:00
Tim Gover
503f1c0055 rpi-eeprom-update: Display a warning when the bootloader is downgraded
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.
2021-05-17 15:21:29 +01:00
Andrew Scheller
650e942947 Typos and wording tweaks 2021-04-24 02:39:43 +01:00
andrum99
89a68bc405 rpi-eeprom-update: up-to-date -> up to date
This is only meant to be hyphenated when used as a compound adjective, which is not the case here. See https://www.thewriter.co.uk/tools/style-guide/punctuation/hyphens#:~:text=When%20it%20comes%20after%20the,up%2Dto%2Ddate%20document.
2021-04-21 16:59:35 +01:00
Tim Gover
a4d7bdbef0 rpi-eeprom-update: Specifiy a minimum version number for automatic updates
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.
2021-03-25 14:24:17 +00:00
Tim Gover
8c9c14526d Revert "rpi-eeprom-update: Use 'tr' instead of 'strings'"
This reverts commit 9a2aede8034aab0bfb050b481d422fddb5c25683.
2021-02-26 14:06:29 +00:00
Tim Gover
dcd114f8fd Revert "rpi-eeprom-update: Surround [:print:] with quotes"
This reverts commit f14fc0f8f6974129ffccc0d5b85e04a1ec96399b.
2021-02-26 14:06:29 +00:00
Tim Gover
6265c773e7 Remove SPI_SPEED variable now that flashrom has been removed. 2021-02-24 14:04:23 +00:00
Nicolas Saenz Julienne
73c91317ca rpi-eeprom-update: Surround [:print:] with quotes
It seems that [:print:] could be substituted by rogue shells[1], so
surround it with quotes to make sure it doesn't happen. Use single
quotes as they are the most constraining kind. All in all, this change
should be harmless.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
[1] https://github.com/raspberrypi/rpi-eeprom/pull/298#issuecomment-784542905
2021-02-24 13:09:59 +01:00
Nicolas Saenz Julienne
b760758c5e rpi-eeprom-update: Use 'tr' instead of 'strings'
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>
2021-02-19 10:45:46 +01:00
Tim Gover
3e03056215 vl805: Move to old following removal of USE_FLASHROM option
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.
2021-02-15 20:57:48 +00:00
timg236
2fec47bd7f rpi-eeprom-update: Expand help to describe CM4 bootloader updates (#293)
Add some brief documentation about CM4 bootloader updates and provide
links to the full documentation.
2021-02-12 08:53:32 +00:00
Tim Gover
7da4173852 rpi-eeprom-update: Remove deprecated flashrom script options.
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.
2021-02-10 19:26:06 +00:00
Nicolas Saenz Julienne
6fe6f22bad rpi-eeprom-config/update: Exit cleanly when not run on rpi4
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>
2021-02-09 15:22:52 +01:00
Tim Gover
5f0de19aee rpi-eeprom-update: Reference raspi-config from version message
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.
2021-01-29 08:04:24 +00:00
Nicolas Saenz Julienne
2aa97029fd rpi-eeprom-update: Get bootloader configuration from DT
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
2021-01-22 19:20:22 +01:00
Tim Gover
a95ecf9355 rpi-eeprom-update: Update docs and default ENV for release names
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.
2021-01-13 09:52:56 +00:00
Tim Gover
690872a3ca rpi-eeprom-update: Add trailing / so find follows the FW symlink 2021-01-12 16:44:31 +00:00
Tim Gover
289befb382 rpi-eeprom-update: Get bootloader build-timestamp from device-tree 2021-01-09 09:38:31 +00:00
Andrew Scheller
435da0f3cb typos 2020-10-28 09:47:50 +00:00
Tim Gover
7612907337 Add the timestamp of the update to the pieeprom.sig file.
Add the timestamp to pieeprom.sig for use with a future bootloader
update.

This is not relevant for the VL805 firmware because it is not
configurable.
2020-10-28 07:40:59 +00:00
Tim Gover
b1ed98c779 rpi-eeprom-update: Skip checksums if there is no dpkg info directory 2020-10-20 16:49:36 +01:00
Tim Gover
2730572da2 rpi-eeprom-update: Fix shellcheck warnings 2020-10-20 16:49:36 +01:00
Tim Gover
d34f62ee3d rpi-eeprom-update: Move .bin filter for checksums into subshell
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.
2020-10-01 20:07:53 +01:00
Tim Gover
6ab4179bae rpi-eeprom-config: Trap errors when deleting previous update files 2020-09-29 10:35:34 +01:00
Tim Gover
b6c6b03add rpi-eeprom-update: Add -b flag to output BOOTFS path
Add an API for external scripts to safely determine which the directory
the EEPROM image update files will be written to.
2020-09-28 10:41:20 +01:00
Tim Gover
ccd8444501 Implement review comments
Update --apply --edit to allow the eeprom image to be specified.
Add some error checking around chmod in rpi-eeprom-update

TODO: Test this on NFS
2020-09-28 10:41:20 +01:00
Tim Gover
a554034c1d rpi-eeprom-update: Add -l option to resolve the latest bootloader image
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.
2020-09-28 10:41:20 +01:00
Tim Gover
29fe479af9 rpi-eeprom-update: Restrict package checksums to EEPROM images.
Only check EEPROM image binaries because it's annoying if
rpi-eeprom-update errors due to the release notes or the script
changing.
2020-09-28 10:41:20 +01:00
Tim Gover
8d4af8db97 rpi-eeprom-update: Use multiple sources for BOARD_INFO
Try device-tree, then cpuinfo and failing that raw OTP.
2020-09-28 10:37:15 +01:00
Kyle J. McKay
28153db403 rpi-eeprom-update: avoid any possible od accidents
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>
2020-09-03 11:37:28 -07:00
Tim Gover
73e845de28 Use od instead of hexdump to simplify package dependencies 2020-09-03 13:08:12 +01:00
Tim Brooks
18d50d52ca Fix #211 - hexdump error on older Pi models 2020-09-01 23:19:01 +01:00
Hristo Venev
eea80bc4ab rpi-eeprom-update: Upstream kernel fix
Upstream kernels do not list the board revision in /proc/cpuinfo. Get it
from the device tree instead.
2020-08-20 13:15:32 +03:00
Tim Gover
a5794dde78 rpi-eeprom-update: Set file permissions on the EEPROM update files
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.
2020-07-21 16:08:22 +01:00
Tim Gover
dd15621c8a Change "update required" message to "update available"
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.
2020-07-16 12:03:52 +01:00
Tim Gover
b2e2818b28 Disable rpi-eeprom-update by default on CM4 2020-07-07 11:50:32 +01:00
Dave Jones
bd7957d353 Query checksums from rpi-eeprom instead of rpi-eeprom-images 2020-06-24 20:38:05 +01:00
Kyle J. McKay
4abaa46e1f rpi-eeprom-update: compare versions algebraically
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>
2020-06-04 14:42:40 -07:00
andrum99
beceaab7ae reword 2020-06-03 17:26:03 +01:00
andrum99
7cf2828046 Clarify -d option when EEPROM update not needed 2020-06-03 17:24:29 +01:00
andrum99
ed86d5e144 rpi-eeprom-update - fix description of -d flag 2020-06-03 17:13:33 +01:00