bootefi.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * EFI application loader
  4. *
  5. * Copyright (c) 2016 Alexander Graf
  6. */
  7. #define LOG_CATEGORY LOGC_EFI
  8. #include <common.h>
  9. #include <bootm.h>
  10. #include <charset.h>
  11. #include <command.h>
  12. #include <dm.h>
  13. #include <efi_loader.h>
  14. #include <efi_selftest.h>
  15. #include <env.h>
  16. #include <errno.h>
  17. #include <image.h>
  18. #include <log.h>
  19. #include <malloc.h>
  20. #include <linux/libfdt.h>
  21. #include <linux/libfdt_env.h>
  22. #include <mapmem.h>
  23. #include <memalign.h>
  24. #include <asm-generic/sections.h>
  25. #include <linux/linkage.h>
  26. DECLARE_GLOBAL_DATA_PTR;
  27. static struct efi_device_path *bootefi_image_path;
  28. static struct efi_device_path *bootefi_device_path;
  29. static void *image_addr;
  30. static size_t image_size;
  31. /**
  32. * efi_clear_bootdev() - clear boot device
  33. */
  34. static void efi_clear_bootdev(void)
  35. {
  36. efi_free_pool(bootefi_device_path);
  37. efi_free_pool(bootefi_image_path);
  38. bootefi_device_path = NULL;
  39. bootefi_image_path = NULL;
  40. image_addr = NULL;
  41. image_size = 0;
  42. }
  43. /**
  44. * efi_set_bootdev() - set boot device
  45. *
  46. * This function is called when a file is loaded, e.g. via the 'load' command.
  47. * We use the path to this file to inform the UEFI binary about the boot device.
  48. *
  49. * @dev: device, e.g. "MMC"
  50. * @devnr: number of the device, e.g. "1:2"
  51. * @path: path to file loaded
  52. * @buffer: buffer with file loaded
  53. * @buffer_size: size of file loaded
  54. */
  55. void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
  56. void *buffer, size_t buffer_size)
  57. {
  58. struct efi_device_path *device, *image;
  59. efi_status_t ret;
  60. /* Forget overwritten image */
  61. if (buffer + buffer_size >= image_addr &&
  62. image_addr + image_size >= buffer)
  63. efi_clear_bootdev();
  64. /* Remember only PE-COFF and FIT images */
  65. if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) {
  66. #ifdef CONFIG_FIT
  67. if (!fit_check_format(buffer))
  68. return;
  69. /*
  70. * FIT images of type EFI_OS are started via command bootm.
  71. * We should not use their boot device with the bootefi command.
  72. */
  73. buffer = 0;
  74. buffer_size = 0;
  75. #else
  76. return;
  77. #endif
  78. }
  79. /* efi_set_bootdev() is typically called repeatedly, recover memory */
  80. efi_clear_bootdev();
  81. image_addr = buffer;
  82. image_size = buffer_size;
  83. ret = efi_dp_from_name(dev, devnr, path, &device, &image);
  84. if (ret == EFI_SUCCESS) {
  85. bootefi_device_path = device;
  86. if (image) {
  87. /* FIXME: image should not contain device */
  88. struct efi_device_path *image_tmp = image;
  89. efi_dp_split_file_path(image, &device, &image);
  90. efi_free_pool(image_tmp);
  91. }
  92. bootefi_image_path = image;
  93. } else {
  94. efi_clear_bootdev();
  95. }
  96. }
  97. /**
  98. * efi_env_set_load_options() - set load options from environment variable
  99. *
  100. * @handle: the image handle
  101. * @env_var: name of the environment variable
  102. * @load_options: pointer to load options (output)
  103. * Return: status code
  104. */
  105. static efi_status_t efi_env_set_load_options(efi_handle_t handle,
  106. const char *env_var,
  107. u16 **load_options)
  108. {
  109. const char *env = env_get(env_var);
  110. size_t size;
  111. u16 *pos;
  112. efi_status_t ret;
  113. *load_options = NULL;
  114. if (!env)
  115. return EFI_SUCCESS;
  116. size = sizeof(u16) * (utf8_utf16_strlen(env) + 1);
  117. pos = calloc(size, 1);
  118. if (!pos)
  119. return EFI_OUT_OF_RESOURCES;
  120. *load_options = pos;
  121. utf8_utf16_strcpy(&pos, env);
  122. ret = efi_set_load_options(handle, size, *load_options);
  123. if (ret != EFI_SUCCESS) {
  124. free(*load_options);
  125. *load_options = NULL;
  126. }
  127. return ret;
  128. }
  129. #if !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
  130. /**
  131. * copy_fdt() - Copy the device tree to a new location available to EFI
  132. *
  133. * The FDT is copied to a suitable location within the EFI memory map.
  134. * Additional 12 KiB are added to the space in case the device tree needs to be
  135. * expanded later with fdt_open_into().
  136. *
  137. * @fdtp: On entry a pointer to the flattened device tree.
  138. * On exit a pointer to the copy of the flattened device tree.
  139. * FDT start
  140. * Return: status code
  141. */
  142. static efi_status_t copy_fdt(void **fdtp)
  143. {
  144. unsigned long fdt_ram_start = -1L, fdt_pages;
  145. efi_status_t ret = 0;
  146. void *fdt, *new_fdt;
  147. u64 new_fdt_addr;
  148. uint fdt_size;
  149. int i;
  150. for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
  151. u64 ram_start = gd->bd->bi_dram[i].start;
  152. u64 ram_size = gd->bd->bi_dram[i].size;
  153. if (!ram_size)
  154. continue;
  155. if (ram_start < fdt_ram_start)
  156. fdt_ram_start = ram_start;
  157. }
  158. /*
  159. * Give us at least 12 KiB of breathing room in case the device tree
  160. * needs to be expanded later.
  161. */
  162. fdt = *fdtp;
  163. fdt_pages = efi_size_in_pages(fdt_totalsize(fdt) + 0x3000);
  164. fdt_size = fdt_pages << EFI_PAGE_SHIFT;
  165. /*
  166. * Safe fdt location is at 127 MiB.
  167. * On the sandbox convert from the sandbox address space.
  168. */
  169. new_fdt_addr = (uintptr_t)map_sysmem(fdt_ram_start + 0x7f00000 +
  170. fdt_size, 0);
  171. ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
  172. EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
  173. &new_fdt_addr);
  174. if (ret != EFI_SUCCESS) {
  175. /* If we can't put it there, put it somewhere */
  176. new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size);
  177. ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
  178. EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
  179. &new_fdt_addr);
  180. if (ret != EFI_SUCCESS) {
  181. log_err("ERROR: Failed to reserve space for FDT\n");
  182. goto done;
  183. }
  184. }
  185. new_fdt = (void *)(uintptr_t)new_fdt_addr;
  186. memcpy(new_fdt, fdt, fdt_totalsize(fdt));
  187. fdt_set_totalsize(new_fdt, fdt_size);
  188. *fdtp = (void *)(uintptr_t)new_fdt_addr;
  189. done:
  190. return ret;
  191. }
  192. /**
  193. * get_config_table() - get configuration table
  194. *
  195. * @guid: GUID of the configuration table
  196. * Return: pointer to configuration table or NULL
  197. */
  198. static void *get_config_table(const efi_guid_t *guid)
  199. {
  200. size_t i;
  201. for (i = 0; i < systab.nr_tables; i++) {
  202. if (!guidcmp(guid, &systab.tables[i].guid))
  203. return systab.tables[i].table;
  204. }
  205. return NULL;
  206. }
  207. #endif /* !CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) */
  208. /**
  209. * efi_install_fdt() - install device tree
  210. *
  211. * If fdt is not EFI_FDT_USE_INTERNAL, the device tree located at that memory
  212. * address will will be installed as configuration table, otherwise the device
  213. * tree located at the address indicated by environment variable fdt_addr or as
  214. * fallback fdtcontroladdr will be used.
  215. *
  216. * On architectures using ACPI tables device trees shall not be installed as
  217. * configuration table.
  218. *
  219. * @fdt: address of device tree or EFI_FDT_USE_INTERNAL to use the
  220. * the hardware device tree as indicated by environment variable
  221. * fdt_addr or as fallback the internal device tree as indicated by
  222. * the environment variable fdtcontroladdr
  223. * Return: status code
  224. */
  225. efi_status_t efi_install_fdt(void *fdt)
  226. {
  227. /*
  228. * The EBBR spec requires that we have either an FDT or an ACPI table
  229. * but not both.
  230. */
  231. #if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
  232. if (fdt) {
  233. log_err("ERROR: can't have ACPI table and device tree.\n");
  234. return EFI_LOAD_ERROR;
  235. }
  236. #else
  237. bootm_headers_t img = { 0 };
  238. efi_status_t ret;
  239. if (fdt == EFI_FDT_USE_INTERNAL) {
  240. const char *fdt_opt;
  241. uintptr_t fdt_addr;
  242. /* Look for device tree that is already installed */
  243. if (get_config_table(&efi_guid_fdt))
  244. return EFI_SUCCESS;
  245. /* Check if there is a hardware device tree */
  246. fdt_opt = env_get("fdt_addr");
  247. /* Use our own device tree as fallback */
  248. if (!fdt_opt) {
  249. fdt_opt = env_get("fdtcontroladdr");
  250. if (!fdt_opt) {
  251. log_err("ERROR: need device tree\n");
  252. return EFI_NOT_FOUND;
  253. }
  254. }
  255. fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
  256. if (!fdt_addr) {
  257. log_err("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
  258. return EFI_LOAD_ERROR;
  259. }
  260. fdt = map_sysmem(fdt_addr, 0);
  261. }
  262. /* Install device tree */
  263. if (fdt_check_header(fdt)) {
  264. log_err("ERROR: invalid device tree\n");
  265. return EFI_LOAD_ERROR;
  266. }
  267. /* Prepare device tree for payload */
  268. ret = copy_fdt(&fdt);
  269. if (ret) {
  270. log_err("ERROR: out of memory\n");
  271. return EFI_OUT_OF_RESOURCES;
  272. }
  273. if (image_setup_libfdt(&img, fdt, 0, NULL)) {
  274. log_err("ERROR: failed to process device tree\n");
  275. return EFI_LOAD_ERROR;
  276. }
  277. /* Create memory reservations as indicated by the device tree */
  278. efi_carve_out_dt_rsv(fdt);
  279. /* Install device tree as UEFI table */
  280. ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
  281. if (ret != EFI_SUCCESS) {
  282. log_err("ERROR: failed to install device tree\n");
  283. return ret;
  284. }
  285. #endif /* GENERATE_ACPI_TABLE */
  286. return EFI_SUCCESS;
  287. }
  288. /**
  289. * do_bootefi_exec() - execute EFI binary
  290. *
  291. * The image indicated by @handle is started. When it returns the allocated
  292. * memory for the @load_options is freed.
  293. *
  294. * @handle: handle of loaded image
  295. * @load_options: load options
  296. * Return: status code
  297. *
  298. * Load the EFI binary into a newly assigned memory unwinding the relocation
  299. * information, install the loaded image protocol, and call the binary.
  300. */
  301. static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
  302. {
  303. efi_status_t ret;
  304. efi_uintn_t exit_data_size = 0;
  305. u16 *exit_data = NULL;
  306. /* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
  307. switch_to_non_secure_mode();
  308. /* Call our payload! */
  309. ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
  310. if (ret != EFI_SUCCESS) {
  311. log_err("## Application failed, r = %lu\n",
  312. ret & ~EFI_ERROR_MASK);
  313. if (exit_data) {
  314. log_err("## %ls\n", exit_data);
  315. efi_free_pool(exit_data);
  316. }
  317. }
  318. efi_restore_gd();
  319. free(load_options);
  320. return ret;
  321. }
  322. /**
  323. * do_efibootmgr() - execute EFI boot manager
  324. *
  325. * Return: status code
  326. */
  327. static int do_efibootmgr(void)
  328. {
  329. efi_handle_t handle;
  330. efi_status_t ret;
  331. void *load_options;
  332. ret = efi_bootmgr_load(&handle, &load_options);
  333. if (ret != EFI_SUCCESS) {
  334. log_notice("EFI boot manager: Cannot load any image\n");
  335. return CMD_RET_FAILURE;
  336. }
  337. ret = do_bootefi_exec(handle, load_options);
  338. if (ret != EFI_SUCCESS)
  339. return CMD_RET_FAILURE;
  340. return CMD_RET_SUCCESS;
  341. }
  342. /**
  343. * do_bootefi_image() - execute EFI binary
  344. *
  345. * Set up memory image for the binary to be loaded, prepare device path, and
  346. * then call do_bootefi_exec() to execute it.
  347. *
  348. * @image_opt: string of image start address
  349. * Return: status code
  350. */
  351. static int do_bootefi_image(const char *image_opt)
  352. {
  353. void *image_buf;
  354. unsigned long addr, size;
  355. efi_status_t ret;
  356. #ifdef CONFIG_CMD_BOOTEFI_HELLO
  357. if (!strcmp(image_opt, "hello")) {
  358. image_buf = __efi_helloworld_begin;
  359. size = __efi_helloworld_end - __efi_helloworld_begin;
  360. efi_clear_bootdev();
  361. } else
  362. #endif
  363. {
  364. addr = strtoul(image_opt, NULL, 16);
  365. /* Check that a numeric value was passed */
  366. if (!addr)
  367. return CMD_RET_USAGE;
  368. image_buf = map_sysmem(addr, 0);
  369. if (image_buf != image_addr) {
  370. log_err("No UEFI binary known at %s\n", image_opt);
  371. return CMD_RET_FAILURE;
  372. }
  373. size = image_size;
  374. }
  375. ret = efi_run_image(image_buf, size);
  376. if (ret != EFI_SUCCESS)
  377. return CMD_RET_FAILURE;
  378. return CMD_RET_SUCCESS;
  379. }
  380. /**
  381. * efi_run_image() - run loaded UEFI image
  382. *
  383. * @source_buffer: memory address of the UEFI image
  384. * @source_size: size of the UEFI image
  385. * Return: status code
  386. */
  387. efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
  388. {
  389. efi_handle_t mem_handle = NULL, handle;
  390. struct efi_device_path *file_path = NULL;
  391. struct efi_device_path *msg_path;
  392. efi_status_t ret;
  393. u16 *load_options;
  394. if (!bootefi_device_path || !bootefi_image_path) {
  395. /*
  396. * Special case for efi payload not loaded from disk,
  397. * such as 'bootefi hello' or for example payload
  398. * loaded directly into memory via JTAG, etc:
  399. */
  400. file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
  401. (uintptr_t)source_buffer,
  402. source_size);
  403. /*
  404. * Make sure that device for device_path exist
  405. * in load_image(). Otherwise, shell and grub will fail.
  406. */
  407. ret = efi_create_handle(&mem_handle);
  408. if (ret != EFI_SUCCESS)
  409. goto out;
  410. ret = efi_add_protocol(mem_handle, &efi_guid_device_path,
  411. file_path);
  412. if (ret != EFI_SUCCESS)
  413. goto out;
  414. msg_path = file_path;
  415. } else {
  416. file_path = efi_dp_append(bootefi_device_path,
  417. bootefi_image_path);
  418. msg_path = bootefi_image_path;
  419. }
  420. log_info("Booting %pD\n", msg_path);
  421. ret = EFI_CALL(efi_load_image(false, efi_root, file_path, source_buffer,
  422. source_size, &handle));
  423. if (ret != EFI_SUCCESS) {
  424. log_err("Loading image failed\n");
  425. goto out;
  426. }
  427. /* Transfer environment variable as load options */
  428. ret = efi_env_set_load_options(handle, "bootargs", &load_options);
  429. if (ret != EFI_SUCCESS)
  430. goto out;
  431. ret = do_bootefi_exec(handle, load_options);
  432. out:
  433. efi_delete_handle(mem_handle);
  434. efi_free_pool(file_path);
  435. return ret;
  436. }
  437. #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
  438. static efi_status_t bootefi_run_prepare(const char *load_options_path,
  439. struct efi_device_path *device_path,
  440. struct efi_device_path *image_path,
  441. struct efi_loaded_image_obj **image_objp,
  442. struct efi_loaded_image **loaded_image_infop)
  443. {
  444. efi_status_t ret;
  445. u16 *load_options;
  446. ret = efi_setup_loaded_image(device_path, image_path, image_objp,
  447. loaded_image_infop);
  448. if (ret != EFI_SUCCESS)
  449. return ret;
  450. /* Transfer environment variable as load options */
  451. return efi_env_set_load_options((efi_handle_t)*image_objp,
  452. load_options_path,
  453. &load_options);
  454. }
  455. /**
  456. * bootefi_test_prepare() - prepare to run an EFI test
  457. *
  458. * Prepare to run a test as if it were provided by a loaded image.
  459. *
  460. * @image_objp: pointer to be set to the loaded image handle
  461. * @loaded_image_infop: pointer to be set to the loaded image protocol
  462. * @path: dummy file path used to construct the device path
  463. * set in the loaded image protocol
  464. * @load_options_path: name of a U-Boot environment variable. Its value is
  465. * set as load options in the loaded image protocol.
  466. * Return: status code
  467. */
  468. static efi_status_t bootefi_test_prepare
  469. (struct efi_loaded_image_obj **image_objp,
  470. struct efi_loaded_image **loaded_image_infop, const char *path,
  471. const char *load_options_path)
  472. {
  473. efi_status_t ret;
  474. /* Construct a dummy device path */
  475. bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, 0, 0);
  476. if (!bootefi_device_path)
  477. return EFI_OUT_OF_RESOURCES;
  478. bootefi_image_path = efi_dp_from_file(NULL, 0, path);
  479. if (!bootefi_image_path) {
  480. ret = EFI_OUT_OF_RESOURCES;
  481. goto failure;
  482. }
  483. ret = bootefi_run_prepare(load_options_path, bootefi_device_path,
  484. bootefi_image_path, image_objp,
  485. loaded_image_infop);
  486. if (ret == EFI_SUCCESS)
  487. return ret;
  488. failure:
  489. efi_clear_bootdev();
  490. return ret;
  491. }
  492. /**
  493. * bootefi_run_finish() - finish up after running an EFI test
  494. *
  495. * @loaded_image_info: Pointer to a struct which holds the loaded image info
  496. * @image_obj: Pointer to a struct which holds the loaded image object
  497. */
  498. static void bootefi_run_finish(struct efi_loaded_image_obj *image_obj,
  499. struct efi_loaded_image *loaded_image_info)
  500. {
  501. efi_restore_gd();
  502. free(loaded_image_info->load_options);
  503. efi_delete_handle(&image_obj->header);
  504. }
  505. /**
  506. * do_efi_selftest() - execute EFI selftest
  507. *
  508. * Return: status code
  509. */
  510. static int do_efi_selftest(void)
  511. {
  512. struct efi_loaded_image_obj *image_obj;
  513. struct efi_loaded_image *loaded_image_info;
  514. efi_status_t ret;
  515. ret = bootefi_test_prepare(&image_obj, &loaded_image_info,
  516. "\\selftest", "efi_selftest");
  517. if (ret != EFI_SUCCESS)
  518. return CMD_RET_FAILURE;
  519. /* Execute the test */
  520. ret = EFI_CALL(efi_selftest(&image_obj->header, &systab));
  521. bootefi_run_finish(image_obj, loaded_image_info);
  522. return ret != EFI_SUCCESS;
  523. }
  524. #endif /* CONFIG_CMD_BOOTEFI_SELFTEST */
  525. /**
  526. * do_bootefi() - execute `bootefi` command
  527. *
  528. * @cmdtp: table entry describing command
  529. * @flag: bitmap indicating how the command was invoked
  530. * @argc: number of arguments
  531. * @argv: command line arguments
  532. * Return: status code
  533. */
  534. static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
  535. char *const argv[])
  536. {
  537. efi_status_t ret;
  538. void *fdt;
  539. if (argc < 2)
  540. return CMD_RET_USAGE;
  541. /* Initialize EFI drivers */
  542. ret = efi_init_obj_list();
  543. if (ret != EFI_SUCCESS) {
  544. log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
  545. ret & ~EFI_ERROR_MASK);
  546. return CMD_RET_FAILURE;
  547. }
  548. if (argc > 2) {
  549. uintptr_t fdt_addr;
  550. fdt_addr = simple_strtoul(argv[2], NULL, 16);
  551. fdt = map_sysmem(fdt_addr, 0);
  552. } else {
  553. fdt = EFI_FDT_USE_INTERNAL;
  554. }
  555. ret = efi_install_fdt(fdt);
  556. if (ret == EFI_INVALID_PARAMETER)
  557. return CMD_RET_USAGE;
  558. else if (ret != EFI_SUCCESS)
  559. return CMD_RET_FAILURE;
  560. if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) {
  561. if (!strcmp(argv[1], "bootmgr"))
  562. return do_efibootmgr();
  563. }
  564. #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
  565. if (!strcmp(argv[1], "selftest"))
  566. return do_efi_selftest();
  567. #endif
  568. return do_bootefi_image(argv[1]);
  569. }
  570. #ifdef CONFIG_SYS_LONGHELP
  571. static char bootefi_help_text[] =
  572. "<image address> [fdt address]\n"
  573. " - boot EFI payload stored at address <image address>.\n"
  574. " If specified, the device tree located at <fdt address> gets\n"
  575. " exposed as EFI configuration table.\n"
  576. #ifdef CONFIG_CMD_BOOTEFI_HELLO
  577. "bootefi hello\n"
  578. " - boot a sample Hello World application stored within U-Boot\n"
  579. #endif
  580. #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
  581. "bootefi selftest [fdt address]\n"
  582. " - boot an EFI selftest application stored within U-Boot\n"
  583. " Use environment variable efi_selftest to select a single test.\n"
  584. " Use 'setenv efi_selftest list' to enumerate all tests.\n"
  585. #endif
  586. #ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
  587. "bootefi bootmgr [fdt address]\n"
  588. " - load and boot EFI payload based on BootOrder/BootXXXX variables.\n"
  589. "\n"
  590. " If specified, the device tree located at <fdt address> gets\n"
  591. " exposed as EFI configuration table.\n"
  592. #endif
  593. ;
  594. #endif
  595. U_BOOT_CMD(
  596. bootefi, 3, 0, do_bootefi,
  597. "Boots an EFI payload from memory",
  598. bootefi_help_text
  599. );