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

lylejfranklin at gmail.com lylejfranklin at gmail.com
Mon Aug 5 10:32:58 UTC 2019


From: Lyle Franklin <lylejfranklin at 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
  0000000000123456/
- 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
  directory

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

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

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",
 		 msg->get_board_serial.body.resp.serial);
 	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)
-- 
2.22.0



More information about the U-Boot mailing list