diff mbox series

[U-Boot] Adds `serial#_trimmed` env var for RPI boards

Message ID 20190805103258.19464-1-lylejfranklin@gmail.com
State New
Delegated to: Matthias Brugger
Headers show
Series [U-Boot] Adds `serial#_trimmed` env var for RPI boards | expand

Commit Message

lylejfranklin@gmail.com Aug. 5, 2019, 10:32 a.m. UTC
From: Lyle Franklin <lylejfranklin@gmail.com>

- The `serial#` env var for Raspberry Pi boards is left padded with
  zeros in order to mimic the format of the serial number
  in `/proc/cpuinfo`
- Unfortunately the Raspberry Pi bootloader which loads up before u-boot
  does not pad the serial number, meaning that some boot files are
  requested from 123456/ while u-boot requests files from
- Although a bit adhoc, adding an additional `serial#_trimmed` env var
  for the RPI board allows for all boot files to live in a single

Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com>

 board/raspberrypi/rpi/rpi.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series


diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 617c892dde..678adff482 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -389,6 +389,9 @@  static void set_serial_number(void)
 	snprintf(serial_string, sizeof(serial_string), "%016llx",
 	env_set("serial#", serial_string);
+	snprintf(serial_string, sizeof(serial_string), "%llx",
+		 msg->get_board_serial.body.resp.serial);
+	env_set("serial#_trimmed", serial_string);
 int misc_init_r(void)