2 * Copyright 2015 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
7 #ifndef __CONFIG_FSL_SECBOOT_H
8 #define __CONFIG_FSL_SECBOOT_H
10 #ifdef CONFIG_SECURE_BOOT
12 #ifndef CONFIG_CMD_ESBC_VALIDATE
13 #define CONFIG_CMD_ESBC_VALIDATE
16 #ifndef CONFIG_EXTRA_ENV
17 #define CONFIG_EXTRA_ENV ""
21 * Control should not reach back to uboot after validation of images
22 * for secure boot flow and therefore bootscript should have
23 * the bootm command. If control reaches back to uboot anyhow
24 * after validating images, core should just spin.
28 * Define the key hash for boot script here if public/private key pair used to
29 * sign bootscript are different from the SRK hash put in the fuse
30 * Example of defining KEY_HASH is
31 * #define CONFIG_BOOTSCRIPT_KEY_HASH \
32 * "41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b"
35 #ifdef CONFIG_BOOTSCRIPT_KEY_HASH
36 #define CONFIG_SECBOOT \
37 "setenv bs_hdraddr " __stringify(CONFIG_BOOTSCRIPT_HDR_ADDR)";" \
38 "setenv bootargs \'root=/dev/ram rw console=ttyS0,115200 " \
39 "ramdisk_size=600000\';" \
41 "esbc_validate $bs_hdraddr " \
42 __stringify(CONFIG_BOOTSCRIPT_KEY_HASH)";" \
46 #define CONFIG_SECBOOT \
47 "setenv bs_hdraddr " __stringify(CONFIG_BOOTSCRIPT_HDR_ADDR)";" \
48 "setenv bootargs \'root=/dev/ram rw console=ttyS0,115200 " \
49 "ramdisk_size=600000\';" \
51 "esbc_validate $bs_hdraddr;" \
56 /* For secure boot flow, default environment used will be used */
57 #if defined(CONFIG_SYS_RAMBOOT)
58 #ifdef CONFIG_BOOTSCRIPT_COPY_RAM
59 #define CONFIG_BS_COPY_ENV \
60 "setenv bs_hdr_ram " __stringify(CONFIG_BS_HDR_ADDR_RAM)";" \
61 "setenv bs_hdr_flash " __stringify(CONFIG_BS_HDR_ADDR_FLASH)";" \
62 "setenv bs_hdr_size " __stringify(CONFIG_BS_HDR_SIZE)";" \
63 "setenv bs_ram " __stringify(CONFIG_BS_ADDR_RAM)";" \
64 "setenv bs_flash " __stringify(CONFIG_BS_ADDR_FLASH)";" \
65 "setenv bs_size " __stringify(CONFIG_BS_SIZE)";"
67 #if defined(CONFIG_RAMBOOT_NAND)
68 #define CONFIG_BS_COPY_CMD \
69 "nand read $bs_hdr_ram $bs_hdr_flash $bs_hdr_size ;" \
70 "nand read $bs_ram $bs_flash $bs_size ;"
71 #endif /* CONFIG_RAMBOOT_NAND */
72 #endif /* CONFIG_BOOTSCRIPT_COPY_RAM */
74 #if defined(CONFIG_RAMBOOT_SPIFLASH)
75 #undef CONFIG_ENV_IS_IN_SPI_FLASH
76 #elif defined(CONFIG_RAMBOOT_NAND)
77 #undef CONFIG_ENV_IS_IN_NAND
78 #elif defined(CONFIG_RAMBOOT_SDCARD)
79 #undef CONFIG_ENV_IS_IN_MMC
81 #else /*CONFIG_SYS_RAMBOOT*/
82 #undef CONFIG_ENV_IS_IN_FLASH
85 #define CONFIG_ENV_IS_NOWHERE
87 #ifndef CONFIG_BS_COPY_ENV
88 #define CONFIG_BS_COPY_ENV
91 #ifndef CONFIG_BS_COPY_CMD
92 #define CONFIG_BS_COPY_CMD
95 #define CONFIG_SECBOOT_CMD CONFIG_BS_COPY_ENV \
99 * We don't want boot delay for secure boot flow
100 * before autoboot starts
102 #undef CONFIG_BOOTDELAY
103 #define CONFIG_BOOTDELAY 0
104 #undef CONFIG_BOOTCOMMAND
105 #define CONFIG_BOOTCOMMAND CONFIG_SECBOOT_CMD
108 * CONFIG_ZERO_BOOTDELAY_CHECK should not be defined for
109 * secure boot flow as defining this would enable a user to
110 * reach uboot prompt by pressing some key before start of
113 #undef CONFIG_ZERO_BOOTDELAY_CHECK