7bb9ea47e1
Store serial number from atsha cryptochip into the serial# env variable. U-Boot automatically puts content of this variable into the root device tree property serial-number when booting Linux kernel. Refactor turris atsha code and from turris_atsha_otp_get_serial_number() function returns directly string suitable for printing or storing into device tree. Because during different boot stages is env storage read-only, it is not possible to always store serial number into env storage. So introduce a new function turris_atsha_otp_init_serial_number() which is called at later stage and which ensures that serial number is correctly stored into env. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <kabel@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
11 lines
261 B
C
11 lines
261 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
#ifndef TURRIS_ATSHA_OTP_H
|
|
#define TURRIS_ATSHA_OTP_H
|
|
|
|
int turris_atsha_otp_init_mac_addresses(int first_idx);
|
|
int turris_atsha_otp_init_serial_number(void);
|
|
int turris_atsha_otp_get_serial_number(char serial[17]);
|
|
|
|
#endif
|