Neha Malcom Francis | b61ad15 | 2023-09-08 15:06:16 +0530 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Neha Malcom Francis <n-francis@ti.com> |
| 3 | |
| 4 | DRA7xx Generation |
| 5 | ================= |
| 6 | |
| 7 | Secure Boot |
| 8 | ----------- |
| 9 | |
| 10 | .. include:: am335x_evm.rst |
| 11 | :start-after: .. secure_boot_include_start_config_ti_secure_device |
| 12 | :end-before: .. secure_boot_include_end_config_ti_secure_device |
| 13 | |
| 14 | .. include:: am335x_evm.rst |
| 15 | :start-after: .. secure_boot_include_start_spl_boot |
| 16 | :end-before: .. secure_boot_include_end_spl_boot |
| 17 | |
| 18 | <IMAGE_FLAG> is a value that specifies the type of the image to |
| 19 | generate OR the action the image generation tool will take. Valid |
| 20 | values are: |
| 21 | |
| 22 | .. list-table:: |
| 23 | :widths: 25 25 |
| 24 | :header-rows: 0 |
| 25 | |
| 26 | * - X-LOADER |
| 27 | - Generates an image for NOR or QSPI boot modes |
| 28 | * - MLO |
| 29 | - Generates an image for NOR or QSPI boot modes |
| 30 | * - ULO |
| 31 | - Generates an image for USB/UART peripheral boot modes |
| 32 | |
| 33 | <INPUT_FILE> is the full path and filename of the public world boot |
| 34 | loaderbinary file (for this platform, this is always u-boot-spl.bin). |
| 35 | |
| 36 | <OUTPUT_FILE> is the full path and filename of the final secure image. |
| 37 | The output binary images should be used in place of the standard |
| 38 | non-secure binary images (see the platform-specific user's guides |
| 39 | and releases notes for how the non-secure images are typically used) |
| 40 | |
| 41 | .. list-table:: |
| 42 | :widths: 25 25 |
| 43 | :header-rows: 0 |
| 44 | |
| 45 | * - u-boot-spl_HS_SPI_X-LOADER |
| 46 | - boot image for SD/MMC/eMMC. This image is |
| 47 | copied to a file named MLO, which is the name that |
| 48 | the device ROM bootloader requires for loading from |
| 49 | the FAT partition of an SD card (same as on |
| 50 | non-secure devices) |
| 51 | * - u-boot-spl_HS_ULO |
| 52 | - boot image for USB/UART peripheral boot modes |
| 53 | * - u-boot-spl_HS_X-LOADER |
| 54 | - boot image for all other flash memories |
| 55 | including QSPI and NOR flash |
| 56 | |
| 57 | <SPL_LOAD_ADDR> is the address at which SOC ROM should load the |
| 58 | <INPUT_FILE> |
| 59 | |
| 60 | .. include:: am335x_evm.rst |
| 61 | :start-after: .. secure_boot_include_start_primary_u_boot |
| 62 | :end-before: .. secure_boot_include_end_primary_u_boot |
| 63 | |
| 64 | eMMC Boot Partition Use |
| 65 | ----------------------- |
| 66 | |
| 67 | It is possible, depending on SYSBOOT configuration to boot from the eMMC |
| 68 | boot partitions using (name depending on documentation referenced) |
| 69 | Alternative Boot operation mode or Boot Sequence Option 1/2. In this |
| 70 | example we load MLO and u-boot.img from the build into DDR and then use |
| 71 | 'mmc bootbus' to set the required rate (see TRM) and 'mmc partconfig' to |
| 72 | set boot0 as the boot device. |
| 73 | |
Nishanth Menon | 740c41c | 2023-11-02 23:40:25 -0500 | [diff] [blame] | 74 | .. prompt:: bash => |
Neha Malcom Francis | b61ad15 | 2023-09-08 15:06:16 +0530 | [diff] [blame] | 75 | |
| 76 | setenv autoload no |
| 77 | usb start |
| 78 | dhcp |
| 79 | mmc dev 1 1 |
| 80 | tftp ${loadaddr} dra7xx/MLO |
| 81 | mmc write ${loadaddr} 0 100 |
| 82 | tftp ${loadaddr} dra7xx/u-boot.img |
| 83 | mmc write ${loadaddr} 300 400 |
| 84 | mmc bootbus 1 2 0 2 |
| 85 | mmc partconf 1 1 1 0 |
| 86 | mmc rst-function 1 1 |
| 87 | |
| 88 | .. include:: am43xx_evm.rst |
| 89 | :start-after: qspi_boot_support_include_start |
| 90 | :end-before: qspi_boot_support_include_end |
| 91 | |
| 92 | Testing |
| 93 | ^^^^^^^ |
| 94 | |
| 95 | Build the patched U-Boot and load MLO/u-boot.img. |
| 96 | |
| 97 | Boot from another medium like MMC |
| 98 | |
| 99 | .. prompt:: bash |
| 100 | |
| 101 | => mmc dev 0 |
| 102 | mmc0 is current device |
| 103 | => fatload mmc 0 0x82000000 MLO |
| 104 | reading MLO |
| 105 | 55872 bytes read in 8 ms (6.7 MiB/s) |
| 106 | => fatload mmc 0 0x83000000 u-boot.img |
| 107 | reading u-boot.img |
| 108 | 248600 bytes read in 19 ms (12.5 MiB/s) |
| 109 | |
| 110 | Commands to erase/write u-boot/MLO to flash device |
| 111 | |
| 112 | .. prompt:: bash |
| 113 | |
| 114 | => sf probe 0 |
| 115 | SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB, mapped at 5c000000 |
| 116 | => sf erase 0 0x10000 |
| 117 | SF: 65536 bytes @ 0x0 Erased: OK |
| 118 | => sf erase 0x20000 0x10000 |
| 119 | SF: 65536 bytes @ 0x20000 Erased: OK |
| 120 | => sf erase 0x30000 0x10000 |
| 121 | SF: 65536 bytes @ 0x30000 Erased: OK |
| 122 | => sf erase 0x40000 0x10000 |
| 123 | SF: 65536 bytes @ 0x40000 Erased: OK |
| 124 | => sf erase 0x50000 0x10000 |
| 125 | SF: 65536 bytes @ 0x50000 Erased: OK |
| 126 | => sf erase 0x60000 0x10000 |
| 127 | SF: 65536 bytes @ 0x60000 Erased: OK |
| 128 | => sf write 82000000 0 0x10000 |
| 129 | SF: 65536 bytes @ 0x0 Written: OK |
| 130 | => sf write 83000000 0x20000 0x60000 |
| 131 | SF: 393216 bytes @ 0x20000 Written: OK |
| 132 | |
| 133 | Next, set sysboot to QSPI-1 boot mode(SYSBOOT[5:0] = 100110) and power |
| 134 | on. ROM should find the GP header at offset 0 and load/execute SPL. SPL |
| 135 | then detects that ROM was in QSPI-1 mode (boot code 10) and attempts to |
| 136 | find a U-Boot image header at offset 0x20000 (set in the config file) |
| 137 | and proceeds to load that image using the U-Boot image payload offset/size |
| 138 | from the header. It will then start U-Boot. |