merged with upstream

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-02 23:29:51 +01:00
commit 6174923799
30 changed files with 527 additions and 230 deletions

215
ChangeLog
View file

@ -1,3 +1,218 @@
2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/grub.d/30_os-prober.in: Add GNU/Hurd support
2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/grub.d/10_hurd.in: Drop /dev/ prefix from root device path before
giving it to GNU Mach.
2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from
GNU partition number to get internal GRUB partition number.
2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/grub.d/10_hurd.in: Call prepare_grub_to_access_device
${GRUB_DEVICE_BOOT} before loading /boot kernel.
2009-11-01 Robert Millan <rmh.grub@aybabtu.com>
Based on patch from BVK Chaitanya <bvk.groups@gmail.com>
* kern/misc.c (grub_strchr, grub_strrchr): Fix to handle c == '\0'
case.
2009-11-01 Felix Zielcke <fzielcke@z-51.de>
* Makefile.in (TARGET_CPPFLAGS): Add `-I$(srcdir)/include'.
2009-10-30 Robert Millan <rmh.grub@aybabtu.com>
Fix build problem.
* Makefile.in (TARGET_CPPFLAGS): Replace `-nostdinc' with
`-isystem=$(srcdir)/include'.
2009-10-30 Robert Millan <rmh.grub@aybabtu.com>
* util/i386/pc/grub-install.in: Remove hint that device.map should be
checked (grub-install doesn't currently rely on it).
2009-10-29 Robert Millan <rmh.grub@aybabtu.com>
Revert SVN r2660.
* conf/common.rmk (script/sh/lexer.c_DEPENDENCIES): Moved from here ...
* conf/i386-coreboot.rmk (script/sh/lexer.c_DEPENDENCIES): ... to here.
* conf/i386-efi.rmk (script/sh/lexer.c_DEPENDENCIES): ... and here.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
2009-10-28 Robert Millan <rmh.grub@aybabtu.com>
* Makefile.in (TARGET_CPPFLAGS): Add `-nostdinc'.
2009-10-28 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/misc.h: Stop checking for APPLE_CC.
2009-10-28 Robert Millan <rmh.grub@aybabtu.com>
* kern/i386/coreboot/init.c (grub_exit): Reimplement in a way that
doesn't cause an infinite call loop.
2009-10-28 Felix Zielcke <fzielcke@z-51.de>
* commands/acpi.c (grub_cmd_acpi): Fix the out of memory error
strings.
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* autogen.sh: Support addition of external modules via `GRUB_CONTRIB'
variable.
* Makefile.in: Likewise.
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* gendistlist.sh: Simplify .svn check. Skip .bzr as well.
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* Makefile.in (RMKFILES): Rewrite using $(wildcard).
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* disk/scsi.c: Remove `<grub/machine/kernel.h>' (not needed).
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* gensymlist.sh.in (COMPILE_TIME_ASSERT): Copy macro declaration
from here ...
* include/grub/misc.h (COMPILE_TIME_ASSERT): ... to here.
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* Makefile.in (docs/grub.info): Use make syntax to ignore errors
in $(MAKEINFO) invocation. This makes it clear in output that
errors are being ignored.
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* conf/i386-coreboot.rmk (script/sh/lexer.c_DEPENDENCIES): Moved
from here ...
* conf/common.rmk (script/sh/lexer.c_DEPENDENCIES): ... to here.
* conf/i386-efi.rmk (script/sh/lexer.c_DEPENDENCIES): Remove.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
2009-10-26 Colin Watson <cjwatson@ubuntu.com>
* util/grub-editenv.c (main): If only a command is given, use
DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG as a default file name.
(usage): FILENAME is now optional and has a default.
2009-10-26 Colin Watson <cjwatson@ubuntu.com>
Improve grub-mkconfig performance when there are several menu
entries on a single filesystem.
* util/grub.d/10_linux.in (linux_entry): Cache the output of
prepare_grub_to_access_device.
* util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise.
* util/grub.d/30_os-prober.in: Likewise.
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* util/grub.d/10_freebsd.in: Remove.
* util/grub.d/10_kfreebsd.in: New file (based on 10_linux.in).
* configure.ac: Set host_kernel=kfreebsd for FreeBSD and GNU/kFreeBSD.
2009-10-26 Robert Millan <rmh.grub@aybabtu.com>
* docs/grub.cfg: Fix example usage of *BSD loaders.
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
* util/i386/pc/grub-setup.c (setup): Add missing parameter to
grub_util_error() call.
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/fs.h [GRUB_UTIL] (struct grub_fs): Add
`reserved_first_sector' member.
* fs/ext2.c [GRUB_UTIL] (grub_ext2_fs): Initialize
`reserved_first_sector' to 1.
* fs/fat.c [GRUB_UTIL] (grub_fat_fs): Likewise.
* fs/ntfs.c [GRUB_UTIL] (grub_ntfs_fs): Likewise.
* fs/hfsplus.c [GRUB_UTIL] (grub_hfsplus_fs): Likewise.
* util/i386/pc/grub-setup.c (setup): Add safety check that probes for
filesystems which begin at first sector.
(options): New option --skip-fs-probe.
(main): Handle --skip-fs-probe and pass it to setup().
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/misc.h: Fix wrong evaluation of APPLE_CC.
(memset): Fix function prototype.
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
2009-10-25 Vasily Averin <vvs@parallels.com>
* fs/ext2.c (grub_ext2_iterate_dir): Avoid infinite loop when
`dirent.direntlen == 0'.
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
* fs/cpio.c [MODE_USTAR]: Initialize `tar' module instead of
`cpio'.
[! MODE_USTAR]: Initialize `cpio' module instead of `tar'.
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
* configure.ac: Check for `__ashldi3', `__ashrdi3', `__lshrdi3',
`__trampoline_setup' and `__ucmpdi2'.
* include/grub/powerpc/libgcc.h: Only export symbols for functions
that libgcc provides.
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/powerpc/libgcc.h (memset): Remove function prototype.
* include/grub/sparc64/libgcc.h (memset): Likewise.
* include/grub/misc.h (memset, memcmp): New function prototypes.
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
* fs/cpio.c [MODE_USTAR]: Finish `tar' module instead of
`cpio'.
[! MODE_USTAR]: Finish `cpio' module instead of `tar'.
2009-10-25 Robert Millan <rmh.grub@aybabtu.com>
Patch from Samuel Thibault <samuel.thibault@ens-lyon.org>
* docs/grub.cfg: Compensate for recent change in multiboot
loader (since 2009-08-14 it won't pass filename to payload).
* util/grub.d/10_hurd.in: Likewise.
2009-10-21 Felix Zielcke <fzielcke@z-51.de>
* config.guess: Update to latest version from config git
repository.
* config.sub: Likewise.
2009-10-20 Robert Millan <rmh.grub@aybabtu.com>
Fix build on sparc64.
* configure.ac: Perform checks for libgcc symbols before
adding `-nostdlib' to LDFLAGS.
2009-10-16 Vladimir Serbinenko <phcoder@gmail.com> 2009-10-16 Vladimir Serbinenko <phcoder@gmail.com>
Let user specify OpenBSD root device. Let user specify OpenBSD root device.

View file

@ -75,7 +75,7 @@ TARGET_ASFLAGS = @TARGET_ASFLAGS@
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@ TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
TARGET_APPLE_CC = @TARGET_APPLE_CC@ TARGET_APPLE_CC = @TARGET_APPLE_CC@
OBJCONV = @OBJCONV@ OBJCONV = @OBJCONV@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \ TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
-Wall -W -Wall -W
TARGET_LDFLAGS = @TARGET_LDFLAGS@ TARGET_LDFLAGS = @TARGET_LDFLAGS@
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@ TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
@ -117,9 +117,7 @@ enable_efiemu = @enable_efiemu@
### General variables. ### General variables.
RMKFILES = $(addprefix conf/,common.rmk i386-coreboot.rmk i386-efi.rmk \ RMKFILES = $(wildcard conf/*.rmk)
i386-qemu.rmk i386-ieee1275.rmk i386-pc.rmk i386.rmk powerpc-ieee1275.rmk \
sparc64-ieee1275.rmk x86_64-efi.rmk)
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
@ -152,6 +150,9 @@ $(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb
include $(srcdir)/conf/$(target_cpu)-$(platform).mk include $(srcdir)/conf/$(target_cpu)-$(platform).mk
# For external modules.
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
### General targets. ### General targets.
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA)
@ -199,7 +200,7 @@ docs/stamp-vti: docs/grub.texi configure.ac
# Use --force until such time as the documentation is cleaned up. # Use --force until such time as the documentation is cleaned up.
docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi
$(MKDIR_P) docs $(MKDIR_P) docs
$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@ || : -$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@
ifeq (, $(UNIFONT_BDF)) ifeq (, $(UNIFONT_BDF))
else else

6
autogen.sh Normal file → Executable file
View file

@ -5,8 +5,10 @@ set -e
autoconf autoconf
autoheader autoheader
echo timestamp > stamp-h.in echo timestamp > stamp-h.in
for rmk in conf/*.rmk; do for rmk in conf/*.rmk ${GRUB_CONTRIB}/*/conf/*.rmk; do
ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'` if test -e $rmk ; then
ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'`
fi
done done
./gendistlist.sh > DISTLIST ./gendistlist.sh > DISTLIST

View file

@ -552,7 +552,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
grub_free (exclude); grub_free (exclude);
grub_free (load_only); grub_free (load_only);
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Could allocate table"); "Couldn't allocate table");
} }
grub_memcpy (table_dsdt, dsdt, dsdt->length); grub_memcpy (table_dsdt, dsdt, dsdt->length);
} }
@ -579,7 +579,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
grub_free (exclude); grub_free (exclude);
grub_free (load_only); grub_free (load_only);
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Could allocate table structure"); "Couldn't allocate table structure");
} }
table->size = curtable->length; table->size = curtable->length;
table->addr = grub_malloc (table->size); table->addr = grub_malloc (table->size);
@ -588,7 +588,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
{ {
free_tables (); free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Could allocate table"); "Couldn't allocate table");
} }
table->next = acpi_tables; table->next = acpi_tables;
acpi_tables = table; acpi_tables = table;
@ -675,7 +675,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
{ {
free_tables (); free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Could allocate table structure"); "Couldn't allocate table structure");
} }
table->size = size; table->size = size;

111
config.guess vendored
View file

@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
timestamp='2009-08-19' timestamp='2009-09-18'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -854,6 +854,20 @@ EOF
i*86:Minix:*:*) i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo ${UNAME_MACHINE}-pc-minix
exit ;; exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*) arm*:Linux:*:*)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@ -876,6 +890,9 @@ EOF
frv:Linux:*:*) frv:Linux:*:*)
echo frv-unknown-linux-gnu echo frv-unknown-linux-gnu
exit ;; exit ;;
i*86:Linux:*:*)
echo ${UNAME_MACHINE}-pc-linux-gnu
exit ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
@ -911,29 +928,12 @@ EOF
or32:Linux:*:*) or32:Linux:*:*)
echo or32-unknown-linux-gnu echo or32-unknown-linux-gnu
exit ;; exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
padre:Linux:*:*) padre:Linux:*:*)
echo sparc-unknown-linux-gnu echo sparc-unknown-linux-gnu
exit ;; exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*) parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level # Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@ -942,8 +942,11 @@ EOF
*) echo hppa-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;;
esac esac
exit ;; exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*) ppc64:Linux:*:*)
echo hppa64-unknown-linux-gnu echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;; exit ;;
s390:Linux:*:* | s390x:Linux:*:*) s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux echo ${UNAME_MACHINE}-ibm-linux
@ -966,58 +969,6 @@ EOF
xtensa*:Linux:*:*) xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
# Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^LIBC/{
s: ::g
p
}'`"
test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit
}
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*) i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both # earlier versions are messed up and put the nodename in both
@ -1247,6 +1198,16 @@ EOF
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;; unknown) UNAME_PROCESSOR=powerpc ;;
esac esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}

9
config.sub vendored
View file

@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
timestamp='2009-08-19' timestamp='2009-10-07'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@ -287,6 +287,7 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \ | pyramid \
| rx \
| score \ | score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
@ -300,7 +301,7 @@ case $basic_machine in
| z8k | z80) | z8k | z80)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12) m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12. # Motorola 68HC11/12.
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
@ -371,7 +372,7 @@ case $basic_machine in
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* \ | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@ -1296,7 +1297,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*) | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)

View file

@ -121,7 +121,7 @@ esac
case "$host_os" in case "$host_os" in
gnu*) host_kernel=hurd ;; gnu*) host_kernel=hurd ;;
linux*) host_kernel=linux ;; linux*) host_kernel=linux ;;
freebsd* | kfreebsd*-gnu) host_kernel=freebsd ;; freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
cygwin) host_kernel=windows ;; cygwin) host_kernel=windows ;;
esac esac
@ -425,6 +425,9 @@ AC_SUBST(TARGET_ASFLAGS)
AC_SUBST(TARGET_CPPFLAGS) AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_LDFLAGS) AC_SUBST(TARGET_LDFLAGS)
# Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS)
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2)
# Set them to their new values for the tests below. # Set them to their new values for the tests below.
CC="$TARGET_CC" CC="$TARGET_CC"
if test "x$TARGET_APPLE_CC" = x1 ; then if test "x$TARGET_APPLE_CC" = x1 ; then
@ -435,9 +438,6 @@ fi
CPPFLAGS="$TARGET_CPPFLAGS" CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS" LDFLAGS="$TARGET_LDFLAGS"
# Check for target functions.
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2)
# Defined in aclocal.m4. # Defined in aclocal.m4.
grub_PROG_TARGET_CC grub_PROG_TARGET_CC
if test "x$TARGET_APPLE_CC" != x1 ; then if test "x$TARGET_APPLE_CC" != x1 ; then

View file

@ -23,7 +23,6 @@
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/mm.h> #include <grub/mm.h>
#include <grub/types.h> #include <grub/types.h>
#include <grub/machine/kernel.h>
#include <grub/scsi.h> #include <grub/scsi.h>
#include <grub/scsicmd.h> #include <grub/scsicmd.h>

View file

@ -15,13 +15,13 @@ set fallback=1
menuentry "GNU (aka GNU/Hurd)" { menuentry "GNU (aka GNU/Hurd)" {
set root=(hd0,1) set root=(hd0,1)
multiboot /boot/gnumach.gz root=device:hd0s1 multiboot /boot/gnumach.gz root=device:hd0s1
module /hurd/ext2fs.static --readonly \ module /hurd/ext2fs.static ext2fs --readonly \
--multiboot-command-line='${kernel-command-line}' \ --multiboot-command-line='${kernel-command-line}' \
--host-priv-port='${host-port}' \ --host-priv-port='${host-port}' \
--device-master-port='${device-port}' \ --device-master-port='${device-port}' \
--exec-server-task='${exec-task}' -T typed '${root}' \ --exec-server-task='${exec-task}' -T typed '${root}' \
'$(task-create)' '$(task-resume)' '$(task-create)' '$(task-resume)'
module /lib/ld.so.1 /hurd/exec '$(exec-task=task-create)' module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'
} }
# For booting GNU/Linux # For booting GNU/Linux
@ -34,26 +34,26 @@ menuentry "GNU/Linux" {
# For booting FreeBSD # For booting FreeBSD
menuentry "FreeBSD (or GNU/kFreeBSD), direct boot" { menuentry "FreeBSD (or GNU/kFreeBSD), direct boot" {
set root=(hd0,1,a) set root=(hd0,1,a)
freebsd /boot/kernel/kernel kfreebsd /boot/kernel/kernel
freebsd_loadenv /boot/device.hints kfreebsd_loadenv /boot/device.hints
freebsd_module /boot/splash.bmp type=splash_image_data kfreebsd_module /boot/splash.bmp type=splash_image_data
set FreeBSD.vfs.root.mountfrom=ufs:ad0s1a set kFreeBSD.vfs.root.mountfrom=ufs:ad0s1a
} }
menuentry "FreeBSD (or GNU/kFreeBSD), via /boot/loader" { menuentry "FreeBSD (or GNU/kFreeBSD), via /boot/loader" {
set root=(hd0,1,a) set root=(hd0,1,a)
freebsd /boot/loader kfreebsd /boot/loader
} }
# For booting NetBSD # For booting NetBSD
menuentry "NetBSD" { menuentry "NetBSD" {
set root=(hd0,1,a) set root=(hd0,1,a)
netbsd /netbsd knetbsd /netbsd
} }
# For booting OpenBSD # For booting OpenBSD
menuentry "OpenBSD" { menuentry "OpenBSD" {
set root=(hd0,1,a) set root=(hd0,1,a)
openbsd /bsd kopenbsd /bsd
} }
# For booting Microsoft Windows # For booting Microsoft Windows

View file

@ -357,9 +357,9 @@ static struct grub_fs grub_cpio_fs = {
}; };
#ifdef MODE_USTAR #ifdef MODE_USTAR
GRUB_MOD_INIT (cpio)
#else
GRUB_MOD_INIT (tar) GRUB_MOD_INIT (tar)
#else
GRUB_MOD_INIT (cpio)
#endif #endif
{ {
grub_fs_register (&grub_cpio_fs); grub_fs_register (&grub_cpio_fs);
@ -367,9 +367,9 @@ GRUB_MOD_INIT (tar)
} }
#ifdef MODE_USTAR #ifdef MODE_USTAR
GRUB_MOD_FINI (cpio)
#else
GRUB_MOD_FINI (tar) GRUB_MOD_FINI (tar)
#else
GRUB_MOD_FINI (cpio)
#endif #endif
{ {
grub_fs_unregister (&grub_cpio_fs); grub_fs_unregister (&grub_cpio_fs);

View file

@ -649,6 +649,9 @@ grub_ext2_iterate_dir (grub_fshelp_node_t dir,
if (grub_errno) if (grub_errno)
return 0; return 0;
if (dirent.direntlen == 0)
return 0;
if (dirent.namelen != 0) if (dirent.namelen != 0)
{ {
char filename[dirent.namelen + 1]; char filename[dirent.namelen + 1];
@ -924,6 +927,9 @@ static struct grub_fs grub_ext2_fs =
.label = grub_ext2_label, .label = grub_ext2_label,
.uuid = grub_ext2_uuid, .uuid = grub_ext2_uuid,
.mtime = grub_ext2_mtime, .mtime = grub_ext2_mtime,
#ifdef GRUB_UTIL
.reserved_first_sector = 1,
#endif
.next = 0 .next = 0
}; };

View file

@ -855,6 +855,9 @@ static struct grub_fs grub_fat_fs =
.close = grub_fat_close, .close = grub_fat_close,
.label = grub_fat_label, .label = grub_fat_label,
.uuid = grub_fat_uuid, .uuid = grub_fat_uuid,
#ifdef GRUB_UTIL
.reserved_first_sector = 1,
#endif
.next = 0 .next = 0
}; };

View file

@ -1021,6 +1021,9 @@ static struct grub_fs grub_hfsplus_fs =
.label = grub_hfsplus_label, .label = grub_hfsplus_label,
.mtime = grub_hfsplus_mtime, .mtime = grub_hfsplus_mtime,
.uuid = grub_hfsplus_uuid, .uuid = grub_hfsplus_uuid,
#ifdef GRUB_UTIL
.reserved_first_sector = 1,
#endif
.next = 0 .next = 0
}; };

View file

@ -1081,15 +1081,19 @@ grub_ntfs_uuid (grub_device_t device, char **uuid)
return grub_errno; return grub_errno;
} }
static struct grub_fs grub_ntfs_fs = { static struct grub_fs grub_ntfs_fs =
.name = "ntfs", {
.dir = grub_ntfs_dir, .name = "ntfs",
.open = grub_ntfs_open, .dir = grub_ntfs_dir,
.read = grub_ntfs_read, .open = grub_ntfs_open,
.close = grub_ntfs_close, .read = grub_ntfs_read,
.label = grub_ntfs_label, .close = grub_ntfs_close,
.uuid = grub_ntfs_uuid, .label = grub_ntfs_label,
.next = 0 .uuid = grub_ntfs_uuid,
#ifdef GRUB_UTIL
.reserved_first_sector = 1,
#endif
.next = 0
}; };
GRUB_MOD_INIT (ntfs) GRUB_MOD_INIT (ntfs)

2
gendistlist.sh Normal file → Executable file
View file

@ -35,7 +35,7 @@ dir=`dirname $0`
cd $dir cd $dir
for dir in $DISTDIRS; do for dir in $DISTDIRS; do
for d in `find $dir -type d | sed '/\/\.svn$/d;\/\.svn\//d' | sort`; do for d in `find $dir -type d -not -name .svn -not -name .bzr | sort`; do
find $d -maxdepth 1 -name '*.[chSy]' -o -name '*.mk' -o -name '*.rmk' \ find $d -maxdepth 1 -name '*.[chSy]' -o -name '*.mk' -o -name '*.rmk' \
-o -name '*.rb' -o -name '*.in' -o -name '*.tex' -o -name '*.texi' \ -o -name '*.rb' -o -name '*.in' -o -name '*.tex' -o -name '*.texi' \
-o -name '*.info' -o -name 'grub.cfg' -o -name 'README' \ -o -name '*.info' -o -name 'grub.cfg' -o -name 'README' \

View file

@ -68,6 +68,11 @@ struct grub_fs
/* Get writing time of filesystem. */ /* Get writing time of filesystem. */
grub_err_t (*mtime) (grub_device_t device, grub_int32_t *timebuf); grub_err_t (*mtime) (grub_device_t device, grub_int32_t *timebuf);
#ifdef GRUB_UTIL
/* Whether this filesystem reserves first sector for DOS-style boot. */
int reserved_first_sector;
#endif
/* The next filesystem. */ /* The next filesystem. */
struct grub_fs *next; struct grub_fs *next;
}; };

View file

@ -28,6 +28,7 @@
#define ALIGN_UP(addr, align) \ #define ALIGN_UP(addr, align) \
((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1)) ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0])) #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args) #define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args)
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ /* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
@ -75,9 +76,11 @@ grub_strncat (char *dest, const char *src, int c)
} }
/* Prototypes for aliases. */ /* Prototypes for aliases. */
#if !defined (GRUB_UTIL) || !defined (APPLE_CC) #ifndef GRUB_UTIL
int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n);
void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);
#endif #endif
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n); int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);

View file

@ -1,6 +1,6 @@
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007 Free Software Foundation, Inc. * Copyright (C) 2004,2007,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,9 +16,20 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/ */
void EXPORT_FUNC (memset) (void); #include <config.h>
#ifdef HAVE___ASHLDI3
void EXPORT_FUNC (__ashldi3) (void); void EXPORT_FUNC (__ashldi3) (void);
#endif
#ifdef HAVE___ASHRDI3
void EXPORT_FUNC (__ashrdi3) (void); void EXPORT_FUNC (__ashrdi3) (void);
#endif
#ifdef HAVE___LSHRDI3
void EXPORT_FUNC (__lshrdi3) (void); void EXPORT_FUNC (__lshrdi3) (void);
#endif
#ifdef HAVE___TRAMPOLINE_SETUP
void EXPORT_FUNC (__trampoline_setup) (void); void EXPORT_FUNC (__trampoline_setup) (void);
#endif
#ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void); void EXPORT_FUNC (__ucmpdi2) (void);
#endif

View file

@ -18,8 +18,6 @@
#include <config.h> #include <config.h>
void EXPORT_FUNC (memset) (void);
#ifdef HAVE___BSWAPSI2 #ifdef HAVE___BSWAPSI2
typedef int SItype __attribute__ ((mode (SI))); typedef int SItype __attribute__ ((mode (SI)));
SItype EXPORT_FUNC (__bswapsi2) (SItype); SItype EXPORT_FUNC (__bswapsi2) (SItype);

View file

@ -62,7 +62,10 @@ grub_stop_floppy (void)
void void
grub_exit (void) grub_exit (void)
{ {
grub_fatal ("grub_exit() is not implemented.\n"); /* We can't use grub_fatal() in this function. This would create an infinite
loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
while (1)
grub_cpu_idle ();
} }
void void

View file

@ -223,12 +223,12 @@ grub_strncmp (const char *s1, const char *s2, grub_size_t n)
char * char *
grub_strchr (const char *s, int c) grub_strchr (const char *s, int c)
{ {
while (*s) do
{ {
if (*s == c) if (*s == c)
return (char *) s; return (char *) s;
s++;
} }
while (*s++);
return 0; return 0;
} }
@ -236,14 +236,14 @@ grub_strchr (const char *s, int c)
char * char *
grub_strrchr (const char *s, int c) grub_strrchr (const char *s, int c)
{ {
char *p = 0; char *p = NULL;
while (*s) do
{ {
if (*s == c) if (*s == c)
p = (char *) s; p = (char *) s;
s++;
} }
while (*s++);
return p; return p;
} }

View file

@ -72,7 +72,7 @@ usage (int status)
fprintf (stderr, "Try ``grub-editenv --help'' for more information.\n"); fprintf (stderr, "Try ``grub-editenv --help'' for more information.\n");
else else
printf ("\ printf ("\
Usage: grub-editenv [OPTIONS] FILENAME COMMAND\n\ Usage: grub-editenv [OPTIONS] [FILENAME] COMMAND\n\
\n\ \n\
Tool to edit environment block.\n\ Tool to edit environment block.\n\
\nCommands:\n\ \nCommands:\n\
@ -85,7 +85,10 @@ Tool to edit environment block.\n\
-V, --version print version information and exit\n\ -V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n", PACKAGE_BUGREPORT); If not given explicitly, FILENAME defaults to %s.\n\
\n\
Report bugs to <%s>.\n",
DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG, PACKAGE_BUGREPORT);
exit (status); exit (status);
} }
@ -288,12 +291,14 @@ main (int argc, char *argv[])
if (optind + 1 >= argc) if (optind + 1 >= argc)
{ {
fprintf (stderr, "no command specified\n"); filename = DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG;
usage (1); command = argv[optind];
}
else
{
filename = argv[optind];
command = argv[optind + 1];
} }
filename = argv[optind];
command = argv[optind + 1];
if (strcmp (command, "create") == 0) if (strcmp (command, "create") == 0)
create_envblk_file (filename); create_envblk_file (filename);

View file

@ -1,76 +0,0 @@
#! /bin/sh -e
# grub-mkconfig helper script.
# Copyright (C) 2008,2009 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/>.
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
. ${libdir}/grub/grub-mkconfig_lib
case "${GRUB_DISTRIBUTOR}" in
Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
*) OS="FreeBSD" ;;
esac
if test -e /boot/device.hints ; then
devices=/boot/device.hints
fi
if test -e /boot/kernel/kernel ; then
kfreebsd=/boot/kernel/kernel
fi
if test -e /boot/kernel/kernel.gz ; then
kfreebsd=/boot/kernel/kernel.gz
fi
if [ "x$kfreebsd" != "x" ] ; then
echo "Found kernel of FreeBSD: $kfreebsd" >&2
kfreebsd_basename=`basename $kfreebsd`
kfreebsd_dirname=`dirname $kfreebsd`
kfreebsd_rel_dirname=`make_system_path_relative_to_its_root $kfreebsd_dirname`
if [ x"$devices" != "x" ] ; then
devices_basename=`basename $devices`
devices_dirname=`dirname $devices`
devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname`
fi
case ${GRUB_FS} in
ufs1 | ufs2) kfreebsd_fs=ufs ;;
*) kfreebsd_fs=${GRUB_FS} ;;
esac
cat << EOF
menuentry "${OS}" {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
kfreebsd ${kfreebsd_rel_dirname}/${kfreebsd_basename}
EOF
if [ x"$devices" != "x" ] ; then
cat << EOF
kfreebsd_loadenv ${devices_rel_dirname}/${devices_basename}
EOF
fi
cat << EOF
set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE}
set kFreeBSD.vfs.root.mountfrom.options=rw
}
EOF
fi

View file

@ -71,15 +71,18 @@ fi
cat << EOF cat << EOF
menuentry "${OS}" { menuentry "${OS}" {
EOF EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
EOF
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/" prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
cat << EOF cat << EOF
multiboot ${kernel} root=device:${GRUB_DEVICE} module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
module /hurd/${hurd_fs}.static --readonly \\
--multiboot-command-line='\${kernel-command-line}' \\ --multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\ --host-priv-port='\${host-port}' \\
--device-master-port='\${device-port}' \\ --device-master-port='\${device-port}' \\
--exec-server-task='\${exec-task}' -T typed '\${root}' \\ --exec-server-task='\${exec-task}' -T typed '\${root}' \\
'\$(task-create)' '\$(task-resume)' '\$(task-create)' '\$(task-resume)'
module /lib/ld.so.1 /hurd/exec '\$(exec-task=task-create)' module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
} }
EOF EOF

106
util/grub.d/10_kfreebsd.in Normal file
View file

@ -0,0 +1,106 @@
#! /bin/sh -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009 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/>.
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
. ${libdir}/grub/grub-mkconfig_lib
case "${GRUB_DISTRIBUTOR}" in
Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
*) OS="FreeBSD" ;;
esac
kfreebsd_entry ()
{
cat << EOF
menuentry "$1" {
EOF
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF
kfreebsd ${rel_dirname}/${basename}
EOF
if test -n "${devices}" ; then
cat << EOF
kfreebsd_loadenv ${devices_rel_dirname}/${devices_basename}
EOF
fi
if test -n "${acpi_ko}" ; then
cat << EOF
kfreebsd_module_elf ${acpi_ko_rel_dirname}/${acpi_ko_basename}
EOF
fi
cat << EOF
set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE}
set kFreeBSD.vfs.root.mountfrom.options=rw
}
EOF
}
list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
while [ "x$list" != "x" ] ; do
kfreebsd=`version_find_latest $list`
echo "Found kernel of FreeBSD: $kfreebsd" >&2
basename=`basename $kfreebsd`
dirname=`dirname $kfreebsd`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
if [ -f /boot/device.hints ] ; then
devices=/boot/device.hints
devices_basename=`basename $devices`
devices_dirname=`dirname $devices`
devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname`
fi
case ${GRUB_FS} in
ufs1 | ufs2) kfreebsd_fs=ufs ;;
*) kfreebsd_fs=${GRUB_FS} ;;
esac
version=`echo $basename | sed -e "s,^[^0-9]*-,,g;s/\.gz$//g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
acpi_ko=
for i in "/lib/modules/${version}/acpi.ko" "/lib/modules/${alt_version}/acpi.ko" \
"/boot/kernel/acpi.ko"; do
if test -e "$i" ; then
acpi_ko="$i"
break
fi
done
if test -n "${acpi_ko}" ; then
echo "Found ACPI module: ${acpi_ko}" >&2
acpi_ko_basename=`basename ${acpi_ko}`
acpi_ko_dirname=`dirname ${acpi_ko}`
acpi_ko_rel_dirname=`make_system_path_relative_to_its_root $acpi_ko_dirname`
fi
kfreebsd_entry "${OS}, kFreeBSD ${version}"
list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '`
done

View file

@ -47,7 +47,10 @@ linux_entry ()
cat << EOF cat << EOF
menuentry "$1" { menuentry "$1" {
EOF EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF cat << EOF
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
EOF EOF
@ -64,6 +67,7 @@ EOF
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done` done`
prepare_boot_cache=
while [ "x$list" != "x" ] ; do while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list` linux=`version_find_latest $list`

View file

@ -74,6 +74,7 @@ EOF
;; ;;
linux) linux)
LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`" LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
prepare_boot_cache=
for LINUX in ${LINUXPROBED} ; do for LINUX in ${LINUXPROBED} ; do
LROOT="`echo ${LINUX} | cut -d ':' -f 1`" LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
@ -90,7 +91,10 @@ EOF
cat << EOF cat << EOF
menuentry "${LLABEL} (on ${DEVICE})" { menuentry "${LLABEL} (on ${DEVICE})" {
EOF EOF
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF cat << EOF
linux ${LKERNEL} ${LPARAMS} linux ${LKERNEL} ${LPARAMS}
EOF EOF
@ -155,7 +159,28 @@ EOF
EOF EOF
;; ;;
hurd|*) hurd|*)
echo " ${LONGNAME} is not yet supported by grub-mkconfig." >&2 cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
EOF
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
mach_device="`echo "${grub_device}" | tr -d '()' | tr , s`"
grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
case "${grub_fs}" in
*fs) hurd_fs="${grub_fs}" ;;
*) hurd_fs="${grub_fs}fs" ;;
esac
cat << EOF
multiboot /boot/gnumach.gz root=device:${mach_device}
module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\
--device-master-port='\${device-port}' \\
--exec-server-task='\${exec-task}' -T typed '\${root}' \\
'\$(task-create)' '\$(task-resume)'
module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
}
EOF
;; ;;
esac esac
done done

View file

@ -1057,7 +1057,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
n = strtol (p, &q, 10); n = strtol (p, &q, 10);
if (p != q && n != GRUB_LONG_MIN && n != GRUB_LONG_MAX) if (p != q && n != GRUB_LONG_MIN && n != GRUB_LONG_MAX)
{ {
dos_part = (int) n; dos_part = (int) n - 1;
if (*q >= 'a' && *q <= 'g') if (*q >= 'a' && *q <= 'g')
bsd_part = *q - 'a'; bsd_part = *q - 'a';

View file

@ -319,14 +319,7 @@ else
$grub_mkimage -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1 $grub_mkimage -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
fi fi
# Prompt the user to check if the device map is correct.
echo "Installation finished. No error reported." echo "Installation finished. No error reported."
echo "This is the contents of the device map $device_map."
echo "Check if this is correct or not. If any of the lines is incorrect,"
echo "fix it and re-run the script \`grub-install'."
echo
cat $device_map
# Bye. # Bye.
exit 0 exit 0

View file

@ -86,7 +86,7 @@ grub_refresh (void)
static void static void
setup (const char *dir, setup (const char *dir,
const char *boot_file, const char *core_file, const char *boot_file, const char *core_file,
const char *root, const char *dest, int must_embed, int force) const char *root, const char *dest, int must_embed, int force, int fs_probe)
{ {
char *boot_path, *core_path, *core_path_dev; char *boot_path, *core_path, *core_path_dev;
char *boot_img, *core_img; char *boot_img, *core_img;
@ -251,6 +251,22 @@ setup (const char *dir,
if (grub_disk_read (dest_dev->disk, 0, 0, GRUB_DISK_SECTOR_SIZE, tmp_img)) if (grub_disk_read (dest_dev->disk, 0, 0, GRUB_DISK_SECTOR_SIZE, tmp_img))
grub_util_error ("%s", grub_errmsg); grub_util_error ("%s", grub_errmsg);
if (dest_dev->disk->partition && fs_probe)
{
grub_fs_t fs;
fs = grub_fs_probe (dest_dev);
if (! fs)
grub_util_error ("Unable to identify a filesystem in %s; safety check can't be performed.",
dest_dev->disk->name);
if (! fs->reserved_first_sector)
grub_util_error ("%s appears to contain a %s filesystem which isn't known to "
"reserve space for DOS-style boot. Installing GRUB there could "
"result in FILESYSTEM DESTRUCTION if valuable data is overwritten "
"by grub-setup (--skip-fs-probe disables this "
"check, use at your own risk).", dest_dev->disk->name, fs->name);
}
/* Copy the possible DOS BPB. */ /* Copy the possible DOS BPB. */
memcpy (boot_img + GRUB_BOOT_MACHINE_BPB_START, memcpy (boot_img + GRUB_BOOT_MACHINE_BPB_START,
tmp_img + GRUB_BOOT_MACHINE_BPB_START, tmp_img + GRUB_BOOT_MACHINE_BPB_START,
@ -556,6 +572,7 @@ static struct option options[] =
{"device-map", required_argument, 0, 'm'}, {"device-map", required_argument, 0, 'm'},
{"root-device", required_argument, 0, 'r'}, {"root-device", required_argument, 0, 'r'},
{"force", no_argument, 0, 'f'}, {"force", no_argument, 0, 'f'},
{"skip-fs-probe", no_argument, 0, 's'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, 0, 'V'},
{"verbose", no_argument, 0, 'v'}, {"verbose", no_argument, 0, 'v'},
@ -580,6 +597,7 @@ DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\
-m, --device-map=FILE use FILE as the device map [default=%s]\n\ -m, --device-map=FILE use FILE as the device map [default=%s]\n\
-r, --root-device=DEV use DEV as the root device [default=guessed]\n\ -r, --root-device=DEV use DEV as the root device [default=guessed]\n\
-f, --force install even if problems are detected\n\ -f, --force install even if problems are detected\n\
-s, --skip-fs-probe do not probe for filesystems in DEVICE\n\
-h, --help display this message and exit\n\ -h, --help display this message and exit\n\
-V, --version print version information and exit\n\ -V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
@ -613,7 +631,7 @@ main (int argc, char *argv[])
char *dev_map = 0; char *dev_map = 0;
char *root_dev = 0; char *root_dev = 0;
char *dest_dev; char *dest_dev;
int must_embed = 0, force = 0; int must_embed = 0, force = 0, fs_probe = 1;
progname = "grub-setup"; progname = "grub-setup";
@ -666,6 +684,10 @@ main (int argc, char *argv[])
force = 1; force = 1;
break; break;
case 's':
fs_probe = 0;
break;
case 'h': case 'h':
usage (0); usage (0);
break; break;
@ -767,7 +789,7 @@ main (int argc, char *argv[])
setup (dir ? : DEFAULT_DIRECTORY, setup (dir ? : DEFAULT_DIRECTORY,
boot_file ? : DEFAULT_BOOT_FILE, boot_file ? : DEFAULT_BOOT_FILE,
core_file ? : DEFAULT_CORE_FILE, core_file ? : DEFAULT_CORE_FILE,
root_dev, grub_util_get_grub_dev (devicelist[i]), 1, force); root_dev, grub_util_get_grub_dev (devicelist[i]), 1, force, fs_probe);
} }
} }
else else
@ -776,7 +798,7 @@ main (int argc, char *argv[])
setup (dir ? : DEFAULT_DIRECTORY, setup (dir ? : DEFAULT_DIRECTORY,
boot_file ? : DEFAULT_BOOT_FILE, boot_file ? : DEFAULT_BOOT_FILE,
core_file ? : DEFAULT_CORE_FILE, core_file ? : DEFAULT_CORE_FILE,
root_dev, dest_dev, must_embed, force); root_dev, dest_dev, must_embed, force, fs_probe);
/* Free resources. */ /* Free resources. */
grub_fini_all (); grub_fini_all ();