config_distro_bootcmd.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  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. #define BOOTENV_EFI_SET_FDTFILE_FALLBACK
  111. #endif
  112. #define BOOTENV_SHARED_EFI \
  113. "boot_efi_bootmgr=" \
  114. "if fdt addr ${fdt_addr_r}; then " \
  115. "bootefi bootmgr ${fdt_addr_r};" \
  116. "else " \
  117. "bootefi bootmgr;" \
  118. "fi\0" \
  119. \
  120. "boot_efi_binary=" \
  121. "load ${devtype} ${devnum}:${distro_bootpart} " \
  122. "${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \
  123. "if fdt addr ${fdt_addr_r}; then " \
  124. "bootefi ${kernel_addr_r} ${fdt_addr_r};" \
  125. "else " \
  126. "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
  127. "fi\0" \
  128. \
  129. "load_efi_dtb=" \
  130. "load ${devtype} ${devnum}:${distro_bootpart} " \
  131. "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \
  132. \
  133. "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \
  134. "scan_dev_for_efi=" \
  135. "setenv efi_fdtfile ${fdtfile}; " \
  136. BOOTENV_EFI_SET_FDTFILE_FALLBACK \
  137. "for prefix in ${efi_dtb_prefixes}; do " \
  138. "if test -e ${devtype} " \
  139. "${devnum}:${distro_bootpart} " \
  140. "${prefix}${efi_fdtfile}; then " \
  141. "run load_efi_dtb; " \
  142. "fi;" \
  143. "done;" \
  144. "run boot_efi_bootmgr;" \
  145. "if test -e ${devtype} ${devnum}:${distro_bootpart} " \
  146. "efi/boot/"BOOTEFI_NAME"; then " \
  147. "echo Found EFI removable media binary " \
  148. "efi/boot/"BOOTEFI_NAME"; " \
  149. "run boot_efi_binary; " \
  150. "echo EFI LOAD FAILED: continuing...; " \
  151. "fi; " \
  152. "setenv efi_fdtfile\0"
  153. #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
  154. #else
  155. #define BOOTENV_SHARED_EFI
  156. #define SCAN_DEV_FOR_EFI
  157. #endif
  158. #ifdef CONFIG_SATA
  159. #define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata)
  160. #define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV
  161. #define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV
  162. #else
  163. #define BOOTENV_SHARED_SATA
  164. #define BOOTENV_DEV_SATA \
  165. BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA
  166. #define BOOTENV_DEV_NAME_SATA \
  167. BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA
  168. #endif
  169. #ifdef CONFIG_NVME
  170. #define BOOTENV_RUN_NVME_INIT "run nvme_init; "
  171. #define BOOTENV_SET_NVME_NEED_INIT "setenv nvme_need_init; "
  172. #define BOOTENV_SHARED_NVME \
  173. "nvme_init=" \
  174. "if ${nvme_need_init}; then " \
  175. "setenv nvme_need_init false; " \
  176. "nvme scan; " \
  177. "fi\0" \
  178. \
  179. "nvme_boot=" \
  180. BOOTENV_RUN_PCI_ENUM \
  181. BOOTENV_RUN_NVME_INIT \
  182. BOOTENV_SHARED_BLKDEV_BODY(nvme)
  183. #define BOOTENV_DEV_NVME BOOTENV_DEV_BLKDEV
  184. #define BOOTENV_DEV_NAME_NVME BOOTENV_DEV_NAME_BLKDEV
  185. #else
  186. #define BOOTENV_RUN_NVME_INIT
  187. #define BOOTENV_SET_NVME_NEED_INIT
  188. #define BOOTENV_SHARED_NVME
  189. #define BOOTENV_DEV_NVME \
  190. BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME
  191. #define BOOTENV_DEV_NAME_NVME \
  192. BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME
  193. #endif
  194. #ifdef CONFIG_SCSI
  195. #define BOOTENV_RUN_SCSI_INIT "run scsi_init; "
  196. #define BOOTENV_SET_SCSI_NEED_INIT "scsi_need_init=; "
  197. #define BOOTENV_SHARED_SCSI \
  198. "scsi_init=" \
  199. "if ${scsi_need_init}; then " \
  200. "scsi_need_init=false; " \
  201. "scsi scan; " \
  202. "fi\0" \
  203. \
  204. "scsi_boot=" \
  205. BOOTENV_RUN_SCSI_INIT \
  206. BOOTENV_SHARED_BLKDEV_BODY(scsi)
  207. #define BOOTENV_DEV_SCSI BOOTENV_DEV_BLKDEV
  208. #define BOOTENV_DEV_NAME_SCSI BOOTENV_DEV_NAME_BLKDEV
  209. #else
  210. #define BOOTENV_RUN_SCSI_INIT
  211. #define BOOTENV_SET_SCSI_NEED_INIT
  212. #define BOOTENV_SHARED_SCSI
  213. #define BOOTENV_DEV_SCSI \
  214. BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI
  215. #define BOOTENV_DEV_NAME_SCSI \
  216. BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_SCSI
  217. #endif
  218. #ifdef CONFIG_IDE
  219. #define BOOTENV_RUN_IDE_INIT "run ide_init; "
  220. #define BOOTENV_SET_IDE_NEED_INIT "setenv ide_need_init; "
  221. #define BOOTENV_SHARED_IDE \
  222. "ide_init=" \
  223. "if ${ide_need_init}; then " \
  224. "setenv ide_need_init false; " \
  225. "ide reset; " \
  226. "fi\0" \
  227. \
  228. "ide_boot=" \
  229. BOOTENV_RUN_IDE_INIT \
  230. BOOTENV_SHARED_BLKDEV_BODY(ide)
  231. #define BOOTENV_DEV_IDE BOOTENV_DEV_BLKDEV
  232. #define BOOTENV_DEV_NAME_IDE BOOTENV_DEV_NAME_BLKDEV
  233. #else
  234. #define BOOTENV_RUN_IDE_INIT
  235. #define BOOTENV_SET_IDE_NEED_INIT
  236. #define BOOTENV_SHARED_IDE
  237. #define BOOTENV_DEV_IDE \
  238. BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_IDE
  239. #define BOOTENV_DEV_NAME_IDE \
  240. BOOT_TARGET_DEVICES_references_IDE_without_CONFIG_IDE
  241. #endif
  242. #if defined(CONFIG_DM_PCI)
  243. #define BOOTENV_RUN_PCI_ENUM "run boot_pci_enum; "
  244. #define BOOTENV_SHARED_PCI \
  245. "boot_pci_enum=pci enum\0"
  246. #else
  247. #define BOOTENV_RUN_PCI_ENUM
  248. #define BOOTENV_SHARED_PCI
  249. #endif
  250. #ifdef CONFIG_CMD_USB
  251. #define BOOTENV_RUN_NET_USB_START "run boot_net_usb_start; "
  252. #define BOOTENV_SHARED_USB \
  253. "boot_net_usb_start=usb start\0" \
  254. "usb_boot=" \
  255. "usb start; " \
  256. BOOTENV_SHARED_BLKDEV_BODY(usb)
  257. #define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV
  258. #define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV
  259. #else
  260. #define BOOTENV_RUN_NET_USB_START
  261. #define BOOTENV_SHARED_USB
  262. #define BOOTENV_DEV_USB \
  263. BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
  264. #define BOOTENV_DEV_NAME_USB \
  265. BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
  266. #endif
  267. #ifdef CONFIG_CMD_VIRTIO
  268. #define BOOTENV_RUN_VIRTIO_INIT "run virtio_init; "
  269. #define BOOTENV_SET_VIRTIO_NEED_INIT "virtio_need_init=; "
  270. #define BOOTENV_SHARED_VIRTIO \
  271. "virtio_init=" \
  272. "if ${virtio_need_init}; then " \
  273. "virtio_need_init=false; " \
  274. "virtio scan; " \
  275. "fi\0" \
  276. \
  277. "virtio_boot=" \
  278. BOOTENV_RUN_PCI_ENUM \
  279. BOOTENV_RUN_VIRTIO_INIT \
  280. BOOTENV_SHARED_BLKDEV_BODY(virtio)
  281. #define BOOTENV_DEV_VIRTIO BOOTENV_DEV_BLKDEV
  282. #define BOOTENV_DEV_NAME_VIRTIO BOOTENV_DEV_NAME_BLKDEV
  283. #else
  284. #define BOOTENV_RUN_VIRTIO_INIT
  285. #define BOOTENV_SET_VIRTIO_NEED_INIT
  286. #define BOOTENV_SHARED_VIRTIO
  287. #define BOOTENV_DEV_VIRTIO \
  288. BOOT_TARGET_DEVICES_references_VIRTIO_without_CONFIG_CMD_VIRTIO
  289. #define BOOTENV_DEV_NAME_VIRTIO \
  290. BOOT_TARGET_DEVICES_references_VIRTIO_without_CONFIG_CMD_VIRTIO
  291. #endif
  292. #if defined(CONFIG_CMD_DHCP)
  293. #if defined(CONFIG_EFI_LOADER)
  294. /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
  295. #if defined(CONFIG_ARM64) || defined(__aarch64__)
  296. #define BOOTENV_EFI_PXE_ARCH "0xb"
  297. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00011:UNDI:003000"
  298. #elif defined(CONFIG_ARM) || defined(__arm__)
  299. #define BOOTENV_EFI_PXE_ARCH "0xa"
  300. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00010:UNDI:003000"
  301. #elif defined(CONFIG_X86) || defined(__x86_64__)
  302. #define BOOTENV_EFI_PXE_ARCH "0x7"
  303. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00007:UNDI:003000"
  304. #elif defined(__i386__)
  305. #define BOOTENV_EFI_PXE_ARCH "0x6"
  306. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00006:UNDI:003000"
  307. #elif defined(CONFIG_ARCH_RV32I) || ((defined(__riscv) && __riscv_xlen == 32))
  308. #define BOOTENV_EFI_PXE_ARCH "0x19"
  309. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00025:UNDI:003000"
  310. #elif defined(CONFIG_ARCH_RV64I) || ((defined(__riscv) && __riscv_xlen == 64))
  311. #define BOOTENV_EFI_PXE_ARCH "0x1b"
  312. #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00027:UNDI:003000"
  313. #elif defined(CONFIG_SANDBOX)
  314. # error "sandbox EFI support is only supported on ARM and x86"
  315. #else
  316. #error Please specify an EFI client identifier
  317. #endif
  318. /*
  319. * Ask the dhcp server for an EFI binary. If we get one, check for a
  320. * device tree in the same folder. Then boot everything. If the file was
  321. * not an EFI binary, we just return from the bootefi command and continue.
  322. */
  323. #define BOOTENV_EFI_RUN_DHCP \
  324. "setenv efi_fdtfile ${fdtfile}; " \
  325. BOOTENV_EFI_SET_FDTFILE_FALLBACK \
  326. "setenv efi_old_vci ${bootp_vci};" \
  327. "setenv efi_old_arch ${bootp_arch};" \
  328. "setenv bootp_vci " BOOTENV_EFI_PXE_VCI ";" \
  329. "setenv bootp_arch " BOOTENV_EFI_PXE_ARCH ";" \
  330. "if dhcp ${kernel_addr_r}; then " \
  331. "tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};" \
  332. "if fdt addr ${fdt_addr_r}; then " \
  333. "bootefi ${kernel_addr_r} ${fdt_addr_r}; " \
  334. "else " \
  335. "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
  336. "fi;" \
  337. "fi;" \
  338. "setenv bootp_vci ${efi_old_vci};" \
  339. "setenv bootp_arch ${efi_old_arch};" \
  340. "setenv efi_fdtfile;" \
  341. "setenv efi_old_arch;" \
  342. "setenv efi_old_vci;"
  343. #else
  344. #define BOOTENV_EFI_RUN_DHCP
  345. #endif
  346. #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
  347. "bootcmd_dhcp=" \
  348. BOOTENV_RUN_NET_USB_START \
  349. BOOTENV_RUN_PCI_ENUM \
  350. "if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
  351. "source ${scriptaddr}; " \
  352. "fi;" \
  353. BOOTENV_EFI_RUN_DHCP \
  354. "\0"
  355. #define BOOTENV_DEV_NAME_DHCP(devtypeu, devtypel, instance) \
  356. "dhcp "
  357. #else
  358. #define BOOTENV_DEV_DHCP \
  359. BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
  360. #define BOOTENV_DEV_NAME_DHCP \
  361. BOOT_TARGET_DEVICES_references_DHCP_without_CONFIG_CMD_DHCP
  362. #endif
  363. #if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
  364. #define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \
  365. "bootcmd_pxe=" \
  366. BOOTENV_RUN_NET_USB_START \
  367. BOOTENV_RUN_PCI_ENUM \
  368. "dhcp; " \
  369. "if pxe get; then " \
  370. "pxe boot; " \
  371. "fi\0"
  372. #define BOOTENV_DEV_NAME_PXE(devtypeu, devtypel, instance) \
  373. "pxe "
  374. #else
  375. #define BOOTENV_DEV_PXE \
  376. BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
  377. #define BOOTENV_DEV_NAME_PXE \
  378. BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
  379. #endif
  380. #define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \
  381. BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance)
  382. #define BOOTENV_BOOT_TARGETS \
  383. "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
  384. #define BOOTENV_DEV(devtypeu, devtypel, instance) \
  385. BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
  386. #define BOOTENV \
  387. BOOTENV_SHARED_HOST \
  388. BOOTENV_SHARED_MMC \
  389. BOOTENV_SHARED_PCI \
  390. BOOTENV_SHARED_USB \
  391. BOOTENV_SHARED_SATA \
  392. BOOTENV_SHARED_SCSI \
  393. BOOTENV_SHARED_NVME \
  394. BOOTENV_SHARED_IDE \
  395. BOOTENV_SHARED_UBIFS \
  396. BOOTENV_SHARED_EFI \
  397. BOOTENV_SHARED_VIRTIO \
  398. "boot_prefixes=/ /boot/\0" \
  399. "boot_scripts=boot.scr.uimg boot.scr\0" \
  400. "boot_script_dhcp=boot.scr.uimg\0" \
  401. BOOTENV_BOOT_TARGETS \
  402. \
  403. "boot_syslinux_conf=extlinux/extlinux.conf\0" \
  404. "boot_extlinux=" \
  405. "sysboot ${devtype} ${devnum}:${distro_bootpart} any " \
  406. "${scriptaddr} ${prefix}${boot_syslinux_conf}\0" \
  407. \
  408. "scan_dev_for_extlinux=" \
  409. "if test -e ${devtype} " \
  410. "${devnum}:${distro_bootpart} " \
  411. "${prefix}${boot_syslinux_conf}; then " \
  412. "echo Found ${prefix}${boot_syslinux_conf}; " \
  413. "run boot_extlinux; " \
  414. "echo SCRIPT FAILED: continuing...; " \
  415. "fi\0" \
  416. \
  417. "boot_a_script=" \
  418. "load ${devtype} ${devnum}:${distro_bootpart} " \
  419. "${scriptaddr} ${prefix}${script}; " \
  420. "source ${scriptaddr}\0" \
  421. \
  422. "scan_dev_for_scripts=" \
  423. "for script in ${boot_scripts}; do " \
  424. "if test -e ${devtype} " \
  425. "${devnum}:${distro_bootpart} " \
  426. "${prefix}${script}; then " \
  427. "echo Found U-Boot script " \
  428. "${prefix}${script}; " \
  429. "run boot_a_script; " \
  430. "echo SCRIPT FAILED: continuing...; " \
  431. "fi; " \
  432. "done\0" \
  433. \
  434. "scan_dev_for_boot=" \
  435. "echo Scanning ${devtype} " \
  436. "${devnum}:${distro_bootpart}...; " \
  437. "for prefix in ${boot_prefixes}; do " \
  438. "run scan_dev_for_extlinux; " \
  439. "run scan_dev_for_scripts; " \
  440. "done;" \
  441. SCAN_DEV_FOR_EFI \
  442. "\0" \
  443. \
  444. "scan_dev_for_boot_part=" \
  445. "part list ${devtype} ${devnum} -bootable devplist; " \
  446. "env exists devplist || setenv devplist 1; " \
  447. "for distro_bootpart in ${devplist}; do " \
  448. "if fstype ${devtype} " \
  449. "${devnum}:${distro_bootpart} " \
  450. "bootfstype; then " \
  451. "run scan_dev_for_boot; " \
  452. "fi; " \
  453. "done; " \
  454. "setenv devplist\0" \
  455. \
  456. BOOT_TARGET_DEVICES(BOOTENV_DEV) \
  457. \
  458. "distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \
  459. BOOTENV_SET_NVME_NEED_INIT \
  460. BOOTENV_SET_IDE_NEED_INIT \
  461. BOOTENV_SET_VIRTIO_NEED_INIT \
  462. "for target in ${boot_targets}; do " \
  463. "run bootcmd_${target}; " \
  464. "done\0"
  465. #ifndef CONFIG_BOOTCOMMAND
  466. #define CONFIG_BOOTCOMMAND "run distro_bootcmd"
  467. #endif
  468. #endif /* _CONFIG_CMD_DISTRO_BOOTCMD_H */