Skip to contentSkip to conversation

Adds `serial#_trimmed` env var for RPI boards

PATCH New lylejfranklin at gmail.com 1 participant 1 message Aug 5, 2019 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Adds `serial#_trimmed` env var for RPI boards

From: Lyle Franklin <[email protected]>

- 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

---

 board/raspberrypi/rpi/rpi.c | 3 +++
 1 file changed, 3 insertions(+)
board/raspberrypi/rpi/rpi.c +3 -0
index 617c892dde..678adff482 100644
@@ -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)
Signature · 1 line
2.22.0