bootefi.c 17 KB

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