Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 2 | /* |
| 3 | * Boot related environment variable definitions on TI boards. |
| 4 | * |
| 5 | * (C) Copyright 2017 Linaro Ltd. |
| 6 | * Sam Protsenko <semen.protsenko@linaro.org> |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __TI_BOOT_H |
| 10 | #define __TI_BOOT_H |
| 11 | |
| 12 | #ifndef CONSOLEDEV |
| 13 | #define CONSOLEDEV "ttyO2" |
| 14 | #endif |
| 15 | |
Igor Opaniuk | b81b3b6 | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 16 | #define VBMETA_PART_SIZE (64 * 1024) |
| 17 | |
| 18 | #if defined(CONFIG_LIBAVB) |
| 19 | #define VBMETA_PART \ |
| 20 | "name=vbmeta,size=" __stringify(VBMETA_PART_SIZE) \ |
| 21 | ",uuid=${uuid_gpt_vbmeta};" |
| 22 | #else |
| 23 | #define VBMETA_PART "" |
| 24 | #endif |
| 25 | |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 26 | #ifndef PARTS_DEFAULT |
Sam Protsenko | 9351605 | 2018-04-19 23:57:30 +0300 | [diff] [blame] | 27 | /* Define the default GPT table for eMMC */ |
| 28 | #define PARTS_DEFAULT \ |
| 29 | /* Linux partitions */ \ |
| 30 | "uuid_disk=${uuid_gpt_disk};" \ |
| 31 | "name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \ |
| 32 | "name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \ |
| 33 | /* Android partitions */ \ |
| 34 | "partitions_android=" \ |
| 35 | "uuid_disk=${uuid_gpt_disk};" \ |
| 36 | "name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \ |
Sam Protsenko | 78371f3 | 2018-11-15 22:26:17 +0200 | [diff] [blame] | 37 | "name=bootloader,size=2048K,uuid=${uuid_gpt_bootloader};" \ |
Sam Protsenko | 22b7130 | 2019-01-04 22:09:08 +0200 | [diff] [blame] | 38 | "name=uboot-env,start=2432K,size=256K,uuid=${uuid_gpt_reserved};" \ |
Sam Protsenko | 9351605 | 2018-04-19 23:57:30 +0300 | [diff] [blame] | 39 | "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ |
Sam Protsenko | 9351605 | 2018-04-19 23:57:30 +0300 | [diff] [blame] | 40 | "name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \ |
| 41 | "name=boot,size=10M,uuid=${uuid_gpt_boot};" \ |
Sam Protsenko | 0e62385 | 2018-12-11 18:20:21 +0200 | [diff] [blame] | 42 | "name=system,size=1024M,uuid=${uuid_gpt_system};" \ |
Sam Protsenko | 9351605 | 2018-04-19 23:57:30 +0300 | [diff] [blame] | 43 | "name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \ |
Igor Opaniuk | b81b3b6 | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 44 | VBMETA_PART \ |
Sam Protsenko | 9351605 | 2018-04-19 23:57:30 +0300 | [diff] [blame] | 45 | "name=userdata,size=-,uuid=${uuid_gpt_userdata}" |
| 46 | #endif /* PARTS_DEFAULT */ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 47 | |
Igor Opaniuk | b81b3b6 | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 48 | #if defined(CONFIG_CMD_AVB) |
| 49 | #define AVB_VERIFY_CHECK "if run avb_verify; then " \ |
| 50 | "echo AVB verification OK.;" \ |
| 51 | "set bootargs $bootargs $avb_bootargs;" \ |
| 52 | "else " \ |
| 53 | "echo AVB verification failed.;" \ |
| 54 | "exit; fi;" |
| 55 | #define AVB_VERIFY_CMD "avb_verify=avb init 1; avb verify;\0" |
| 56 | #else |
| 57 | #define AVB_VERIFY_CHECK "" |
| 58 | #define AVB_VERIFY_CMD "" |
| 59 | #endif |
| 60 | |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 61 | #define DEFAULT_COMMON_BOOT_TI_ARGS \ |
| 62 | "console=" CONSOLEDEV ",115200n8\0" \ |
| 63 | "fdtfile=undefined\0" \ |
| 64 | "bootpart=0:2\0" \ |
| 65 | "bootdir=/boot\0" \ |
| 66 | "bootfile=zImage\0" \ |
| 67 | "usbtty=cdc_acm\0" \ |
| 68 | "vram=16M\0" \ |
Igor Opaniuk | b81b3b6 | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 69 | AVB_VERIFY_CMD \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 70 | "partitions=" PARTS_DEFAULT "\0" \ |
| 71 | "optargs=\0" \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 72 | "dofastboot=0\0" \ |
Sam Protsenko | 7e43edc | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 73 | "emmc_linux_boot=" \ |
Sam Protsenko | bfd9f7c | 2017-09-21 22:37:59 +0300 | [diff] [blame] | 74 | "echo Trying to boot Linux from eMMC ...; " \ |
Sam Protsenko | 7e43edc | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 75 | "setenv mmcdev 1; " \ |
| 76 | "setenv bootpart 1:2; " \ |
| 77 | "setenv mmcroot /dev/mmcblk0p2 rw; " \ |
| 78 | "run mmcboot;\0" \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 79 | "emmc_android_boot=" \ |
Sam Protsenko | bfd9f7c | 2017-09-21 22:37:59 +0300 | [diff] [blame] | 80 | "echo Trying to boot Android from eMMC ...; " \ |
Praneeth Bajjuri | d89516b | 2018-04-25 16:03:24 -0500 | [diff] [blame] | 81 | "run update_to_fit; " \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 82 | "setenv eval_bootargs setenv bootargs $bootargs; " \ |
| 83 | "run eval_bootargs; " \ |
| 84 | "setenv mmcdev 1; " \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 85 | "setenv machid fe6; " \ |
| 86 | "mmc dev $mmcdev; " \ |
| 87 | "mmc rescan; " \ |
Igor Opaniuk | b81b3b6 | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 88 | AVB_VERIFY_CHECK \ |
Sam Protsenko | 8883265 | 2018-02-26 23:18:01 +0200 | [diff] [blame] | 89 | "part start mmc ${mmcdev} boot boot_start; " \ |
| 90 | "part size mmc ${mmcdev} boot boot_size; " \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 91 | "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \ |
Praneeth Bajjuri | d89516b | 2018-04-25 16:03:24 -0500 | [diff] [blame] | 92 | "bootm ${loadaddr}#${fdtfile};\0 " |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 93 | |
| 94 | #ifdef CONFIG_OMAP54XX |
| 95 | |
| 96 | #define DEFAULT_FDT_TI_ARGS \ |
| 97 | "findfdt="\ |
| 98 | "if test $board_name = omap5_uevm; then " \ |
| 99 | "setenv fdtfile omap5-uevm.dtb; fi; " \ |
| 100 | "if test $board_name = dra7xx; then " \ |
| 101 | "setenv fdtfile dra7-evm.dtb; fi;" \ |
| 102 | "if test $board_name = dra72x-revc; then " \ |
| 103 | "setenv fdtfile dra72-evm-revc.dtb; fi;" \ |
| 104 | "if test $board_name = dra72x; then " \ |
| 105 | "setenv fdtfile dra72-evm.dtb; fi;" \ |
| 106 | "if test $board_name = dra71x; then " \ |
| 107 | "setenv fdtfile dra71-evm.dtb; fi;" \ |
Lokesh Vutla | 7b8b6f7 | 2017-12-29 11:47:58 +0530 | [diff] [blame] | 108 | "if test $board_name = dra76x_acd; then " \ |
Lokesh Vutla | 066f578 | 2017-08-21 12:50:58 +0530 | [diff] [blame] | 109 | "setenv fdtfile dra76-evm.dtb; fi;" \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 110 | "if test $board_name = beagle_x15; then " \ |
| 111 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 112 | "if test $board_name = beagle_x15_revb1; then " \ |
| 113 | "setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;" \ |
Lokesh Vutla | 473d816 | 2017-08-23 11:39:07 +0530 | [diff] [blame] | 114 | "if test $board_name = beagle_x15_revc; then " \ |
| 115 | "setenv fdtfile am57xx-beagle-x15-revc.dtb; fi;" \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 116 | "if test $board_name = am572x_idk; then " \ |
| 117 | "setenv fdtfile am572x-idk.dtb; fi;" \ |
Lokesh Vutla | 7b8b6f7 | 2017-12-29 11:47:58 +0530 | [diff] [blame] | 118 | "if test $board_name = am574x_idk; then " \ |
| 119 | "setenv fdtfile am574x-idk.dtb; fi;" \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 120 | "if test $board_name = am57xx_evm; then " \ |
| 121 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 122 | "if test $board_name = am57xx_evm_reva3; then " \ |
| 123 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 124 | "if test $board_name = am571x_idk; then " \ |
| 125 | "setenv fdtfile am571x-idk.dtb; fi;" \ |
| 126 | "if test $fdtfile = undefined; then " \ |
| 127 | "echo WARNING: Could not determine device tree to use; fi; \0" |
| 128 | |
| 129 | #define CONFIG_BOOTCOMMAND \ |
| 130 | "if test ${dofastboot} -eq 1; then " \ |
| 131 | "echo Boot fastboot requested, resetting dofastboot ...;" \ |
| 132 | "setenv dofastboot 0; saveenv;" \ |
| 133 | "echo Booting into fastboot ...; " \ |
| 134 | "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \ |
| 135 | "fi;" \ |
| 136 | "if test ${boot_fit} -eq 1; then " \ |
| 137 | "run update_to_fit;" \ |
| 138 | "fi;" \ |
| 139 | "run findfdt; " \ |
| 140 | "run envboot; " \ |
| 141 | "run mmcboot;" \ |
Sam Protsenko | 7e43edc | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 142 | "run emmc_linux_boot; " \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 143 | "run emmc_android_boot; " \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 144 | "" |
| 145 | |
| 146 | #endif /* CONFIG_OMAP54XX */ |
| 147 | |
| 148 | #endif /* __TI_BOOT_H */ |