1
/* init.c - generic EFI initialization and finalization */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2006 Free Software Foundation, Inc.
6
* This program 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 2 of the License, or
9
* (at your option) any later version.
11
* This program 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 this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
#include <grub/efi/efi.h>
23
#include <grub/efi/console.h>
24
#include <grub/efi/disk.h>
25
#include <grub/term.h>
26
#include <grub/misc.h>
29
#include <grub/machine/kernel.h>
34
/* First of all, initialize the console so that GRUB can display
38
/* Initialize the memory management system. */
45
grub_efi_set_prefix (void)
47
grub_efi_loaded_image_t *image;
49
image = grub_efi_get_loaded_image (grub_efi_image_handle);
55
device = grub_efidisk_get_device_name (image->device_handle);
56
file = grub_efi_get_filename (image->file_path);
63
/* Get the directory. */
64
p = grub_strrchr (file, '/');
68
prefix = grub_malloc (1 + grub_strlen (device) + 1
69
+ grub_strlen (file) + 1);
72
grub_sprintf (prefix, "(%s)%s", device, file);
73
grub_env_set ("prefix", prefix);