merge trunk

This commit is contained in:
Colin Watson 2011-02-17 14:51:11 +00:00
commit 28f9509eb7
42 changed files with 467 additions and 108 deletions

View file

@ -44,7 +44,6 @@ grub-kbdcomp
grub-macho2img grub-macho2img
grub-menulst2cfg grub-menulst2cfg
grub-mk* grub-mk*
grub-pbkdf2
grub-pe2elf grub-pe2elf
grub-probe grub-probe
grub_probe_init.c grub_probe_init.c

202
ChangeLog
View file

@ -1,3 +1,205 @@
2011-02-12 Vladimir Serbinenko <phcoder@gmail.com>
Workaround yet another IEEE1275 bug.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New enum value
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS.
* grub-core/kern/ieee1275/mmap.c (grub_machine_mmap_iterate): Ignore
adress_cells and size:cells if GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS
is set.
* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS on powermacs.
2011-02-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/partmap/msdos.c (pc_partition_map_embed): Fix off by one
error.
2011-02-11 Colin Watson <cjwatson@ubuntu.com>
* util/grub.d/20_linux_xen.in: Bail out early if linux_list is
empty, since in that case we can only generate either nothing or a
syntactically invalid configuration file.
Reported by: Michal Suchanek. Fixes Debian bug #612898.
2011-02-09 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Kernel): Add reference to grub-mkrescue.
(Making a GRUB bootable CD-ROM): Likewise.
(Invoking grub-mkrescue): New section.
Reported by: Yann Dirson. Fixes Debian bug #612585.
2011-02-09 Colin Watson <cjwatson@ubuntu.com>
* util/grub-install.in: Remove unnecessary brackets from tr
arguments.
* util/grub.d/10_hurd.in: Likewise.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub.d/20_linux_xen.in: Likewise.
Reported by: Jamie Heilman. Fixes Debian bug #612564.
2011-02-08 Colin Watson <cjwatson@ubuntu.com>
* include/grub/file.h (not_easly_seekable): Rename to ...
(not_easily_seekable): ... this. Update all users.
2011-01-28 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Making a GRUB bootable CD-ROM): Update to describe
grub-mkrescue.
2011-01-24 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkimage.c (generate_image): Refuse to create the images
bigger than the actual flash (512K) in Loongson machines. 512K is also
the biggest chip supported by them.
2011-01-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/getroot.c: Include config-util.h explicitly.
2011-01-22 Anthony DeRobertis <anthony@derobert.net>
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Check
super_offset field.
2011-01-22 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Ignore install device on platforms
where it doesn't make sense. Always use UUIDs except on pc, efi and
sparc64.
Reported by: Daniel Kahn Gillmor.
2011-01-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/bus/bonito.c (write_bases): Fix direction of the shift.
2011-01-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/partmap/bsdlabel.c: Include grub/emu/misc.h and not grub/util/misc.h.
(iterate_real): Don't rely on partition being non-NULL.
2011-01-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/script/argv.c (round_up_exp): unsigned is 32-bit on all
supported platforms. Put a compile time assert for this rather than
generate a warning with 32-bit shift.
2011-01-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/scsi.c (grub_scsi_read): Fix binary and check and make
logical expression more readable.
2011-01-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/raid.c (insert_array): Ensure uniqueness of p->number
even if some elements have a name.
Reported by: Alexander GQ Gerasiov.
2011-01-22 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkconfig_lib.in (is_path_readable_by_grub): Consider a
path unreadable if `grub-probe -t abstraction' fails, for example if
memberlist fails on an LVM volume group.
Reported by: Darius Jahandarie.
2011-01-22 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Simple configuration): Document
GRUB_PRELOAD_MODULES.
2011-01-17 Colin Watson <cjwatson@ubuntu.com>
* .bzrignore: Remove nonexistent grub-pbkdf2.
2011-01-16 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Bump version to 1.99~rc1.
2011-01-15 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkimage.c (generate_image): Check fwstart.img checksum
for safety.
2011-01-14 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mips/yeeloong/init.c (grub_machine_init): Init boot
module.
2011-01-14 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/Makefile.core.def (fwstart): Add lost LDFLAGS.
2011-01-13 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/zfs/zfsinfo.c (grub_cmd_zfs_bootfs): Quote bootpath and
diskdevid.
2011-01-13 Vladimir Serbinenko <phcoder@gmail.com>
Fix compilation on cygwin.
* conf/Makefile.common (STRIPFLAGS_KERNEL): Add -F elf32-i386 and
-R .drectve on cygwin.
* conf/i386-pc-cygwin-img-ld.sc: Merge rdata and pdata into data.
* configure.ac: Use $(top_builddir) in TARGET_OBJ2ELF.
(COND_CYGWIN): New condition.
* grub-core/Makefile.am (%.mod): Set TARGET_OBJ2ELF.
* grub-core/genmod.sh.in: Use ${TARGET_OBJ2ELF} and
not @TARGET_OBJ2ELF@.
* util/grub-pe2elf.c (write_symbol_table): Use pe_symtab->type and not
type to determine whether aux is to be used.
2011-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* util/ieee1275/ofpath.c (grub_util_devname_to_ofpath): Use the
realpath'ed device string.
Handle floppy (somewhat).
Issue error in unknown case rather than garbage.
Reported by: Axel Beckert.
2011-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/00_header.in (load_video): Handle the case when no video
drivers available.
Thanks to: Axel Beckert.
2011-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkfont.c (write_font_pf2): Use appropriate type for data
variable. Fixes problem on big endian platforms.
2011-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/Makefile.core.def (ieee1275_fb): Disable on sparc.
It doesn't work well there.
2011-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/context.c (grub_env_context_close): Silence spurious
warning.
* grub-core/normal/menu.c (grub_menu_execute_entry): Likewise.
* grub-core/partmap/msdos.c (pc_partition_map_embed): Use unsigned
counter.
2011-01-12 Vladimir Serbinenko <phcoder@gmail.com>
Use alias->path rather than buggy "canon".
* grub-core/disk/ieee1275/ofdisk.c (ofdisk_hash_add_real): New function.
(ofdisk_hash_add): New argument curcan. All users updated.
2011-01-11 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Fall back to `true' if `makeinfo' does not exist.
2011-01-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/powerpc/ieee1275/linux.c (grub_linux_load32): Apply
loadmask before doing any calculations. Use correct type for offset.
(grub_linux_load64): Likewise.
2011-01-11 Colin Watson <cjwatson@ubuntu.com> 2011-01-11 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mklayout.c (console_grub_equivalences_shift): Terminate * util/grub-mklayout.c (console_grub_equivalences_shift): Terminate

View file

@ -67,7 +67,11 @@ CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
if COND_CYGWIN
STRIPFLAGS_KERNEL = -F elf32-i386 -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve
else
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment
endif
CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d

View file

@ -13,15 +13,9 @@ SECTIONS
__data_start__ = . ; __data_start__ = . ;
*(.data) *(.data)
__data_end__ = . ; __data_end__ = . ;
}
.rdata :
{
__rdata_start__ = . ; __rdata_start__ = . ;
*(.rdata) *(.rdata)
__rdata_end__ = . ; __rdata_end__ = . ;
}
.pdata :
{
*(.pdata) *(.pdata)
edata = . ; edata = . ;
} }

View file

@ -32,7 +32,7 @@ dnl type, so there is no conflict. Variables with the prefix "TARGET_"
dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
dnl type. dnl type.
AC_INIT([GRUB],[1.99~beta0],[bug-grub@gnu.org]) AC_INIT([GRUB],[1.99~rc1],[bug-grub@gnu.org])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
@ -246,7 +246,7 @@ else
fi fi
# These are not a "must". # These are not a "must".
AC_PATH_PROG(MAKEINFO, makeinfo) AC_PATH_PROGS(MAKEINFO, makeinfo true)
# #
# Checks for host programs. # Checks for host programs.
@ -454,7 +454,7 @@ fi
# For platforms where ELF is not the default link format. # For platforms where ELF is not the default link format.
AC_MSG_CHECKING([for command to convert module to ELF format]) AC_MSG_CHECKING([for command to convert module to ELF format])
case "${host_os}" in case "${host_os}" in
cygwin) TARGET_OBJ2ELF='$(grub_utildir)/grub-pe2elf'; cygwin) TARGET_OBJ2ELF='$(top_builddir)/grub-pe2elf';
# FIXME: put proper test here # FIXME: put proper test here
NEED_REGISTER_FRAME_INFO=1 NEED_REGISTER_FRAME_INFO=1
;; ;;
@ -964,6 +964,7 @@ 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_EFIEMU], [test x$enable_efiemu = xyes])
AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1]) AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin])
# Output files. # Output files.
grub_CHECK_LINK_DIR grub_CHECK_LINK_DIR

View file

@ -36,6 +36,7 @@ Invariant Sections.
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive * grub-install: (grub)Invoking grub-install. Install GRUB on your drive
* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration * grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration
* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2. * grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
* grub-mkrescue: (grub)Invoking grub-mkrescue. Make a GRUB rescue image
@end direntry @end direntry
@setchapternewpage odd @setchapternewpage odd
@ -94,6 +95,7 @@ This edition documents version @value{VERSION}.
* Invoking grub-mkconfig:: Generate a GRUB configuration file * Invoking grub-mkconfig:: Generate a GRUB configuration file
* Invoking grub-mkpasswd-pbkdf2:: * Invoking grub-mkpasswd-pbkdf2::
Generate GRUB password hashes Generate GRUB password hashes
* Invoking grub-mkrescue:: Make a GRUB rescue image
* Obtaining and Building GRUB:: How to obtain and build GRUB * Obtaining and Building GRUB:: How to obtain and build GRUB
* Reporting bugs:: Where you should send a bug report * Reporting bugs:: Where you should send a bug report
* Future:: Some future plans on GRUB * Future:: Some future plans on GRUB
@ -651,15 +653,22 @@ using BIOS functions.}. This means that you can use the whole CD-ROM
from GRUB and you don't have to make a floppy or hard disk image file, from GRUB and you don't have to make a floppy or hard disk image file,
which can cause compatibility problems. which can cause compatibility problems.
For booting from a CD-ROM, GRUB uses a special Stage 2 called For booting from a CD-ROM, GRUB uses a special image called
@file{stage2_eltorito}. The only GRUB files you need to have in your @file{cdboot.img}, which is concatenated with @file{core.img}. The
bootable CD-ROM are this @file{stage2_eltorito} and optionally a config file @file{core.img} used for this should be built with at least the
@file{grub.cfg}. You don't need to use @file{stage1} or @file{stage2}, @samp{iso9660} and @samp{biosdisk} modules. Your bootable CD-ROM will
because El Torito is quite different from the standard boot process. usually also need to include a configuration file @file{grub.cfg} and some
other GRUB modules.
Here is an example of procedures to make a bootable CD-ROM To make a simple generic GRUB rescue CD, you can use the
image. First, make a top directory for the bootable image, say, @command{grub-mkrescue} program (@pxref{Invoking grub-mkrescue}):
@samp{iso}:
@example
$ @kbd{grub-mkrescue -o grub.iso}
@end example
You will often need to include other files in your image. To do this, first
make a top directory for the bootable image, say, @samp{iso}:
@example @example
$ @kbd{mkdir iso} $ @kbd{mkdir iso}
@ -671,33 +680,24 @@ Make a directory for GRUB:
$ @kbd{mkdir -p iso/boot/grub} $ @kbd{mkdir -p iso/boot/grub}
@end example @end example
Copy the file @file{stage2_eltorito}:
@example
$ @kbd{cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub}
@end example
If desired, make the config file @file{grub.cfg} under @file{iso/boot/grub} If desired, make the config file @file{grub.cfg} under @file{iso/boot/grub}
(@pxref{Configuration}), and copy any files and directories for the disc to the (@pxref{Configuration}), and copy any files and directories for the disc to the
directory @file{iso/}. directory @file{iso/}.
Finally, make a ISO9660 image file like this: Finally, make the image:
@example @example
$ @kbd{mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \ $ @kbd{grub-mkrescue -o grub.iso iso}
-boot-load-size 4 -boot-info-table -o grub.iso iso}
@end example @end example
This produces a file named @file{grub.iso}, which then can be burned This produces a file named @file{grub.iso}, which then can be burned
into a CD (or a DVD). @kbd{mkisofs} has already set up the disc to boot into a CD (or a DVD), or written to a USB mass storage device.
from the @kbd{boot/grub/stage2_eltorito} file, so there is no need to
setup GRUB on the disc. (Note that the @kbd{-boot-load-size 4} bit is
required for compatibility with the BIOS on many older machines.)
You can use the device @samp{(cd)} to access a CD-ROM in your The root device will be set up appropriately on entering your
config file. This is not required; GRUB automatically sets the root device @file{grub.cfg} configuration file, so you can refer to file names on the CD
to @samp{(cd)} when booted from a CD-ROM. It is only necessary to refer to without needing to use an explicit device name. This makes it easier to
@samp{(cd)} if you want to access other drives as well. produce rescue images that will work on both optical drives and USB mass
storage devices.
@node Device map @node Device map
@ -1181,6 +1181,11 @@ directly to @ref{play}.
If this option is set, GRUB will issue a @ref{badram} command to filter If this option is set, GRUB will issue a @ref{badram} command to filter
out specified regions of RAM. out specified regions of RAM.
@item GRUB_PRELOAD_MODULES
This option may be set to a list of GRUB module names separated by spaces.
Each module will be loaded as early as possible, at the start of
@file{grub.cfg}.
@end table @end table
For more detailed customisation of @command{grub-mkconfig}'s output, you may For more detailed customisation of @command{grub-mkconfig}'s output, you may
@ -3606,6 +3611,64 @@ Length of the salt. Defaults to 64.
@end table @end table
@node Invoking grub-mkrescue
@chapter Invoking grub-mkrescue
The program @command{grub-mkrescue} generates a bootable GRUB rescue image
(@pxref{Making a GRUB bootable CD-ROM}).
@example
grub-mkrescue -o grub.iso
@end example
All arguments not explicitly listed as @command{grub-mkrescue} options are
passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
Options passed to @command{xorriso} will normally be interpreted as
@command{mkisofs} options; if the option @samp{--} is used, then anything
after that will be interpreted as native @command{xorriso} options.
Non-option arguments specify additional source directories. This is
commonly used to add extra files to the image:
@example
mkdir -p disk/boot/grub
@r{(add extra files to @file{disk/boot/grub})}
grub-mkrescue -o grub.iso disk
@end example
@command{grub-mkrescue} accepts the following options:
@table @option
@item --help
Print a summary of the command-line options and exit.
@item --version
Print the version number of GRUB and exit.
@item -o @var{file}
@itemx --output=@var{file}
Save output in @var{file}. This "option" is required.
@item --modules=@var{modules}
Pre-load the named GRUB modules in the image. Multiple entries in
@var{modules} should be separated by whitespace (so you will probably need
to quote this for your shell).
@item --rom-directory=@var{dir}
If generating images for the QEMU or Coreboot platforms, copy the resulting
@file{qemu.img} or @file{coreboot.elf} files respectively to the @var{dir}
directory as well as including them in the image.
@item --xorriso=@var{file}
Use @var{file} as the @command{xorriso} program, rather than the built-in
default.
@item --grub-mkimage=@var{file}
Use @var{file} as the @command{grub-mkimage} program, rather than the
built-in default.
@end table
@node Obtaining and Building GRUB @node Obtaining and Building GRUB
@appendix How to obtain and build GRUB @appendix How to obtain and build GRUB

View file

@ -303,7 +303,7 @@ platform_DATA += moddep.lst
CLEANFILES += config.log syminfo.lst moddep.lst CLEANFILES += config.log syminfo.lst moddep.lst
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) $(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT)
sh $^ $@ TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
platform_DATA += $(MOD_FILES) platform_DATA += $(MOD_FILES)
CLEANFILES += $(MOD_FILES) CLEANFILES += $(MOD_FILES)

View file

@ -324,6 +324,7 @@ image = {
name = fwstart; name = fwstart;
mips_yeeloong = boot/mips/yeeloong/fwstart.S; mips_yeeloong = boot/mips/yeeloong/fwstart.S;
objcopyflags = '-O binary'; objcopyflags = '-O binary';
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_yeeloong; enable = mips_yeeloong;
}; };
@ -1464,7 +1465,6 @@ module = {
name = ieee1275_fb; name = ieee1275_fb;
ieee1275 = video/ieee1275.c; ieee1275 = video/ieee1275.c;
enable = powerpc; enable = powerpc;
enable = sparc64;
}; };
module = { module = {

View file

@ -38,7 +38,7 @@ write_bases (void)
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++) for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT) reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
& GRUB_MACHINE_PCI_WIN_MASK) & GRUB_MACHINE_PCI_WIN_MASK)
>> (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE)); << (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
GRUB_MACHINE_PCI_IO_CTRL_REG = reg; GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
} }

View file

@ -62,11 +62,10 @@ ofdisk_hash_find (const char *devpath)
} }
static struct ofdisk_hash_ent * static struct ofdisk_hash_ent *
ofdisk_hash_add (char *devpath) ofdisk_hash_add_real (char *devpath)
{ {
struct ofdisk_hash_ent *p;
struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)]; struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)];
struct ofdisk_hash_ent *p, *pcan;
char *curcan;
p = grub_malloc(sizeof (*p)); p = grub_malloc(sizeof (*p));
if (!p) if (!p)
@ -76,17 +75,27 @@ ofdisk_hash_add (char *devpath)
p->next = *head; p->next = *head;
p->shortest = 0; p->shortest = 0;
*head = p; *head = p;
return p;
}
static struct ofdisk_hash_ent *
ofdisk_hash_add (char *devpath, char *curcan)
{
struct ofdisk_hash_ent *p, *pcan;
p = ofdisk_hash_add_real (devpath);
grub_dprintf ("disk", "devpath = %s, canonical = %s\n", devpath, curcan);
curcan = grub_ieee1275_canonicalise_devname (devpath);
if (!curcan) if (!curcan)
{ {
grub_errno = GRUB_ERR_NONE; p->shortest = devpath;
return p; return p;
} }
pcan = ofdisk_hash_find (curcan); pcan = ofdisk_hash_find (curcan);
if (!pcan) if (!pcan)
pcan = ofdisk_hash_add (curcan); pcan = ofdisk_hash_add_real (curcan);
else else
grub_free (curcan); grub_free (curcan);
@ -118,17 +127,22 @@ scan (void)
return 0; return 0;
grub_dprintf ("disk", "disk name = %s\n", alias->name); grub_dprintf ("disk", "disk name = %s\n", alias->name);
grub_dprintf ("disk", "disk name = %s, path = %s\n", alias->name,
alias->path);
op = ofdisk_hash_find (alias->path); op = ofdisk_hash_find (alias->name);
if (!op) if (!op)
{ {
char *name = grub_strdup (alias->name); char *name = grub_strdup (alias->name);
if (!name) char *can = grub_strdup (alias->path);
if (!name || !can)
{ {
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
grub_free (name);
grub_free (can);
return 0; return 0;
} }
op = ofdisk_hash_add (name); op = ofdisk_hash_add (name, can);
} }
return 0; return 0;
} }
@ -247,7 +261,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
struct ofdisk_hash_ent *op; struct ofdisk_hash_ent *op;
op = ofdisk_hash_find (devpath); op = ofdisk_hash_find (devpath);
if (!op) if (!op)
op = ofdisk_hash_add (devpath); op = ofdisk_hash_add (devpath, NULL);
else else
grub_free (devpath); grub_free (devpath);
if (!op) if (!op)

View file

@ -143,7 +143,8 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
&sb)) &sb))
return grub_errno; return grub_errno;
if (grub_le_to_cpu32 (sb.magic) != SB_MAGIC) if (grub_le_to_cpu32 (sb.magic) != SB_MAGIC
|| grub_le_to_cpu64 (sb.super_offset) != sector)
continue; continue;
{ {

View file

@ -570,7 +570,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
{ {
for (p = array_list; p != NULL; p = p->next) for (p = array_list; p != NULL; p = p->next)
{ {
if (! p->name && p->number == array->number) if (p->number == array->number)
break; break;
} }
} }

View file

@ -506,7 +506,7 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
if (scsi->blocksize != GRUB_DISK_SECTOR_SIZE) if (scsi->blocksize != GRUB_DISK_SECTOR_SIZE)
{ {
unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS; unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS;
if (! (spb != 0 && (scsi->blocksize & GRUB_DISK_SECTOR_SIZE) == 0)) if (spb == 0 || (scsi->blocksize & (GRUB_DISK_SECTOR_SIZE - 1)) != 0)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"unsupported SCSI block size"); "unsupported SCSI block size");

View file

@ -281,7 +281,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
} }
file->data = data; file->data = data;
file->not_easly_seekable = 1; file->not_easily_seekable = 1;
grub_memcpy (file_int, file, sizeof (struct grub_file)); grub_memcpy (file_int, file, sizeof (struct grub_file));
curr_file = file_int; curr_file = file_int;

View file

@ -364,12 +364,14 @@ grub_cmd_zfs_bootfs (grub_command_t cmd __attribute__ ((unused)), int argc,
grub_free (nv); grub_free (nv);
grub_free (nvlist); grub_free (nvlist);
bootfs = grub_xasprintf ("zfs-bootfs=%s/%llu%s%s%s%s", bootfs = grub_xasprintf ("zfs-bootfs=%s/%llu%s%s%s%s%s%s",
poolname, (unsigned long long) mdnobj, poolname, (unsigned long long) mdnobj,
bootpath ? ",bootpath=" : "", bootpath ? ",bootpath=\"" : "",
bootpath ? : "", bootpath ? : "",
devid ? ",diskdevid=" : "", bootpath ? "\"" : "",
devid ? : ""); devid ? ",diskdevid=\"" : "",
devid ? : "",
devid ? "\"" : "");
if (!bootfs) if (!bootfs)
return grub_errno; return grub_errno;
if (argc >= 2) if (argc >= 2)

View file

@ -52,8 +52,8 @@ fi
rm -f $t1 $t2 rm -f $t1 $t2
if test x@TARGET_APPLE_CC@ != x1; then if test x@TARGET_APPLE_CC@ != x1; then
if ! test -z "@TARGET_OBJ2ELF@"; then if ! test -z "${TARGET_OBJ2ELF}"; then
./@TARGET_OBJ2ELF@ $tmpfile || exit 1 ./${TARGET_OBJ2ELF} $tmpfile || exit 1
fi fi
if test x@platform@ != xemu; then if test x@platform@ != xemu; then
@STRIP@ --strip-unneeded \ @STRIP@ --strip-unneeded \

View file

@ -74,7 +74,7 @@ grub_bufio_open (grub_file_t io, int size)
file->data = bufio; file->data = bufio;
file->read_hook = 0; file->read_hook = 0;
file->fs = &grub_bufio_fs; file->fs = &grub_bufio_fs;
file->not_easly_seekable = io->not_easly_seekable; file->not_easily_seekable = io->not_easily_seekable;
return file; return file;
} }

View file

@ -1151,7 +1151,7 @@ grub_gzio_open (grub_file_t io)
file->data = gzio; file->data = gzio;
file->read_hook = 0; file->read_hook = 0;
file->fs = &grub_gzio_fs; file->fs = &grub_gzio_fs;
file->not_easly_seekable = 1; file->not_easily_seekable = 1;
if (! test_gzip_header (file)) if (! test_gzip_header (file))
{ {

View file

@ -200,7 +200,7 @@ grub_xzio_open (grub_file_t io)
file->read_hook = 0; file->read_hook = 0;
file->fs = &grub_xzio_fs; file->fs = &grub_xzio_fs;
file->size = GRUB_FILE_SIZE_UNKNOWN; file->size = GRUB_FILE_SIZE_UNKNOWN;
file->not_easly_seekable = 1; file->not_easily_seekable = 1;
if (grub_file_tell (xzio->file) != 0) if (grub_file_tell (xzio->file) != 0)
grub_file_seek (xzio->file, 0); grub_file_seek (xzio->file, 0);

View file

@ -17,7 +17,9 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <config-util.h>
#include <config.h> #include <config.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <assert.h> #include <assert.h>

View file

@ -84,6 +84,9 @@ grub_ieee1275_find_options (void)
if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC")) if (rc >= 0 && !grub_strcmp (tmp, "Emulated PC"))
is_qemu = 1; is_qemu = 1;
if (grub_strncmp (tmp, "PowerMac", sizeof ("PowerMac") - 1) == 0)
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS);
if (is_smartfirmware) if (is_smartfirmware)
{ {
/* Broken in all versions */ /* Broken in all versions */

View file

@ -50,6 +50,12 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"couldn't examine /memory/available property"); "couldn't examine /memory/available property");
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS))
{
address_cells = 1;
size_cells = 1;
}
/* Decode each entry and call `hook'. */ /* Decode each entry and call `hook'. */
i = 0; i = 0;
available_size /= sizeof (grub_uint32_t); available_size /= sizeof (grub_uint32_t);

View file

@ -41,6 +41,7 @@ extern void grub_at_keyboard_init (void);
extern void grub_serial_init (void); extern void grub_serial_init (void);
extern void grub_terminfo_init (void); extern void grub_terminfo_init (void);
extern void grub_keylayouts_init (void); extern void grub_keylayouts_init (void);
extern void grub_boot_init (void);
/* FIXME: use interrupt to count high. */ /* FIXME: use interrupt to count high. */
grub_uint64_t grub_uint64_t
@ -210,6 +211,8 @@ grub_machine_init (void)
grub_terminfo_init (); grub_terminfo_init ();
grub_serial_init (); grub_serial_init ();
grub_boot_init ();
} }
void void

View file

@ -152,7 +152,8 @@ grub_linux_load32 (grub_elf_t elf)
Elf32_Addr base_addr; Elf32_Addr base_addr;
grub_addr_t seg_addr; grub_addr_t seg_addr;
grub_uint32_t align; grub_uint32_t align;
int offset; grub_uint32_t offset;
Elf32_Addr entry;
linux_size = grub_elf32_size (elf, &base_addr, &align); linux_size = grub_elf32_size (elf, &base_addr, &align);
if (linux_size == 0) if (linux_size == 0)
@ -160,9 +161,12 @@ grub_linux_load32 (grub_elf_t elf)
/* Pad it; the kernel scribbles over memory beyond its load address. */ /* Pad it; the kernel scribbles over memory beyond its load address. */
linux_size += 0x100000; linux_size += 0x100000;
offset = elf->ehdr.ehdr32.e_entry - base_addr; /* Linux's entry point incorrectly contains a virtual address. */
entry = elf->ehdr.ehdr32.e_entry & ~ELF32_LOADMASK;
/* Linux's incorrectly contains a virtual address. */ /* Linux's incorrectly contains a virtual address. */
base_addr &= ~ELF32_LOADMASK; base_addr &= ~ELF32_LOADMASK;
offset = entry - base_addr;
/* On some systems, firmware occupies the memory we're trying to use. /* On some systems, firmware occupies the memory we're trying to use.
* Happily, Linux can be loaded anywhere (it relocates itself). Iterate * Happily, Linux can be loaded anywhere (it relocates itself). Iterate
@ -196,7 +200,8 @@ grub_linux_load64 (grub_elf_t elf)
Elf64_Addr base_addr; Elf64_Addr base_addr;
grub_addr_t seg_addr; grub_addr_t seg_addr;
grub_uint64_t align; grub_uint64_t align;
int offset; grub_uint64_t offset;
Elf64_Addr entry;
linux_size = grub_elf64_size (elf, &base_addr, &align); linux_size = grub_elf64_size (elf, &base_addr, &align);
if (linux_size == 0) if (linux_size == 0)
@ -204,9 +209,10 @@ grub_linux_load64 (grub_elf_t elf)
/* Pad it; the kernel scribbles over memory beyond its load address. */ /* Pad it; the kernel scribbles over memory beyond its load address. */
linux_size += 0x100000; linux_size += 0x100000;
offset = elf->ehdr.ehdr64.e_entry - base_addr;
/* Linux's incorrectly contains a virtual address. */
base_addr &= ~ELF64_LOADMASK; base_addr &= ~ELF64_LOADMASK;
entry = elf->ehdr.ehdr64.e_entry & ~ELF64_LOADMASK;
offset = entry - base_addr;
/* Linux's incorrectly contains a virtual address. */
/* On some systems, firmware occupies the memory we're trying to use. /* On some systems, firmware occupies the memory we're trying to use.
* Happily, Linux can be loaded anywhere (it relocates itself). Iterate * Happily, Linux can be loaded anywhere (it relocates itself). Iterate

View file

@ -148,7 +148,7 @@ grub_env_context_close (void)
grub_err_t grub_err_t
grub_env_extractor_close (int source) grub_env_extractor_close (int source)
{ {
grub_menu_t menu, menu2; grub_menu_t menu = NULL;
grub_menu_entry_t *last; grub_menu_entry_t *last;
grub_err_t err; grub_err_t err;
@ -161,6 +161,7 @@ grub_env_extractor_close (int source)
if (source) if (source)
{ {
grub_menu_t menu2;
menu2 = grub_env_get_menu (); menu2 = grub_env_get_menu ();
last = &menu2->entry_list; last = &menu2->entry_list;

View file

@ -159,7 +159,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
{ {
grub_err_t err = GRUB_ERR_NONE; grub_err_t err = GRUB_ERR_NONE;
int errs_before; int errs_before;
grub_menu_t menu; grub_menu_t menu = NULL;
char *optr, *buf, *oldchosen = NULL, *olddefault = NULL; char *optr, *buf, *oldchosen = NULL, *olddefault = NULL;
const char *ptr, *chosen, *def; const char *ptr, *chosen, *def;
grub_size_t sz = 0; grub_size_t sz = 0;

View file

@ -26,7 +26,7 @@
#include <grub/msdos_partition.h> #include <grub/msdos_partition.h>
#ifdef GRUB_UTIL #ifdef GRUB_UTIL
#include <grub/util/misc.h> #include <grub/emu/misc.h>
#endif #endif
static struct grub_partition_map grub_bsdlabel_partition_map; static struct grub_partition_map grub_bsdlabel_partition_map;
@ -101,7 +101,8 @@ iterate_real (grub_disk_t disk, grub_disk_addr_t sector, int freebsd,
#ifdef GRUB_UTIL #ifdef GRUB_UTIL
char *partname; char *partname;
/* disk->partition != NULL as 0 < delta */ /* disk->partition != NULL as 0 < delta */
partname = grub_partition_get_name (disk->partition); partname = disk->partition ? grub_partition_get_name (disk->partition)
: "";
grub_util_warn ("Discarding improperly nested partition (%s,%s,%s%d)", grub_util_warn ("Discarding improperly nested partition (%s,%s,%s%d)",
disk->name, partname, p.partmap->name, p.number + 1); disk->name, partname, p.partmap->name, p.number + 1);
grub_free (partname); grub_free (partname);

View file

@ -232,10 +232,10 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
break; break;
} }
if (end >= *nsectors + 1) if (end >= *nsectors + 2)
{ {
int i; unsigned i;
*nsectors = end - 1; *nsectors = end - 2;
*sectors = grub_malloc (*nsectors * sizeof (**sectors)); *sectors = grub_malloc (*nsectors * sizeof (**sectors));
if (!*sectors) if (!*sectors)
return grub_errno; return grub_errno;

View file

@ -25,6 +25,8 @@
static unsigned static unsigned
round_up_exp (unsigned v) round_up_exp (unsigned v)
{ {
COMPILE_TIME_ASSERT (sizeof (v) == 4);
v--; v--;
v |= v >> 1; v |= v >> 1;
v |= v >> 2; v |= v >> 2;
@ -32,9 +34,6 @@ round_up_exp (unsigned v)
v |= v >> 8; v |= v >> 8;
v |= v >> 16; v |= v >> 16;
if (sizeof (v) > 4)
v |= v >> 32;
v++; v++;
v += (v == 0); v += (v == 0);

View file

@ -39,8 +39,8 @@ struct grub_file
/* The file size. */ /* The file size. */
grub_off_t size; grub_off_t size;
/* If file is not easly seekable. Should be set by underlying layer. */ /* If file is not easily seekable. Should be set by underlying layer. */
int not_easly_seekable; int not_easily_seekable;
/* Filesystem-specific data. */ /* Filesystem-specific data. */
void *data; void *data;
@ -123,7 +123,7 @@ grub_file_tell (const grub_file_t file)
static inline int static inline int
grub_file_seekable (const grub_file_t file) grub_file_seekable (const grub_file_t file)
{ {
return !file->not_easly_seekable; return !file->not_easily_seekable;
} }
#endif /* ! GRUB_FILE_HEADER */ #endif /* ! GRUB_FILE_HEADER */

View file

@ -106,6 +106,12 @@ enum grub_ieee1275_flag
/* OLPC / XO firmware has the cursor ON/OFF routines. */ /* OLPC / XO firmware has the cursor ON/OFF routines. */
GRUB_IEEE1275_FLAG_HAS_CURSORONOFF, GRUB_IEEE1275_FLAG_HAS_CURSORONOFF,
/* Some PowerMacs claim to use 2 address cells but in fact use only 1.
Other PowerMacs claim to use only 1 and really do so. Always assume
1 address cell is used on PowerMacs.
*/
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS,
}; };
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);

View file

@ -64,7 +64,7 @@ if test -f "${sysconfdir}/default/grub" ; then
. "${sysconfdir}/default/grub" . "${sysconfdir}/default/grub"
fi fi
bootloader_id="$(echo "$GRUB_DISTRIBUTOR" | tr '[A-Z]' '[a-z]' | cut -d' ' -f1)" bootloader_id="$(echo "$GRUB_DISTRIBUTOR" | tr 'A-Z' 'a-z' | cut -d' ' -f1)"
if test -z "$bootloader_id"; then if test -z "$bootloader_id"; then
bootloader_id=grub bootloader_id=grub
fi fi
@ -270,6 +270,11 @@ if test "x$install_device" = x && ([ "${target_cpu}-${platform}" = "i386-pc" ] \
exit 1 exit 1
fi fi
if ! ([ "${target_cpu}-${platform}" = "i386-pc" ] \
|| [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ]); then
install_device=
fi
# If the debugging feature is enabled, print commands. # If the debugging feature is enabled, print commands.
setup_verbose= setup_verbose=
if test x"$debug" = xyes; then if test x"$debug" = xyes; then
@ -516,27 +521,24 @@ if [ "x${devabstraction_module}" = "x" ] ; then
# Strip partition number # Strip partition number
grub_partition="`echo "${grub_drive}" | sed -e 's/^[^,]*[,)]//; s/)$//'`" grub_partition="`echo "${grub_drive}" | sed -e 's/^[^,]*[,)]//; s/)$//'`"
grub_drive="`echo "${grub_drive}" | sed -e s/,[a-z0-9,]*//g`" grub_drive="`echo "${grub_drive}" | sed -e s/,[a-z0-9,]*//g`"
if [ "$disk_module" = ata ] ; then if [ "$disk_module" = ata ] || [ "x${grub_drive}" != "x${install_drive}" ] || ([ "x$platform" != xefi ] && [ "x$platform" != xpc ] && [ x"${target_cpu}-${platform}" != x"sparc64-ieee1275" ]) ; then
# generic method (used on coreboot and ata mod) # generic method (used on coreboot and ata mod)
uuid="`"$grub_probe" --device-map="${device_map}" --target=fs_uuid --device "${grub_device}"`" uuid="`"$grub_probe" --device-map="${device_map}" --target=fs_uuid --device "${grub_device}"`"
if [ "x${uuid}" = "x" ] ; then if [ "x${uuid}" = "x" ] ; then
echo "UUID needed with ata mod, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2 if [ "x$platform" != xefi ] && [ "x$platform" != xpc ] && [ x"${target_cpu}-${platform}" != x"sparc64-ieee1275" ]; then
echo "UUID needed with $platform, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
elif [ "$disk_module" = ata ]; then
echo "UUID needed with ata mod, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
else
echo "UUID needed with cross-disk installs, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
fi
exit 1 exit 1
fi fi
echo "search.fs_uuid ${uuid} root " >> "${grubdir}/load.cfg" echo "search.fs_uuid ${uuid} root " >> "${grubdir}/load.cfg"
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg" echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
config_opt="-c ${grubdir}/load.cfg " config_opt="-c ${grubdir}/load.cfg "
modules="$modules search_fs_uuid" modules="$modules search_fs_uuid"
elif [ "x${grub_drive}" != "x${install_drive}" ] ; then
uuid="`"$grub_probe" --device-map="${device_map}" --target=fs_uuid --device "${grub_device}"`"
if [ "x${uuid}" = "x" ] ; then
echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
exit 1
fi
echo "search.fs_uuid ${uuid} root " >> ${grubdir}/load.cfg
echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
config_opt="-c ${grubdir}/load.cfg "
modules="$modules search_fs_uuid"
elif [ "x$platform" = xefi ] || [ "x$platform" = xpc ]; then elif [ "x$platform" = xefi ] || [ "x$platform" = xpc ]; then
# we need to hardcode the partition number in the core image's prefix. # we need to hardcode the partition number in the core image's prefix.
if [ x"$grub_partition" = x ]; then if [ x"$grub_partition" = x ]; then

View file

@ -61,6 +61,12 @@ is_path_readable_by_grub ()
return 1 return 1
fi fi
# ... or if we can't figure out the abstraction module, for example if
# memberlist fails on an LVM volume group.
if ${grub_probe} -t abstraction $path > /dev/null 2>&1 ; then : ; else
return 1
fi
return 0 return 0
} }

View file

@ -859,7 +859,7 @@ void
write_font_pf2 (struct grub_font_info *font_info, char *output_file) write_font_pf2 (struct grub_font_info *font_info, char *output_file)
{ {
FILE *file; FILE *file;
grub_uint32_t leng, data; grub_uint32_t leng;
char style_name[20], *font_name; char style_name[20], *font_name;
int offset; int offset;
struct grub_glyph_info *cur; struct grub_glyph_info *cur;
@ -959,12 +959,14 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
for (cur = font_info->glyphs_sorted; for (cur = font_info->glyphs_sorted;
cur < font_info->glyphs_sorted + font_info->num_glyphs; cur++) cur < font_info->glyphs_sorted + font_info->num_glyphs; cur++)
{ {
data = grub_cpu_to_be32 (cur->char_code); grub_uint32_t data32;
grub_util_write_image ((char *) &data, 4, file); grub_uint8_t data8;
data = 0; data32 = grub_cpu_to_be32 (cur->char_code);
grub_util_write_image ((char *) &data, 1, file); grub_util_write_image ((char *) &data32, 4, file);
data = grub_cpu_to_be32 (offset); data8 = 0;
grub_util_write_image ((char *) &data, 4, file); grub_util_write_image ((char *) &data8, 1, file);
data32 = grub_cpu_to_be32 (offset);
grub_util_write_image ((char *) &data32, 4, file);
offset += 10 + cur->bitmap_size; offset += 10 + cur->bitmap_size;
} }
@ -976,6 +978,7 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
for (cur = font_info->glyphs_sorted; for (cur = font_info->glyphs_sorted;
cur < font_info->glyphs_sorted + font_info->num_glyphs; cur++) cur < font_info->glyphs_sorted + font_info->num_glyphs; cur++)
{ {
grub_uint16_t data;
data = grub_cpu_to_be16 (cur->width); data = grub_cpu_to_be16 (cur->width);
grub_util_write_image ((char *) &data, 2, file); grub_util_write_image ((char *) &data, 2, file);
data = grub_cpu_to_be16 (cur->height); data = grub_cpu_to_be16 (cur->height);

View file

@ -29,6 +29,7 @@
#include <grub/util/resolve.h> #include <grub/util/resolve.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/offsets.h> #include <grub/offsets.h>
#include <grub/crypto.h>
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
@ -1167,12 +1168,37 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
size_t rom_size; size_t rom_size;
char *boot_path, *boot_img; char *boot_path, *boot_img;
size_t boot_size; size_t boot_size;
grub_uint8_t context[GRUB_MD_SHA512->contextsize];
/* fwstart.img is the only part which can't be testes by using *-elf
target. Check it against the checksum. This checksum is obtained with
sha512sum utility after compiling on Gnewsense.
*/
const grub_uint8_t fwstart_good_hash[] =
{ 0x75, 0xbf, 0xa3, 0x0e, 0x7c, 0xd1, 0x03, 0x82,
0xe1, 0x34, 0x55, 0xd7, 0x09, 0x1e, 0x6c, 0xcc,
0xef, 0x08, 0x61, 0xc1, 0x3c, 0xd8, 0xc7, 0x9f,
0xe8, 0x2d, 0x3d, 0xb2, 0xda, 0x41, 0xd3, 0x83,
0xd7, 0xb8, 0xe3, 0xd7, 0x13, 0xec, 0x9b, 0xf6,
0xf6, 0xae, 0x6b, 0x32, 0x29, 0xc1, 0x69, 0x82,
0xfa, 0x65, 0x2d, 0x97, 0x3e, 0x83, 0x6e, 0x6c,
0xce, 0x34, 0x10, 0x59, 0x74, 0x0e, 0x96, 0x26 };
boot_path = grub_util_get_path (dir, "fwstart.img"); boot_path = grub_util_get_path (dir, "fwstart.img");
boot_size = grub_util_get_image_size (boot_path); boot_size = grub_util_get_image_size (boot_path);
boot_img = grub_util_read_image (boot_path); boot_img = grub_util_read_image (boot_path);
rom_size = ALIGN_UP (core_size + boot_size, 512 * 1024); grub_memset (context, 0, sizeof (context));
GRUB_MD_SHA512->init (context);
GRUB_MD_SHA512->write (context, boot_img, boot_size);
GRUB_MD_SHA512->final (context);
if (grub_memcmp (GRUB_MD_SHA512->read (context), fwstart_good_hash,
GRUB_MD_SHA512->mdlen) != 0)
grub_util_warn ("fwstart.img doesn't match the known good version. "
"Proceed at your own risk");
if (core_size + boot_size > 512 * 1024)
grub_util_error ("firmware image is too big");
rom_size = 512 * 1024;
rom_img = xmalloc (rom_size); rom_img = xmalloc (rom_size);
memset (rom_img, 0, rom_size); memset (rom_img, 0, rom_size);

View file

@ -337,7 +337,7 @@ write_symbol_table (FILE* fp, char *image,
else else
bind = STB_LOCAL; bind = STB_LOCAL;
if ((type != STT_FUNC) && (pe_symtab->num_aux)) if ((pe_symtab->type != GRUB_PE32_DT_FUNCTION) && (pe_symtab->num_aux))
{ {
if (! pe_symtab->value) if (! pe_symtab->value)
type = STT_SECTION; type = STT_SECTION;

View file

@ -84,11 +84,16 @@ if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
EOF EOF
else else
# Insert all available backends; GRUB will use the most appropriate. # Insert all available backends; GRUB will use the most appropriate.
have_video=0;
for backend in $(cat "${GRUB_PREFIX}/video.lst"); do for backend in $(cat "${GRUB_PREFIX}/video.lst"); do
have_video=1;
cat <<EOF cat <<EOF
insmod ${backend} insmod ${backend}
EOF EOF
done done
if [ x$have_video = x0 ]; then
echo "true"
fi
fi fi
cat <<EOF cat <<EOF
} }

View file

@ -28,7 +28,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU OS=GNU
else else
OS="${GRUB_DISTRIBUTOR} GNU/Hurd" OS="${GRUB_DISTRIBUTOR} GNU/Hurd"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) ${CLASS}" CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
fi fi
at_least_one=false at_least_one=false

View file

@ -31,7 +31,7 @@ CLASS="--class os"
case "${GRUB_DISTRIBUTOR}" in case "${GRUB_DISTRIBUTOR}" in
Debian) Debian)
OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) --class gnu-kfreebsd --class gnu ${CLASS}" CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) --class gnu-kfreebsd --class gnu ${CLASS}"
;; ;;
*) *)
OS="FreeBSD" OS="FreeBSD"

View file

@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux OS=GNU/Linux
else else
OS="${GRUB_DISTRIBUTOR} GNU/Linux" OS="${GRUB_DISTRIBUTOR} GNU/Linux"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) ${CLASS}" CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
fi fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but # loop-AES arranges things so that /dev/loop/X can be our root device, but

View file

@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux OS=GNU/Linux
else else
OS="${GRUB_DISTRIBUTOR} GNU/Linux" OS="${GRUB_DISTRIBUTOR} GNU/Linux"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) ${CLASS}" CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
fi fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but # loop-AES arranges things so that /dev/loop/X can be our root device, but
@ -98,6 +98,9 @@ linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
version=$(echo $basename | sed -e "s,^[^0-9]*-,,g") version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
if grub_file_is_not_garbage "$i" && grep -qx "CONFIG_XEN_DOM0=y" /boot/config-${version} 2> /dev/null ; then echo -n "$i " ; fi if grub_file_is_not_garbage "$i" && grep -qx "CONFIG_XEN_DOM0=y" /boot/config-${version} 2> /dev/null ; then echo -n "$i " ; fi
done` done`
if [ "x${linux_list}" = "x" ] ; then
exit 0
fi
xen_list=`for i in /boot/xen*; do xen_list=`for i in /boot/xen*; 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`

View file

@ -377,8 +377,8 @@ grub_util_devname_to_ofpath (const char *devname)
if (! name_buf) if (! name_buf)
grub_util_error ("cannot get the real path of `%s'", devname); grub_util_error ("cannot get the real path of `%s'", devname);
device = get_basename (devname); device = get_basename (name_buf);
devnode = strip_trailing_digits (devname); devnode = strip_trailing_digits (name_buf);
devicenode = strip_trailing_digits (device); devicenode = strip_trailing_digits (device);
ofpath = xmalloc (OF_PATH_MAX); ofpath = xmalloc (OF_PATH_MAX);
@ -391,6 +391,13 @@ grub_util_devname_to_ofpath (const char *devname)
else if (device[0] == 'v' && device[1] == 'd' && device[2] == 'i' else if (device[0] == 'v' && device[1] == 'd' && device[2] == 'i'
&& device[3] == 's' && device[4] == 'k') && device[3] == 's' && device[4] == 'k')
of_path_of_vdisk(ofpath, name_buf, device, devnode, devicenode); of_path_of_vdisk(ofpath, name_buf, device, devnode, devicenode);
else if (device[0] == 'f' && device[1] == 'd'
&& device[2] == '0' && device[3] == '\0')
/* All the models I've seen have a devalias "floppy".
New models have no floppy at all. */
strcpy (ofpath, "floppy");
else
grub_util_error ("unknown device type %s\n", device);
free (devnode); free (devnode);
free (devicenode); free (devicenode);