2002-12-27 08:53:07 +00:00
|
|
|
/*
|
2004-04-04 13:46:03 +00:00
|
|
|
* GRUB -- GRand Unified Bootloader
|
2010-01-01 20:32:30 +00:00
|
|
|
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
2002-12-27 08:53:07 +00:00
|
|
|
*
|
2007-07-21 23:32:33 +00:00
|
|
|
* GRUB is free software: you can redistribute it and/or modify
|
2002-12-27 08:53:07 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-21 23:32:33 +00:00
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
2002-12-27 08:53:07 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2007-07-21 23:32:33 +00:00
|
|
|
* GRUB is distributed in the hope that it will be useful,
|
2002-12-27 08:53:07 +00:00
|
|
|
* 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
|
2007-07-21 23:32:33 +00:00
|
|
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
2002-12-27 08:53:07 +00:00
|
|
|
*/
|
|
|
|
|
2006-06-13 22:50:01 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2009-11-08 00:49:15 +00:00
|
|
|
#include <errno.h>
|
2009-07-01 13:01:33 +00:00
|
|
|
#include <setjmp.h>
|
2002-12-27 08:53:07 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
2009-11-08 00:49:15 +00:00
|
|
|
#include <stdint.h>
|
2002-12-27 08:53:07 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2005-02-27 21:19:06 +00:00
|
|
|
#include <sys/time.h>
|
2005-01-04 14:01:45 +00:00
|
|
|
#include <unistd.h>
|
2009-03-04 10:25:31 +00:00
|
|
|
#include <time.h>
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2008-04-06 17:51:56 +00:00
|
|
|
#include <grub/kernel.h>
|
2010-02-07 16:52:11 +00:00
|
|
|
#include <grub/dl.h>
|
2008-04-06 17:51:56 +00:00
|
|
|
#include <grub/misc.h>
|
|
|
|
#include <grub/cache.h>
|
2010-05-06 06:04:04 +00:00
|
|
|
#include <grub/emu/misc.h>
|
2004-04-04 13:46:03 +00:00
|
|
|
#include <grub/util/misc.h>
|
|
|
|
#include <grub/mm.h>
|
|
|
|
#include <grub/term.h>
|
2008-08-07 23:48:13 +00:00
|
|
|
#include <grub/time.h>
|
2010-01-01 20:32:30 +00:00
|
|
|
#include <grub/i18n.h>
|
2010-05-06 06:04:04 +00:00
|
|
|
#include <grub/script_sh.h>
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2010-02-07 01:37:48 +00:00
|
|
|
#define ENABLE_RELOCATABLE 0
|
2009-11-25 23:10:02 +00:00
|
|
|
#include "progname.h"
|
|
|
|
|
2006-06-13 22:50:01 +00:00
|
|
|
/* Include malloc.h, only if memalign is available. It is known that
|
|
|
|
memalign is declared in malloc.h in all systems, if present. */
|
|
|
|
#ifdef HAVE_MEMALIGN
|
|
|
|
# include <malloc.h>
|
|
|
|
#endif
|
|
|
|
|
2009-03-21 07:48:28 +00:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winioctl.h>
|
|
|
|
#endif
|
|
|
|
|
2010-02-07 03:23:44 +00:00
|
|
|
#ifdef GRUB_UTIL
|
2008-08-14 18:46:47 +00:00
|
|
|
int
|
|
|
|
grub_err_printf (const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
int ret;
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2008-08-14 18:46:47 +00:00
|
|
|
va_start (ap, fmt);
|
|
|
|
ret = vfprintf (stderr, fmt, ap);
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2010-02-07 03:23:44 +00:00
|
|
|
#endif
|
2008-08-14 18:46:47 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
char *
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_get_path (const char *dir, const char *file)
|
2002-12-27 08:53:07 +00:00
|
|
|
{
|
|
|
|
char *path;
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
path = (char *) xmalloc (strlen (dir) + 1 + strlen (file) + 1);
|
|
|
|
sprintf (path, "%s/%s", dir, file);
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
2005-01-04 14:01:45 +00:00
|
|
|
size_t
|
|
|
|
grub_util_get_fp_size (FILE *fp)
|
|
|
|
{
|
|
|
|
struct stat st;
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2005-01-04 14:01:45 +00:00
|
|
|
if (fflush (fp) == EOF)
|
|
|
|
grub_util_error ("fflush failed");
|
|
|
|
|
|
|
|
if (fstat (fileno (fp), &st) == -1)
|
|
|
|
grub_util_error ("fstat failed");
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2005-01-04 14:01:45 +00:00
|
|
|
return st.st_size;
|
|
|
|
}
|
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
size_t
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_get_image_size (const char *path)
|
2002-12-27 08:53:07 +00:00
|
|
|
{
|
|
|
|
struct stat st;
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_info ("getting the size of %s", path);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
if (stat (path, &st) == -1)
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_error ("cannot stat %s", path);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
return st.st_size;
|
|
|
|
}
|
|
|
|
|
2005-01-04 14:01:45 +00:00
|
|
|
void
|
|
|
|
grub_util_read_at (void *img, size_t size, off_t offset, FILE *fp)
|
|
|
|
{
|
2008-04-02 01:49:18 +00:00
|
|
|
if (fseeko (fp, offset, SEEK_SET) == -1)
|
|
|
|
grub_util_error ("seek failed");
|
2005-01-04 14:01:45 +00:00
|
|
|
|
|
|
|
if (fread (img, 1, size, fp) != size)
|
|
|
|
grub_util_error ("read failed");
|
|
|
|
}
|
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
char *
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_read_image (const char *path)
|
2002-12-27 08:53:07 +00:00
|
|
|
{
|
|
|
|
char *img;
|
|
|
|
FILE *fp;
|
|
|
|
size_t size;
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_info ("reading %s", path);
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
size = grub_util_get_image_size (path);
|
2002-12-27 08:53:07 +00:00
|
|
|
img = (char *) xmalloc (size);
|
|
|
|
|
|
|
|
fp = fopen (path, "rb");
|
|
|
|
if (! fp)
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_error ("cannot open %s", path);
|
2005-01-04 14:01:45 +00:00
|
|
|
|
|
|
|
grub_util_read_at (img, size, 0, fp);
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2003-01-31 03:26:56 +00:00
|
|
|
fclose (fp);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
return img;
|
|
|
|
}
|
|
|
|
|
2003-01-31 03:26:56 +00:00
|
|
|
void
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_load_image (const char *path, char *buf)
|
2003-01-31 03:26:56 +00:00
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
size_t size;
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_info ("reading %s", path);
|
2003-01-31 03:26:56 +00:00
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
size = grub_util_get_image_size (path);
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2003-01-31 03:26:56 +00:00
|
|
|
fp = fopen (path, "rb");
|
|
|
|
if (! fp)
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_error ("cannot open %s", path);
|
2003-01-31 03:26:56 +00:00
|
|
|
|
|
|
|
if (fread (buf, 1, size, fp) != size)
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_error ("cannot read %s", path);
|
2003-01-31 03:26:56 +00:00
|
|
|
|
|
|
|
fclose (fp);
|
|
|
|
}
|
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
void
|
2005-01-04 14:01:45 +00:00
|
|
|
grub_util_write_image_at (const void *img, size_t size, off_t offset, FILE *out)
|
2002-12-27 08:53:07 +00:00
|
|
|
{
|
2005-01-04 14:01:45 +00:00
|
|
|
grub_util_info ("writing 0x%x bytes at offset 0x%x", size, offset);
|
2008-04-02 01:49:18 +00:00
|
|
|
if (fseeko (out, offset, SEEK_SET) == -1)
|
2005-01-04 14:01:45 +00:00
|
|
|
grub_util_error ("seek failed");
|
2002-12-27 08:53:07 +00:00
|
|
|
if (fwrite (img, 1, size, out) != size)
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_util_error ("write failed");
|
2002-12-27 08:53:07 +00:00
|
|
|
}
|
|
|
|
|
2005-01-04 14:01:45 +00:00
|
|
|
void
|
|
|
|
grub_util_write_image (const char *img, size_t size, FILE *out)
|
|
|
|
{
|
2005-01-05 13:33:16 +00:00
|
|
|
grub_util_info ("writing 0x%x bytes", size);
|
|
|
|
if (fwrite (img, 1, size, out) != size)
|
|
|
|
grub_util_error ("write failed");
|
2005-01-04 14:01:45 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
char *
|
|
|
|
grub_script_execute_argument_to_string (struct grub_script_arg *arg __attribute__ ((unused)))
|
2003-01-02 20:12:33 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
return 0;
|
2003-01-02 20:12:33 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_err_t
|
|
|
|
grub_script_execute_cmdline (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
2003-01-02 20:12:33 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
return 0;
|
2003-11-17 18:07:09 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_err_t
|
|
|
|
grub_script_execute_cmdblock (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
2003-11-17 18:07:09 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
return 0;
|
2003-01-02 20:12:33 +00:00
|
|
|
}
|
2003-11-12 20:33:52 +00:00
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_err_t
|
|
|
|
grub_script_execute_cmdif (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
2003-11-12 20:33:52 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2003-11-12 20:33:52 +00:00
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_err_t
|
|
|
|
grub_script_execute_cmdfor (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_err_t
|
|
|
|
grub_script_execute_cmdwhile (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
|
|
|
{
|
|
|
|
return 0;
|
2003-11-12 20:33:52 +00:00
|
|
|
}
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_err_t
|
|
|
|
grub_script_execute_menuentry (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
2008-08-07 23:48:13 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2008-08-07 23:48:13 +00:00
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_err_t
|
|
|
|
grub_script_execute (struct grub_script *script)
|
|
|
|
{
|
|
|
|
if (script == 0 || script->cmd == 0)
|
|
|
|
return 0;
|
2009-06-10 21:04:23 +00:00
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
return script->cmd->exec (script->cmd);
|
2008-08-07 23:48:13 +00:00
|
|
|
}
|
|
|
|
|
2009-03-21 07:48:28 +00:00
|
|
|
void
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_putchar (int c)
|
2009-03-21 07:48:28 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
putchar (c);
|
2009-03-21 07:48:28 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
int
|
|
|
|
grub_getkey (void)
|
2009-03-04 10:25:31 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
return -1;
|
2009-03-04 10:25:31 +00:00
|
|
|
}
|
|
|
|
|
2009-06-10 21:04:23 +00:00
|
|
|
void
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_refresh (void)
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
fflush (stdout);
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
}
|
2008-08-29 19:55:23 +00:00
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
int
|
|
|
|
grub_dl_ref (grub_dl_t mod)
|
|
|
|
{
|
|
|
|
(void) mod;
|
|
|
|
return 0;
|
|
|
|
}
|
2009-12-07 16:46:24 +00:00
|
|
|
|
|
|
|
int
|
2010-05-06 06:04:04 +00:00
|
|
|
grub_dl_unref (grub_dl_t mod)
|
2009-12-07 16:46:24 +00:00
|
|
|
{
|
2010-05-06 06:04:04 +00:00
|
|
|
(void) mod;
|
|
|
|
return 0;
|
|
|
|
}
|
2009-12-07 16:46:24 +00:00
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
/* Some functions that we don't use. */
|
|
|
|
void
|
|
|
|
grub_mm_init_region (void *addr __attribute__ ((unused)),
|
|
|
|
grub_size_t size __attribute__ ((unused)))
|
|
|
|
{
|
2009-12-07 16:46:24 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 06:04:04 +00:00
|
|
|
void
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_register_exported_symbols (void)
|
2010-05-06 06:04:04 +00:00
|
|
|
{
|
|
|
|
}
|
2009-12-07 16:46:24 +00:00
|
|
|
|
2009-03-21 07:48:28 +00:00
|
|
|
#ifdef __MINGW32__
|
2008-08-29 19:55:23 +00:00
|
|
|
|
2009-03-21 07:48:28 +00:00
|
|
|
void
|
|
|
|
grub_millisleep (grub_uint32_t ms)
|
2008-08-29 19:55:23 +00:00
|
|
|
{
|
2009-03-21 07:48:28 +00:00
|
|
|
Sleep (ms);
|
|
|
|
}
|
2008-08-29 19:55:23 +00:00
|
|
|
|
2009-03-21 07:48:28 +00:00
|
|
|
#else
|
2008-08-29 19:55:23 +00:00
|
|
|
|
2009-03-04 10:25:31 +00:00
|
|
|
void
|
|
|
|
grub_millisleep (grub_uint32_t ms)
|
|
|
|
{
|
|
|
|
struct timespec ts;
|
|
|
|
|
|
|
|
ts.tv_sec = ms / 1000;
|
|
|
|
ts.tv_nsec = (ms % 1000) * 1000000;
|
|
|
|
nanosleep (&ts, NULL);
|
2008-08-29 19:55:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
|
|
|
|
void sync (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-04-04 07:42:13 +00:00
|
|
|
int fsync (int fno __attribute__ ((unused)))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-29 19:55:23 +00:00
|
|
|
void sleep (int s)
|
|
|
|
{
|
|
|
|
Sleep (s * 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
grub_int64_t
|
|
|
|
grub_util_get_disk_size (char *name)
|
|
|
|
{
|
|
|
|
HANDLE hd;
|
|
|
|
grub_int64_t size = -1LL;
|
|
|
|
|
|
|
|
hd = CreateFile (name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|
|
|
0, OPEN_EXISTING, 0, 0);
|
|
|
|
|
|
|
|
if (hd == INVALID_HANDLE_VALUE)
|
|
|
|
return size;
|
|
|
|
|
|
|
|
if (((name[0] == '/') || (name[0] == '\\')) &&
|
|
|
|
((name[1] == '/') || (name[1] == '\\')) &&
|
|
|
|
(name[2] == '.') &&
|
|
|
|
((name[3] == '/') || (name[3] == '\\')) &&
|
|
|
|
(! strncasecmp (name + 4, "PHYSICALDRIVE", 13)))
|
|
|
|
{
|
|
|
|
DWORD nr;
|
|
|
|
DISK_GEOMETRY g;
|
|
|
|
|
|
|
|
if (! DeviceIoControl (hd, IOCTL_DISK_GET_DRIVE_GEOMETRY,
|
|
|
|
0, 0, &g, sizeof (g), &nr, 0))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
size = g.Cylinders.QuadPart;
|
|
|
|
size *= g.TracksPerCylinder * g.SectorsPerTrack * g.BytesPerSector;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LARGE_INTEGER s;
|
|
|
|
|
|
|
|
s.LowPart = GetFileSize (hd, &s.HighPart);
|
|
|
|
size = s.QuadPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
fail:
|
|
|
|
|
|
|
|
CloseHandle (hd);
|
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2009-07-01 13:01:33 +00:00
|
|
|
#endif /* __MINGW32__ */
|
2009-11-08 00:49:15 +00:00
|
|
|
|
2010-02-07 03:23:44 +00:00
|
|
|
#ifdef GRUB_UTIL
|
2010-01-01 20:32:30 +00:00
|
|
|
void
|
|
|
|
grub_util_init_nls (void)
|
|
|
|
{
|
2010-03-27 11:19:32 +00:00
|
|
|
#if (defined(ENABLE_NLS) && ENABLE_NLS)
|
2010-01-01 20:32:30 +00:00
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
|
|
textdomain (PACKAGE);
|
2010-03-27 11:19:32 +00:00
|
|
|
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
|
2010-01-01 20:32:30 +00:00
|
|
|
}
|
2010-02-07 03:23:44 +00:00
|
|
|
#endif
|