/* main.c - the kernel main routine */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2006,2008,2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* This is actualy platform-independant but used only on loongson and sparc. */
#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_SPARC64)
grub_modules_get_end (void)
{
/* Check if there are any modules. */
return grub_modbase;
}
#endif
/* Load all modules in core. */
static void
grub_load_modules (void)
{
{
/* Not an ELF module, skip. */
continue;
if (grub_errno)
grub_print_error ();
}
}
static void
grub_load_config (void)
{
{
/* Not an embedded config, skip. */
continue;
grub_parser_execute ((char *) header +
sizeof (struct grub_module_header));
break;
}
}
/* Write hook for the environment variables of root. Remove surrounding
parentheses, if any. */
static char *
const char *val)
{
/* XXX Is it better to check the existence of the device? */
return grub_strdup (val);
}
static void
grub_set_prefix_and_root (void)
{
if (prefix)
{
if (prefix[0] == '(')
{
if (pptr)
{
pptr++;
}
}
if (!pptr)
if (pptr[0])
}
#if 0
/* Commented this out because we always want network interfaces
* plumbed, even when we have a prefix on memdisk. We could check
* if the devicename is actually memdisk and only do this then, but
* there does not appear to be any harm in doing it unconditionally
*/
#endif
{
/* We have a partition, but still need to fill in the drive. */
if (comma)
{
}
else
device = new_device;
}
if (device)
{
char *prefix_set;
if (prefix_set)
{
}
if (fwdevice)
else
}
grub_print_error ();
}
/* Load the normal mode module and execute the normal mode if possible. */
static void
grub_load_normal_mode (void)
{
/* Load the module. */
grub_dl_load ("normal");
/* Print errors if any. */
grub_print_error ();
grub_errno = 0;
grub_command_execute ("normal", 0, 0);
}
/* The main routine. */
void __attribute__ ((noreturn))
grub_main (void)
{
/* First of all, initialize the machine. */
/* Hello. */
grub_printf ("Welcome to GRUB!\n\n");
/* Load pre-loaded modules and free the space. */
#ifdef GRUB_LINKER_HAVE_INIT
#endif
/* It is better to set the root device as soon as possible,
for convenience. */
grub_env_export ("root");
grub_env_export ("prefix");
grub_load_config ();
grub_rescue_run ();
}