source: grub-pc/trunk/fuentes/grub-core/kern/efi/init.c @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 2.0 KB
Line 
1/* init.c - generic EFI initialization and finalization */
2/*
3 *  GRUB  --  GRand Unified Bootloader
4 *  Copyright (C) 2006,2007  Free Software Foundation, Inc.
5 *
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.
10 *
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.
15 *
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/>.
18 */
19
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>
25#include <grub/env.h>
26#include <grub/mm.h>
27#include <grub/kernel.h>
28
29grub_addr_t grub_modbase;
30
31void
32grub_efi_init (void)
33{
34  grub_modbase = grub_efi_modules_addr ();
35  /* First of all, initialize the console so that GRUB can display
36     messages.  */
37  grub_console_init ();
38
39  /* Initialize the memory management system.  */
40  grub_efi_mm_init ();
41
42  efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer,
43              0, 0, 0, NULL);
44
45  grub_efidisk_init ();
46}
47
48void (*grub_efi_net_config) (grub_efi_handle_t hnd, 
49                             char **device,
50                             char **path);
51
52void
53grub_machine_get_bootlocation (char **device, char **path)
54{
55  grub_efi_loaded_image_t *image = NULL;
56  char *p;
57
58  image = grub_efi_get_loaded_image (grub_efi_image_handle);
59  if (!image)
60    return;
61  *device = grub_efidisk_get_device_name (image->device_handle);
62  *path = grub_efi_get_filename (image->file_path);
63  if (!*device && grub_efi_net_config)
64    grub_efi_net_config (image->device_handle, device, path);
65
66  /* Get the directory.  */
67  p = grub_strrchr (*path, '/');
68  if (p)
69    *p = '\0';
70}
71
72void
73grub_efi_fini (void)
74{
75  grub_efidisk_fini ();
76  grub_console_fini ();
77}
Note: See TracBrowser for help on using the repository browser.