bootefi.c 17 KB

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