merge mainline into net

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-10-05 13:32:40 +02:00
commit aa6b91afe9
68 changed files with 2264 additions and 747 deletions

372
ChangeLog
View file

@ -1,3 +1,375 @@
2011-10-01 Ales Nesrsta <starous@volny.cz>
* grub-core/bus/usb/uhci.c: Changes made by Rock Cui - thanks!
(fixed problem related to using UHCI with coreboot).
2011-08-25 BVK Chaitanya <bvk.groups@gmail.com>
* gentpl.py: Use Autogen macros so that the output template file
(Makefile.tpl) size is reduced.
2011-09-29 Mads Kiilerich <mads@kiilerich.com>
* grub-core/Makefile.core.def (kernel): Add kern/i386/int.S to
extra_dist.
2011-09-29 Mario Limonciello <mario_limonciello@dell.com>
* util/misc.c (grub_util_get_disk_size) [__MINGW32__]: Strip trailing
slashes on PHYSICALDRIVE%d paths when making Windows CreateFile calls.
2011-09-29 Mario Limonciello <mario_limonciello@dell.com>
* grub-core/kern/emu/misc.c (canonicalize_file_name) [__MINGW32__]: Use
_fullpath.
2011-09-29 Mario Limonciello <mario_limonciello@dell.com>
Remove extra declaration of sleep for mingw32.
* util/misc.c (sleep) [__MINGW32__]: Removed.
* include/grub/util/misc.h (sleep) [__MINGW32__]: Likewise.
2011-09-28 Grégoire Sutre <gregoire.sutre@gmail.com>
* include/grub/bsdlabel.h (grub_partition_bsd_disk_label): Add fields
type and packname.
* include/grub/i386/netbsd_bootinfo.h (NETBSD_BTINFO_BOOTDISK):
Resurrected.
(NETBSD_BTINFO_BOOTWEDGE): New definition.
(grub_netbsd_btinfo_bootwedge): New struct.
* grub-core/loader/i386/bsd.c (grub_netbsd_add_boot_disk_and_wedge):
New function.
(grub_cmd_netbsd): Call grub_netbsd_add_boot_disk_and_wedge.
2011-09-28 Thomas Haller <thomas.haller@fen-net.de>
* grub-core/loader/multiboot_elfxx.c (Elf_Shdr): Set according to
loader.
2011-09-28 Andreas Born <futur.andy@googlemail.com>
Fix incorrect identifiers in bash-completion.
* util/bash-completion.d/grub-completion.bash.in
(_grub_mkpasswd-pbkdf2): Rename to ...
(_grub_mkpasswd_pbkdf2): ... this. All users updated.
(_grub_script-check): Rename to ...
(_grub_script_check): ... this. All users updated.
2011-09-28 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy):
Return 0 if disk isn't biosdisk.
2011-09-17 Grégoire Sutre <gregoire.sutre@gmail.com>
* Makefile.util.def (grub-mkrelpath): Add LIBUTIL for getrawpartition(3)
on NetBSD.
* Makefile.util.def (grub-fstest): Likewise.
2011-09-17 Grégoire Sutre <gregoire.sutre@gmail.com>
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors) [__NetBSD__]:
Get sector size from disk label.
2011-09-05 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkconfig_lib.in (grub_file_is_not_garbage): Return 1 for
*/README* as well as README*.
Reported by: Axel Beckert.
2011-08-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mips/loongson/init.c (grub_machine_init): Handle the
case of less than 256 MiB of RAM.
2011-08-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/wildcard.c (make_regex): Handle @.
2011-08-23 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Move cryptodisk logic to appropriate place.
2011-08-21 Szymon Janc <szymon@janc.net.pl>
* acinclude.m4: Use AC_LANG_PROGRAM macro to generate source code for
AC_LANG_CONFTEST macros.
2011-08-20 Szymon Janc <szymon@janc.net.pl>
Add grub-fstest option to uncompress data for commands.
* util/grub-fstest.c (uncompress): New var.
(options): New option -u.
2011-08-20 Szymon Janc <szymon@janc.net.pl>
* grub-core/loader/i386/linux.c (grub_linux_setup_video): Add
GRUB_VIDEO_DRIVER_RADEON_FULOONG2E to switch case statement.
2011-08-20 Szymon Janc <szymon@janc.net.pl>
* grub-core/io/gzio.c (grub_gzio_open): Always return original io if
file type was not recognized correctly (not gzip or corrupted).
2011-08-19 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mips/loongson/init.c (grub_reboot): Reboot Fuloong.
* include/grub/cs5536.h (GRUB_CS5536_MSR_DIVIL_RESET): New definition.
2011-08-19 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/Makefile.core.def (kernel): Add video/radeon_fuloong2e.c on
loongson.
* grub-core/kern/mips/loongson/init.c (grub_machine_init): Init
video_radeon_fuloong2e.
* grub-core/video/radeon_fuloong2e.c: New file.
* include/grub/video.h (grub_video_id_t): Add new ID
GRUB_VIDEO_DRIVER_RADEON_FULOONG2E.
2011-08-19 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/mips/loongson.h (GRUB_CPU_LOONGSON_COP0_PRID): New
define.
* grub-core/kern/mips/loongson/init.c (grub_machine_init): Check
that PRID matches the detected subplatform and reset the subplatform
if it doesn't.
2011-08-19 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/misc.c (grub_vprintf): Fix a bug on malloc failure.
2011-08-19 Vladimir Serbinenko <phcoder@gmail.com>
Fix PCI iterating on functions >= 4.
* grub-core/bus/pci.c (grub_pci_iterate): Remove useless ghost skipping.
* include/grub/mips/loongson/pci.h (GRUB_LOONGSON_OHCI_GHOST_FUNCTION):
Removed.
(GRUB_LOONGSON_EHCI_GHOST_FUNCTION): Likewise.
(grub_pci_read): Fix bitmask.
(grub_pci_read_word): Likewise.
(grub_pci_read_byte): Likewise.
(grub_pci_write): Likewise.
(grub_pci_write_word): Likewise.
(grub_pci_write_byte): Likewise.
2011-08-19 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Don't impose march=loongson2f on loongson platform. (It
can still be specified in TARGET_CFLAGS)
2011-08-19 Vladimir Serbinenko <phcoder@gmail.com>
Rename Fuloong into Fuloong 2F. Add new ID for Fuloong2E.
* grub-core/Makefile.core.def (fwstart_fuloong): Rename fwstart_fuloong
into fwstart_fuloong2f. Use boot/mips/loongson/fuloong2f.S.
* grub-core/boot/mips/loongson/fuloong.S: Rename to ...
* grub-core/boot/mips/loongson/fuloong2f.S: ... this.
(FULOONG): Rename to ...
(FULOONG2F): ... this. All users updated.
* grub-core/boot/mips/startup_raw.S (machtype_fuloong_str): Rename to
(machtype_fuloong2f_str): ... this.
(machtype_fuloong2e_str): New string.
Check for machtype_fuloong2e_str.
* grub-core/loader/mips/linux.c (loongson_machtypes)
[GRUB_MACHINE_MIPS_LOONGSON]: Add GRUB_ARCH_MACHINE_FULOONG2E.
* grub-core/term/serial.c (loongson_defserial)
[GRUB_MACHINE_MIPS_LOONGSON]: New array.
(grub_serial_register) [GRUB_MACHINE_MIPS_LOONGSON]: Use
loongson_defserial.
* include/grub/mips/loongson/kernel.h (GRUB_ARCH_MACHINE_FULOONG):
Rename to ...
(GRUB_ARCH_MACHINE_FULOONG2F): ... this.
(GRUB_ARCH_MACHINE_FULOONG2E): New const.
* util/grub-mkimage.c (image_target_desc): Rename IMAGE_FULOONG_FLASH
to IMAGE_FULOONG2F_FLASH. All users updated.
(image_targets): Rename images.
* util/grub-mkstandalone.in: Accept fuloong2f and fuloong2e.
2011-08-19 Szymon Janc <szymon@janc.net.pl>
Make enable of disk cache statistics code configurable.
* configure.ac: --enable-cache-stats added.
* config.h.in (DISK_CACHE_STATS): New define.
* grub-core/Makefile.core.def (cacheinfo): New command.
* include/grub/disk.h(grub_disk_cache_get_performance): New function.
* grub-core/commands/cacheinfo.c: New file.
* grub-core/commands/minicmd.c (grub_rescue_cmd_info): Updated and
moved to cacheinfo.c.
* grub-core/kern/disk.c: Use DISK_CACHE_STATS to disable disk cache
debug code.
* include/grub/disk.h: Likewise.
2011-08-19 Szymon Janc <szymon@janc.net.pl>
* Makefile.am (AUTOMAKE_OPTIONS): = Added -Wno-portability flag.
* grub-core/Makefile.am: Likewise.
2011-08-16 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_iterate): Skip with
non-zero pull.
2011-08-16 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/jfs.c (grub_jfs_read_file): New parameter ino.
All users updated.
(grub_jfs_lookup_symlink): Use correct starting inode.
2011-08-16 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-setup.c (main): Add missing gcry initialisation.
2011-08-16 Vladimir Serbinenko <phcoder@gmail.com>
Don't accept text modes on EFI when booting Linux.
* grub-core/loader/i386/linux.c (ACCEPTS_PURE_TEXT): New define.
(grub_linux_boot) [!ACCEPTS_PURE_TEXT]: Restrict to graphics modes.
2011-08-15 Mario Limonciello <mario_limonciello@dell.com>
2011-08-15 Colin Watson <cjwatson@ubuntu.com>
* util/grub-probe.c (probe): Canonicalise the path argument, fixing
use of "/path/.." as in grub-install for EFI as well as handling
symlinks correctly.
Fixes Debian bug #637768.
2011-08-15 Colin Watson <cjwatson@ubuntu.com>
* util/grub-probe.c: Remove duplicate #include.
2011-08-10 Robert Millan <rmh@gnu.org>
Detect LSI MegaRAID SAS (`mfi') devices on GNU/kFreeBSD.
* util/deviceiter.c [__FreeBSD_kernel__] (get_mfi_disk_name): New
function.
[__FreeBSD_kernel__] (grub_util_iterate_devices): Scan for mfi
(/dev/mfid[0-9]+) devices using get_mfi_disk_name().
2011-08-03 Robert Millan <rmh@gnu.org>
* include/grub/zfs/zap_leaf.h (typedef union zap_leaf_chunk): Mark
la_array as packed.
Reported by: Zachary Bedell
2011-07-26 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: The Loongson port requires grub-mkfont due to its
use of -DUSE_ASCII_FAILBACK. Raise an error if it is not going to
be built.
2011-07-26 Colin Watson <cjwatson@ubuntu.com>
* util/grub-install.in: Don't source grub-mkconfig_lib until after
processing arguments (otherwise help2man fails when GRUB has not yet
been installed).
2011-07-25 Vladimir Serbinenko <phcoder@gmail.com>
New script grub-mkstandalone.
* Makefile.util.def (grub-mkstandalone): New script.
* docs/man/grub-mkstandalone.h2m: New file.
* util/grub-mkstandalone.in: Likewise.
2011-07-25 Vladimir Serbinenko <phcoder@gmail.com>
Support ATA disks with 4K sectors.
* include/grub/ata.h (grub_ata): New member log_sector_size.
* grub-core/disk/ata.c (grub_ata_dumpinfo): Show sector size.
(grub_ata_identify): Read sector size.
(grub_ata_readwrite): Use log_sector_size rather than hardcoded value.
2011-07-25 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Don't use uhci outside of x86.
2011-07-25 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrescue.in: Add missing quotes.
2011-07-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/menu.c (grub_menu_execute_entry): Fix NULL
dereference.
2011-07-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/pata.c (grub_pata_readwrite): Add missing wait.
2011-07-23 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/video.h: add missing EXPORT_FUND on
grub_video_edid_checksum and grub_video_edid_preferred_mode.
2011-07-23 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/mips/kernel.h: Fix define conflict.
2011-07-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mips/cache_flush.S [GRUB_MACHINE_MIPS_LOONGSON]: Flush
all four ways.
2011-07-21 Colin Watson <cjwatson@ubuntu.com>
Preferred resolution detection for VBE.
* grub-core/video/video.c (grub_video_edid_checksum): New function.
(grub_video_edid_preferred_mode): Likewise. Try EDID followed by
the Flat Panel extension, in line with the X.org VESA driver.
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_flat_panel_info):
New function.
(grub_vbe_bios_get_ddc_capabilities): Likewise.
(grub_vbe_bios_read_edid): Likewise.
(grub_vbe_get_preferred_mode): Likewise.
(grub_video_vbe_setup): When the mode is "auto", try to get the
preferred mode from VBE, and use the largest mode that is no larger
than the preferred mode (some BIOSes expose a preferred mode that is
not in their mode list!). If this fails, fall back to 640x480 as a
safe conservative choice.
(grub_video_vbe_get_edid): New function.
(grub_video_vbe_adapter): Add get_edid.
* include/grub/video.h (struct grub_vbe_edid_info): New structure.
(struct grub_video_adapter): Add get_edid.
(grub_video_edid_checksum): Add prototype.
(grub_video_edid_preferred_mode): Likewise.
* include/grub/i386/pc/vbe.h (struct grub_vbe_flat_panel_info): New
structure.
* grub-core/commands/videoinfo.c (print_edid): New function.
(grub_cmd_videoinfo): Print EDID if available.
* util/grub.d/00_header.in (GRUB_GFXMODE): Default to "auto". This
is more appropriate on a wider range of platforms than 640x480.
* docs/grub.texi (Simple configuration): Update GRUB_GFXMODE
documentation.
2011-07-10 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Recognize ESP mounted at /boot/EFI.
2011-07-10 Vladimir Serbinenko <phcoder@gmail.com>
* po/POTFILES.in: Regenerate.
2011-07-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name): Fix
incorrect memory usage.
2011-07-10 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Source grub-mkconfig_lib.
2011-07-08 Vladimir Serbinenko <phcoder@gmail.com>
Remove getroot.c from core on emu platform.

View file

@ -1,4 +1,4 @@
AUTOMAKE_OPTIONS = subdir-objects
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
DEPDIR = .deps-util
SUBDIRS = grub-core/gnulib . grub-core po docs util/bash-completion.d

View file

@ -147,7 +147,7 @@ program = {
ldadd = libgrubgcry.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -226,7 +226,7 @@ program = {
ldadd = libgrubgcry.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -412,6 +412,12 @@ script = {
enable = powerpc_ieee1275;
};
script = {
mansection = 1;
name = grub-mkstandalone;
common = util/grub-mkstandalone.in;
};
script = {
mansection = 8;
installdir = sbin;

View file

@ -316,14 +316,14 @@ fi
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
AC_LANG_CONFTEST([[
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
void f (int (*p) (void));
void g (int i)
{
int nestedfunc (void) { return i; }
f (nestedfunc);
}
]])
]])])
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then
true
else
@ -346,7 +346,9 @@ AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
ssp_possible=yes]
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
# Is this a reliable test case?
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
void foo (void) { volatile char a[8]; a[3]; }
]])])
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
# `ac_compile' like this correct, after all?
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
@ -364,7 +366,9 @@ AC_DEFUN([grub_CHECK_STACK_ARG_PROBE],[
[# Smashing stack arg probe.
sap_possible=yes]
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
void foo (void) { volatile char a[8]; a[3]; }
]])])
[if eval "$ac_compile -S -mstack-arg-probe -o conftest.s" 2> /dev/null; then]
AC_MSG_RESULT([yes])
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
@ -399,7 +403,7 @@ AC_DEFUN([grub_CHECK_PIE],[
pie_possible=yes]
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
# Is this a reliable test case?
AC_LANG_CONFTEST([[
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
#ifdef __PIE__
int main() {
return 0;
@ -407,7 +411,7 @@ int main() {
#else
#error NO __PIE__ DEFINED
#endif
]])
]])])
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
# `ac_compile' like this correct, after all?

View file

@ -36,6 +36,8 @@
#define NEED_ENABLE_EXECUTE_STACK @NEED_ENABLE_EXECUTE_STACK@
/* Define to 1 if GCC generates calls to __register_frame_info(). */
#define NEED_REGISTER_FRAME_INFO @NEED_REGISTER_FRAME_INFO@
/* Define to 1 to enable disk cache statistics. */
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
#if defined(__i386__)
#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))

View file

@ -412,23 +412,6 @@ if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
fi
if test "${target_cpu}-${platform}" = mipsel-loongson; then
AC_CACHE_CHECK([whether -march=loongson2f works], [grub_cv_cc_march_loongson2f], [
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -march=loongson2f"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_march_loongson2f=yes],
[grub_cv_cc_march_loongson2f=no])
CFLAGS="$SAVE_CFLAGS"
])
if test "x$grub_cv_cc_march_loongson2f" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -march=loongson2f"
else
TARGET_CFLAGS="$TARGET_CFLAGS -march=mips3"
fi
fi
grub_apple_target_cc
if test x$grub_cv_apple_target_cc = xyes ; then
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
@ -717,6 +700,17 @@ AC_ARG_ENABLE([mm-debug],
[AC_DEFINE([MM_DEBUG], [1],
[Define to 1 if you enable memory manager debugging.])])
AC_ARG_ENABLE([cache-stats],
AS_HELP_STRING([--enable-cache-stats],
[enable disk cache statistics collection]))
if test x$enable_cache_stats = xyes; then
DISK_CACHE_STATS=1
else
DISK_CACHE_STATS=0
fi
AC_SUBST([DISK_CACHE_STATS])
AC_ARG_ENABLE([grub-emu-usb],
[AS_HELP_STRING([--enable-grub-emu-usb],
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
@ -866,6 +860,9 @@ enable_grub_mkfont=yes
else
enable_grub_mkfont=no
fi
if test x"$enable_grub_mkfont" = xno && test "x$platform" = xloongson; then
AC_MSG_ERROR([loongson port needs grub-mkfont])
fi
AC_SUBST([enable_grub_mkfont])
AC_SUBST([freetype_cflags])
AC_SUBST([freetype_libs])
@ -987,6 +984,7 @@ AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin])
@ -1053,6 +1051,11 @@ echo With memory debugging: Yes
else
echo With memory debugging: No
fi
if [ x"$enable_cache_stats" = xyes ]; then
echo With disk cache statistics: Yes
else
echo With disk cache statistics: No
fi
if [ x"$efiemu_excuse" = x ]; then
echo efiemu runtime: Yes
else

View file

@ -1203,7 +1203,8 @@ listed in @file{/boot/grub/video.lst}.
Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
you can only use modes which your graphics card supports via VESA BIOS
Extensions (VBE), so for example native LCD panel resolutions may not be
available. The default is @samp{640x480}. @xref{gfxmode}.
available. The default is @samp{auto}, which tries to select a preferred
resolution. @xref{gfxmode}.
@item GRUB_BACKGROUND
Set a background image for use with the @samp{gfxterm} graphical terminal.

View file

@ -0,0 +1,4 @@
[NAME]
grub-mkstandalone \- make a memdisk-based GRUB image
[SEE ALSO]
.BR grub-mkimage (1)

114
gentpl.py
View file

@ -183,6 +183,17 @@ def foreach_platform_specific_value(platform, suffix, nonetag, closure):
r += "[+ ELSE +][+ FOR " + nonetag + " +]" + closure("[+ ." + nonetag + " +]") + "[+ ENDFOR +][+ ENDIF +]"
return r
#
# Returns autogen code that defines an autogen macro using the
# definition given in the 'snippet'.
#
def define_autogen_macro(name, snippet):
r = ""
r += "[+ DEFINE " + name + " +]"
r += snippet
r += "[+ ENDDEF +]\n"
return r
#
# Template for handling values from sum of all groups for a platform,
# for example:
@ -245,10 +256,18 @@ def foreach_enabled_platform(closure):
# emu_condition = COND_GRUB_EMU_USB;
# };
#
def define_macro_for_platform_conditionals_if_statement(p):
return define_autogen_macro(
"if_" + p + "_conditionals",
foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n"))
def define_macro_for_platform_conditionals_endif_statement(p):
return define_autogen_macro(
"endif_" + p + "_conditionals",
foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n"))
def under_platform_specific_conditionals(platform, snippet):
r = foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n")
r = "[+ if_" + platform + "_conditionals +]"
r += snippet
r += foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n")
r += "[+ endif_" + platform + "_conditionals +]"
return r
def platform_specific_values(platform, suffix, nonetag):
@ -261,18 +280,69 @@ def platform_values(platform, suffix):
def extra_dist():
return foreach_value("extra_dist", lambda value: value + " ")
def platform_sources(p): return platform_values(p, "")
def platform_nodist_sources(p): return platform_values(p, "_nodist")
def platform_dependencies(p): return platform_values(p, "dependencies", "_dependencies")
def define_macro_for_platform_sources(p):
return define_autogen_macro(
"get_" + p + "_sources",
platform_values(p, ""))
def define_macro_for_platform_nodist_sources(p):
return define_autogen_macro(
"get_" + p + "_nodist_sources",
platform_values(p, "_nodist"))
def define_macro_for_platform_dependencies(p):
return define_autogen_macro(
"get_" + p + "_dependencies",
platform_values(p, "dependencies", "_dependencies"))
def platform_sources(p): return "[+ get_" + p + "_sources +]"
def platform_nodist_sources(p): return "[+ get_" + p + "_nodist_sources +]"
def platform_dependencies(p): return "[+ get_" + p + "_dependencies +]"
def platform_startup(p): return platform_specific_values(p, "_startup", "startup")
def platform_ldadd(p): return platform_specific_values(p, "_ldadd", "ldadd")
def platform_cflags(p): return platform_specific_values(p, "_cflags", "cflags")
def platform_ldflags(p): return platform_specific_values(p, "_ldflags", "ldflags")
def platform_cppflags(p): return platform_specific_values(p, "_cppflags", "cppflags")
def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "ccasflags")
def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags")
def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags")
#
# Returns Autogen code which defines the autogen macros that collect
# platform specific values for cflags, ldflags, etc. tags.
#
def define_macro_for_platform_startup(p):
return define_autogen_macro(
"get_" + p + "_startup",
platform_specific_values(p, "_startup", "startup"))
def define_macro_for_platform_cflags(p):
return define_autogen_macro(
"get_" + p + "_cflags",
platform_specific_values(p, "_cflags", "cflags"))
def define_macro_for_platform_ldadd(p):
return define_autogen_macro(
"get_" + p + "_ldadd",
platform_specific_values(p, "_ldadd", "ldadd"))
def define_macro_for_platform_ldflags(p):
return define_autogen_macro(
"get_" + p + "_ldflags",
platform_specific_values(p, "_ldflags", "ldflags"))
def define_macro_for_platform_cppflags(p):
return define_autogen_macro(
"get_" + p + "_cppflags",
platform_specific_values(p, "_cppflags", "cppflags"))
def define_macro_for_platform_ccasflags(p):
return define_autogen_macro(
"get_" + p + "_ccasflags",
platform_specific_values(p, "_ccasflags", "ccasflags"))
def define_macro_for_platform_stripflags(p):
return define_autogen_macro(
"get_" + p + "_stripflags",
platform_specific_values(p, "_stripflags", "stripflags"))
def define_macro_for_platform_objcopyflags(p):
return define_autogen_macro(
"get_" + p + "_objcopyflags",
platform_specific_values(p, "_objcopyflags", "objcopyflags"))
#
# Autogen calls to invoke the above macros.
#
def platform_startup(p): return "[+ get_" + p + "_startup +]"
def platform_ldadd(p): return "[+ get_" + p + "_ldadd +]"
def platform_cflags(p): return "[+ get_" + p + "_cflags +]"
def platform_ldflags(p): return "[+ get_" + p + "_ldflags +]"
def platform_cppflags(p): return "[+ get_" + p + "_cppflags +]"
def platform_ccasflags(p): return "[+ get_" + p + "_ccasflags +]"
def platform_stripflags(p): return "[+ get_" + p + "_stripflags +]"
def platform_objcopyflags(p): return "[+ get_" + p + "_objcopyflags +]"
#
# Emit snippet only the first time through for the current name.
@ -489,7 +559,6 @@ def script_rules():
def data_rules():
return rules("data", data)
print "[+ AutoGen5 template +]\n"
a = module_rules()
b = kernel_rules()
c = image_rules()
@ -499,6 +568,23 @@ f = script_rules()
g = data_rules()
z = global_variable_initializers()
print "[+ AutoGen5 template +]\n"
for p in GRUB_PLATFORMS:
print define_macro_for_platform_sources(p)
print define_macro_for_platform_nodist_sources(p)
# print define_macro_for_platform_dependencies(p)
print define_macro_for_platform_startup(p)
print define_macro_for_platform_cflags(p)
print define_macro_for_platform_ldadd(p)
print define_macro_for_platform_ldflags(p)
print define_macro_for_platform_cppflags(p)
print define_macro_for_platform_ccasflags(p)
print define_macro_for_platform_stripflags(p)
print define_macro_for_platform_objcopyflags(p)
print define_macro_for_platform_conditionals_if_statement(p)
print define_macro_for_platform_conditionals_endif_statement(p)
# print z # initializer for all vars
print a
print b

View file

@ -1,4 +1,4 @@
AUTOMAKE_OPTIONS = subdir-objects
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
DEPDIR=.deps-core

View file

@ -180,6 +180,7 @@ kernel = {
mips_loongson = term/serial.c;
mips_loongson = video/sm712.c;
mips_loongson = video/sis315pro.c;
mips_loongson = video/radeon_fuloong2e.c;
extra_dist = video/sm712_init.c;
mips_loongson = commands/keylayouts.c;
@ -218,6 +219,7 @@ kernel = {
videoinkernel = commands/boot.c;
extra_dist = kern/i386/int.S;
extra_dist = kern/i386/realmode.S;
extra_dist = kern/i386/pc/lzma_decode.S;
extra_dist = kern/mips/cache_flush.S;
@ -363,8 +365,8 @@ image = {
};
image = {
name = fwstart_fuloong;
mips_loongson = boot/mips/loongson/fuloong.S;
name = fwstart_fuloong2f;
mips_loongson = boot/mips/loongson/fuloong2f.S;
objcopyflags = '-O binary';
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_loongson;
@ -398,11 +400,15 @@ module = {
module = {
name = usb;
common = bus/usb/usb.c;
noemu = bus/usb/usbtrans.c;
noemu = bus/usb/usbhub.c;
enable = emu;
common = bus/usb/usbtrans.c;
common = bus/usb/usbhub.c;
enable = usb;
emu_condition = COND_GRUB_EMU_USB;
};
module = {
name = emuusb;
common = bus/usb/usb.c;
condition = COND_GRUB_EMU_USB;
};
module = {
@ -437,18 +443,22 @@ module = {
module = {
name = pci;
noemu = bus/pci.c;
emu = bus/emu/pci.c;
emu = commands/lspci.c;
common = bus/pci.c;
enable = emu;
enable = i386_pc;
enable = i386_efi;
enable = x86_64_efi;
enable = i386_ieee1275;
enable = i386_coreboot;
enable = i386_multiboot;
emu_condition = COND_GRUB_EMU_PCI;
};
module = {
name = emupci;
common = bus/emu/pci.c;
common = commands/lspci.c;
condition = COND_GRUB_EMU_PCI;
};
module = {
@ -786,8 +796,6 @@ module = {
name = usbtest;
common = commands/usbtest.c;
enable = usb;
enable = emu;
emu_condition = COND_GRUB_EMU_USB;
};
module = {
@ -901,8 +909,6 @@ module = {
name = usbms;
common = disk/usbms.c;
enable = usb;
enable = emu;
emu_condition = COND_GRUB_EMU_USB;
};
module = {
@ -1444,9 +1450,7 @@ module = {
common = term/serial.c;
x86 = term/ns8250.c;
enable = emu;
enable = x86;
emu_condition = COND_GRUB_EMU_USB;
};
module = {
@ -1681,3 +1685,9 @@ module = {
name = time;
common = commands/time.c;
};
module = {
name = cacheinfo;
common = commands/cacheinfo.c;
condition = COND_ENABLE_CACHE_STATS;
};

View file

@ -1,2 +1,2 @@
#define FULOONG 1
#define FULOONG2F 1
#include "fwstart.S"

View file

@ -26,7 +26,7 @@
#include <grub/cs5536.h>
#include <grub/smbus.h>
#ifdef FULOONG
#ifdef FULOONG2F
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT2
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT2_DIVISOR_115200
#else
@ -43,10 +43,10 @@
start:
_start:
__start:
/* Put serial init as soon as possible. But on Fuloong serial is past
Geode, so on Fuloong we need Geode first.
/* Put serial init as soon as possible. But on Fuloong2f serial is past
Geode, so on Fuloong2f we need Geode first.
*/
#ifndef FULOONG
#ifndef FULOONG2F
bal serial_hw_init
nop
#endif
@ -72,7 +72,7 @@ retry_cs5536:
bnel $t2, $t3, 1b
sll $t4, $t4, 1
#ifndef FULOONG
#ifndef FULOONG2F
bal message
addiu $a0, $a0, %lo(cs5536_found)
bal printhex
@ -95,7 +95,7 @@ retry_cs5536:
bal gpio_init
nop
#ifdef FULOONG
#ifdef FULOONG2F
bal serial_hw_init
nop
#endif
@ -130,7 +130,7 @@ retry_cs5536:
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL3) ($t0)
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL2) ($t0)
/* Yeeloong and Fuloong have only one memory slot. */
/* Yeeloong and Fuloong2f have only one memory slot. */
/* Output first byte on serial for debugging. */
ori $a1, $zero, GRUB_SMB_RAM_START_ADDR
bal read_spd
@ -252,7 +252,7 @@ gpio_init:
/* In: none. Out: none. Clobbered: $t0, $t1, $t2, $a0, $a1, $a2. */
serial_hw_init:
move $t2, $ra
#ifdef FULOONG
#ifdef FULOONG2F
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_LEG_IO)
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_LEG_IO)
lui $a1, %hi (GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 \
@ -471,7 +471,7 @@ regdump:
.quad 0x0100020200010101 /* 4 */
.quad 0x0a04030603050203 /* 6 */
.quad 0x0f0e040000010a0b /* 7 */
#ifdef FULOONG
#ifdef FULOONG2F
.quad 0x0000000100000001 /* 8 */
#else
.quad 0x0000010200000102 /* 8 */
@ -482,7 +482,7 @@ regdump:
.quad 0x002a3c0615000000 /* c */
.quad 0x002a002a002a002a /* d */
.quad 0x002a002a002a002a /* e */
#ifdef FULOONG
#ifdef FULOONG2F
.quad 0x00b40020005b0004 /* f */
#else
.quad 0x00b40020006d0004 /* f */
@ -503,7 +503,7 @@ regdump:
/* Dump of GPIO connections. FIXME: Remove useless and macroify. */
gpio_dump:
#ifdef FULOONG
#ifdef FULOONG2F
.long 0xffff0000, 0x2eefd110, 0xffff0000, 0xffff0000
.long 0x2eefd110, 0xffff0000, 0x1000efff, 0xefff1000
.long 0x3df3c20c, 0xffff0000, 0xffff0000, 0xffff0000
@ -740,8 +740,8 @@ continue:
lui $t0, %hi(cached_continue - 0x20000000)
addiu $t0, $t0, %lo(cached_continue - 0x20000000)
jr $t0
#ifdef FULOONG
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG)
#ifdef FULOONG2F
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG2F)
#else
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_YEELOONG)
#endif

View file

@ -109,7 +109,7 @@ argcont:
DO_PARSE (memsizestr, $s4)
DO_PARSE (highmemsizestr, $s5)
DO_CHECKT1 (pmon_yeeloong_verstr, GRUB_ARCH_MACHINE_YEELOONG)
DO_CHECKT1 (pmon_fuloong_verstr, GRUB_ARCH_MACHINE_FULOONG)
DO_CHECKT1 (pmon_fuloong2f_verstr, GRUB_ARCH_MACHINE_FULOONG2F)
2:
b argcont
addiu $t0, $t0, 4
@ -155,11 +155,12 @@ memsizestr: .asciiz "memsize="
highmemsizestr: .asciiz "highmemsize="
machtype_yeeloong_str1: .asciiz "machtype=8.9"
machtype_yeeloong_str2: .asciiz "machtype=lemote-yeeloong-"
machtype_fuloong_str: .asciiz "machtype=lemote-fuloong-"
machtype_fuloong2f_str: .asciiz "machtype=lemote-fuloong-2f"
machtype_fuloong2e_str: .asciiz "machtype=lemote-fuloong-2e"
pmon_yeeloong_str: .asciiz "PMON_VER=LM8"
pmon_fuloong_str: .asciiz "PMON_VER=LM6"
pmon_fuloong2f_str: .asciiz "PMON_VER=LM6"
pmon_yeeloong_verstr: .asciiz "Version=LM8"
pmon_fuloong_verstr: .asciiz "Version=LM6"
pmon_fuloong2f_verstr: .asciiz "Version=LM6"
.p2align 2
argdone:
@ -173,8 +174,9 @@ argdone:
DO_CHECKA1 (machtype_yeeloong_str1, GRUB_ARCH_MACHINE_YEELOONG)
DO_CHECKA1 (machtype_yeeloong_str2, GRUB_ARCH_MACHINE_YEELOONG)
DO_CHECKA1 (pmon_yeeloong_str, GRUB_ARCH_MACHINE_YEELOONG)
DO_CHECKA1 (machtype_fuloong_str, GRUB_ARCH_MACHINE_FULOONG)
DO_CHECKA1 (pmon_fuloong_str, GRUB_ARCH_MACHINE_FULOONG)
DO_CHECKA1 (machtype_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F)
DO_CHECKA1 (machtype_fuloong2e_str, GRUB_ARCH_MACHINE_FULOONG2E)
DO_CHECKA1 (pmon_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F)
addiu $a0, $a0, -1
b argdone
addiu $a1, $a1, 4

View file

@ -281,7 +281,7 @@ grub_cs5536_init_geode (grub_pci_device_t dev)
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
break;
case GRUB_ARCH_MACHINE_FULOONG:
case GRUB_ARCH_MACHINE_FULOONG2F:
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3
| GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1

View file

@ -115,16 +115,6 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
continue;
}
#ifdef GRUB_MACHINE_MIPS_LOONGSON
/* Skip ghosts. */
if (id == GRUB_LOONGSON_OHCI_PCIID
&& dev.function == GRUB_LOONGSON_OHCI_GHOST_FUNCTION)
continue;
if (id == GRUB_LOONGSON_EHCI_PCIID
&& dev.function == GRUB_LOONGSON_EHCI_GHOST_FUNCTION)
continue;
#endif
if (hook (dev, id))
return;

View file

@ -36,11 +36,33 @@ GRUB_MOD_LICENSE ("GPLv3+");
typedef enum
{
GRUB_UHCI_REG_USBCMD = 0x00,
GRUB_UHCI_REG_USBINTR = 0x04,
GRUB_UHCI_REG_FLBASEADD = 0x08,
GRUB_UHCI_REG_PORTSC1 = 0x10,
GRUB_UHCI_REG_PORTSC2 = 0x12
GRUB_UHCI_REG_PORTSC2 = 0x12,
GRUB_UHCI_REG_USBLEGSUP = 0xc0
} grub_uhci_reg_t;
/* R/WC legacy support bits */
#define GRUB_UHCI_LEGSUP_END_A20GATE (1 << 15)
#define GRUB_UHCI_TRAP_BY_64H_WSTAT (1 << 11)
#define GRUB_UHCI_TRAP_BY_64H_RSTAT (1 << 10)
#define GRUB_UHCI_TRAP_BY_60H_WSTAT (1 << 9)
#define GRUB_UHCI_TRAP_BY_60H_RSTAT (1 << 8)
/* Reset all legacy support - clear all R/WC bits and all R/W bits */
#define GRUB_UHCI_RESET_LEGSUP_SMI ( GRUB_UHCI_LEGSUP_END_A20GATE \
| GRUB_UHCI_TRAP_BY_64H_WSTAT \
| GRUB_UHCI_TRAP_BY_64H_RSTAT \
| GRUB_UHCI_TRAP_BY_60H_WSTAT \
| GRUB_UHCI_TRAP_BY_60H_RSTAT )
/* Some UHCI commands */
#define GRUB_UHCI_CMD_RUN_STOP (1 << 0)
#define GRUB_UHCI_CMD_HCRESET (1 << 1)
#define GRUB_UHCI_CMD_MAXP (1 << 7)
/* Important bits in structures */
#define GRUB_UHCI_LINK_TERMINATE 1
#define GRUB_UHCI_LINK_QUEUE_HEAD 2
@ -181,6 +203,11 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
if (class != 0x0c || subclass != 0x03 || interf != 0x00)
return 0;
/* Set bus master - needed for coreboot or broken BIOSes */
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
grub_pci_write_word(addr,
GRUB_PCI_COMMAND_BUS_MASTER | grub_pci_read_word(addr));
/* Determine IO base address. */
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
base = grub_pci_read (addr);
@ -195,6 +222,19 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
u->iobase = base & GRUB_UHCI_IOMASK;
/* Reset PIRQ and SMI */
addr = grub_pci_make_address (dev, GRUB_UHCI_REG_USBLEGSUP);
grub_pci_write_word(addr, GRUB_UHCI_RESET_LEGSUP_SMI);
/* Reset the HC */
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, GRUB_UHCI_CMD_HCRESET);
grub_millisleep(5);
/* Disable interrupts and commands (just to be safe) */
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBINTR, 0);
/* Finish HC reset, HC remains disabled */
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, 0);
/* Read back to be sure PCI write is done */
grub_uhci_readreg16(u, GRUB_UHCI_REG_USBCMD);
/* Reserve a page for the frame list. */
u->framelist = grub_memalign (4096, 4096);
if (! u->framelist)
@ -252,9 +292,6 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
u->td[N_TD - 2].linkptr = 0;
u->tdfree = u->td;
/* Make sure UHCI is disabled! */
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0);
/* Setup the frame list pointers. Since no isochronous transfers
are and will be supported, they all point to the (same!) queue
head. */
@ -285,7 +322,8 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
u->qh[N_QH - 1].linkptr = 1;
/* Enable UHCI again. */
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 1 | (1 << 7));
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD,
GRUB_UHCI_CMD_RUN_STOP | GRUB_UHCI_CMD_MAXP);
/* UHCI is initialized and ready for transfers. */
grub_dprintf ("uhci", "UHCI initialized\n");

View file

@ -0,0 +1,58 @@
/* cacheinfo.c - disk cache statistics */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2010 Free Software Foundation, Inc.
*
* GRUB 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 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/>.
*/
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/command.h>
#include <grub/i18n.h>
#include <grub/disk.h>
static grub_err_t
grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused)))
{
unsigned long hits, misses;
grub_disk_cache_get_performance (&hits, &misses);
grub_printf ("Disk cache: hits = %lu, misses = %lu ", hits, misses);
if (hits + misses)
{
unsigned long ratio = hits * 10000 / (hits + misses);
grub_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100);
}
else
grub_printf ("(N/A)\n");
return 0;
}
static grub_command_t cmd_cacheinfo;
GRUB_MOD_INIT(cacheinfo)
{
cmd_cacheinfo =
grub_register_command ("cacheinfo", grub_rescue_cmd_info,
0, N_("Get disk cache info."));
}
GRUB_MOD_FINI(cacheinfo)
{
grub_unregister_command (cmd_cacheinfo);
}

View file

@ -90,26 +90,6 @@ grub_mini_cmd_help (struct grub_command *cmd __attribute__ ((unused)),
return 0;
}
#if 0
static void
grub_rescue_cmd_info (void)
{
extern void grub_disk_cache_get_performance (unsigned long *,
unsigned long *);
unsigned long hits, misses;
grub_disk_cache_get_performance (&hits, &misses);
grub_printf ("Disk cache: hits = %u, misses = %u ", hits, misses);
if (hits + misses)
{
unsigned long ratio = hits * 10000 / (hits + misses);
grub_printf ("(%u.%u%%)\n", ratio / 100, ratio % 100);
}
else
grub_printf ("(N/A)\n");
}
#endif
/* dump ADDRESS [SIZE] */
static grub_err_t
grub_mini_cmd_dump (struct grub_command *cmd __attribute__ ((unused)),

View file

@ -86,6 +86,30 @@ hook (const struct grub_video_mode_info *info)
return 0;
}
static void
print_edid (struct grub_video_edid_info *edid_info)
{
unsigned int edid_width, edid_height;
if (grub_video_edid_checksum (edid_info))
{
grub_printf (" EDID checksum invalid\n");
grub_errno = GRUB_ERR_NONE;
return;
}
grub_printf (" EDID version: %u.%u\n",
edid_info->version, edid_info->revision);
if (grub_video_edid_preferred_mode (edid_info, &edid_width, &edid_height)
== GRUB_ERR_NONE)
grub_printf (" Preferred mode: %ux%u\n", edid_width, edid_height);
else
{
grub_printf (" No preferred mode available\n");
grub_errno = GRUB_ERR_NONE;
}
}
static grub_err_t
grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
@ -130,6 +154,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
FOR_VIDEO_ADAPTERS (adapter)
{
struct grub_video_mode_info info;
struct grub_video_edid_info edid_info;
grub_printf ("Adapter '%s':\n", adapter->name);
@ -164,6 +189,11 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
adapter->iterate (hook);
if (adapter->get_edid && adapter->get_edid (&edid_info) == GRUB_ERR_NONE)
print_edid (&edid_info);
else
grub_errno = GRUB_ERR_NONE;
current_mode = NULL;
if (adapter->id != id)

View file

@ -139,6 +139,7 @@ make_regex (const char *start, const char *end, regex_t *regexp)
case '.':
case '(':
case ')':
case '@':
buffer[i++] = '\\';
buffer[i++] = ch;
break;

View file

@ -57,6 +57,7 @@ grub_ata_dumpinfo (struct grub_ata *dev, char *info)
{
grub_dprintf ("ata", "Addressing: %d\n", dev->addr);
grub_dprintf ("ata", "Sectors: %lld\n", (unsigned long long) dev->size);
grub_dprintf ("ata", "Sector size: %u\n", 1U << dev->log_sector_size);
}
}
@ -170,6 +171,21 @@ grub_ata_identify (struct grub_ata *dev)
else
dev->size = grub_le_to_cpu64(*((grub_uint64_t *) &info16[100]));
if (info16[106] & (1 << 12))
{
grub_uint32_t secsize;
secsize = grub_le_to_cpu32 (*((grub_uint32_t *) &info16[117]));
if (secsize & (secsize - 1) || !secsize
|| secsize > 1048576)
secsize = 256;
for (dev->log_sector_size = 0;
(1U << dev->log_sector_size) < secsize;
dev->log_sector_size++);
dev->log_sector_size++;
}
else
dev->log_sector_size = 9;
/* Read CHS information. */
dev->cylinders = info16[1];
dev->heads = info16[3];
@ -314,7 +330,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
grub_ata_setaddress (ata, &parms, sector, batch, addressing);
parms.taskfile.cmd = (! rw ? cmd : cmd_write);
parms.buffer = buf;
parms.size = batch * GRUB_DISK_SECTOR_SIZE;
parms.size = batch << ata->log_sector_size;
parms.write = rw;
if (ata->dma)
parms.dma = 1;
@ -322,9 +338,9 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
err = ata->dev->readwrite (ata, &parms, 0);
if (err)
return err;
if (parms.size != batch * GRUB_DISK_SECTOR_SIZE)
if (parms.size != batch << ata->log_sector_size)
return grub_error (GRUB_ERR_READ_ERROR, "incomplete read");
buf += GRUB_DISK_SECTOR_SIZE * batch;
buf += batch << ata->log_sector_size;
sector += batch;
nsectors += batch;
}
@ -433,6 +449,7 @@ grub_ata_open (const char *name, grub_disk_t disk)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
disk->total_sectors = ata->size;
disk->log_sector_size = ata->log_sector_size;
disk->id = grub_make_scsi_id (id, bus, 0);

View file

@ -709,7 +709,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp)
== GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE))
{
grub_partition_t tpart = NULL;
char *partition_name = NULL;
char *device_name;
grub_efi_device_path_t *dup_dp, *dup_ldp;
grub_efi_hard_drive_device_path_t hd;
@ -722,7 +722,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
if (grub_partition_get_start (part) == hd.partition_start
&& grub_partition_get_len (part) == hd.partition_size)
{
tpart = part;
partition_name = grub_partition_get_name (part);
return 1;
}
@ -760,17 +760,14 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
}
else
{
char *partition_name;
grub_partition_iterate (parent, find_partition);
if (! tpart)
if (! partition_name)
{
grub_disk_close (parent);
return 0;
}
partition_name = grub_partition_get_name (tpart);
device_name = grub_xasprintf ("%s,%s", parent->name, partition_name);
grub_free (partition_name);
}

View file

@ -177,6 +177,10 @@ grub_pata_readwrite (struct grub_ata *disk,
/* Start command. */
grub_pata_regset (dev, GRUB_ATA_REG_CMD, parms->taskfile.cmd);
/* Wait for !BSY. */
if (grub_pata_wait_not_busy (dev, GRUB_ATA_TOUT_DATA))
return grub_errno;
/* Check status. */
grub_int8_t sts = grub_pata_regget (dev, GRUB_ATA_REG_STATUS);
grub_dprintf ("pata", "status=0x%x\n", sts);

View file

@ -614,7 +614,8 @@ grub_jfs_read_file (struct grub_jfs_data *data,
/* Find the file with the pathname PATH on the filesystem described by
DATA. */
static grub_err_t
grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
grub_jfs_find_file (struct grub_jfs_data *data, const char *path,
grub_uint32_t start_ino)
{
char fpath[grub_strlen (path)];
char *name = fpath;
@ -623,7 +624,7 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
grub_strncpy (fpath, path, grub_strlen (path) + 1);
if (grub_jfs_read_inode (data, GRUB_JFS_AGGR_INODE, &data->currinode))
if (grub_jfs_read_inode (data, start_ino, &data->currinode))
return grub_errno;
/* Skip the first slashes. */
@ -724,11 +725,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
if (symlink[0] == '/')
ino = 2;
/* Now load in the old inode. */
if (grub_jfs_read_inode (data, ino, &data->currinode))
return grub_errno;
grub_jfs_find_file (data, symlink);
grub_jfs_find_file (data, symlink, ino);
if (grub_errno)
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
@ -750,7 +747,7 @@ grub_jfs_dir (grub_device_t device, const char *path,
if (!data)
goto fail;
if (grub_jfs_find_file (data, path))
if (grub_jfs_find_file (data, path, GRUB_JFS_AGGR_INODE))
goto fail;
diro = grub_jfs_opendir (data, &data->currinode);
@ -801,7 +798,7 @@ grub_jfs_open (struct grub_file *file, const char *name)
if (!data)
goto fail;
grub_jfs_find_file (data, name);
grub_jfs_find_file (data, name, GRUB_JFS_AGGR_INODE);
if (grub_errno)
goto fail;

View file

@ -1179,12 +1179,9 @@ grub_gzio_open (grub_file_t io)
grub_free (gzio);
grub_free (file);
grub_file_seek (io, 0);
grub_errno = GRUB_ERR_NONE;
if (grub_errno == GRUB_ERR_BAD_FILE_TYPE)
{
grub_errno = GRUB_ERR_NONE;
return io;
}
return io;
}
return file;

View file

@ -46,7 +46,7 @@ static struct grub_disk_cache grub_disk_cache_table[GRUB_DISK_CACHE_NUM];
void (*grub_disk_firmware_fini) (void);
int grub_disk_firmware_is_tainted;
#if 0
#if DISK_CACHE_STATS
static unsigned long grub_disk_cache_hits;
static unsigned long grub_disk_cache_misses;
@ -119,13 +119,13 @@ grub_disk_cache_fetch (unsigned long dev_id, unsigned long disk_id,
&& cache->sector == sector)
{
cache->lock = 1;
#if 0
#if DISK_CACHE_STATS
grub_disk_cache_hits++;
#endif
return cache->data;
}
#if 0
#if DISK_CACHE_STATS
grub_disk_cache_misses++;
#endif

View file

@ -217,6 +217,9 @@ grub_util_biosdisk_iterate (int (*hook) (const char *name),
{
unsigned i;
if (pull != GRUB_DISK_PULL_NONE)
return 0;
for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
if (map[i].drive && hook (map[i].drive))
return 1;
@ -262,10 +265,13 @@ grub_util_get_fd_sectors (int fd, unsigned *log_secsize)
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
if (ioctl (fd, DIOCGSECTORSIZE, &sector_size))
goto fail;
# elif defined(__NetBSD__)
sector_size = label.d_secsize;
# else
if (ioctl (fd, BLKSSZGET, &sector_size))
# endif
goto fail;
# endif
if (sector_size & (sector_size - 1) || !sector_size)
goto fail;
@ -1835,6 +1841,9 @@ grub_util_biosdisk_is_floppy (grub_disk_t disk)
struct stat st;
int fd;
if (disk->dev != &grub_util_biosdisk_dev)
return 0;
fd = open (map[disk->id].device, O_RDONLY);
/* Shouldn't happen. */
if (fd == -1)

View file

@ -224,7 +224,11 @@ char *
canonicalize_file_name (const char *path)
{
char *ret;
#ifdef PATH_MAX
#ifdef __MINGW32__
ret = xmalloc (PATH_MAX);
if (!_fullpath (ret, path, PATH_MAX))
return NULL;
#elif defined (PATH_MAX)
ret = xmalloc (PATH_MAX);
if (!realpath (path, ret))
return NULL;

View file

@ -9,6 +9,13 @@
subu $t1, $t3, $t2
1:
cache 1, 0($t0)
/* All four ways. */
#ifdef GRUB_MACHINE_MIPS_LOONGSON
cache 1, 1($t0)
cache 1, 2($t0)
cache 1, 3($t0)
#endif
addiu $t1, $t1, -0x4
bne $t1, $zero, 1b
addiu $t0, $t0, 0x4

View file

@ -35,6 +35,7 @@
extern void grub_video_sm712_init (void);
extern void grub_video_sis315pro_init (void);
extern void grub_video_radeon_fuloong2e_init (void);
extern void grub_video_init (void);
extern void grub_bitmap_init (void);
extern void grub_font_init (void);
@ -123,6 +124,23 @@ void
grub_machine_init (void)
{
grub_addr_t modend;
grub_uint32_t prid;
asm volatile ("mfc0 %0, " GRUB_CPU_LOONGSON_COP0_PRID : "=r" (prid));
switch (prid)
{
/* Loongson 2E. */
case 0x6302:
grub_arch_machine = GRUB_ARCH_MACHINE_FULOONG2E;
break;
/* Loongson 2F. */
case 0x6303:
if (grub_arch_machine != GRUB_ARCH_MACHINE_FULOONG2F
&& grub_arch_machine != GRUB_ARCH_MACHINE_YEELOONG)
grub_arch_machine = GRUB_ARCH_MACHINE_YEELOONG;
break;
}
/* FIXME: measure this. */
if (grub_arch_busclock == 0)
@ -170,7 +188,7 @@ grub_machine_init (void)
}
else
{
grub_arch_memsize = (totalmem >> 20);
grub_arch_memsize = totalmem;
grub_arch_highmemsize = 0;
}
@ -189,6 +207,7 @@ grub_machine_init (void)
grub_video_init ();
grub_video_sm712_init ();
grub_video_sis315pro_init ();
grub_video_radeon_fuloong2e_init ();
grub_bitmap_init ();
grub_font_init ();
grub_gfxterm_init ();
@ -213,7 +232,9 @@ grub_halt (void)
{
switch (grub_arch_machine)
{
case GRUB_ARCH_MACHINE_FULOONG:
case GRUB_ARCH_MACHINE_FULOONG2E:
break;
case GRUB_ARCH_MACHINE_FULOONG2F:
{
grub_pci_device_t dev;
grub_port_t p;
@ -248,8 +269,27 @@ grub_exit (void)
void
grub_reboot (void)
{
grub_write_ec (GRUB_MACHINE_EC_COMMAND_REBOOT);
switch (grub_arch_machine)
{
case GRUB_ARCH_MACHINE_FULOONG2E:
grub_outb (grub_inb (0xbfe00104) & ~4, 0xbfe00104);
grub_outb (grub_inb (0xbfe00104) | 4, 0xbfe00104);
break;
case GRUB_ARCH_MACHINE_FULOONG2F:
{
grub_pci_device_t dev;
if (!grub_cs5536_find (&dev))
break;
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_RESET,
grub_cs5536_read_msr (dev,
GRUB_CS5536_MSR_DIVIL_RESET)
| 1);
break;
}
case GRUB_ARCH_MACHINE_YEELOONG:
grub_write_ec (GRUB_MACHINE_EC_COMMAND_REBOOT);
break;
}
grub_millisleep (1500);
grub_printf ("Reboot failed\n");

View file

@ -61,7 +61,7 @@ VARIABLE (grub_arch_highmemsize)
.long 0
#ifdef GRUB_MACHINE_MIPS_LOONGSON
VARIABLE (grub_arch_machine)
.long GRUB_ARCH_MACHINE_FULOONG
.long GRUB_ARCH_MACHINE_FULOONG2F
#endif
cont:
/* Save our base. */

View file

@ -210,6 +210,7 @@ grub_vprintf (const char *fmt, va_list args)
buf[PREALLOC_SIZE - 2] = '.';
buf[PREALLOC_SIZE - 1] = '.';
buf[PREALLOC_SIZE] = 0;
curbuf = buf;
}
else
s = grub_vsnprintf_real (curbuf, s, fmt, ap2);

View file

@ -33,6 +33,8 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
#include <grub/ns8250.h>
#include <grub/bsdlabel.h>
#include <grub/crypto.h>
GRUB_MOD_LICENSE ("GPLv3+");
@ -946,6 +948,86 @@ grub_netbsd_add_modules (void)
return err;
}
/*
* Adds NetBSD bootinfo bootdisk and bootwedge. The partition identified
* in these bootinfo fields is the root device.
*/
static void
grub_netbsd_add_boot_disk_and_wedge (void)
{
grub_device_t dev;
grub_disk_t disk;
grub_partition_t part;
grub_uint32_t biosdev;
grub_uint32_t partmapsector;
struct grub_partition_bsd_disk_label *label;
grub_uint64_t buf[GRUB_DISK_SECTOR_SIZE / 8];
grub_uint8_t *hash;
grub_uint64_t ctx[(GRUB_MD_MD5->contextsize + 7) / 8];
dev = grub_device_open (0);
if (! (dev && dev->disk && dev->disk->partition))
goto fail;
disk = dev->disk;
part = disk->partition;
if (disk->dev && disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
biosdev = (grub_uint32_t) disk->id & 0xff;
else
biosdev = 0xff;
/* Absolute sector of the partition map describing this partition. */
partmapsector = grub_partition_get_start (part->parent) + part->offset;
disk->partition = part->parent;
if (grub_disk_read (disk, part->offset, 0, GRUB_DISK_SECTOR_SIZE, buf) != GRUB_ERR_NONE)
goto fail;
disk->partition = part;
/* Fill bootwedge. */
{
struct grub_netbsd_btinfo_bootwedge biw;
grub_memset (&biw, 0, sizeof (biw));
biw.biosdev = biosdev;
biw.startblk = grub_partition_get_start (part);
biw.nblks = part->len;
biw.matchblk = partmapsector;
biw.matchnblks = 1;
GRUB_MD_MD5->init (&ctx);
GRUB_MD_MD5->write (&ctx, buf, GRUB_DISK_SECTOR_SIZE);
GRUB_MD_MD5->final (&ctx);
hash = GRUB_MD_MD5->read (&ctx);
memcpy (biw.matchhash, hash, 16);
grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw));
}
/* Fill bootdisk if this a NetBSD disk label. */
label = (struct grub_partition_bsd_disk_label *) &buf;
if (part->partmap != NULL &&
(grub_strcmp (part->partmap->name, "netbsd") == 0) &&
label->magic == grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
{
struct grub_netbsd_btinfo_bootdisk bid;
grub_memset (&bid, 0, sizeof (bid));
bid.labelsector = partmapsector;
bid.label.type = label->type;
bid.label.checksum = label->checksum;
memcpy (bid.label.packname, label->packname, 16);
bid.biosdev = biosdev;
bid.partition = part->number;
grub_bsd_add_meta (NETBSD_BTINFO_BOOTDISK, &bid, sizeof (bid));
}
fail:
if (dev)
grub_device_close (dev);
}
static grub_err_t
grub_netbsd_boot (void)
{
@ -1607,6 +1689,8 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
grub_bsd_add_meta (NETBSD_BTINFO_CONSOLE, &cons, sizeof (cons));
}
grub_netbsd_add_boot_disk_and_wedge ();
grub_loader_set (grub_netbsd_boot, grub_bsd_unload, 0);
}

View file

@ -45,15 +45,18 @@ GRUB_MOD_LICENSE ("GPLv3+");
#include <grub/efi/efi.h>
#define HAS_VGA_TEXT 0
#define DEFAULT_VIDEO_MODE "auto"
#define ACCEPTS_PURE_TEXT 0
#elif defined (GRUB_MACHINE_IEEE1275)
#include <grub/ieee1275/ieee1275.h>
#define HAS_VGA_TEXT 0
#define DEFAULT_VIDEO_MODE "text"
#define ACCEPTS_PURE_TEXT 1
#else
#include <grub/i386/pc/vbe.h>
#include <grub/i386/pc/console.h>
#define HAS_VGA_TEXT 1
#define DEFAULT_VIDEO_MODE "text"
#define ACCEPTS_PURE_TEXT 1
#endif
#define GRUB_LINUX_CL_OFFSET 0x1000
@ -371,6 +374,7 @@ grub_linux_setup_video (struct linux_kernel_params *params)
case GRUB_VIDEO_DRIVER_VGA:
case GRUB_VIDEO_DRIVER_CIRRUS:
case GRUB_VIDEO_DRIVER_BOCHS:
case GRUB_VIDEO_DRIVER_RADEON_FULOONG2E:
/* Make gcc happy. */
case GRUB_VIDEO_DRIVER_SDL:
case GRUB_VIDEO_DRIVER_NONE:
@ -483,12 +487,22 @@ grub_linux_boot (void)
tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar);
if (! tmp)
return grub_errno;
#if ACCEPTS_PURE_TEXT
err = grub_video_set_mode (tmp, 0, 0);
#else
err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
#endif
grub_free (tmp);
}
else
err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0);
{
#if ACCEPTS_PURE_TEXT
err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0);
#else
err = grub_video_set_mode (DEFAULT_VIDEO_MODE,
GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
#endif
}
if (err)
{
grub_print_error ();

View file

@ -41,7 +41,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
const char loongson_machtypes[][60] =
{
[GRUB_ARCH_MACHINE_YEELOONG] = "machtype=lemote-yeeloong-2f-8.9inches",
[GRUB_ARCH_MACHINE_FULOONG] = "machtype=lemote-fuloong-2f-unknown"
[GRUB_ARCH_MACHINE_FULOONG2F] = "machtype=lemote-fuloong-2f-unknown",
[GRUB_ARCH_MACHINE_FULOONG2E] = "machtype=lemote-fuloong-2e-unknown"
};
#endif

View file

@ -22,12 +22,14 @@
# define ELFCLASSXX ELFCLASS32
# define Elf_Ehdr Elf32_Ehdr
# define Elf_Phdr Elf32_Phdr
# define Elf_Shdr Elf32_Shdr
#elif defined(MULTIBOOT_LOAD_ELF64)
# define XX 64
# define E_MACHINE MULTIBOOT_ELF64_MACHINE
# define ELFCLASSXX ELFCLASS64
# define Elf_Ehdr Elf64_Ehdr
# define Elf_Phdr Elf64_Phdr
# define Elf_Shdr Elf64_Shdr
#else
#error "I'm confused"
#endif
@ -223,3 +225,4 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
#undef ELFCLASSXX
#undef Elf_Ehdr
#undef Elf_Phdr
#undef Elf_Shdr

View file

@ -232,7 +232,8 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
grub_env_export ("chosen");
grub_free (buf);
}
for (ptr = def; *ptr; ptr++)
for (ptr = def; ptr && *ptr; ptr++)
{
if (ptr[0] == '>' && ptr[1] == '>')
{
@ -242,10 +243,12 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
if (ptr[0] == '>')
break;
}
if (ptr[0] && ptr[1])
if (ptr && ptr[0] && ptr[1])
grub_env_set ("default", ptr + 1);
else
grub_env_unset ("default");
grub_script_execute_sourcecode (entry->sourcecode, entry->argc, entry->args);
if (errs_before != grub_err_printed_errors)

View file

@ -239,6 +239,15 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args)
return GRUB_ERR_NONE;
}
#ifdef GRUB_MACHINE_MIPS_LOONGSON
const char loongson_defserial[][6] =
{
[GRUB_ARCH_MACHINE_YEELOONG] = "com0",
[GRUB_ARCH_MACHINE_FULOONG2F] = "com2",
[GRUB_ARCH_MACHINE_FULOONG2E] = "com1"
};
#endif
grub_err_t
grub_serial_register (struct grub_serial_port *port)
{
@ -301,9 +310,7 @@ grub_serial_register (struct grub_serial_port *port)
port->term_out = out;
grub_terminfo_output_register (out, "vt100");
#ifdef GRUB_MACHINE_MIPS_LOONGSON
if (grub_strcmp (port->name,
(grub_arch_machine == GRUB_ARCH_MACHINE_YEELOONG)
? "com0" : "com2") == 0)
if (grub_strcmp (port->name, loongson_defserial[grub_arch_machine]) == 0)
{
grub_term_register_input_active ("serial_*", in);
grub_term_register_output_active ("serial_*", out);

View file

@ -274,6 +274,56 @@ grub_vbe_bios_get_pm_interface (grub_uint16_t *segment, grub_uint16_t *offset,
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f11 to get flat panel information, return status. */
static grub_vbe_status_t
grub_vbe_bios_get_flat_panel_info (struct grub_vbe_flat_panel_info *flat_panel_info)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f11;
regs.ebx = 0x0001;
regs.es = (((grub_addr_t) flat_panel_info) & 0xffff0000) >> 4;
regs.edi = ((grub_addr_t) flat_panel_info) & 0xffff;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f15 to get DDC availability, return status. */
static grub_vbe_status_t
grub_vbe_bios_get_ddc_capabilities (grub_uint8_t *level)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f15;
regs.ebx = 0x0000;
regs.ecx = 0x0000;
regs.es = 0x0000;
regs.edi = 0x0000;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
*level = regs.ebx & 0xff;
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f15 to read EDID information, return status. */
static grub_vbe_status_t
grub_vbe_bios_read_edid (struct grub_video_edid_info *edid_info)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f15;
regs.ebx = 0x0001;
regs.ecx = 0x0000;
regs.edx = 0x0000;
regs.es = (((grub_addr_t) edid_info) & 0xffff0000) >> 4;
regs.edi = ((grub_addr_t) edid_info) & 0xffff;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
grub_err_t
grub_vbe_probe (struct grub_vbe_info_block *info_block)
@ -328,6 +378,61 @@ grub_vbe_probe (struct grub_vbe_info_block *info_block)
return GRUB_ERR_NONE;
}
static grub_err_t
grub_video_vbe_get_edid (struct grub_video_edid_info *edid_info)
{
struct grub_video_edid_info *edid_info_lowmem;
/* Use low memory scratch area as temporary storage for VESA BIOS calls. */
edid_info_lowmem =
(struct grub_video_edid_info *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
grub_memset (edid_info_lowmem, 0, sizeof (*edid_info_lowmem));
if (grub_vbe_bios_read_edid (edid_info_lowmem) != GRUB_VBE_STATUS_OK)
return grub_error (GRUB_ERR_BAD_DEVICE, "EDID information not available");
grub_memcpy (edid_info, edid_info_lowmem, sizeof (*edid_info));
return GRUB_ERR_NONE;
}
static grub_err_t
grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height)
{
grub_vbe_status_t status;
grub_uint8_t ddc_level;
struct grub_video_edid_info edid_info;
struct grub_vbe_flat_panel_info *flat_panel_info;
/* Use low memory scratch area as temporary storage for VESA BIOS calls. */
flat_panel_info = (struct grub_vbe_flat_panel_info *)
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + sizeof (struct grub_video_edid_info));
grub_memset (flat_panel_info, 0, sizeof (*flat_panel_info));
if (controller_info.version >= 0x200
&& (grub_vbe_bios_get_ddc_capabilities (&ddc_level) & 0xff)
== GRUB_VBE_STATUS_OK)
{
if (grub_video_vbe_get_edid (&edid_info) == GRUB_ERR_NONE
&& grub_video_edid_checksum (&edid_info) == GRUB_ERR_NONE
&& grub_video_edid_preferred_mode (&edid_info, width, height)
== GRUB_ERR_NONE)
return GRUB_ERR_NONE;
grub_errno = GRUB_ERR_NONE;
}
status = grub_vbe_bios_get_flat_panel_info (flat_panel_info);
if (status == GRUB_VBE_STATUS_OK)
{
*width = flat_panel_info->horizontal_size;
*height = flat_panel_info->vertical_size;
return GRUB_ERR_NONE;
}
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot get preferred mode");
}
grub_err_t
grub_vbe_set_video_mode (grub_uint32_t vbe_mode,
struct grub_vbe_mode_info_block *vbe_mode_info)
@ -697,11 +802,28 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
struct grub_vbe_mode_info_block best_vbe_mode_info;
grub_uint32_t best_vbe_mode = 0;
int depth;
int preferred_mode = 0;
/* Decode depth from mode_type. If it is zero, then autodetect. */
depth = (mode_type & GRUB_VIDEO_MODE_TYPE_DEPTH_MASK)
>> GRUB_VIDEO_MODE_TYPE_DEPTH_POS;
if (width == 0 && height == 0)
{
grub_vbe_get_preferred_mode (&width, &height);
if (grub_errno == GRUB_ERR_NONE)
preferred_mode = 1;
else
{
/* Fall back to 640x480. This is conservative, but the largest
mode supported by the graphics card may not be safe for the
display device. */
grub_errno = GRUB_ERR_NONE;
width = 640;
height = 480;
}
}
/* Walk thru mode list and try to find matching mode. */
for (p = vbe_mode_list; *p != 0xFFFF; p++)
{
@ -744,10 +866,21 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
/* Unsupported bitdepth . */
continue;
if (((vbe_mode_info.x_resolution != width)
|| (vbe_mode_info.y_resolution != height)) && width != 0 && height != 0)
/* Non matching resolution. */
continue;
if (preferred_mode)
{
if (vbe_mode_info.x_resolution > width
|| vbe_mode_info.y_resolution > height)
/* Resolution exceeds that of preferred mode. */
continue;
}
else
{
if (((vbe_mode_info.x_resolution != width)
|| (vbe_mode_info.y_resolution != height))
&& width != 0 && height != 0)
/* Non matching resolution. */
continue;
}
/* Check if user requested RGB or index color mode. */
if ((mode_mask & GRUB_VIDEO_MODE_TYPE_COLOR_MASK) != 0)
@ -901,6 +1034,7 @@ static struct grub_video_adapter grub_video_vbe_adapter =
.set_active_render_target = grub_video_fb_set_active_render_target,
.get_active_render_target = grub_video_fb_get_active_render_target,
.iterate = grub_video_vbe_iterate,
.get_edid = grub_video_vbe_get_edid,
.print_adapter_specific_info = grub_video_vbe_print_adapter_specific_info,
.next = 0

View file

@ -0,0 +1,231 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc.
*
* GRUB 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 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/>.
*/
#define grub_video_render_target grub_video_fbrender_target
#include <grub/err.h>
#include <grub/types.h>
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/video.h>
#include <grub/video_fb.h>
#include <grub/pci.h>
#include <grub/vga.h>
#define GRUB_RADEON_FULOONG2E_TOTAL_MEMORY_SPACE 1048576
static struct
{
struct grub_video_mode_info mode_info;
struct grub_video_render_target *render_target;
grub_uint8_t *ptr;
int mapped;
grub_uint32_t base;
grub_pci_device_t dev;
} framebuffer;
static grub_err_t
grub_video_radeon_fuloong2e_video_init (void)
{
/* Reset frame buffer. */
grub_memset (&framebuffer, 0, sizeof(framebuffer));
return grub_video_fb_init ();
}
static grub_err_t
grub_video_radeon_fuloong2e_video_fini (void)
{
if (framebuffer.mapped)
grub_pci_device_unmap_range (framebuffer.dev, framebuffer.ptr,
GRUB_RADEON_FULOONG2E_TOTAL_MEMORY_SPACE);
return grub_video_fb_fini ();
}
static grub_err_t
grub_video_radeon_fuloong2e_setup (unsigned int width, unsigned int height,
unsigned int mode_type, unsigned int mode_mask __attribute__ ((unused)))
{
int depth;
grub_err_t err;
int found = 0;
#ifndef TEST
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)));
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)))
{
grub_pci_address_t addr;
grub_uint32_t class;
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
class = grub_pci_read (addr);
if (((class >> 16) & 0xffff) != GRUB_PCI_CLASS_SUBCLASS_VGA
|| pciid != 0x515a1002)
return 0;
found = 1;
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0);
framebuffer.base = grub_pci_read (addr);
framebuffer.dev = dev;
return 1;
}
/* Decode depth from mode_type. If it is zero, then autodetect. */
depth = (mode_type & GRUB_VIDEO_MODE_TYPE_DEPTH_MASK)
>> GRUB_VIDEO_MODE_TYPE_DEPTH_POS;
if ((width != 640 && width != 0) || (height != 480 && height != 0)
|| (depth != 16 && depth != 0))
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Only 1024x600x16 is supported");
grub_pci_iterate (find_card);
if (!found)
return grub_error (GRUB_ERR_IO, "Couldn't find graphics card");
#endif
/* Fill mode info details. */
framebuffer.mode_info.width = 640;
framebuffer.mode_info.height = 480;
framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_RGB;
framebuffer.mode_info.bpp = 16;
framebuffer.mode_info.bytes_per_pixel = 2;
framebuffer.mode_info.pitch = 640 * 2;
framebuffer.mode_info.number_of_colors = 256;
framebuffer.mode_info.red_mask_size = 5;
framebuffer.mode_info.red_field_pos = 11;
framebuffer.mode_info.green_mask_size = 6;
framebuffer.mode_info.green_field_pos = 5;
framebuffer.mode_info.blue_mask_size = 5;
framebuffer.mode_info.blue_field_pos = 0;
framebuffer.mode_info.reserved_mask_size = 0;
framebuffer.mode_info.reserved_field_pos = 0;
#ifndef TEST
framebuffer.mode_info.blit_format
= grub_video_get_blit_format (&framebuffer.mode_info);
#endif
/* We can safely discard volatile attribute. */
#ifndef TEST
framebuffer.ptr
= (void *) grub_pci_device_map_range (framebuffer.dev,
framebuffer.base,
GRUB_RADEON_FULOONG2E_TOTAL_MEMORY_SPACE);
#endif
framebuffer.mapped = 1;
/* Prevent garbage from appearing on the screen. */
grub_memset (framebuffer.ptr, 0x55,
framebuffer.mode_info.height * framebuffer.mode_info.pitch);
#ifndef TEST
err = grub_video_fb_create_render_target_from_pointer (&framebuffer
.render_target,
&framebuffer.mode_info,
framebuffer.ptr);
if (err)
return err;
err = grub_video_fb_set_active_render_target (framebuffer.render_target);
if (err)
return err;
/* Copy default palette to initialize emulated palette. */
err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
grub_video_fbstd_colors);
#endif
return err;
}
static grub_err_t
grub_video_radeon_fuloong2e_swap_buffers (void)
{
/* TODO: Implement buffer swapping. */
return GRUB_ERR_NONE;
}
static grub_err_t
grub_video_radeon_fuloong2e_set_active_render_target (struct grub_video_render_target *target)
{
if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY)
target = framebuffer.render_target;
return grub_video_fb_set_active_render_target (target);
}
static grub_err_t
grub_video_radeon_fuloong2e_get_info_and_fini (struct grub_video_mode_info *mode_info,
void **framebuf)
{
grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info));
*framebuf = (char *) framebuffer.ptr;
grub_video_fb_fini ();
return GRUB_ERR_NONE;
}
static struct grub_video_adapter grub_video_radeon_fuloong2e_adapter =
{
.name = "RADEON RV100 QZ (Fuloong2E) Video Driver",
.id = GRUB_VIDEO_DRIVER_RADEON_FULOONG2E,
.prio = GRUB_VIDEO_ADAPTER_PRIO_NATIVE,
.init = grub_video_radeon_fuloong2e_video_init,
.fini = grub_video_radeon_fuloong2e_video_fini,
.setup = grub_video_radeon_fuloong2e_setup,
.get_info = grub_video_fb_get_info,
.get_info_and_fini = grub_video_radeon_fuloong2e_get_info_and_fini,
.set_palette = grub_video_fb_set_palette,
.get_palette = grub_video_fb_get_palette,
.set_viewport = grub_video_fb_set_viewport,
.get_viewport = grub_video_fb_get_viewport,
.map_color = grub_video_fb_map_color,
.map_rgb = grub_video_fb_map_rgb,
.map_rgba = grub_video_fb_map_rgba,
.unmap_color = grub_video_fb_unmap_color,
.fill_rect = grub_video_fb_fill_rect,
.blit_bitmap = grub_video_fb_blit_bitmap,
.blit_render_target = grub_video_fb_blit_render_target,
.scroll = grub_video_fb_scroll,
.swap_buffers = grub_video_radeon_fuloong2e_swap_buffers,
.create_render_target = grub_video_fb_create_render_target,
.delete_render_target = grub_video_fb_delete_render_target,
.set_active_render_target = grub_video_radeon_fuloong2e_set_active_render_target,
.get_active_render_target = grub_video_fb_get_active_render_target,
.next = 0
};
GRUB_MOD_INIT(video_radeon_fuloong2e)
{
grub_video_register (&grub_video_radeon_fuloong2e_adapter);
}
GRUB_MOD_FINI(video_radeon_fuloong2e)
{
grub_video_unregister (&grub_video_radeon_fuloong2e_adapter);
}

View file

@ -376,6 +376,50 @@ grub_video_get_active_render_target (struct grub_video_render_target **target)
return grub_video_adapter_active->get_active_render_target (target);
}
grub_err_t
grub_video_edid_checksum (struct grub_video_edid_info *edid_info)
{
const char *edid_bytes = (const char *) edid_info;
int i;
char checksum = 0;
/* Check EDID checksum. */
for (i = 0; i < 128; ++i)
checksum += edid_bytes[i];
if (checksum != 0)
return grub_error (GRUB_ERR_BAD_DEVICE,
"invalid EDID checksum %d", checksum);
grub_errno = GRUB_ERR_NONE;
return grub_errno;
}
grub_err_t
grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info,
unsigned int *width, unsigned int *height)
{
/* Bit 1 in the Feature Support field indicates that the first
Detailed Timing Description is the preferred timing mode. */
if (edid_info->version == 1 /* we don't understand later versions */
&& (edid_info->feature_support
& GRUB_VIDEO_EDID_FEATURE_PREFERRED_TIMING_MODE)
&& edid_info->detailed_timings[0].pixel_clock)
{
*width = edid_info->detailed_timings[0].horizontal_active_lo
| (((unsigned int)
(edid_info->detailed_timings[0].horizontal_hi & 0xf0))
<< 4);
*height = edid_info->detailed_timings[0].vertical_active_lo
| (((unsigned int)
(edid_info->detailed_timings[0].vertical_hi & 0xf0))
<< 4);
return GRUB_ERR_NONE;
}
return grub_error (GRUB_ERR_BAD_DEVICE, "no preferred mode available");
}
/* Parse <width>x<height>[x<depth>]*/
static grub_err_t
parse_modespec (const char *current_mode, int *width, int *height, int *depth)

View file

@ -170,6 +170,7 @@ struct grub_ata
/* Sector count. */
grub_uint64_t size;
grub_uint32_t log_sector_size;
/* CHS maximums. */
grub_uint16_t cylinders;

View file

@ -80,7 +80,10 @@ struct grub_partition_bsd_entry
struct grub_partition_bsd_disk_label
{
grub_uint32_t magic;
grub_uint8_t padding[128];
grub_uint16_t type;
grub_uint8_t unused1[18];
grub_uint8_t packname[16];
grub_uint8_t unused2[92];
grub_uint32_t magic2;
grub_uint16_t checksum;
grub_uint16_t num_partitions;

View file

@ -77,6 +77,7 @@
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP 0x04000000
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1 0x00070000
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 0x00500000
#define GRUB_CS5536_MSR_DIVIL_RESET 0x80000017
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK 0x80000024
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK 0x80000025
#define GRUB_CS5536_DIVIL_LPC_INTERRUPTS 0x1002

View file

@ -175,6 +175,11 @@ grub_err_t EXPORT_FUNC(grub_disk_write) (grub_disk_t disk,
grub_uint64_t EXPORT_FUNC(grub_disk_get_size) (grub_disk_t disk);
#if DISK_CACHE_STATS
void
EXPORT_FUNC(grub_disk_cache_get_performance) (unsigned long *hits, unsigned long *misses);
#endif
extern void (* EXPORT_VAR(grub_disk_firmware_fini)) (void);
extern int EXPORT_VAR(grub_disk_firmware_is_tainted);

View file

@ -51,9 +51,11 @@
#define NETBSD_BTINFO_BOOTPATH 0
#define NETBSD_BTINFO_ROOTDEVICE 1
#define NETBSD_BTINFO_BOOTDISK 3
#define NETBSD_BTINFO_CONSOLE 6
#define NETBSD_BTINFO_SYMTAB 8
#define NETBSD_BTINFO_MEMMAP 9
#define NETBSD_BTINFO_BOOTWEDGE 10
#define NETBSD_BTINFO_MODULES 11
#define NETBSD_BTINFO_FRAMEBUF 12
@ -83,6 +85,15 @@ struct grub_netbsd_btinfo_bootdisk
grub_uint32_t partition;
};
struct grub_netbsd_btinfo_bootwedge {
grub_uint32_t biosdev;
grub_disk_addr_t startblk;
grub_uint64_t nblks;
grub_disk_addr_t matchblk;
grub_uint64_t matchnblks;
grub_uint8_t matchhash[16]; /* MD5 hash */
} __packed;
struct grub_netbsd_btinfo_symtab
{
grub_uint32_t nsyms;

View file

@ -19,6 +19,8 @@
#ifndef GRUB_VBE_MACHINE_HEADER
#define GRUB_VBE_MACHINE_HEADER 1
#include <grub/video.h>
/* Default video mode to be used. */
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101
@ -169,6 +171,21 @@ struct grub_vbe_palette_data
grub_uint8_t alignment;
} __attribute__ ((packed));
struct grub_vbe_flat_panel_info
{
grub_uint16_t horizontal_size;
grub_uint16_t vertical_size;
grub_uint16_t panel_type;
grub_uint8_t red_bpp;
grub_uint8_t green_bpp;
grub_uint8_t blue_bpp;
grub_uint8_t reserved_bpp;
grub_uint32_t reserved_offscreen_mem_size;
grub_vbe_farptr_t reserved_offscreen_mem_ptr;
grub_uint8_t reserved[14];
} __attribute__ ((packed));
/* Prototypes for helper functions. */
/* Call VESA BIOS 0x4f00 to get VBE Controller Information, return status. */
grub_vbe_status_t

View file

@ -16,8 +16,8 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#include <grub/symbol.h>

View file

@ -66,6 +66,7 @@
#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
#define GRUB_CPU_LOONGSON_COP0_PRID GRUB_CPU_REGISTER_WRAP($15)
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI GRUB_CPU_REGISTER_WRAP($29)

View file

@ -23,7 +23,8 @@
#include <grub/cpu/kernel.h>
#define GRUB_ARCH_MACHINE_YEELOONG 0
#define GRUB_ARCH_MACHINE_FULOONG 1
#define GRUB_ARCH_MACHINE_FULOONG2F 1
#define GRUB_ARCH_MACHINE_FULOONG2E 2
#ifndef ASM_FILE

View file

@ -26,8 +26,6 @@
#define GRUB_LOONGSON_OHCI_PCIID 0x00351033
#define GRUB_LOONGSON_EHCI_PCIID 0x00e01033
#define GRUB_LOONGSON_OHCI_GHOST_FUNCTION 4
#define GRUB_LOONGSON_EHCI_GHOST_FUNCTION 5
#define GRUB_PCI_NUM_BUS 1
#define GRUB_PCI_NUM_DEVICES 16
@ -66,7 +64,7 @@ grub_pci_read (grub_pci_address_t addr)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
| (addr & 0x07ff));
}
static inline grub_uint16_t
@ -74,7 +72,7 @@ grub_pci_read_word (grub_pci_address_t addr)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
| (addr & 0x07ff));
}
static inline grub_uint8_t
@ -82,7 +80,7 @@ grub_pci_read_byte (grub_pci_address_t addr)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
| (addr & 0x07ff));
}
static inline void
@ -90,7 +88,7 @@ grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
| (addr & 0x07ff)) = data;
}
static inline void
@ -98,7 +96,7 @@ grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
| (addr & 0x07ff)) = data;
}
static inline void
@ -106,7 +104,7 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
| (addr & 0x07ff)) = data;
}
volatile void *

View file

@ -47,7 +47,6 @@ void grub_util_write_image_at (const void *img, size_t size, off_t offset,
void sync (void);
int fsync (int fno);
void sleep(int s);
grub_int64_t grub_util_get_disk_size (char *name);

View file

@ -210,6 +210,66 @@ struct grub_video_palette_data
grub_uint8_t a; /* Reserved bits value (0-255). */
};
struct grub_video_edid_info
{
grub_uint8_t header[8];
grub_uint16_t manufacturer_id;
grub_uint16_t product_id;
grub_uint32_t serial_number;
grub_uint8_t week_of_manufacture;
grub_uint8_t year_of_manufacture;
grub_uint8_t version;
grub_uint8_t revision;
grub_uint8_t video_input_definition;
grub_uint8_t max_horizontal_image_size;
grub_uint8_t max_vertical_image_size;
grub_uint8_t display_gamma;
grub_uint8_t feature_support;
#define GRUB_VIDEO_EDID_FEATURE_PREFERRED_TIMING_MODE (1 << 1)
grub_uint8_t red_green_lo;
grub_uint8_t blue_white_lo;
grub_uint8_t red_x_hi;
grub_uint8_t red_y_hi;
grub_uint8_t green_x_hi;
grub_uint8_t green_y_hi;
grub_uint8_t blue_x_hi;
grub_uint8_t blue_y_hi;
grub_uint8_t white_x_hi;
grub_uint8_t white_y_hi;
grub_uint8_t established_timings_1;
grub_uint8_t established_timings_2;
grub_uint8_t manufacturer_reserved_timings;
grub_uint16_t standard_timings[8];
struct {
grub_uint16_t pixel_clock;
/* Only valid if the pixel clock is non-null. */
grub_uint8_t horizontal_active_lo;
grub_uint8_t horizontal_blanking_lo;
grub_uint8_t horizontal_hi;
grub_uint8_t vertical_active_lo;
grub_uint8_t vertical_blanking_lo;
grub_uint8_t vertical_hi;
grub_uint8_t horizontal_sync_offset_lo;
grub_uint8_t horizontal_sync_pulse_width_lo;
grub_uint8_t vertical_sync_lo;
grub_uint8_t sync_hi;
grub_uint8_t horizontal_image_size_lo;
grub_uint8_t vertical_image_size_lo;
grub_uint8_t image_size_hi;
grub_uint8_t horizontal_border;
grub_uint8_t vertical_border;
grub_uint8_t flags;
} detailed_timings[4];
grub_uint8_t extension_flag;
grub_uint8_t checksum;
} __attribute__ ((packed));
typedef enum grub_video_driver_id
{
GRUB_VIDEO_DRIVER_NONE,
@ -222,6 +282,7 @@ typedef enum grub_video_driver_id
GRUB_VIDEO_DRIVER_BOCHS,
GRUB_VIDEO_DRIVER_SDL,
GRUB_VIDEO_DRIVER_SIS315PRO,
GRUB_VIDEO_DRIVER_RADEON_FULOONG2E,
} grub_video_driver_id_t;
typedef enum grub_video_adapter_prio
@ -312,6 +373,8 @@ struct grub_video_adapter
int (*iterate) (int (*hook) (const struct grub_video_mode_info *info));
grub_err_t (*get_edid) (struct grub_video_edid_info *edid_info);
void (*print_adapter_specific_info) (void);
};
typedef struct grub_video_adapter *grub_video_adapter_t;
@ -424,6 +487,11 @@ grub_err_t EXPORT_FUNC (grub_video_set_active_render_target) (struct grub_video_
grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target);
grub_err_t EXPORT_FUNC (grub_video_edid_checksum) (struct grub_video_edid_info *edid_info);
grub_err_t EXPORT_FUNC (grub_video_edid_preferred_mode) (struct grub_video_edid_info *edid_info,
unsigned int *width,
unsigned int *height);
grub_err_t EXPORT_FUNC (grub_video_set_mode) (const char *modestring,
unsigned int modemask,
unsigned int modevalue);

View file

@ -90,7 +90,7 @@ typedef union zap_leaf_chunk {
{
grub_uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
grub_uint64_t la_array64;
};
} __attribute__ ((packed));
grub_uint16_t la_next; /* next blk or CHAIN_END */
} l_array;
struct zap_leaf_free {

File diff suppressed because it is too large Load diff

View file

@ -402,7 +402,7 @@ unset __grub_mkimage_program
#
# grub-mkpasswd-pbkdf2
#
_grub_mkpasswd-pbkdf2 () {
_grub_mkpasswd_pbkdf2 () {
local cur
COMPREPLY=()
@ -417,7 +417,7 @@ _grub_mkpasswd-pbkdf2 () {
}
__grub_mkpasswd_pbkdf2_program=$( echo grub-mkpasswd-pbkdf2 | sed "@program_transform_name@" )
have ${__grub_mkpasswd_pbkdf2_program} && \
complete -F _grub_mkpasswd-pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
unset __grub_mkpasswd_pbkdf2_program
@ -462,7 +462,7 @@ unset __grub_probe_program
#
# grub-script-check
#
_grub_script-check () {
_grub_script_check () {
local cur
COMPREPLY=()
@ -477,7 +477,7 @@ _grub_script-check () {
}
__grub_script_check_program=$( echo grub-script-check | sed "@program_transform_name@" )
have ${__grub_script_check_program} && \
complete -F _grub_script-check -o filenames ${__grub_script_check_program}
complete -F _grub_script_check -o filenames ${__grub_script_check_program}
# Local variables:

View file

@ -298,6 +298,12 @@ get_ataraid_disk_name (char *name, int unit)
{
sprintf (name, "/dev/ar%d", unit);
}
static void
get_mfi_disk_name (char *name, int unit)
{
sprintf (name, "/dev/mfid%d", unit);
}
#endif
#ifdef __linux__
@ -661,6 +667,19 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
goto out;
}
}
/* LSI MegaRAID SAS. */
for (i = 0; i < 32; i++)
{
char name[20];
get_mfi_disk_name (name, i);
if (check_device_readable_unique (name))
{
if (hook (name, 0))
goto out;
}
}
#endif
#ifdef __linux__

View file

@ -68,6 +68,7 @@ enum {
#define BUF_SIZE 32256
static grub_disk_addr_t skip, leng;
static int uncompress = 0;
static void
read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
@ -111,7 +112,8 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
return;
}
grub_file_filter_disable_compression ();
if (uncompress == 0)
grub_file_filter_disable_compression ();
file = grub_file_open (pathname);
if (!file)
{
@ -409,6 +411,7 @@ static struct argp_option options[] = {
{"debug", 'd', "S", 0, N_("Set debug environment variable."), 2},
{"crypto", 'C', NULL, OPTION_ARG_OPTIONAL, N_("Mount crypto devices."), 2},
{"verbose", 'v', NULL, OPTION_ARG_OPTIONAL, N_("Print verbose messages."), 2},
{"uncompress", 'u', NULL, OPTION_ARG_OPTIONAL, N_("Uncompress data."), 2},
{0, 0, 0, 0, 0, 0}
};
@ -469,6 +472,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
verbosity++;
return 0;
case 'u':
uncompress = 1;
return 0;
case ARGP_KEY_END:
if (args_count < num_disks)
{

View file

@ -263,6 +263,8 @@ do
esac
done
. ${libdir}/@PACKAGE@/grub-mkconfig_lib
if test "x$install_device" = x && ([ "${target_cpu}-${platform}" = "i386-pc" ] \
|| [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ]); then
echo "install_device not specified." 1>&2
@ -333,6 +335,12 @@ if [ x"$platform" = xefi ]; then
if test "x$install_device" != "x`"$grub_mkdevicemap" --device-map=/dev/stdout | "$grub_probe" --target=device --device-map=/dev/stdin "${bootdir}"`"; then
efidir="${bootdir}/efi"
fi
elif test -d "${bootdir}/EFI"; then
install_device="`"$grub_mkdevicemap" --device-map=/dev/stdout | "$grub_probe" --target=device --device-map=/dev/stdin "${bootdir}/EFI"`"
# Is it a mount point?
if test "x$install_device" != "x`"$grub_mkdevicemap" --device-map=/dev/stdout | "$grub_probe" --target=device --device-map=/dev/stdin "${bootdir}"`"; then
efidir="${bootdir}/EFI"
fi
elif test -n "$rootdir" && test "x$rootdir" != "x/"; then
# The EFI System Partition may have been given directly using
# --root-directory.
@ -496,7 +504,11 @@ if [ "x$disk_module" = xata ]; then
fi
if [ "x$disk_module" = xnative ]; then
disk_module="pata ahci ohci uhci usbms"
disk_module="pata ahci ohci"
if [ "x$target_cpu" = "xi386" ] || [ "x$target_cpu" = "xx86_64" ]; then
disk_module="$disk_module uhci"
fi
disk_module="$disk_module usbms"
fi
# The order in this list is critical. Be careful when modifying it.
@ -546,11 +558,6 @@ if [ "x${devabstraction_module}" = "x" ] ; then
exit 1
fi
if [ x$GRUB_CRYPTODISK_ENABLE = xy ]; then
for uuid in "`"${grub_probe}" --device "${device}" --target=cryptodisk_uuid`"; do
echo "cryptomount -u $uuid"
done
fi
echo "search.fs_uuid ${uuid} root " >> "${grubdir}/load.cfg"
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
@ -565,6 +572,14 @@ if [ "x${devabstraction_module}" = "x" ] ; then
fi
fi
else
if [ x$GRUB_CRYPTODISK_ENABLE = xy ]; then
for uuid in "`"${grub_probe}" --device "${grub_device}" --target=cryptodisk_uuid`"; do
echo "cryptomount -u $uuid" >> "${grubdir}/load.cfg"
done
fi
config_opt="-c ${grubdir}/load.cfg "
prefix_drive=`"$grub_probe" --device-map="${device_map}" --target=drive --device "${grub_device}"` || exit 1
fi

View file

@ -157,7 +157,7 @@ grub_file_is_not_garbage ()
if test -f "$1" ; then
case "$1" in
*.dpkg-*) return 1 ;; # debian dpkg
README*) return 1 ;; # documentation
README*|*/README*) return 1 ;; # documentation
esac
else
return 1

View file

@ -67,7 +67,7 @@ struct image_target_desc
IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275,
IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
IMAGE_FULOONG_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC,
IMAGE_FULOONG2F_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC,
IMAGE_QEMU_MIPS_FLASH
} id;
enum
@ -298,10 +298,10 @@ struct image_target_desc image_targets[] =
},
{
.dirname = "mipsel-loongson",
.names = { "mipsel-fuloong-flash", NULL },
.names = { "mipsel-fuloong2f-flash", NULL },
.voidp_sizeof = 4,
.bigendian = 0,
.id = IMAGE_FULOONG_FLASH,
.id = IMAGE_FULOONG2F_FLASH,
.flags = PLATFORM_FLAGS_DECOMPRESSORS,
.prefix = GRUB_KERNEL_MIPS_LOONGSON_PREFIX,
.prefix_end = GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END,
@ -321,6 +321,7 @@ struct image_target_desc image_targets[] =
{
.dirname = "mipsel-loongson",
.names = { "mipsel-loongson-elf", "mipsel-yeeloong-elf",
"mipsel-fuloong2f-elf", "mipsel-fuloong2e-elf",
"mipsel-fuloong-elf", NULL },
.voidp_sizeof = 4,
.bigendian = 0,
@ -1362,7 +1363,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
}
break;
case IMAGE_YEELOONG_FLASH:
case IMAGE_FULOONG_FLASH:
case IMAGE_FULOONG2F_FLASH:
{
char *rom_img;
size_t rom_size;
@ -1381,7 +1382,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
/* None yet. */
const grub_uint8_t fuloong_fwstart_good_hash[512 / 8] =
const grub_uint8_t fuloong2f_fwstart_good_hash[512 / 8] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -1393,10 +1394,10 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
};
const grub_uint8_t *fwstart_good_hash;
if (image_target->id == IMAGE_FULOONG_FLASH)
if (image_target->id == IMAGE_FULOONG2F_FLASH)
{
fwstart_good_hash = fuloong_fwstart_good_hash;
boot_path = grub_util_get_path (dir, "fwstart_fuloong.img");
fwstart_good_hash = fuloong2f_fwstart_good_hash;
boot_path = grub_util_get_path (dir, "fwstart_fuloong2f.img");
}
else
{

View file

@ -31,15 +31,15 @@ pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst
self=`basename $0`
multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-multiboot
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-coreboot
qemu_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-qemu
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc
efi32_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi
efi64_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi
multiboot_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-multiboot"
coreboot_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-coreboot"
qemu_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-qemu"
pc_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc"
efi32_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi"
efi64_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi"
rom_directory=
override_dir=
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
xorriso=xorriso

189
util/grub-mkstandalone.in Normal file
View file

@ -0,0 +1,189 @@
#! /bin/sh
set -e
# Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# GRUB 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 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/>.
# Initialize some variables.
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
self=`basename $0`
source_dirrectory=
compression=auto
format=
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
source=
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: $self [OPTION] SOURCE...
Make GRUB rescue image.
-h, --help print this message and exit
-v, --version print the version information and exit
-o, --output=FILE save output in FILE [required]
-d, --directory=DIR use images and modules under DIR [default=%s/@platform@]
-O, --format=FORMAT generate an image in format
available formats: %s
-C, --compression=(xz|none|auto) choose the compression to use
--modules=MODULES pre-load specified modules MODULES
--grub-mkimage=FILE use FILE as grub-mkimage
$self generates a standalone image (containing all modules) in the selected format
Report bugs to <bug-grub@gnu.org>.
EOF
}
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
# Check the arguments.
while test $# -gt 0
do
option=$1
shift
case "$option" in
-h | --help)
usage
exit 0 ;;
-v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;;
--modules)
modules=`argument $option "$@"`; shift ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
-o | --output)
output_image=`argument $option "$@"`; shift ;;
--output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;;
--directory | -d)
source_directory=`argument $option "$@"`; shift ;;
--directory=*)
source_directory=`echo "$option" | sed 's/--rom-directory=//'` ;;
--grub-mkimage)
grub_mkimage=`argument $option "$@"`; shift ;;
--grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--compression | -C)
compression=`argument $option "$@"`; shift ;;
--compression=*)
compression=`echo "${option}/" | sed 's/--xorriso=//'` ;;
--format | -O)
format=`argument $option "$@"`; shift ;;
--format=*)
format=`echo "${option}/" | sed 's/--xorriso=//'` ;;
*)
source="${source} ${option} $@"; break ;;
esac
done
if [ "x${output_image}" = x ] ; then
echo "output file must be given" >&2
usage
exit 1
fi
if [ "x${format}" = x ] ; then
echo "format must be given" >&2
usage
exit 1
fi
if [ "x$source_directory" = x ] ; then
cpu="`echo $format | awk -F - '{ print $1; }'`"
platform="`echo $format | awk -F - '{ print $2; }'`"
case "$platform" in
yeeloong | fuloong | fuloong2f | fuloong2e)
platform=loongson ;;
esac
case "$cpu-$platform" in
mips-loongson)
cpu=mipsel ;;
esac
source_directory="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/$cpu-$platform"
fi
set $grub_mkimage dummy
if test -f "$1"; then
:
else
echo "$1: Not found." 1>&2
exit 1
fi
memdisk_dir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
mkdir -p "${memdisk_dir}"/boot/grub
for file in "${source_directory}/"*.mod "${source_directory}/"efiemu32.o "${source_directory}/"efiemu64.o; do
if test -f "$file"; then
cp -f "$file" "${memdisk_dir}"/boot/grub/
fi
done
for file in ${pkglib_DATA}; do
if test -f "${source_directory}/${file}"; then
cp -f "${source_directory}/${file}" "${memdisk_dir}"/boot/grub/
fi
done
mkdir -p "${memdisk_dir}"/boot/grub/locale
for file in "${source_directory}"/po/*.mo; do
if test -f "$file"; then
cp -f "$file" "${memdisk_dir}"/boot/grub/locale/
fi
done
for file in $source; do
cp -f "$file" "${memdisk_dir}"/"$file";
done
memdisk_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
(cd "${memdisk_dir}"; tar -cf - * $source) > "${memdisk_img}"
rm -rf "${memdisk_dir}"
$grub_mkimage -O "${format}" -C "$compression" -d "${source_directory}" -m "${memdisk_img}" -o "$output_image" --prefix='(memdisk)/boot/grub' memdisk tar $modules
rm -rf "${memdisk_img}"
exit 0

View file

@ -21,7 +21,6 @@
#include <grub/types.h>
#include <grub/emu/misc.h>
#include <grub/util/misc.h>
#include <grub/util/misc.h>
#include <grub/device.h>
#include <grub/disk.h>
#include <grub/file.h>
@ -181,7 +180,10 @@ probe (const char *path, char *device_name)
#endif
}
else
device_name = grub_guess_root_device (path);
{
grub_path = canonicalize_file_name (path);
device_name = grub_guess_root_device (grub_path);
}
if (! device_name)
grub_util_error ("cannot find a device for %s (is /dev mounted?)", path);

View file

@ -893,6 +893,7 @@ main (int argc, char *argv[])
/* Initialize all modules. */
grub_init_all ();
grub_gcry_init_all ();
grub_lvm_fini ();
grub_mdraid09_fini ();

View file

@ -36,7 +36,7 @@ done
if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=640x480 ; fi
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi
if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi
if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi

View file

@ -55,6 +55,7 @@
#ifdef __MINGW32__
#include <windows.h>
#include <winioctl.h>
#include "dirname.h"
#endif
#ifdef GRUB_UTIL
@ -316,17 +317,13 @@ int fsync (int fno __attribute__ ((unused)))
return 0;
}
void sleep (int s)
{
Sleep (s * 1000);
}
grub_int64_t
grub_util_get_disk_size (char *name)
{
HANDLE hd;
grub_int64_t size = -1LL;
strip_trailing_slashes(name);
hd = CreateFile (name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
0, OPEN_EXISTING, 0, 0);