2004-07-27 17:47:37 +00:00
|
|
|
|
/* linux.c - boot Linux */
|
|
|
|
|
/*
|
|
|
|
|
* GRUB -- GRand Unified Bootloader
|
2005-02-14 18:41:33 +00:00
|
|
|
|
* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
2004-07-27 17:47:37 +00:00
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <grub/elf.h>
|
|
|
|
|
#include <grub/loader.h>
|
|
|
|
|
#include <grub/dl.h>
|
|
|
|
|
#include <grub/mm.h>
|
|
|
|
|
#include <grub/rescue.h>
|
|
|
|
|
#include <grub/misc.h>
|
2005-08-03 22:53:51 +00:00
|
|
|
|
#include <grub/ieee1275/ieee1275.h>
|
|
|
|
|
#include <grub/machine/loader.h>
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
|
|
|
|
static grub_dl_t my_mod;
|
|
|
|
|
|
|
|
|
|
static int loaded;
|
|
|
|
|
static int vmlinux;
|
|
|
|
|
|
|
|
|
|
static grub_addr_t initrd_addr;
|
|
|
|
|
static grub_size_t initrd_size;
|
|
|
|
|
|
|
|
|
|
static grub_addr_t linux_addr;
|
|
|
|
|
static grub_size_t linux_size;
|
|
|
|
|
|
|
|
|
|
static char *linux_args;
|
|
|
|
|
|
2005-08-03 22:53:51 +00:00
|
|
|
|
typedef void (*kernel_entry_t) (void *, unsigned long, int (void *),
|
2004-07-27 17:47:37 +00:00
|
|
|
|
unsigned long, unsigned long);
|
|
|
|
|
|
|
|
|
|
static grub_err_t
|
|
|
|
|
grub_linux_boot (void)
|
|
|
|
|
{
|
|
|
|
|
kernel_entry_t linuxmain;
|
|
|
|
|
grub_size_t actual;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
/* Set the command line arguments. */
|
2005-06-21 02:33:52 +00:00
|
|
|
|
grub_ieee1275_set_property (grub_ieee1275_chosen, "bootargs", linux_args,
|
2004-07-27 17:47:37 +00:00
|
|
|
|
grub_strlen (linux_args) + 1, &actual);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
|
|
|
|
grub_dprintf ("loader", "Entry point: 0x%x\n", linux_addr);
|
|
|
|
|
grub_dprintf ("loader", "Initrd at: 0x%x, size 0x%x\n", initrd_addr,
|
|
|
|
|
initrd_size);
|
|
|
|
|
grub_dprintf ("loader", "Boot arguments: %s\n", linux_args);
|
|
|
|
|
grub_dprintf ("loader", "Jumping to Linux...\n");
|
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
/* Boot the kernel. */
|
|
|
|
|
linuxmain = (kernel_entry_t) linux_addr;
|
|
|
|
|
linuxmain ((void *) initrd_addr, initrd_size, grub_ieee1275_entry_fn, 0, 0);
|
|
|
|
|
|
|
|
|
|
return GRUB_ERR_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static grub_err_t
|
|
|
|
|
grub_linux_release_mem (void)
|
|
|
|
|
{
|
|
|
|
|
grub_free (linux_args);
|
|
|
|
|
linux_args = 0;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-10-03 09:19:10 +00:00
|
|
|
|
if (linux_addr && grub_ieee1275_release (linux_addr, linux_size))
|
2004-07-27 17:47:37 +00:00
|
|
|
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not release memory");
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
if (initrd_addr && grub_ieee1275_release (initrd_addr, initrd_size))
|
|
|
|
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not release memory");
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
linux_addr = 0;
|
2005-01-31 21:44:35 +00:00
|
|
|
|
initrd_addr = 0;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
return GRUB_ERR_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static grub_err_t
|
|
|
|
|
grub_linux_unload (void)
|
|
|
|
|
{
|
|
|
|
|
grub_err_t err;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
err = grub_linux_release_mem ();
|
|
|
|
|
grub_dl_unref (my_mod);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
loaded = 0;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2005-01-31 21:44:35 +00:00
|
|
|
|
grub_rescue_cmd_linux (int argc, char *argv[])
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
|
|
|
|
grub_file_t file = 0;
|
|
|
|
|
Elf32_Ehdr ehdr;
|
|
|
|
|
Elf32_Phdr *phdrs = 0;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
int i;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
int offset = 0;
|
2005-01-31 21:44:35 +00:00
|
|
|
|
grub_addr_t entry;
|
|
|
|
|
int found_addr = 0;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
int size;
|
2005-08-20 08:25:51 +00:00
|
|
|
|
char *dest;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
grub_dl_ref (my_mod);
|
|
|
|
|
|
|
|
|
|
if (argc == 0)
|
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
file = grub_file_open (argv[0]);
|
|
|
|
|
if (! file)
|
|
|
|
|
goto fail;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
if (grub_file_read (file, (char *) &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_READ_ERROR, "cannot read the linux elf header");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-02-14 18:41:33 +00:00
|
|
|
|
if (grub_dl_check_header (&ehdr, sizeof(ehdr)))
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_UNKNOWN_OS, "No valid ELF header found");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
if (ehdr.e_type != ET_EXEC)
|
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_UNKNOWN_OS,
|
|
|
|
|
"This ELF file is not of the right type\n");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the sections. */
|
|
|
|
|
entry = ehdr.e_entry;
|
|
|
|
|
if (entry == 0xc0000000)
|
|
|
|
|
{
|
|
|
|
|
entry = 0x01400000;
|
|
|
|
|
vmlinux = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
vmlinux = 0;
|
|
|
|
|
|
|
|
|
|
phdrs = (Elf32_Phdr *) grub_malloc (ehdr.e_phnum * ehdr.e_phentsize);
|
|
|
|
|
grub_file_read (file, (void *) phdrs, ehdr.e_phnum * ehdr.e_phentsize);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
/* Release the previously used memory. */
|
|
|
|
|
grub_loader_unset ();
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
/* Determine the amount of memory that is required. */
|
|
|
|
|
linux_size = 0;
|
|
|
|
|
for (i = 0; i < ehdr.e_phnum; i++)
|
|
|
|
|
{
|
|
|
|
|
Elf32_Phdr *phdr = phdrs + i;
|
|
|
|
|
/* XXX: Is this calculation correct? */
|
|
|
|
|
linux_size += phdr->p_memsz + phdr->p_filesz;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
/* Reserve memory for the kernel. */
|
|
|
|
|
linux_size += 0x100000;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
/* For some vmlinux kernels the address set above won't work. Just
|
|
|
|
|
try some other addresses just like yaboot does. */
|
|
|
|
|
for (linux_addr = entry; linux_addr < entry + 200 * 0x100000; linux_addr += 0x100000)
|
|
|
|
|
{
|
2005-11-23 04:25:16 +00:00
|
|
|
|
grub_dprintf ("loader", "Attempting to claim at 0x%x, size 0x%x.\n",
|
|
|
|
|
linux_addr, linux_size);
|
2005-01-31 21:44:35 +00:00
|
|
|
|
found_addr = grub_claimmap (linux_addr, linux_size);
|
|
|
|
|
if (found_addr != -1)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (found_addr == -1)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not claim memory");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-01-31 21:44:35 +00:00
|
|
|
|
entry = linux_addr;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
/* Load every loadable segment in memory. */
|
|
|
|
|
for (i = 0; i < ehdr.e_phnum; i++)
|
|
|
|
|
{
|
|
|
|
|
Elf32_Phdr *phdr = phdrs + i;
|
|
|
|
|
|
|
|
|
|
if (phdr->p_type == PT_LOAD)
|
|
|
|
|
{
|
2005-07-12 22:36:43 +00:00
|
|
|
|
void *segment_addr = ((char *) entry) + offset;
|
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
if (grub_file_seek (file, phdr->p_offset) == -1)
|
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_BAD_OS, "Invalid offset in program header");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
|
|
|
|
grub_dprintf ("loader", "Loading segment %d at %p, size 0x%x\n", i,
|
|
|
|
|
segment_addr, phdr->p_filesz);
|
|
|
|
|
|
|
|
|
|
if (grub_file_read (file, segment_addr, phdr->p_filesz)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
!= (grub_ssize_t) phdr->p_filesz)
|
|
|
|
|
goto fail;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
if (phdr->p_filesz < phdr->p_memsz)
|
2005-07-12 22:36:43 +00:00
|
|
|
|
grub_memset ((char *) (((char *) entry) + offset) + phdr->p_filesz, 0,
|
2004-07-27 17:47:37 +00:00
|
|
|
|
phdr->p_memsz - phdr->p_filesz);
|
|
|
|
|
|
|
|
|
|
offset += phdr->p_filesz;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-08-20 08:25:51 +00:00
|
|
|
|
size = sizeof ("BOOT_IMAGE=") + grub_strlen (argv[0]);
|
2004-07-27 17:47:37 +00:00
|
|
|
|
for (i = 0; i < argc; i++)
|
2005-08-20 08:25:51 +00:00
|
|
|
|
size += grub_strlen (argv[i]) + 1;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-08-20 08:25:51 +00:00
|
|
|
|
linux_args = grub_malloc (size);
|
|
|
|
|
if (! linux_args)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
goto fail;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-08-20 08:25:51 +00:00
|
|
|
|
/* Specify the boot file. */
|
|
|
|
|
dest = grub_stpcpy (linux_args, "BOOT_IMAGE=");
|
|
|
|
|
dest = grub_stpcpy (dest, argv[0]);
|
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
|
{
|
2005-08-20 08:25:51 +00:00
|
|
|
|
*dest++ = ' ';
|
|
|
|
|
dest = grub_stpcpy (dest, argv[i]);
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
fail:
|
|
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
|
grub_file_close (file);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
grub_free (phdrs);
|
|
|
|
|
|
|
|
|
|
if (grub_errno != GRUB_ERR_NONE)
|
|
|
|
|
{
|
|
|
|
|
grub_linux_release_mem ();
|
|
|
|
|
grub_dl_unref (my_mod);
|
|
|
|
|
loaded = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
grub_loader_set (grub_linux_boot, grub_linux_unload);
|
2005-06-21 02:33:52 +00:00
|
|
|
|
initrd_addr = 0;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
loaded = 1;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
void
|
|
|
|
|
grub_rescue_cmd_initrd (int argc, char *argv[])
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
2005-01-31 21:44:35 +00:00
|
|
|
|
grub_file_t file = 0;
|
|
|
|
|
grub_ssize_t size;
|
2005-11-23 04:25:16 +00:00
|
|
|
|
grub_addr_t first_addr;
|
2005-01-31 21:44:35 +00:00
|
|
|
|
grub_addr_t addr;
|
2005-11-23 04:25:16 +00:00
|
|
|
|
int found_addr = 0;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
if (argc == 0)
|
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_BAD_ARGUMENT, "no initrd specified");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
if (!loaded)
|
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
file = grub_file_open (argv[0]);
|
|
|
|
|
if (! file)
|
|
|
|
|
goto fail;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-11-23 04:25:16 +00:00
|
|
|
|
first_addr = linux_addr + linux_size;
|
2005-01-31 21:44:35 +00:00
|
|
|
|
size = grub_file_size (file);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-11-23 04:25:16 +00:00
|
|
|
|
/* Attempt to claim at a series of addresses until successful in
|
|
|
|
|
the same way that grub_rescue_cmd_linux does. */
|
|
|
|
|
for (addr = first_addr; addr < first_addr + 200 * 0x100000; addr += 0x100000)
|
|
|
|
|
{
|
|
|
|
|
grub_dprintf ("loader", "Attempting to claim at 0x%x, size 0x%x.\n",
|
|
|
|
|
addr, size);
|
|
|
|
|
found_addr = grub_claimmap (addr, size);
|
|
|
|
|
if (found_addr != -1)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (found_addr == -1)
|
2005-01-31 21:44:35 +00:00
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not claim memory");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
|
|
|
|
grub_dprintf ("loader", "Loading initrd at 0x%x, size 0x%x\n", addr, size);
|
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
if (grub_file_read (file, (void *) addr, size) != size)
|
|
|
|
|
{
|
|
|
|
|
grub_ieee1275_release (addr, size);
|
|
|
|
|
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
initrd_addr = addr;
|
|
|
|
|
initrd_size = size;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
fail:
|
|
|
|
|
if (file)
|
|
|
|
|
grub_file_close (file);
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
|
|
|
|
|
|
2005-11-13 Marco Gerards <mgerards@xs4all.nl>
* geninit.sh: New file.
* geninitheader.sh: Likewise.
* commands/boot.c (grub_boot_init, grub_boot_fini): Removed.
* commands/cat.c (grub_cat_init, grub_cat_fini): Likewise.
* commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise.
* commands/configfile.c (grub_configfile_init)
(grub_configfile_fini): Likewise.
* commands/default.c (grub_default_init, grub_default_fini):
Likewise.
* commands/help.c (grub_help_init, grub_help_fini): Likewise.
* commands/ls.c (grub_ls_init, grub_ls_fini): Likewise.
* commands/search.c (grub_search_init, grub_search_fini): Likewise.
* commands/terminal.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* commands/test.c (grub_test_init, grub_test_fini): Likewise.
* commands/timeout.c (grub_timeout_init, grub_timeout_fini):
Likewise.
* commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise.
* commands/iee1275/halt.c (grub_halt_init, grub_halt_fini):
Likewise.
* commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise.
* fs/affs.c (grub_affs_init, grub_affs_fini): Likewise.
* fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise.
* fs/fat.c (grub_fat_init, grub_fat_fini): Likewise.
* fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise.
* fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise.
* fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise.
* fs/minix.c (grub_minix_init, grub_minix_fini): Likewise.
* fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise.
* fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise.
* fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise.
* normal/main.c (grub_normal_init, grub_normal_fini): Likewise.
* partmap/amiga.c (grub_amiga_partition_map_init)
(grub_amiga_partition_map_fini): Likewise.
* partmap/apple.c (grub_apple_partition_map_init)
(grub_apple_partition_map_fini): Likewise.
* partmap/pc.c (grub_pc_partition_map_init)
(grub_pc_partition_map_fini): Likewise.
* partmap/sun.c (grub_sun_partition_map_init,
grub_sun_partition_map_fini): Likewise.
* term/terminfo.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* util/grub-emu.c: Include <grub_modules_init.h>.
(main): Don't initialize and de-initialize any modules directly,
use `grub_init_all' and `grub_fini_all' instead.
* term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to
`grub_vesafb_mod_init'.
(grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated
all users.
* term/i386/pc/vga.c (grub_vga_init): Renamed to
`grub_vga_mod_init'. Updated all users.
(grub_vga_fini): Renamed to `grub_vga_mod_fini'.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'.
(grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New
rules.
* include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'.
Generate a function to initialize the module in utilities.
Updated all callers.
(GRUB_MOD_FINI): Add argument `name'. Generate a function to
initialize the module in utilities. Updated all callers.
2005-11-13 15:47:09 +00:00
|
|
|
|
GRUB_MOD_INIT(linux)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
2005-01-31 21:44:35 +00:00
|
|
|
|
grub_rescue_register_command ("linux", grub_rescue_cmd_linux,
|
2004-07-27 17:47:37 +00:00
|
|
|
|
"load a linux kernel");
|
2005-01-31 21:44:35 +00:00
|
|
|
|
grub_rescue_register_command ("initrd", grub_rescue_cmd_initrd,
|
|
|
|
|
"load an initrd");
|
|
|
|
|
my_mod = mod;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-11-13 Marco Gerards <mgerards@xs4all.nl>
* geninit.sh: New file.
* geninitheader.sh: Likewise.
* commands/boot.c (grub_boot_init, grub_boot_fini): Removed.
* commands/cat.c (grub_cat_init, grub_cat_fini): Likewise.
* commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise.
* commands/configfile.c (grub_configfile_init)
(grub_configfile_fini): Likewise.
* commands/default.c (grub_default_init, grub_default_fini):
Likewise.
* commands/help.c (grub_help_init, grub_help_fini): Likewise.
* commands/ls.c (grub_ls_init, grub_ls_fini): Likewise.
* commands/search.c (grub_search_init, grub_search_fini): Likewise.
* commands/terminal.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* commands/test.c (grub_test_init, grub_test_fini): Likewise.
* commands/timeout.c (grub_timeout_init, grub_timeout_fini):
Likewise.
* commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise.
* commands/iee1275/halt.c (grub_halt_init, grub_halt_fini):
Likewise.
* commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise.
* fs/affs.c (grub_affs_init, grub_affs_fini): Likewise.
* fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise.
* fs/fat.c (grub_fat_init, grub_fat_fini): Likewise.
* fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise.
* fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise.
* fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise.
* fs/minix.c (grub_minix_init, grub_minix_fini): Likewise.
* fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise.
* fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise.
* fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise.
* normal/main.c (grub_normal_init, grub_normal_fini): Likewise.
* partmap/amiga.c (grub_amiga_partition_map_init)
(grub_amiga_partition_map_fini): Likewise.
* partmap/apple.c (grub_apple_partition_map_init)
(grub_apple_partition_map_fini): Likewise.
* partmap/pc.c (grub_pc_partition_map_init)
(grub_pc_partition_map_fini): Likewise.
* partmap/sun.c (grub_sun_partition_map_init,
grub_sun_partition_map_fini): Likewise.
* term/terminfo.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* util/grub-emu.c: Include <grub_modules_init.h>.
(main): Don't initialize and de-initialize any modules directly,
use `grub_init_all' and `grub_fini_all' instead.
* term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to
`grub_vesafb_mod_init'.
(grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated
all users.
* term/i386/pc/vga.c (grub_vga_init): Renamed to
`grub_vga_mod_init'. Updated all users.
(grub_vga_fini): Renamed to `grub_vga_mod_fini'.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'.
(grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New
rules.
* include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'.
Generate a function to initialize the module in utilities.
Updated all callers.
(GRUB_MOD_FINI): Add argument `name'. Generate a function to
initialize the module in utilities. Updated all callers.
2005-11-13 15:47:09 +00:00
|
|
|
|
GRUB_MOD_FINI(linux)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
|
|
|
|
grub_rescue_unregister_command ("linux");
|
2005-01-31 21:44:35 +00:00
|
|
|
|
grub_rescue_unregister_command ("initrd");
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|