Optionally: Set the serial# environment variable on the i.MX7.
Subsystems (3)
PATCH 1/1 Optionally: Set the serial# environment variable on the i.MX7.
Enabline this new option allows the kernel to obtain the unique ID of the CPU when not using ATAGS.
Signed-off-by Mark G <[email protected]>
--- arch/arm/include/asm/bootm.h | 2 +- arch/arm/mach-imx/mx7/Kconfig | 7 +++++++ arch/arm/mach-imx/mx7/soc.c | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-)
arch/arm/include/asm/bootm.h +1 -1
@@ -39,7 +39,7 @@ extern void udc_disconnect(void);#endif struct tag_serialnr ; -#ifdef CONFIG_SERIAL_TAG +#if defined(CONFIG_SERIAL_TAG ) || defined(CONFIG_SET_SERIAL_ENV )#define BOOTM_ENABLE_SERIAL_TAG 1void get_board_serial (struct tag_serialnr *serialnr);#else
arch/arm/mach-imx/mx7/Kconfig +7 -0
@@ -71,6 +71,13 @@ config TARGET_COLIBRI_IMX7 endchoice +config SET_SERIAL_ENV + bool "Set serial number variable from the OCOTP" + help + Selecting this option will populate the serial# environment + variable with a unique identifier from the i.MX7 CPU. The + Linux kernel will use this as the serial number of the machine. + config SYS_SOC default "mx7"
arch/arm/mach-imx/mx7/soc.c +14 -1
@@ -344,11 +344,24 @@ int arch_misc_init(void)sec_init ();#endif +#ifdef CONFIG_SET_SERIAL_ENV + { +struct tag_serialnr serialnr; +char serialbuf[sizeof (serialnr) *2 +8 ]; + +get_board_serial (&serialnr); +snprintf (serialbuf,sizeof (serialbuf), +"%08lx%08lx" , + (ulong )serialnr.high, (ulong )serialnr.low); +env_set ("serial#" , serialbuf); + } +#endif + return 0; }#endif -#ifdef CONFIG_SERIAL_TAG +#if defined(CONFIG_SERIAL_TAG ) || defined(CONFIG_SET_SERIAL_ENV )/* * OCOTP_TESTER * i.MX 7Solo Applications Processor Reference Manual, Rev. 0.1, 08/2016
Signature · 1 line
2.17.1