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 | |
| 74 | .. prompt:: bash |
| 75 | :prompts: => |
| 76 | |
| 77 | setenv autoload no |
| 78 | usb start |
| 79 | dhcp |
| 80 | mmc dev 1 1 |
| 81 | tftp ${loadaddr} dra7xx/MLO |
| 82 | mmc write ${loadaddr} 0 100 |
| 83 | tftp ${loadaddr} dra7xx/u-boot.img |
| 84 | mmc write ${loadaddr} 300 400 |
| 85 | mmc bootbus 1 2 0 2 |
| 86 | mmc partconf 1 1 1 0 |
| 87 | mmc rst-function 1 1 |
| 88 | |
| 89 | .. include:: am43xx_evm.rst |
| 90 | :start-after: qspi_boot_support_include_start |
| 91 | :end-before: qspi_boot_support_include_end |
| 92 | |
| 93 | Testing |
| 94 | ^^^^^^^ |
| 95 | |
| 96 | Build the patched U-Boot and load MLO/u-boot.img. |
| 97 | |
| 98 | Boot from another medium like MMC |
| 99 | |
| 100 | .. prompt:: bash |
| 101 | |
| 102 | => mmc dev 0 |
| 103 | mmc0 is current device |
| 104 | => fatload mmc 0 0x82000000 MLO |
| 105 | reading MLO |
| 106 | 55872 bytes read in 8 ms (6.7 MiB/s) |
| 107 | => fatload mmc 0 0x83000000 u-boot.img |
| 108 | reading u-boot.img |
| 109 | 248600 bytes read in 19 ms (12.5 MiB/s) |
| 110 | |
| 111 | Commands to erase/write u-boot/MLO to flash device |
| 112 | |
| 113 | .. prompt:: bash |
| 114 | |
| 115 | => sf probe 0 |
| 116 | SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB, mapped at 5c000000 |
| 117 | => sf erase 0 0x10000 |
| 118 | SF: 65536 bytes @ 0x0 Erased: OK |
| 119 | => sf erase 0x20000 0x10000 |
| 120 | SF: 65536 bytes @ 0x20000 Erased: OK |
| 121 | => sf erase 0x30000 0x10000 |
| 122 | SF: 65536 bytes @ 0x30000 Erased: OK |
| 123 | => sf erase 0x40000 0x10000 |
| 124 | SF: 65536 bytes @ 0x40000 Erased: OK |
| 125 | => sf erase 0x50000 0x10000 |
| 126 | SF: 65536 bytes @ 0x50000 Erased: OK |
| 127 | => sf erase 0x60000 0x10000 |
| 128 | SF: 65536 bytes @ 0x60000 Erased: OK |
| 129 | => sf write 82000000 0 0x10000 |
| 130 | SF: 65536 bytes @ 0x0 Written: OK |
| 131 | => sf write 83000000 0x20000 0x60000 |
| 132 | SF: 393216 bytes @ 0x20000 Written: OK |
| 133 | |
| 134 | Next, set sysboot to QSPI-1 boot mode(SYSBOOT[5:0] = 100110) and power |
| 135 | on. ROM should find the GP header at offset 0 and load/execute SPL. SPL |
| 136 | then detects that ROM was in QSPI-1 mode (boot code 10) and attempts to |
| 137 | find a U-Boot image header at offset 0x20000 (set in the config file) |
| 138 | and proceeds to load that image using the U-Boot image payload offset/size |
| 139 | from the header. It will then start U-Boot. |