Skip to contentSkip to conversation

toradex: tdx-cfg-block: use only snprintf

PATCH In review Philippe Schenker 4 participants 12 messages Jun 13, 2022 – Jul 7, 2022 x86 trust domain extensions (TDX)

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 toradex: tdx-cfg-block: use only snprintf

From: Philippe Schenker <[email protected]>

Prevent memory issues that could appear with sprintf. Replace all sprintf occurences with snprintf.

---

 board/toradex/common/tdx-common.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
board/toradex/common/tdx-common.c +15 -12
index 9db4553e0f..2207818447 100644
@@ -89,11 +89,13 @@ int show_board_info(void)
 		tdx_eth_addr.nic = htonl(tdx_serial << 8);
 		checkboard();
 	} else {
-		sprintf(tdx_serial_str, "%08u", tdx_serial);
-		sprintf(tdx_board_rev_str, "V%1d.%1d%c",
-			tdx_hw_tag.ver_major,
-			tdx_hw_tag.ver_minor,
-			(char)tdx_hw_tag.ver_assembly + 'A');
+		snprintf(tdx_serial_str, sizeof(tdx_serial_str),
+			 "%08u", tdx_serial);
+		snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
+			 "V%1d.%1d%c",
+			 tdx_hw_tag.ver_major,
+			 tdx_hw_tag.ver_minor,
+			 (char)tdx_hw_tag.ver_assembly + 'A');
 
 		env_set("serial#", tdx_serial_str);
 
@@ -109,12 +111,13 @@ int show_board_info(void)
 			tdx_carrier_board_name = (char *)
 				toradex_carrier_boards[tdx_car_hw_tag.prodid];
 
-			sprintf(tdx_car_serial_str, "%08u", tdx_car_serial);
-			sprintf(tdx_car_rev_str, "V%1d.%1d%c",
-				tdx_car_hw_tag.ver_major,
-				tdx_car_hw_tag.ver_minor,
-				(char)tdx_car_hw_tag.ver_assembly +
-				'A');
+			snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str),
+				 "%08u", tdx_car_serial);
+			snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str),
+				 "V%1d.%1d%c",
+				 tdx_car_hw_tag.ver_major,
+				 tdx_car_hw_tag.ver_minor,
+				 (char)tdx_car_hw_tag.ver_assembly + 'A');
 
 			env_set("carrier_serial#", tdx_car_serial_str);
 			printf("Carrier: Toradex %s %s, Serial# %s\n",
@@ -170,7 +173,7 @@ int ft_common_board_setup(void *blob, struct bd_info *bd)
 	if (tdx_hw_tag.ver_major) {
 		char prod_id[5];
 
-		sprintf(prod_id, "%04u", tdx_hw_tag.prodid);
+		snprintf(prod_id, sizeof(prod_id), "%04u", tdx_hw_tag.prodid);
 		fdt_setprop(blob, 0, "toradex,product-id", prod_id, 5);
 
 		fdt_setprop(blob, 0, "toradex,board-rev", tdx_board_rev_str,
Signature · 1 line
2.36.1
#1 lore raw

PATCH 2/3 toradex: tdx-cfg-block: use defines for string length

From: Philippe Schenker <[email protected]>

With those defines the length can be reused and is in one place extendable.

---

 board/toradex/common/tdx-common.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
board/toradex/common/tdx-common.c +8 -4
index 2207818447..94e603c14f 100644
@@ -22,13 +22,17 @@
 
 #define TORADEX_OUI 0x00142dUL
 
+#define SERIAL_STR_LEN 8
+#define MODULE_VER_STR_LEN 4 // V1.1
+#define MODULE_REV_STR_LEN 1 // [A-Z]
+
 #ifdef CONFIG_TDX_CFG_BLOCK
-static char tdx_serial_str[9];
-static char tdx_board_rev_str[6];
+static char tdx_serial_str[SERIAL_STR_LEN + 1];
+static char tdx_board_rev_str[MODULE_VER_STR_LEN + MODULE_REV_STR_LEN + 1];
 
 #ifdef CONFIG_TDX_CFG_BLOCK_EXTRA
-static char tdx_car_serial_str[9];
-static char tdx_car_rev_str[6];
+static char tdx_car_serial_str[SERIAL_STR_LEN + 1];
+static char tdx_car_rev_str[MODULE_VER_STR_LEN + MODULE_REV_STR_LEN + 1];
 static char *tdx_carrier_board_name;
 #endif
 
Signature · 1 line
2.36.1
Acked-by on v1 2/3
#3 lore raw

Re: [PATCH 2/3] toradex: tdx-cfg-block: use defines for string length

In reply to Philippe Schenker
Quoted 6 lines · Philippe Schenker

From: Philippe Schenker <[email protected]>

With those defines the length can be reused and is in one place extendable.

Quoted 30 lines

---

 board/toradex/common/tdx-common.c | 12 ++++++++----

 1 file changed, 8 insertions(+), 4 deletions(-)
board/toradex/common/tdx-common.c +0 -0
index 2207818447..94e603c14f 100644
@@ -22,13 +22,17 @@


 #define TORADEX_OUI 0x00142dUL

board/toradex/common/tdx-common.c +4 -0
+#define SERIAL_STR_LEN 8
+#define MODULE_VER_STR_LEN 4 // V1.1
+#define MODULE_REV_STR_LEN 1 // [A-Z]
+

 #ifdef CONFIG_TDX_CFG_BLOCK

board/toradex/common/tdx-common.c +2 -2
-static char tdx_serial_str[9];
-static char tdx_board_rev_str[6];
+static char tdx_serial_str[SERIAL_STR_LEN + 1];
+static char tdx_board_rev_str[MODULE_VER_STR_LEN + MODULE_REV_STR_LEN + 1];


 #ifdef CONFIG_TDX_CFG_BLOCK_EXTRA

board/toradex/common/tdx-common.c +2 -2
-static char tdx_car_serial_str[9];
-static char tdx_car_rev_str[6];
+static char tdx_car_serial_str[SERIAL_STR_LEN + 1];
+static char tdx_car_rev_str[MODULE_VER_STR_LEN + MODULE_REV_STR_LEN + 1];

 static char *tdx_carrier_board_name;
 #endif

#5 lore raw

PATCH 3/3 toradex: tdx-cfg-block: extend assembly version

In reply to Philippe Schenker

From: Philippe Schenker <[email protected]>

There are two decimal digits reserved to encode the module version and revision. This code so far implemented A-Z which used 0-25 of this range.
This commit extends the range to make use of all 99 numbers. After capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows, as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

---

 board/toradex/common/tdx-cfg-block.c | 32 ++++++++++++++++++++++++----
 board/toradex/common/tdx-common.c    | 25 +++++++++++++++++-----
 2 files changed, 48 insertions(+), 9 deletions(-)
board/toradex/common/tdx-cfg-block.c +28 -4
index 9c87289ae9..05f25fe7e6 100644
@@ -353,6 +353,18 @@ out:
 	return ret;
 }
 
+static int parse_assembly_string(char *string_to_parse, u16 *assembly)
+{
+	if (string_to_parse[3] >= 'A' && string_to_parse[3] <= 'Z')
+		*assembly = string_to_parse[3] - 'A';
+	else if (string_to_parse[3] == '#')
+		*assembly = dectoul(&string_to_parse[4], NULL);
+	else
+		return -EINVAL;
+
+	return 0;
+}
+
 static int get_cfgblock_interactive(void)
 {
 	char message[CONFIG_SYS_CBSIZE];
@@ -360,6 +372,7 @@ static int get_cfgblock_interactive(void)
 	char it = 'n';
 	char wb = 'n';
 	int len = 0;
+	int ret = 0;
 
 	/* Unknown module by default */
 	tdx_hw_tag.prodid = 0;
@@ -531,13 +544,18 @@ static int get_cfgblock_interactive(void)
 	}
 
 	while (len < 4) {
-		sprintf(message, "Enter the module version (e.g. V1.1B): V");
+		sprintf(message, "Enter the module version (e.g. V1.1B or V1.1#26): V");
 		len = cli_readline(message);
 	}
 
 	tdx_hw_tag.ver_major = console_buffer[0] - '0';
 	tdx_hw_tag.ver_minor = console_buffer[2] - '0';
-	tdx_hw_tag.ver_assembly = console_buffer[3] - 'A';
+
+	ret = parse_assembly_string(console_buffer, &tdx_hw_tag.ver_assembly);
+	if (ret) {
+		printf("Parsing module version failed\n");
+		return ret;
+	}
 
 	while (len < 8) {
 		sprintf(message, "Enter module serial number: ");
@@ -740,6 +758,7 @@ static int get_cfgblock_carrier_interactive(void)
 {
 	char message[CONFIG_SYS_CBSIZE];
 	int len;
+	int ret = 0;
 
 	printf("Supported carrier boards:\n");
 	printf("CARRIER BOARD NAME\t\t [ID]\n");
@@ -753,13 +772,18 @@ static int get_cfgblock_carrier_interactive(void)
 	tdx_car_hw_tag.prodid = dectoul(console_buffer, NULL);
 
 	do {
-		sprintf(message, "Enter carrier board version (e.g. V1.1B): V");
+		sprintf(message, "Enter carrier board version (e.g. V1.1B or V1.1#26): V");
 		len = cli_readline(message);
 	} while (len < 4);
 
 	tdx_car_hw_tag.ver_major = console_buffer[0] - '0';
 	tdx_car_hw_tag.ver_minor = console_buffer[2] - '0';
-	tdx_car_hw_tag.ver_assembly = console_buffer[3] - 'A';
+
+	ret = parse_assembly_string(console_buffer, &tdx_car_hw_tag.ver_assembly);
+	if (ret) {
+		printf("Parsing module version failed\n");
+		return ret;
+	}
 
 	while (len < 8) {
 		sprintf(message, "Enter carrier board serial number: ");
board/toradex/common/tdx-common.c +20 -5
index 94e603c14f..5ad5d00a0d 100644
@@ -24,7 +24,7 @@
 
 #define SERIAL_STR_LEN 8
 #define MODULE_VER_STR_LEN 4 // V1.1
-#define MODULE_REV_STR_LEN 1 // [A-Z]
+#define MODULE_REV_STR_LEN 3 // [A-Z] or #[26-99]
 
 #ifdef CONFIG_TDX_CFG_BLOCK
 static char tdx_serial_str[SERIAL_STR_LEN + 1];
@@ -83,6 +83,21 @@ void get_board_serial(struct tag_serialnr *serialnr)
 }
 #endif /* CONFIG_SERIAL_TAG */
 
+static const char *get_board_assembly(u16 ver_assembly)
+{
+	static char ver_name[MODULE_REV_STR_LEN + 1];
+
+	if (ver_assembly < 26) {
+		ver_name[0] = (char)ver_assembly + 'A';
+		ver_name[1] = '\0';
+	} else {
+		snprintf(ver_name, sizeof(ver_name),
+			 "#%u", ver_assembly);
+	}
+
+	return ver_name;
+}
+
 int show_board_info(void)
 {
 	unsigned char ethaddr[6];
@@ -96,10 +111,10 @@ int show_board_info(void)
 		snprintf(tdx_serial_str, sizeof(tdx_serial_str),
 			 "%08u", tdx_serial);
 		snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
-			 "V%1d.%1d%c",
+			 "V%1d.%1d%s",
 			 tdx_hw_tag.ver_major,
 			 tdx_hw_tag.ver_minor,
-			 (char)tdx_hw_tag.ver_assembly + 'A');
+			 get_board_assembly(tdx_hw_tag.ver_assembly));
 
 		env_set("serial#", tdx_serial_str);
 
@@ -118,10 +133,10 @@ int show_board_info(void)
 			snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str),
 				 "%08u", tdx_car_serial);
 			snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str),
-				 "V%1d.%1d%c",
+				 "V%1d.%1d%s",
 				 tdx_car_hw_tag.ver_major,
 				 tdx_car_hw_tag.ver_minor,
-				 (char)tdx_car_hw_tag.ver_assembly + 'A');
+				 get_board_assembly(tdx_car_hw_tag.ver_assembly));
 
 			env_set("carrier_serial#", tdx_car_serial_str);
 			printf("Carrier: Toradex %s %s, Serial# %s\n",
Signature · 1 line
2.36.1
Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] toradex: tdx-cfg-block: extend assembly version

Quoted 17 lines · Philippe Schenker

From: Philippe Schenker <[email protected]>

There are two decimal digits reserved to encode the module version and revision. This code so far implemented A-Z which used 0-25 of this range.
This commit extends the range to make use of all 99 numbers. After capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows, as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

Quoted 8 lines

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Acked-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] toradex: tdx-cfg-block: extend assembly version

In reply to Philippe Schenker
Quoted 17 lines · Philippe Schenker

From: Philippe Schenker <[email protected]>

There are two decimal digits reserved to encode the module version and revision. This code so far implemented A-Z which used 0-25 of this range.
This commit extends the range to make use of all 99 numbers. After capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows, as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

Quoted 8 lines

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Quoted 148 lines

---

 board/toradex/common/tdx-cfg-block.c | 32 ++++++++++++++++++++++++---- board/toradex/common/tdx-common.c    | 25 +++++++++++++++++-----

 2 files changed, 48 insertions(+), 9 deletions(-)
board/toradex/common/tdx-cfg-block.c +0 -0
index 9c87289ae9..05f25fe7e6 100644
@@ -353,6 +353,18 @@ out:
         return ret;
  }

board/toradex/common/tdx-cfg-block.c +12 -0
+static int parse_assembly_string(char *string_to_parse, u16 *assembly)
+{
+       if (string_to_parse[3] >= 'A' && string_to_parse[3] <= 'Z')
+               *assembly = string_to_parse[3] - 'A';
+       else if (string_to_parse[3] == '#')
+               *assembly = dectoul(&string_to_parse[4], NULL);
+       else
+               return -EINVAL;
+
+       return 0;
+}
+

 static int get_cfgblock_interactive(void)
 {
        char message[CONFIG_SYS_CBSIZE];

board/toradex/common/tdx-cfg-block.c +1 -0
@@ -360,6 +372,7 @@ static int get_cfgblock_interactive(void)
         char it = 'n';
         char wb = 'n';
         int len = 0;
+       int ret = 0;


        /* Unknown module by default */
        tdx_hw_tag.prodid = 0;

board/toradex/common/tdx-cfg-block.c +0 -0
@@ -531,13 +544,18 @@ static int get_cfgblock_interactive(void)
         }


        while (len < 4) {
-               sprintf(message, "Enter the module version (e.g. V1.1B): V"); +               sprintf(message, "Enter the module version (e.g. V1.1B or V1.1#26): V"); len = cli_readline(message);
        }

        tdx_hw_tag.ver_major = console_buffer[0] - '0'; tdx_hw_tag.ver_minor = console_buffer[2] - '0';
-       tdx_hw_tag.ver_assembly = console_buffer[3] - 'A';
+
+       ret = parse_assembly_string(console_buffer, &tdx_hw_tag.ver_assembly); +       if (ret) {
+               printf("Parsing module version failed\n");
+               return ret;
+       }

        while (len < 8) {
                sprintf(message, "Enter module serial number: ");

board/toradex/common/tdx-cfg-block.c +1 -0
@@ -740,6 +758,7 @@ static int get_cfgblock_carrier_interactive(void)
  {
         char message[CONFIG_SYS_CBSIZE];
         int len;
+       int ret = 0;


        printf("Supported carrier boards:\n");
        printf("CARRIER BOARD NAME\t\t [ID]\n");

board/toradex/common/tdx-cfg-block.c +0 -0
@@ -753,13 +772,18 @@ static int get_cfgblock_carrier_interactive(void)
         tdx_car_hw_tag.prodid = dectoul(console_buffer, NULL);


        do {
-               sprintf(message, "Enter carrier board version (e.g. V1.1B): V"); +               sprintf(message, "Enter carrier board version (e.g. V1.1B or V1.1#26): V"); len = cli_readline(message);
        } while (len < 4);

        tdx_car_hw_tag.ver_major = console_buffer[0] - '0'; tdx_car_hw_tag.ver_minor = console_buffer[2] - '0';
-       tdx_car_hw_tag.ver_assembly = console_buffer[3] - 'A';
+
+       ret = parse_assembly_string(console_buffer, &tdx_car_hw_tag.ver_assembly); +       if (ret) {
+               printf("Parsing module version failed\n");
+               return ret;
+       }

        while (len < 8) {
                sprintf(message, "Enter carrier board serial number: ");

board/toradex/common/tdx-common.c +0 -0
index 94e603c14f..5ad5d00a0d 100644
@@ -24,7 +24,7 @@


 #define SERIAL_STR_LEN 8
 #define MODULE_VER_STR_LEN 4 // V1.1

board/toradex/common/tdx-common.c +1 -1
-#define MODULE_REV_STR_LEN 1 // [A-Z]
+#define MODULE_REV_STR_LEN 3 // [A-Z] or #[26-99]


 #ifdef CONFIG_TDX_CFG_BLOCK
 static char tdx_serial_str[SERIAL_STR_LEN + 1];

board/toradex/common/tdx-common.c +0 -0
@@ -83,6 +83,21 @@ void get_board_serial(struct tag_serialnr *serialnr)
  }
  #endif /* CONFIG_SERIAL_TAG */

board/toradex/common/tdx-common.c +15 -0
+static const char *get_board_assembly(u16 ver_assembly)
+{
+       static char ver_name[MODULE_REV_STR_LEN + 1];
+
+       if (ver_assembly < 26) {
+               ver_name[0] = (char)ver_assembly + 'A';
+               ver_name[1] = '\0';
+       } else {
+               snprintf(ver_name, sizeof(ver_name),
+                        "#%u", ver_assembly);
+       }
+
+       return ver_name;
+}
+

 int show_board_info(void)
 {
        unsigned char ethaddr[6];

board/toradex/common/tdx-common.c +2 -2
@@ -96,10 +111,10 @@ int show_board_info(void)
                 snprintf(tdx_serial_str, sizeof(tdx_serial_str),
                          "%08u", tdx_serial);
                 snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
-                        "V%1d.%1d%c",
+                        "V%1d.%1d%s",
                          tdx_hw_tag.ver_major,
                          tdx_hw_tag.ver_minor,
-                        (char)tdx_hw_tag.ver_assembly + 'A');
+                        get_board_assembly(tdx_hw_tag.ver_assembly));


                env_set("serial#", tdx_serial_str);

board/toradex/common/tdx-common.c +2 -2
@@ -118,10 +133,10 @@ int show_board_info(void)
                         snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str),
                                  "%08u", tdx_car_serial);
                         snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str),
-                                "V%1d.%1d%c",
+                                "V%1d.%1d%s",
                                  tdx_car_hw_tag.ver_major,
                                  tdx_car_hw_tag.ver_minor,
-                                (char)tdx_car_hw_tag.ver_assembly + 'A');
+                                get_board_assembly(tdx_car_hw_tag.ver_assembly));


                        env_set("carrier_serial#", tdx_car_serial_str); printf("Carrier: Toradex %s %s, Serial# %s\n",

#8 lore raw

Re: [PATCH 3/3] toradex: tdx-cfg-block: extend assembly version

In reply to Philippe Schenker
Quoted 24 lines · Philippe Schenker

From: Philippe Schenker <[email protected]>

There are two decimal digits reserved to encode the module version and revision. This code so far implemented A-Z which used 0-25 of this range.
This commit extends the range to make use of all 99 numbers. After capital letters the form with a hashtag and number (e.g. #26) is used.

Examples:

If the assembly version is between zero and 25 the numbering is as follows, as it also has been before this commit:
0: V0.0A
1: V0.0B
...
25: V0.0Z

New numbering of assembly version:
If the number is between 26 and 99 the new assembly version name is:
26: V0.0#26
27: V0.0#27
...
99: V0.0#99

Quoted 3 lines

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
Acked-by on v1 1/3
#10 lore raw
In reply to Philippe Schenker
Quoted 6 lines · Philippe Schenker

From: Philippe Schenker <[email protected]>

Prevent memory issues that could appear with sprintf. Replace all sprintf occurences with snprintf.

Quoted 57 lines

---

 board/toradex/common/tdx-common.c | 27 +++++++++++++++------------

 1 file changed, 15 insertions(+), 12 deletions(-)
board/toradex/common/tdx-common.c +7 -5
index 9db4553e0f..2207818447 100644
@@ -89,11 +89,13 @@ int show_board_info(void)
                 tdx_eth_addr.nic = htonl(tdx_serial << 8);
                 checkboard();
         } else {
-               sprintf(tdx_serial_str, "%08u", tdx_serial);
-               sprintf(tdx_board_rev_str, "V%1d.%1d%c",
-                       tdx_hw_tag.ver_major,
-                       tdx_hw_tag.ver_minor,
-                       (char)tdx_hw_tag.ver_assembly + 'A');
+               snprintf(tdx_serial_str, sizeof(tdx_serial_str),
+                        "%08u", tdx_serial);
+               snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
+                        "V%1d.%1d%c",
+                        tdx_hw_tag.ver_major,
+                        tdx_hw_tag.ver_minor,
+                        (char)tdx_hw_tag.ver_assembly + 'A');


                env_set("serial#", tdx_serial_str);

board/toradex/common/tdx-common.c +0 -0
@@ -109,12 +111,13 @@ int show_board_info(void)
                         tdx_carrier_board_name = (char *)
                                 toradex_carrier_boards[tdx_car_hw_tag.prodid];


-                       sprintf(tdx_car_serial_str, "%08u", tdx_car_serial); -                       sprintf(tdx_car_rev_str, "V%1d.%1d%c",
-                               tdx_car_hw_tag.ver_major,
-                               tdx_car_hw_tag.ver_minor,
-                               (char)tdx_car_hw_tag.ver_assembly + -                               'A');
+                       snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str), +                                "%08u", tdx_car_serial);
+                       snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str), +                                "V%1d.%1d%c",
+                                tdx_car_hw_tag.ver_major,
+                                tdx_car_hw_tag.ver_minor,
+                                (char)tdx_car_hw_tag.ver_assembly + 'A');
                        env_set("carrier_serial#", tdx_car_serial_str); printf("Carrier: Toradex %s %s, Serial# %s\n",

board/toradex/common/tdx-common.c +0 -0
@@ -170,7 +173,7 @@ int ft_common_board_setup(void *blob, struct bd_info *bd)
         if (tdx_hw_tag.ver_major) {
                 char prod_id[5];


-               sprintf(prod_id, "%04u", tdx_hw_tag.prodid);
+               snprintf(prod_id, sizeof(prod_id), "%04u", tdx_hw_tag.prodid); fdt_setprop(blob, 0, "toradex,product-id", prod_id, 5);
                fdt_setprop(blob, 0, "toradex,board-rev", tdx_board_rev_str,