config_distro_bootcmd.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2014
  4. * NVIDIA Corporation <www.nvidia.com>
  5. *
  6. * Copyright 2014 Red Hat, Inc.
  7. */
  8. #ifndef _CONFIG_CMD_DISTRO_BOOTCMD_H
  9. #define _CONFIG_CMD_DISTRO_BOOTCMD_H
  10. /*
  11. * A note on error handling: It is possible for BOOT_TARGET_DEVICES to
  12. * reference a device that is not enabled in the U-Boot configuration, e.g.
  13. * it may include MMC in the list without CONFIG_CMD_MMC being enabled. Given
  14. * that BOOT_TARGET_DEVICES is a macro that's expanded by the C pre-processor
  15. * at compile time, it's not possible to detect and report such problems via
  16. * a simple #ifdef/#error combination. Still, the code needs to report errors.
  17. * The best way I've found to do this is to make BOOT_TARGET_DEVICES expand to
  18. * reference a non-existent symbol, and have the name of that symbol encode
  19. * the error message. Consequently, this file contains references to e.g.
  20. * BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC. Given the
  21. * prevalence of capitals here, this looks like a pre-processor macro and
  22. * hence seems like it should be all capitals, but it's really an error
  23. * message that includes some other pre-processor symbols in the text.
  24. */
  25. #define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \
  26. "if " #devtypel " dev ${devnum}; then " \
  27. "devtype=" #devtypel "; " \
  28. "run scan_dev_for_boot_part; " \
  29. "fi\0"
  30. #define BOOTENV_SHARED_BLKDEV(devtypel) \
  31. #devtypel "_boot=" \
  32. BOOTENV_SHARED_BLKDEV_BODY(devtypel)
  33. #define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \
  34. "bootcmd_" #devtypel #instance "=" \
  35. "devnum=" #instance "; " \
  36. "run " #devtypel "_boot\0"
  37. #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
  38. #devtypel #instance " "
  39. #ifdef CONFIG_SANDBOX
  40. #define BOOTENV_SHARED_HOST BOOTENV_SHARED_BLKDEV(host)
  41. #define BOOTENV_DEV_HOST BOOTENV_DEV_BLKDEV
  42. #define BOOTENV_DEV_NAME_HOST BOOTENV_DEV_NAME_BLKDEV
  43. #else
  44. #define BOOTENV_SHARED_HOST
  45. #define BOOTENV_DEV_HOST \
  46. BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
  47. #define BOOTENV_DEV_NAME_HOST \
  48. BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
  49. #endif
  50. #ifdef CONFIG_CMD_MMC
  51. #define BOOTENV_SHARED_MMC BOOTENV_SHARED_BLKDEV(mmc)
  52. #define BOOTENV_DEV_MMC BOOTENV_DEV_BLKDEV
  53. #define BOOTENV_DEV_NAME_MMC BOOTENV_DEV_NAME_BLKDEV
  54. #else
  55. #define BOOTENV_SHARED_MMC
  56. #define BOOTENV_DEV_MMC \
  57. BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
  58. #define BOOTENV_DEV_NAME_MMC \
  59. BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
  60. #endif
  61. #ifdef CONFIG_CMD_UBIFS
  62. #define BOOTENV_SHARED_UBIFS \
  63. "ubifs_boot=" \
  64. "env exists bootubipart || " \
  65. "env set bootubipart UBI; " \
  66. "env exists bootubivol || " \
  67. "env set bootubivol boot; " \
  68. "if ubi part ${bootubipart} && " \
  69. "ubifsmount ubi${devnum}:${bootubivol}; " \
  70. "then " \
  71. "devtype=ubi; " \
  72. "run scan_dev_for_boot; " \
  73. "fi\0"
  74. #define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV
  75. #define BOOTENV_DEV_NAME_UBIFS BOOTENV_DEV_NAME_BLKDEV
  76. #else
  77. #define BOOTENV_SHARED_UBIFS
  78. #define BOOTENV_DEV_UBIFS \
  79. BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS
  80. #define BOOTENV_DEV_NAME_UBIFS \
  81. BOOT_TARGET_DEVICES_references_UBIFS_without_CONFIG_CMD_UBIFS
  82. #endif
  83. #ifdef CONFIG_EFI_LOADER
  84. #if defined(CONFIG_ARM64)
  85. #define BOOTEFI_NAME "bootaa64.efi"
  86. #elif defined(CONFIG_ARM)
  87. #define BOOTEFI_NAME "bootarm.efi"
  88. #elif defined(CONFIG_X86_RUN_32BIT)
  89. #define BOOTEFI_NAME "bootia32.efi"
  90. #elif defined(CONFIG_X86_RUN_64BIT)
  91. #define BOOTEFI_NAME "bootx64.efi"
  92. #elif defined(CONFIG_ARCH_RV32I)
  93. #define BOOTEFI_NAME "bootriscv32.efi"
  94. #elif defined(CONFIG_ARCH_RV64I)
  95. #define BOOTEFI_NAME "bootriscv64.efi"
  96. #endif
  97. #endif
  98. #ifdef BOOTEFI_NAME
  99. #if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
  100. /*
  101. * On 32bit ARM systems there is a reasonable number of systems that follow
  102. * the $soc-$board$boardver.dtb name scheme for their device trees. Use that
  103. * scheme if we don't have an explicit fdtfile variable.
  104. */
  105. #define BOOTENV_EFI_SET_FDTFILE_FALLBACK \
  106. "if test -z \"${fdtfile}\" -a -n \"${soc}\"; then " \
  107. "setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; " \
  108. "fi; "
  109. #else
  110. #ifndef BOOTENV_EFI_SET_FDTFILE_FALLBACK
  111. #define BOOTENV_EFI_SET_FDTFILE_FALLBACK
  112. #endif
  113. #endif
  114. #ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
  115. #define BOOTENV_EFI_BOOTMGR \
  116. "boot_efi_bootmgr=" \
  117. "if fdt addr ${fdt_addr_r}; then " \
  118. "bootefi bootmgr ${fdt_addr_r};" \
  119. "else " \
  120. "bootefi bootmgr;" \
  121. "fi\0"
  122. #else
  123. #define BOOTENV_EFI_BOOTMGR
  124. #endif
  125. #define BOOTENV_SHARED_EFI \
  126. BOOTENV_EFI_BOOTMGR \
  127. \
  128. "boot_efi_binary=" \
  129. "load ${devtype} ${devnum}:${distro_bootpart} " \
  130. "${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \
  131. "if fdt addr ${fdt_addr_r}; then " \
  132. "bootefi ${kernel_addr_r} ${fdt_addr_r};" \
  133. "else " \
  134. "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
  135. "fi\0" \
  136. \
  137. "load_efi_dtb=" \
  138. "load ${devtype} ${devnum}:${distro_bootpart} " \
  139. "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \
  140. \
  141. "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \
  142. "scan_dev_for_efi=" \
  143. "setenv efi_fdtfile ${fdtfile}; " \
  144. BOOTENV_EFI_SET_FDTFILE_FALLBACK \
  145. "for prefix in ${efi_dtb_prefixes}; do " \
  146. "if test -e ${devtype} " \
  147. "${devnum}:${distro_bootpart} " \
  148. "${prefix}${efi_fdtfile}; then " \
  149. "run load_efi_dtb; " \
  150. "fi;" \
  151. "done;" \
  152. "run boot_efi_bootmgr;" \
  153. "if test -e ${devtype} ${devnum}:${distro_bootpart} " \
  154. "efi/boot/"BOOTEFI_NAME"; then " \
  155. "echo Found EFI removable media binary " \
  156. "efi/boot/"BOOTEFI_NAME"; " \
  157. "run boot_efi_binary; " \
  158. "echo EFI LOAD FAILED: continuing...; " \
  159. "fi; " \
  160. "setenv efi_fdtfile\0"
  161. #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
  162. #else
  163. #define BOOTENV_SHARED_EFI
  164. #define SCAN_DEV_FOR_EFI
  165. #endif
  166. #ifdef CONFIG_SATA
  167. #define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata)
  168. #define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV
  169. #define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV
  170. #else
  171. #define BOOTENV_SHARED_SATA
  172. #define BOOTENV_DEV_SATA \
  173. BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA
  174. #define BOOTENV_DEV_NAME_SATA \
  175. BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA
  176. #endif
  177. #ifdef CONFIG_NVME
  178. #define BOOTENV_RUN_NVME_INIT "run nvme_init; "
  179. #define BOOTENV_SET_NVME_NEED_INIT "setenv nvme_need_init; "
  180. #define BOOTENV_SHARED_NVME \
  181. "nvme_init=" \
  182. "if ${nvme_need_init}; then " \
  183. "setenv nvme_need_init false; " \
  184. "nvme scan; " \
  185. "fi\0" \
  186. \
  187. "nvme_boot=" \
  188. BOOTENV_RUN_PCI_ENUM \
  189. BOOTENV_RUN_NVME_INIT \
  190. BOOTENV_SHARED_BLKDEV_BODY(nvme)
  191. #define BOOTENV_DEV_NVME BOOTENV_DEV_BLKDEV
  192. #define BOOTENV_DEV_NAME_NVME BOOTENV_DEV_NAME_BLKDEV
  193. #else
  194. #define BOOTENV_RUN_NVME_INIT
  195. #define BOOTENV_SET_NVME_NEED_INIT
  196. #define BOOTENV_SHARED_NVME
  197. #define BOOTENV_DEV_NVME \
  198. BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME
  199. #define BOOTENV_DEV_NAME_NVME \
  200. BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME
  201. #endif
  202. #ifdef CONFIG_SCSI
  203. #define BOOTENV_RUN_SCSI_INIT "run scsi_init; "
  204. #define BOOTENV_SET_SCSI_NEED_INIT "scsi_need_init=; "
  205. #define BOOTENV_SHARED_SCSI \
  206. "scsi_init=" \
  207. "if ${scsi_need_init}; then " \
  208. "scsi_need_init=false; " \
  209. "scsi scan; " \
  210. "fi\0" \
  211. \
  212. "scsi_boot=" \
  213. BOOTENV_RUN_SCSI_INIT \
  214. BOOTENV_SHARED_BLKDEV_BODY(scsi)
  215. #define BOOTENV_DEV_SCSI BOOTENV_DEV_BLKDEV
  216. #define BOOTENV_DEV_NAME_SCSI BOOTENV_DEV_NAME_BLKDEV
  217. #else
  218. #define BOOTENV_RUN_SCSI_INIT
  219. #define BOOTENV_SET_SCSI_NEED_INIT
  220. #define BOOTENV_SHARED_SCSI
  221. #define BOOTENV_DEV_SCSI \
  222. BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI
  223. #define BOOTENV_DEV_NAME_SCSI \
  224. BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI
  225. #endif
  226. #ifdef CONFIG_IDE
  227. #define BOOTENV_RUN_IDE_INIT "run ide_init; "
  228. #define BOOTENV_SET_IDE_NEED_INIT "setenv ide_need_init; "
  229. #define BOOTENV_SHARED_IDE \
  230. "ide_init=" \
  231. "if ${ide_need_init}; then " \
  232. "setenv ide_need_init false; " \
  233. "ide reset; " \
  234. "fi\0" \
  235. \
  236. "ide_boot=" \
  237. BOOTENV_RUN_IDE_INIT \
  238. BOOTENV_SHARED_BLKDEV_BODY(ide)
  239. #define BOOTENV_DEV_IDE BOOTENV_DEV_BLKDEV
  240. #define BOOTENV_DEV_NAME_IDE BOOTENV_DEV_NAME_BLKDEV
  241. #else
  242. #define BOOTENV_RUN_IDE_INIT
  243. #define BOOTENV_SET_IDE_NEED_INIT
  244. #define BOOTENV_SHARED_IDE
  245. #define BOOTENV_DEV_IDE \
  246. BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_IDE
  247. #define BOOTENV_DEV_NAME_IDE \
  248. BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_IDE
  249. #endif
  250. #if defined(CONFIG_DM_PCI)
  251. #define BOOTENV_RUN_PCI_ENUM "run boot_pci_enum; "
  252. #define BOOTENV_SHARED_PCI \
  253. "boot_pci_enum=pci enum\0"
  254. #else
  255. #define BOOTENV_RUN_PCI_ENUM
  256. #define BOOTENV_SHARED_PCI
  257. #endif
  258. #ifdef CONFIG_CMD_USB
  259. #define BOOTENV_RUN_NET_USB_START "run boot_net_usb_start; "
  260. #define BOOTENV_SHARED_USB \
  261. "boot_net_usb_start=usb start\0" \
  262. "usb_boot=" \
  263. "usb start; " \
  264. BOOTENV_SHARED_BLKDEV_BODY(usb)
  265. #define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV
  266. #define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV
  267. #else
  268. #define BOOTENV_RUN_NET_USB_START
  269. #define BOOTENV_SHARED_USB
  270. #define BOOTENV_DEV_USB \
  271. BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
  272. #define BOOTENV_DEV_NAME_USB \
  273. BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
  274. #endif
  275. #ifdef CONFIG_CMD_VIRTIO
  276. #define BOOTENV_RUN_VIRTIO_INIT "run virtio_init; "
  277. #define BOOTENV_SET_VIRTIO_NEED_INIT "virtio_need_init=; "
  278. #define BOOTENV_SHARED_VIRTIO \
  279. "virtio_init=" \
  280. "if ${virtio_need_init}; then " \
  281. "virtio_need_init=false; " \
  282. "virtio scan; " \
  283. "fi\0" \
  284. \
  285. "virtio_boot=" \
  286. BOOTENV_RUN_PCI_ENUM \
  287. BOOTENV_RUN_VIRTIO_INIT \
  288. BOOTENV_SHARED_BLKDEV_BODY(virtio)
  289. #define BOOTENV_DEV_VIRTIO BOOTENV_DEV_BLKDEV
  290. #define BOOTENV_DEV_NAME_VIRTIO BOOTENV_DEV_NAME_BLKDEV
  291. #else
  292. #define BOOTENV_RUN_VIRTIO_INIT
  293. #define BOOTENV_SET_VIRTIO_NEED_INIT
  294. #define BOOTENV_SHARED_VIRTIO
  295. #define BOOTENV_DEV_VIRTIO \
  296. BOOT_TARGET_DEVICES_references_VIRTIO_without_CONFIG_CMD_VIRTIO
  297. #define BOOTENV_DEV_NAME_VIRTIO \
  298. BOOT_TARGET_DEVICES_references_VIRTIO_without_CONFIG_CMD_VIRTIO
  299. #endif
  300. #if defined(CONFIG_CMD_DHCP)
  301. #if defined(CONFIG_EFI_LOADER)
  302. /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
  303. #if defined(CONFIG_ARM64) || defined(__aarch64__)
  304. #define BOOTENV_EFI_PXE_ARCH "0xb"
  305. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00011:UNDI:003000"
  306. #elif defined(CONFIG_ARM) || defined(__arm__)
  307. #define BOOTENV_EFI_PXE_ARCH "0xa"
  308. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00010:UNDI:003000"
  309. #elif defined(CONFIG_X86) || defined(__x86_64__)
  310. #define BOOTENV_EFI_PXE_ARCH "0x7"
  311. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00007:UNDI:003000"
  312. #elif defined(__i386__)
  313. #define BOOTENV_EFI_PXE_ARCH "0x6"
  314. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00006:UNDI:003000"
  315. #elif defined(CONFIG_ARCH_RV32I) || ((defined(__riscv) && __riscv_xlen == 32))
  316. #define BOOTENV_EFI_PXE_ARCH "0x19"
  317. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00025:UNDI:003000"
  318. #elif defined(CONFIG_ARCH_RV64I) || ((defined(__riscv) && __riscv_xlen == 64))
  319. #define BOOTENV_EFI_PXE_ARCH "0x1b"
  320. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00027:UNDI:003000"
  321. #elif defined(CONFIG_SANDBOX)
  322. # error "sandbox EFI support is only supported on ARM and x86"
  323. #else
  324. #error Please specify an EFI client identifier
  325. #endif
  326. /*
  327. * Ask the dhcp server for an EFI binary. If we get one, check for a
  328. * device tree in the same folder. Then boot everything. If the file was
  329. * not an EFI binary, we just return from the bootefi command and continue.
  330. */
  331. #define BOOTENV_EFI_RUN_DHCP \
  332. "setenv efi_fdtfile ${fdtfile}; " \
  333. BOOTENV_EFI_SET_FDTFILE_FALLBACK \
  334. "setenv efi_old_vci ${bootp_vci};" \
  335. "setenv efi_old_arch ${bootp_arch};" \
  336. "setenv bootp_vci " BOOTENV_EFI_PXE_VCI ";" \
  337. "setenv bootp_arch " BOOTENV_EFI_PXE_ARCH ";" \
  338. "if dhcp ${kernel_addr_r}; then " \
  339. "tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};" \
  340. "if fdt addr ${fdt_addr_r}; then " \
  341. "bootefi ${kernel_addr_r} ${fdt_addr_r}; " \
  342. "else " \
  343. "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
  344. "fi;" \
  345. "fi;" \
  346. "setenv bootp_vci ${efi_old_vci};" \
  347. "setenv bootp_arch ${efi_old_arch};" \
  348. "setenv efi_fdtfile;" \
  349. "setenv efi_old_arch;" \
  350. "setenv efi_old_vci;"
  351. #else
  352. #define BOOTENV_EFI_RUN_DHCP
  353. #endif
  354. #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
  355. "bootcmd_dhcp=" \
  356. "devtype=" #devtypel "; " \
  357. BOOTENV_RUN_NET_USB_START \
  358. BOOTENV_RUN_PCI_ENUM \
  359. "if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
  360. "source ${scriptaddr}; " \
  361. "fi;" \
  362. BOOTENV_EFI_RUN_DHCP \
  363. "\0"
  364. #define BOOTENV_DEV_NAME_DHCP(devtypeu, devtypel, instance) \
  365. "dhcp "
  366. #else
  367. #define BOOTENV_DEV_DHCP \
  368. BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
  369. #define BOOTENV_DEV_NAME_DHCP \
  370. BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
  371. #endif
  372. #if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
  373. #define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \
  374. "bootcmd_pxe=" \
  375. BOOTENV_RUN_NET_USB_START \
  376. BOOTENV_RUN_PCI_ENUM \
  377. "dhcp; " \
  378. "if pxe get; then " \
  379. "pxe boot; " \
  380. "fi\0"
  381. #define BOOTENV_DEV_NAME_PXE(devtypeu, devtypel, instance) \
  382. "pxe "
  383. #else
  384. #define BOOTENV_DEV_PXE \
  385. BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
  386. #define BOOTENV_DEV_NAME_PXE \
  387. BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
  388. #endif
  389. #define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \
  390. BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance)
  391. #define BOOTENV_BOOT_TARGETS \
  392. "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
  393. #define BOOTENV_DEV(devtypeu, devtypel, instance) \
  394. BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
  395. #define BOOTENV \
  396. BOOTENV_SHARED_HOST \
  397. BOOTENV_SHARED_MMC \
  398. BOOTENV_SHARED_PCI \
  399. BOOTENV_SHARED_USB \
  400. BOOTENV_SHARED_SATA \
  401. BOOTENV_SHARED_SCSI \
  402. BOOTENV_SHARED_NVME \
  403. BOOTENV_SHARED_IDE \
  404. BOOTENV_SHARED_UBIFS \
  405. BOOTENV_SHARED_EFI \
  406. BOOTENV_SHARED_VIRTIO \
  407. "boot_prefixes=/ /boot/\0" \
  408. "boot_scripts=boot.scr.uimg boot.scr\0" \
  409. "boot_script_dhcp=boot.scr.uimg\0" \
  410. BOOTENV_BOOT_TARGETS \
  411. \
  412. "boot_syslinux_conf=extlinux/extlinux.conf\0" \
  413. "boot_extlinux=" \
  414. "sysboot ${devtype} ${devnum}:${distro_bootpart} any " \
  415. "${scriptaddr} ${prefix}${boot_syslinux_conf}\0" \
  416. \
  417. "scan_dev_for_extlinux=" \
  418. "if test -e ${devtype} " \
  419. "${devnum}:${distro_bootpart} " \
  420. "${prefix}${boot_syslinux_conf}; then " \
  421. "echo Found ${prefix}${boot_syslinux_conf}; " \
  422. "run boot_extlinux; " \
  423. "echo SCRIPT FAILED: continuing...; " \
  424. "fi\0" \
  425. \
  426. "boot_a_script=" \
  427. "load ${devtype} ${devnum}:${distro_bootpart} " \
  428. "${scriptaddr} ${prefix}${script}; " \
  429. "source ${scriptaddr}\0" \
  430. \
  431. "scan_dev_for_scripts=" \
  432. "for script in ${boot_scripts}; do " \
  433. "if test -e ${devtype} " \
  434. "${devnum}:${distro_bootpart} " \
  435. "${prefix}${script}; then " \
  436. "echo Found U-Boot script " \
  437. "${prefix}${script}; " \
  438. "run boot_a_script; " \
  439. "echo SCRIPT FAILED: continuing...; " \
  440. "fi; " \
  441. "done\0" \
  442. \
  443. "scan_dev_for_boot=" \
  444. "echo Scanning ${devtype} " \
  445. "${devnum}:${distro_bootpart}...; " \
  446. "for prefix in ${boot_prefixes}; do " \
  447. "run scan_dev_for_extlinux; " \
  448. "run scan_dev_for_scripts; " \
  449. "done;" \
  450. SCAN_DEV_FOR_EFI \
  451. "\0" \
  452. \
  453. "scan_dev_for_boot_part=" \
  454. "part list ${devtype} ${devnum} -bootable devplist; " \
  455. "env exists devplist || setenv devplist 1; " \
  456. "for distro_bootpart in ${devplist}; do " \
  457. "if fstype ${devtype} " \
  458. "${devnum}:${distro_bootpart} " \
  459. "bootfstype; then " \
  460. "run scan_dev_for_boot; " \
  461. "fi; " \
  462. "done; " \
  463. "setenv devplist\0" \
  464. \
  465. BOOT_TARGET_DEVICES(BOOTENV_DEV) \
  466. \
  467. "distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \
  468. BOOTENV_SET_NVME_NEED_INIT \
  469. BOOTENV_SET_IDE_NEED_INIT \
  470. BOOTENV_SET_VIRTIO_NEED_INIT \
  471. "for target in ${boot_targets}; do " \
  472. "run bootcmd_${target}; " \
  473. "done\0"
  474. #ifndef CONFIG_BOOTCOMMAND
  475. #define CONFIG_BOOTCOMMAND "run distro_bootcmd"
  476. #endif
  477. #endif /* _CONFIG_CMD_DISTRO_BOOTCMD_H */