1 /* init.c - generic EFI initialization and finalization */
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2006,2007 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #include <grub/efi/efi.h>
21 #include <grub/efi/console.h>
22 #include <grub/efi/disk.h>
23 #include <grub/term.h>
24 #include <grub/misc.h>
27 #include <grub/machine/kernel.h>
32 /* First of all, initialize the console so that GRUB can display
36 /* Initialize the memory management system. */
43 grub_efi_set_prefix (void)
45 grub_efi_loaded_image_t
*image
;
47 image
= grub_efi_get_loaded_image (grub_efi_image_handle
);
53 device
= grub_efidisk_get_device_name (image
->device_handle
);
54 file
= grub_efi_get_filename (image
->file_path
);
61 /* Get the directory. */
62 p
= grub_strrchr (file
, '/');
66 prefix
= grub_malloc (1 + grub_strlen (device
) + 1
67 + grub_strlen (file
) + 1);
70 grub_sprintf (prefix
, "(%s)%s", device
, file
);
71 grub_env_set ("prefix", prefix
);