Skip to content

Commit a2fb4ed

Browse files
committed
rpi-eeprom-config: Process bootcode arg with other file replacements
It should be possible to change the config, public key, signature and signed bootcode in a single operation.
1 parent ca7a39e commit a2fb4ed

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

rpi-eeprom-config

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ Operating modes:
510510
The configuration file will be taken from:
511511
* The blconfig reserved memory nvmem device
512512
* The cached bootloader configuration 'vcgencmd bootloader_config'
513-
* The current pending update - typically /boot/pieeprom.upd
513+
* The current pending update - typically /boot/firmware/pieeprom.upd
514514
515515
sudo -E rpi-eeprom-config --edit [pieeprom.bin]
516516
@@ -524,8 +524,7 @@ Operating modes:
524524
the corresponding RSA public key.
525525
526526
Requires Python Cryptodomex libraries and OpenSSL. To install on Raspberry Pi OS run:-
527-
sudo apt install openssl python-pip
528-
sudo python3 -m pip install cryptodomex
527+
sudo apt install python3-pycryptodome
529528
530529
rpi-eeprom-digest -k private.pem -i bootconf.txt -o bootconf.sig
531530
rpi-eeprom-config --config bootconf.txt --digest bootconf.sig --pubkey public.pem --out pieeprom-signed.bin pieeprom.bin
@@ -571,21 +570,25 @@ See 'rpi-eeprom-update -h' for more information about the available EEPROM image
571570
image = BootloaderImage(args.eeprom, args.out)
572571
if args.timestamp is not None:
573572
image.set_timestamp(args.timestamp)
573+
574574
if args.bootcode is not None:
575575
image.update_file(args.bootcode, BOOTCODE_BIN)
576-
image.write()
577-
elif args.config is not None:
576+
577+
if args.cacertder is not None:
578+
image.update_file(args.cacertder, CACERT_DER)
579+
580+
if args.config is not None:
581+
# The public key, EEPROM config and signature should be set together
578582
if not os.path.exists(args.config):
579583
exit_error("config file '%s' not found" % args.config)
580584
image.update_file(args.config, BOOTCONF_TXT)
581585
if args.digest is not None:
582586
image.update_file(args.digest, BOOTCONF_SIG)
583587
if args.pubkey is not None:
584588
image.update_key(args.pubkey, PUBKEY_BIN)
585-
if args.cacertder is not None:
586-
image.update_file(args.cacertder, CACERT_DER)
587-
image.write()
588-
elif args.config is None and args.timestamp is not None:
589+
590+
if args.config is not None or args.timestamp is not None or args.bootcode is not None or args.cacertder is not None:
591+
debug("Writing image")
589592
image.write()
590593
else:
591594
image.read()

0 commit comments

Comments
 (0)