Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Semen Protsenko | 4fd79ac | 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 | 4fd79ac | 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 | e883ffe | 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 | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 26 | #ifndef PARTS_DEFAULT |
Sam Protsenko | c90a760 | 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};" \ |
| 37 | "name=bootloader,size=1792K,uuid=${uuid_gpt_bootloader};" \ |
Sam Protsenko | c90a760 | 2018-04-19 23:57:30 +0300 | [diff] [blame] | 38 | "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ |
| 39 | "name=reserved,size=256K,uuid=${uuid_gpt_reserved};" \ |
| 40 | "name=efs,size=16M,uuid=${uuid_gpt_efs};" \ |
| 41 | "name=crypto,size=16K,uuid=${uuid_gpt_crypto};" \ |
| 42 | "name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \ |
| 43 | "name=boot,size=10M,uuid=${uuid_gpt_boot};" \ |
| 44 | "name=system,size=768M,uuid=${uuid_gpt_system};" \ |
| 45 | "name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \ |
| 46 | "name=cache,size=256M,uuid=${uuid_gpt_cache};" \ |
| 47 | "name=ipu1,size=1M,uuid=${uuid_gpt_ipu1};" \ |
| 48 | "name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \ |
Igor Opaniuk | e883ffe | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 49 | VBMETA_PART \ |
Sam Protsenko | c90a760 | 2018-04-19 23:57:30 +0300 | [diff] [blame] | 50 | "name=userdata,size=-,uuid=${uuid_gpt_userdata}" |
| 51 | #endif /* PARTS_DEFAULT */ |
Semen Protsenko | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 52 | |
Igor Opaniuk | e883ffe | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 53 | #if defined(CONFIG_CMD_AVB) |
| 54 | #define AVB_VERIFY_CHECK "if run avb_verify; then " \ |
| 55 | "echo AVB verification OK.;" \ |
| 56 | "set bootargs $bootargs $avb_bootargs;" \ |
| 57 | "else " \ |
| 58 | "echo AVB verification failed.;" \ |
| 59 | "exit; fi;" |
| 60 | #define AVB_VERIFY_CMD "avb_verify=avb init 1; avb verify;\0" |
| 61 | #else |
| 62 | #define AVB_VERIFY_CHECK "" |
| 63 | #define AVB_VERIFY_CMD "" |
| 64 | #endif |
| 65 | |
Semen Protsenko | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 66 | #define DEFAULT_COMMON_BOOT_TI_ARGS \ |
| 67 | "console=" CONSOLEDEV ",115200n8\0" \ |
| 68 | "fdtfile=undefined\0" \ |
| 69 | "bootpart=0:2\0" \ |
| 70 | "bootdir=/boot\0" \ |
| 71 | "bootfile=zImage\0" \ |
| 72 | "usbtty=cdc_acm\0" \ |
| 73 | "vram=16M\0" \ |
Igor Opaniuk | e883ffe | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 74 | AVB_VERIFY_CMD \ |
Semen Protsenko | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 75 | "partitions=" PARTS_DEFAULT "\0" \ |
| 76 | "optargs=\0" \ |
Semen Protsenko | a17c8b1 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 77 | "dofastboot=0\0" \ |
Sam Protsenko | 2717c08 | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 78 | "emmc_linux_boot=" \ |
Sam Protsenko | 6ca43a5 | 2017-09-21 22:37:59 +0300 | [diff] [blame] | 79 | "echo Trying to boot Linux from eMMC ...; " \ |
Sam Protsenko | 2717c08 | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 80 | "setenv mmcdev 1; " \ |
| 81 | "setenv bootpart 1:2; " \ |
| 82 | "setenv mmcroot /dev/mmcblk0p2 rw; " \ |
| 83 | "run mmcboot;\0" \ |
Semen Protsenko | a17c8b1 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 84 | "emmc_android_boot=" \ |
Sam Protsenko | 6ca43a5 | 2017-09-21 22:37:59 +0300 | [diff] [blame] | 85 | "echo Trying to boot Android from eMMC ...; " \ |
Praneeth Bajjuri | b2031ff | 2018-04-25 16:03:24 -0500 | [diff] [blame] | 86 | "run update_to_fit; " \ |
Semen Protsenko | a17c8b1 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 87 | "setenv eval_bootargs setenv bootargs $bootargs; " \ |
| 88 | "run eval_bootargs; " \ |
| 89 | "setenv mmcdev 1; " \ |
Semen Protsenko | a17c8b1 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 90 | "setenv machid fe6; " \ |
| 91 | "mmc dev $mmcdev; " \ |
| 92 | "mmc rescan; " \ |
Igor Opaniuk | e883ffe | 2018-06-03 21:56:41 +0300 | [diff] [blame] | 93 | AVB_VERIFY_CHECK \ |
Sam Protsenko | 2c9afab | 2018-02-26 23:18:01 +0200 | [diff] [blame] | 94 | "part start mmc ${mmcdev} boot boot_start; " \ |
| 95 | "part size mmc ${mmcdev} boot boot_size; " \ |
Semen Protsenko | a17c8b1 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 96 | "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \ |
Praneeth Bajjuri | b2031ff | 2018-04-25 16:03:24 -0500 | [diff] [blame] | 97 | "bootm ${loadaddr}#${fdtfile};\0 " |
Semen Protsenko | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 98 | |
| 99 | #ifdef CONFIG_OMAP54XX |
| 100 | |
| 101 | #define DEFAULT_FDT_TI_ARGS \ |
| 102 | "findfdt="\ |
| 103 | "if test $board_name = omap5_uevm; then " \ |
| 104 | "setenv fdtfile omap5-uevm.dtb; fi; " \ |
| 105 | "if test $board_name = dra7xx; then " \ |
| 106 | "setenv fdtfile dra7-evm.dtb; fi;" \ |
| 107 | "if test $board_name = dra72x-revc; then " \ |
| 108 | "setenv fdtfile dra72-evm-revc.dtb; fi;" \ |
| 109 | "if test $board_name = dra72x; then " \ |
| 110 | "setenv fdtfile dra72-evm.dtb; fi;" \ |
| 111 | "if test $board_name = dra71x; then " \ |
| 112 | "setenv fdtfile dra71-evm.dtb; fi;" \ |
Lokesh Vutla | 3741c04 | 2017-12-29 11:47:58 +0530 | [diff] [blame] | 113 | "if test $board_name = dra76x_acd; then " \ |
Lokesh Vutla | 911d76c | 2017-08-21 12:50:58 +0530 | [diff] [blame] | 114 | "setenv fdtfile dra76-evm.dtb; fi;" \ |
Semen Protsenko | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 115 | "if test $board_name = beagle_x15; then " \ |
| 116 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 117 | "if test $board_name = beagle_x15_revb1; then " \ |
| 118 | "setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;" \ |
Lokesh Vutla | 0831831 | 2017-08-23 11:39:07 +0530 | [diff] [blame] | 119 | "if test $board_name = beagle_x15_revc; then " \ |
| 120 | "setenv fdtfile am57xx-beagle-x15-revc.dtb; fi;" \ |
Semen Protsenko | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 121 | "if test $board_name = am572x_idk; then " \ |
| 122 | "setenv fdtfile am572x-idk.dtb; fi;" \ |
Lokesh Vutla | 3741c04 | 2017-12-29 11:47:58 +0530 | [diff] [blame] | 123 | "if test $board_name = am574x_idk; then " \ |
| 124 | "setenv fdtfile am574x-idk.dtb; fi;" \ |
Semen Protsenko | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 125 | "if test $board_name = am57xx_evm; then " \ |
| 126 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 127 | "if test $board_name = am57xx_evm_reva3; then " \ |
| 128 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 129 | "if test $board_name = am571x_idk; then " \ |
| 130 | "setenv fdtfile am571x-idk.dtb; fi;" \ |
| 131 | "if test $fdtfile = undefined; then " \ |
| 132 | "echo WARNING: Could not determine device tree to use; fi; \0" |
| 133 | |
| 134 | #define CONFIG_BOOTCOMMAND \ |
| 135 | "if test ${dofastboot} -eq 1; then " \ |
| 136 | "echo Boot fastboot requested, resetting dofastboot ...;" \ |
| 137 | "setenv dofastboot 0; saveenv;" \ |
| 138 | "echo Booting into fastboot ...; " \ |
| 139 | "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \ |
| 140 | "fi;" \ |
| 141 | "if test ${boot_fit} -eq 1; then " \ |
| 142 | "run update_to_fit;" \ |
| 143 | "fi;" \ |
| 144 | "run findfdt; " \ |
| 145 | "run envboot; " \ |
| 146 | "run mmcboot;" \ |
Sam Protsenko | 2717c08 | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 147 | "run emmc_linux_boot; " \ |
Semen Protsenko | a17c8b1 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 148 | "run emmc_android_boot; " \ |
Semen Protsenko | 4fd79ac | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 149 | "" |
| 150 | |
| 151 | #endif /* CONFIG_OMAP54XX */ |
| 152 | |
| 153 | #endif /* __TI_BOOT_H */ |