Merge branch 'master' into leiflindholm/arm64

This commit is contained in:
Vladimir Serbinenko 2013-11-18 17:51:28 +01:00
commit 96fa2d9d02
33 changed files with 519 additions and 96 deletions

208
ChangeLog
View File

@ -1,3 +1,211 @@
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* tests/grub_func_test.in: Decrease RAM size to 512M. With less
fragmentation 512M is enough.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the
pointer to 32K. This is the size of cache element which is the most
common allocation >1K. This way the pointer is always around blocks
of 32K and so we keep performance while decreasing fragmentation.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mm.c (grub_real_malloc): Don't update the pointer to
current memory when allocating large chunks. This significantly
decreases memory fragmentation.
2013-11-18 Colin Watson <cjwatson@ubuntu.com>
* tests/gzcompress_test.in: Skip if gzip is not installed (unlikely,
but for symmetry).
* tests/lzocompress_test.in: Skip if lzop is not installed.
* tests/xzcompress_test.in: Skip if xz is not installed.
2013-11-18 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkrescue.c (main): Fix typo.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mips/qemu_mips/init.c (grub_machine_init): Update
clock frequency to 200 MHz,
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* tests/util/grub-shell.in: Increase console size to 1024x1024.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* Makefile.am (default_payload.elf): Add pata to loaded modules.
Load config file from (cbfsdisk)/etc/grub.cfg.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install-common.c (grub_install_copy_files): Fix module
destination directory.
2013-11-18 Colin Watson <cjwatson@ubuntu.com>
* tests/util/grub-shell.in: Don't fail on emu platform if po/*.gmo
files have not been built.
2013-11-18 Colin Watson <cjwatson@ubuntu.com>
* grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file):
Handle errors from mkstemp.
(grub_util_make_temporary_dir): Handle errors from mkdtemp.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* tests/util/grub-shell.in: Use -cdrom and don't force cdrom
on primary master on pseries.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/tests/videotest_checksum.c: Don't reload unifont if it's
already loaded. This saves memory needed for tests,
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrescue.c (main): Fix a typo to make yeeloong part
work again.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/terminfo.c (grub_cmd_terminfo): Fix a typo to make -g
work again.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* tests/util/grub-shell.in: For powerpc tests put the CD-ROM as primary
master since with some combinations of qemu and firmware only primary
IDE channel is available.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/tests/gfxterm_menu.c: Skip high-resolution tests on
low-memory platforms where we don't have enough memory for them.
* grub-core/tests/videotest_checksum.c: Likewise.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/tests/cmdline_cat_test.c: Don't reload unifont if it's
already loaded. This saves memory needed for tests,
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
Fix handling of install lists.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/sparc64/setjmp.S: Force spilling of current window.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
On i386-ieee1275 we run in paged mode. So we need to explicitly map
the devices before accessing them.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/relocator.c (grub_mm_check_real): Accept const char *
as file argument.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/cmdline.c (grub_cmdline_get): Plug memory leak.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/file.c (grub_file_open): Free file->name on failure.
(grub_file_close): Free file->name.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/verify.c (free_pk): Plug memory leak.
(grub_load_public_key): Likewise.
(grub_verify_signature_real): Likewise.
(grub_cmd_verify_signature): Likewise.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/legacycfg.c (grub_legacy_check_md5_password): Plug
memory leak.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/powerpc/setjmp.S (grub_setjmp): Save r31.
(grub_longjmp): Restore r31.
* include/grub/powerpc/setjmp.h (grub_jmp_buf): Reserve space for r31.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrescue.c (make_image_fwdisk_abs): Insert all partmap
modules to be in line with make_image_abs.
2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/mips/setjmp.h (grub_jmp_buf): Fix buffer size.
setjmp.S uses 12 entries but buffer is declared with only 11 entries.
2013-11-17 Ian Campbell <ijc@hellion.org.uk>
* grub-core/disk/uboot/ubootdisk.c: Include SCSI disks.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* tests/grub_func_test.in: Increase memory reservation as on EFI we need
to leave some memory to firmware.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/tests/cmdline_cat_test.c (cmdline_cat_test): Ignore errors
of loading gfxterm as gfxterm is embed in kernel on some platforms.
* grub-core/tests/gfxterm_menu.c (gfxterm_menu): Likewise.
Load gfxmenu.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* tests/core_compress_test.in: Use full arguments as grub-mkimage-extra
now needs full arguments.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrescue.c (main): Add trailing \n in
.disk_label.contentDetails to be in line with previous shell script.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrescue.c (main): Use right source file for bootinfo.txt.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install-common.c (grub_install_parse): Recognize
--compress=none like shell script did.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/misc.h: Replace check for __sparc64__ with one for
__sparc__ as __sparc64__ isn't actually defined.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* tests/util/grub-shell.in: Use escc-ch-b on powerpc. This is missing
counterpart of fixing the naming of escc ports.
2013-11-17 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install-common.c (platforms): Fix the order of entries and
remove useless field val.
2013-11-16 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.c: Add new option --no-bootsector to skip
installing of bootsector. Accept --grub-setup=/bin/true as
backwards-compatible synonym.
2013-11-16 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub-install.c (device_map_check_duplicates): Fix incorrect

View File

@ -394,7 +394,7 @@ bootcheck: $(BOOTCHECKS)
if COND_i386_coreboot
default_payload.elf: grub-mkstandalone grub-mkimage
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump setpci lsacpi chain' --fonts= --themes= --locales= -d grub-core/
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
endif
windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows

View File

@ -574,6 +574,7 @@ module = {
module = {
name = pci;
common = bus/pci.c;
i386_ieee1275 = bus/i386/ieee1275/pci.c;
enable = i386_pc;
enable = i386_ieee1275;

View File

@ -0,0 +1,42 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/dl.h>
#include <grub/pci.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/ieee1275/ieee1275.h>
volatile void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base,
grub_size_t size)
{
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE))
return (volatile void *) base;
if (grub_ieee1275_map (base, base, size, 7))
grub_fatal ("couldn't map 0x%lx", base);
return (volatile void *) base;
}
void
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
volatile void *mem __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
}

View File

@ -735,6 +735,7 @@ grub_legacy_check_md5_password (int argc, char **args,
char *entered)
{
struct legacy_md5_password *pw = NULL;
int ret;
if (args[0][0] != '-' || args[0][1] != '-')
{
@ -751,7 +752,9 @@ grub_legacy_check_md5_password (int argc, char **args,
if (!pw)
return 0;
return check_password_md5_real (entered, pw);
ret = check_password_md5_real (entered, pw);
grub_free (pw);
return ret;
}
static grub_err_t

View File

@ -192,6 +192,10 @@ free_pk (struct grub_public_key *pk)
struct grub_public_subkey *nsk, *sk;
for (sk = pk->subkeys; sk; sk = nsk)
{
grub_size_t i;
for (i = 0; i < ARRAY_SIZE (sk->mpis); i++)
if (sk->mpis[i])
gcry_mpi_release (sk->mpis[i]);
nsk = sk->next;
grub_free (sk);
}
@ -244,6 +248,7 @@ grub_load_public_key (grub_file_t f)
if (type == 0xff)
{
grub_free (fingerprint_context);
grub_free (buffer);
return ret;
}
@ -631,6 +636,9 @@ grub_verify_signature_real (char *buf, grub_size_t size,
if ((*pkalgos[pk].algo)->verify (0, hmpi, mpis, sk->mpis, 0, 0))
goto fail;
grub_free (context);
grub_free (readbuf);
return GRUB_ERR_NONE;
fail:
@ -736,8 +744,8 @@ static grub_err_t
grub_cmd_verify_signature (grub_extcmd_context_t ctxt,
int argc, char **args)
{
grub_file_t f, sig;
grub_err_t err;
grub_file_t f = NULL, sig = NULL;
grub_err_t err = GRUB_ERR_NONE;
struct grub_public_key *pk = NULL;
grub_dprintf ("crypt", "alive\n");
@ -768,19 +776,27 @@ grub_cmd_verify_signature (grub_extcmd_context_t ctxt,
grub_file_filter_disable_all ();
f = grub_file_open (args[0]);
if (!f)
return grub_errno;
{
err = grub_errno;
goto fail;
}
grub_file_filter_disable_all ();
sig = grub_file_open (args[1]);
if (!sig)
{
grub_file_close (f);
return grub_errno;
err = grub_errno;
goto fail;
}
err = grub_verify_signature (f, sig, pk);
grub_file_close (f);
grub_file_close (sig);
fail:
if (sig)
grub_file_close (sig);
if (f)
grub_file_close (f);
if (pk)
free_pk (pk);
return err;
}

View File

@ -47,6 +47,7 @@ grub_ubootdisk_register (struct device_info *newdev)
{
case DT_STOR_IDE:
case DT_STOR_SATA:
case DT_STOR_SCSI:
case DT_STOR_MMC:
case DT_STOR_USB:
/* hd */

View File

@ -87,9 +87,6 @@ grub_file_open (const char *name)
if (! file)
goto fail;
file->name = grub_strdup (name);
grub_errno = GRUB_ERR_NONE;
file->device = device;
if (device->disk && file_name[0] != '/')
@ -105,6 +102,9 @@ grub_file_open (const char *name)
if ((file->fs->open) (file, file_name) != GRUB_ERR_NONE)
goto fail;
file->name = grub_strdup (name);
grub_errno = GRUB_ERR_NONE;
for (filter = 0; file && filter < ARRAY_SIZE (grub_file_filters_enabled);
filter++)
if (grub_file_filters_enabled[filter])
@ -187,6 +187,7 @@ grub_file_close (grub_file_t file)
if (file->device)
grub_device_close (file->device);
grub_free (file->name);
grub_free (file);
return grub_errno;
}

View File

@ -49,7 +49,7 @@ grub_machine_init (void)
}
/* FIXME: measure this. */
grub_arch_cpuclock = 64000000;
grub_arch_cpuclock = 200000000;
modend = grub_modules_get_end ();
grub_mm_init_region ((void *) modend, grub_arch_memsize

View File

@ -298,7 +298,10 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
/* Mark find as a start marker for next allocation to fasten it.
This will have side effect of fragmenting memory as small
pieces before this will be un-used. */
*first = q;
/* So do it only for chunks under 64K. */
if (n < (0x8000 >> GRUB_MM_ALIGN_LOG2)
|| *first == p)
*first = q;
return p + 1;
}

View File

@ -47,10 +47,11 @@ FUNCTION(grub_setjmp)
stw 28, 60(3)
stw 29, 64(3)
stw 30, 68(3)
stw 31, 72(3)
mflr 4
stw 4, 72(3)
mfcr 4
stw 4, 76(3)
mfcr 4
stw 4, 80(3)
li 3, 0
blr
@ -76,9 +77,10 @@ FUNCTION(grub_longjmp)
lwz 28, 60(3)
lwz 29, 64(3)
lwz 30, 68(3)
lwz 5, 72(3)
mtlr 5
lwz 31, 72(3)
lwz 5, 76(3)
mtlr 5
lwz 5, 80(3)
mtcr 5
mr. 3, 4
bne 1f

View File

@ -1618,7 +1618,7 @@ grub_relocator_prepare_relocs (struct grub_relocator *rel, grub_addr_t addr,
}
void
grub_mm_check_real (char *file, int line)
grub_mm_check_real (const char *file, int line)
{
grub_mm_region_t r;
grub_mm_header_t p, pa;

View File

@ -41,7 +41,11 @@ FUNCTION(grub_setjmp)
FUNCTION(grub_longjmp)
ldx [%o0 + 0x10], %g1
movrz %o1, 1, %o1
save %sp, -64, %sp
flushw
restore
ldx [%o0 + 0x00], %o7
ldx [%o0 + 0x08], %fp
sub %fp, 192, %sp

View File

@ -379,12 +379,18 @@ grub_cmdline_get (const char *prompt_translated)
cl_terms = grub_malloc (sizeof (cl_terms[0]) * nterms);
if (!cl_terms)
return 0;
{
grub_free (buf);
return 0;
}
cl_term_cur = cl_terms;
unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t));
if (!unicode_msg)
return 0;;
{
grub_free (buf);
return 0;
}
msg_len = grub_utf8_to_ucs4 (unicode_msg, msg_len - 1,
(grub_uint8_t *) prompt_translated, -1, 0);
unicode_msg[msg_len++] = ' ';
@ -621,6 +627,7 @@ grub_cmdline_get (const char *prompt_translated)
case '\e':
grub_free (cl_terms);
grub_free (buf);
return 0;
case '\b':

View File

@ -281,7 +281,8 @@ grub_util_make_temporary_file (void)
memcpy (tmp, t, tl);
memcpy (tmp + tl, "/grub.XXXXXX",
sizeof ("/grub.XXXXXX"));
mkstemp (tmp);
if (mkstemp (tmp) == -1)
grub_util_error (_("cannot make temporary file: %s"), strerror (errno));
return tmp;
}
@ -298,7 +299,9 @@ grub_util_make_temporary_dir (void)
memcpy (tmp, t, tl);
memcpy (tmp + tl, "/grub.XXXXXX",
sizeof ("/grub.XXXXXX"));
mkdtemp (tmp);
if (!mkdtemp (tmp))
grub_util_error (_("cannot make temporary directory: %s"),
strerror (errno));
return tmp;
}

View File

@ -748,8 +748,8 @@ grub_cmd_terminfo (grub_extcmd_context_t ctxt, int argc, char **args)
{
struct grub_terminfo_output_state *data
= (struct grub_terminfo_output_state *) cur->data;
data->pos.x = w;
data->pos.y = h;
data->size.x = w;
data->size.y = h;
}
if (argc == 1)

View File

@ -66,16 +66,25 @@ struct grub_procfs_entry test_txt =
.get_contents = get_test_txt
};
#define FONT_NAME "Unknown Regular 16"
/* Functional test main method. */
static void
cmdline_cat_test (void)
{
unsigned i;
grub_font_t font;
grub_dl_load ("gfxterm");
grub_errno = GRUB_ERR_NONE;
if (grub_font_load ("unicode") == 0)
font = grub_font_get (FONT_NAME);
if (font && grub_strcmp (font->name, FONT_NAME) != 0)
font = 0;
if (!font)
font = grub_font_load ("unicode");
if (!font)
{
grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
return;

View File

@ -91,17 +91,30 @@ struct
{ "gfxterm_high", "menu_color_highlight", "blue/red" },
};
#define FONT_NAME "Unknown Regular 16"
/* Functional test main method. */
static void
gfxterm_menu (void)
{
unsigned i, j;
grub_font_t font;
grub_dl_load ("png");
grub_dl_load ("gettext");
grub_dl_load ("gfxterm");
if (grub_font_load ("unicode") == 0)
grub_errno = GRUB_ERR_NONE;
grub_dl_load ("gfxmenu");
font = grub_font_get (FONT_NAME);
if (font && grub_strcmp (font->name, FONT_NAME) != 0)
font = 0;
if (!font)
font = grub_font_load ("unicode");
if (!font)
{
grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
return;
@ -112,7 +125,16 @@ gfxterm_menu (void)
for (j = 0; j < ARRAY_SIZE (tests); j++)
for (i = 0; i < GRUB_TEST_VIDEO_SMALL_N_MODES; i++)
{
grub_uint64_t start = grub_get_time_ms ();
grub_uint64_t start;
#if defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_IEEE1275)
if (grub_test_video_modes[i].width > 1024)
continue;
if (grub_strcmp (tests[j].name, "gfxmenu") == 0
&& grub_test_video_modes[i].width > 800)
continue;
#endif
start = grub_get_time_ms ();
grub_video_capture_start (&grub_test_video_modes[i],
grub_video_fbstd_colors,

View File

@ -26,13 +26,22 @@
GRUB_MOD_LICENSE ("GPLv3+");
#define FONT_NAME "Unknown Regular 16"
/* Functional test main method. */
static void
videotest_checksum (void)
{
unsigned i;
grub_font_t font;
if (grub_font_load ("unicode") == 0)
font = grub_font_get (FONT_NAME);
if (font && grub_strcmp (font->name, FONT_NAME) != 0)
font = 0;
if (!font)
font = grub_font_load ("unicode");
if (!font)
{
grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
return;
@ -40,9 +49,20 @@ videotest_checksum (void)
for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++)
{
grub_video_capture_start (&grub_test_video_modes[i],
grub_video_fbstd_colors,
grub_test_video_modes[i].number_of_colors);
grub_err_t err;
#if defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_IEEE1275)
if (grub_test_video_modes[i].width > 1024)
continue;
#endif
err = grub_video_capture_start (&grub_test_video_modes[i],
grub_video_fbstd_colors,
grub_test_video_modes[i].number_of_colors);
if (err)
{
grub_test_assert (0, "can't start capture: %s", grub_errmsg);
grub_print_error ();
continue;
}
grub_terminal_input_fake_sequence ((int []) { '\n' }, 1);
grub_video_checksum ("videotest");

View File

@ -70,6 +70,8 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
}
#ifndef GRUB_MACHINE_IEEE1275
static inline volatile void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base,
@ -85,5 +87,19 @@ grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
{
}
#else
volatile void *
grub_pci_device_map_range (grub_pci_device_t dev,
grub_addr_t base,
grub_size_t size);
void
grub_pci_device_unmap_range (grub_pci_device_t dev,
volatile void *mem,
grub_size_t size);
#endif
#endif /* GRUB_CPU_PCI_H */

View File

@ -19,7 +19,7 @@
#ifndef GRUB_SETJMP_CPU_HEADER
#define GRUB_SETJMP_CPU_HEADER 1
typedef unsigned long grub_jmp_buf[11];
typedef unsigned long grub_jmp_buf[12];
int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));

View File

@ -465,7 +465,7 @@ EXPORT_FUNC (__umodsi3) (grub_uint32_t a, grub_uint32_t b);
#endif
#if defined (__sparc64__) || defined (__powerpc__)
#if defined (__sparc__) || defined (__powerpc__)
unsigned
EXPORT_FUNC (__ctzdi2) (grub_uint64_t x);
#define NEED_CTZDI2 1

View File

@ -35,7 +35,7 @@ void EXPORT_FUNC(grub_free) (void *ptr);
void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
void grub_mm_check_real (char *file, int line);
void grub_mm_check_real (const char *file, int line);
#define grub_mm_check() grub_mm_check_real (GRUB_FILE, __LINE__);
/* For debugging. */

View File

@ -19,7 +19,7 @@
#ifndef GRUB_SETJMP_CPU_HEADER
#define GRUB_SETJMP_CPU_HEADER 1
typedef unsigned long grub_jmp_buf[20];
typedef unsigned long grub_jmp_buf[21];
int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));

View File

@ -27,10 +27,10 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
esac
if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=-C --grub-mkimage-extra=xz)" != "Hello World" ]; then
if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=--compress=xz)" != "Hello World" ]; then
exit 1
fi
if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=-C --grub-mkimage-extra=none)" != "Hello World" ]; then
if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=--compress=none)" != "Hello World" ]; then
exit 1
fi

View File

@ -3,8 +3,16 @@ set -e
. "@builddir@/grub-core/modinfo.sh"
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
# PLATFORM: Max RAM is 256M
mips-qemu_mips | mipsel-qemu_mips)
mem=256M;;
*)
mem=512M;;
esac
# Increase memory as some of tests are high-resolution and need a lot of memory.
out=`echo all_functional_test | @builddir@/grub-shell --timeout=3600 --files="/boot/grub/fonts/unicode.pf2"="@builddir@/"unicode.pf2 --qemu-opts="-m 512"`
out=`echo all_functional_test | @builddir@/grub-shell --timeout=3600 --files="/boot/grub/fonts/unicode.pf2"="@builddir@/"unicode.pf2 --qemu-opts="-m $mem"`
if [ "$(echo "$out" | tail -n 1)" != "ALL TESTS PASSED" ]; then
echo "Functional test failure: $out"

View File

@ -19,6 +19,11 @@ grubshell=@builddir@/grub-shell
. "@builddir@/grub-core/modinfo.sh"
if ! which gzip >/dev/null 2>&1; then
echo "gzip not installed; cannot test gzip compression."
exit 77
fi
if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=gz)" != "Hello World" ]; then
exit 1
fi

View File

@ -19,6 +19,11 @@ grubshell=@builddir@/grub-shell
. "@builddir@/grub-core/modinfo.sh"
if ! which lzop >/dev/null 2>&1; then
echo "lzop not installed; cannot test lzo compression."
exit 77
fi
if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo)" != "Hello World" ]; then
exit 1
fi

View File

@ -79,7 +79,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
boot=hd
qemu=qemu-system-ppc
console=console
serial_port=escc-ch-a
serial_port=escc-ch-b
serial_null="-serial null"
netbootext=elf
;;
@ -211,6 +211,7 @@ for option in "$@"; do
serial_null=
qemuopts="$qemuopts -M pseries -no-reboot"
trim=1
pseries=y
;;
--qemu-opts=*)
qs=`echo "$option" | sed -e 's/--qemu-opts=//'`
@ -306,7 +307,7 @@ else
fi
cat <<EOF >>${cfgfile}
terminfo -g 255x255 ${term} dumb
terminfo -g 1024x1024 ${term} dumb
terminal_input ${term}
terminal_output ${term}
EOF
@ -354,39 +355,43 @@ if [ x$boot != xnet ] && [ x$boot != xemu ]; then
fi
if [ x$boot = xhd ]; then
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mips-arc ]; then
device=hdb
device="hdb "
else
device=hda
device="hda "
fi
bootdev="-boot c"
fi
if [ x$boot = xcd ]; then
device=cdrom
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = powerpc-ieee1275 ] && [ x$pseries != xy ] ; then
device="-drive if=ide,media=cdrom,file="
else
device="cdrom "
fi
bootdev="-boot d"
fi
if [ x$boot = xfd ]; then
device=fda
device="fda "
bootdev="-boot a"
fi
if [ x$boot = xqemu ]; then
bootdev="-bios ${rom_directory}/qemu.img"
device=cdrom
device="cdrom "
fi
if [ x$boot = xmipsel_qemu ]; then
bootdev="-kernel ${rom_directory}/mipsel-qemu_mips.elf"
device=cdrom
device="cdrom "
fi
if [ x$boot = xmipsel_fulong2e ]; then
bootdev="-kernel ${rom_directory}/mipsel-loongson.elf -append machtype=lemote-fuloong-2e"
device=cdrom
device="cdrom "
fi
if [ x$boot = xmips_qemu ]; then
bootdev="-kernel ${rom_directory}/mips-qemu_mips.elf"
device=cdrom
device="cdrom "
fi
if [ x$boot = xcoreboot ]; then
@ -394,7 +399,7 @@ if [ x$boot = xcoreboot ]; then
cp "${GRUB_COREBOOT_ROM}" "${imgfile}"
"${GRUB_CBFSTOOL}" "${imgfile}" add-payload "${rom_directory}/coreboot.elf" fallback/payload
bootdev="-bios ${imgfile}"
device=cdrom
device="cdrom "
test -z "$debug" || echo "Coreboot image: ${imgfile}" >&2
fi
@ -429,13 +434,17 @@ elif [ x$boot = xemu ]; then
mkdir -p "$grubdir/locale"
cp "@builddir@/"unicode.pf2 "$grubdir/fonts/unicode.pf2"
cp -R "@srcdir@/themes/starfield" "$grubdir/themes/starfield"
cp -R "@srcdir@/po/"*.gmo "$grubdir/locale/"
for file in "@srcdir@/po/"*.gmo; do
if [ -f "$file" ]; then
cp "$file" "$grubdir/locale/"
fi
done
cp "${cfgfile}" "$grubdir/grub.cfg"
cp "${source}" "$grubdir/testcase.cfg"
@builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim
rm -rf "$grubdir"
else
timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device} ${isofile} ${bootdev} | cat | tr -d "\r" | do_trim
timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} | cat | tr -d "\r" | do_trim
fi
if [ x$boot = xcoreboot ]; then
test -n "$debug" || rm -f "${imgfile}"

View File

@ -19,6 +19,11 @@ grubshell=@builddir@/grub-shell
. "@builddir@/grub-core/modinfo.sh"
if ! which xz >/dev/null 2>&1; then
echo "xz not installed; cannot test xz compression."
exit 77
fi
if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=xz)" != "Hello World" ]; then
exit 1
fi

View File

@ -271,6 +271,7 @@ handle_install_list (struct install_list *il, const char *val,
}
il->n_alloc = il->n_entries + 1;
il->entries = xmalloc (il->n_alloc * sizeof (il->entries[0]));
ptr = val;
for (ce = il->entries; ; ce++)
{
const char *bptr;
@ -284,7 +285,6 @@ handle_install_list (struct install_list *il, const char *val,
*ce = xmalloc (ptr - bptr + 1);
memcpy (*ce, bptr, ptr - bptr);
(*ce)[ptr - bptr] = '\0';
ce++;
}
*ce = NULL;
}
@ -329,7 +329,8 @@ grub_install_parse (int key, char *arg)
handle_install_list (&install_fonts, arg, 0);
return 1;
case GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS:
if (strcmp (arg, "no") == 0)
if (strcmp (arg, "no") == 0
|| strcmp (arg, "none") == 0)
{
compress_func = NULL;
return 1;
@ -585,28 +586,27 @@ copy_locales (const char *dstd)
static struct
{
enum grub_install_plat val;
const char *cpu;
const char *platform;
} platforms[] =
} platforms[GRUB_INSTALL_PLATFORM_MAX] =
{
{ GRUB_INSTALL_PLATFORM_I386_PC, "i386", "pc" },
{ GRUB_INSTALL_PLATFORM_I386_EFI, "i386", "efi" },
{ GRUB_INSTALL_PLATFORM_I386_QEMU, "i386", "qemu" },
{ GRUB_INSTALL_PLATFORM_I386_COREBOOT, "i386", "coreboot" },
{ GRUB_INSTALL_PLATFORM_I386_MULTIBOOT, "i386", "multiboot" },
{ GRUB_INSTALL_PLATFORM_I386_IEEE1275, "i386", "ieee1275" },
{ GRUB_INSTALL_PLATFORM_X86_64_EFI, "x86_64", "efi" },
{ GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel", "loongson" },
{ GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS, "mipsel", "qemu_mips" },
{ GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS, "mips", "qemu_mips" },
{ GRUB_INSTALL_PLATFORM_MIPSEL_ARC, "mipsel", "arc" },
{ GRUB_INSTALL_PLATFORM_MIPS_ARC, "mips", "arc" },
{ GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275, "sparc64", "ieee1275" },
{ GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275, "powerpc", "ieee1275" },
{ GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64", "efi" },
{ GRUB_INSTALL_PLATFORM_ARM_EFI, "arm", "efi" },
{ GRUB_INSTALL_PLATFORM_ARM_UBOOT, "arm", "uboot" },
[GRUB_INSTALL_PLATFORM_I386_PC] = { "i386", "pc" },
[GRUB_INSTALL_PLATFORM_I386_EFI] = { "i386", "efi" },
[GRUB_INSTALL_PLATFORM_I386_QEMU] = { "i386", "qemu" },
[GRUB_INSTALL_PLATFORM_I386_COREBOOT] = { "i386", "coreboot" },
[GRUB_INSTALL_PLATFORM_I386_MULTIBOOT] = { "i386", "multiboot" },
[GRUB_INSTALL_PLATFORM_I386_IEEE1275] = { "i386", "ieee1275" },
[GRUB_INSTALL_PLATFORM_X86_64_EFI] = { "x86_64", "efi" },
[GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON] = { "mipsel", "loongson" },
[GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS] = { "mipsel", "qemu_mips" },
[GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS] = { "mips", "qemu_mips" },
[GRUB_INSTALL_PLATFORM_MIPSEL_ARC] = { "mipsel", "arc" },
[GRUB_INSTALL_PLATFORM_MIPS_ARC] = { "mips", "arc" },
[GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275] = { "sparc64", "ieee1275" },
[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275] = { "powerpc", "ieee1275" },
[GRUB_INSTALL_PLATFORM_IA64_EFI] = { "ia64", "efi" },
[GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" },
[GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" },
};
char *
@ -662,10 +662,17 @@ grub_install_copy_files (const char *src,
install_modules.entries);
for (p = path_list; p; p = p->next)
{
char *srcf = grub_util_path_concat_ext (2, src, p->name, ".mo");
char *dstf = grub_util_path_concat_ext (2, dst, p->name, ".mo");
const char *srcf = p->name;
const char *dir;
char *dstf;
dir = grub_strrchr (srcf, '/');
if (dir)
dir++;
else
dir = srcf;
dstf = grub_util_path_concat (2, dst_platform, dir);
grub_install_compress_file (srcf, dstf, 1);
free (srcf);
free (dstf);
}
}
@ -825,7 +832,7 @@ grub_install_get_target (const char *src)
&& strcmp (platforms[i].platform, pl) == 0)
{
free (fn);
return platforms[i].val;
return i;
}
grub_util_error (_("Unknown platform `%s-%s'"), c, pl);
}

View File

@ -67,6 +67,7 @@ static char * bootloader_id;
static int have_load_cfg = 0;
static FILE * load_cfg_f = NULL;
static char *load_cfg;
static int install_bootsector = 1;
enum
{
@ -91,7 +92,8 @@ enum
OPTION_DEBUG,
OPTION_DEBUG_IMAGE,
OPTION_NO_FLOPPY,
OPTION_DISK_MODULE
OPTION_DISK_MODULE,
OPTION_NO_BOOTSECTOR
};
static int fs_probe = 1;
@ -110,9 +112,13 @@ argp_parser (int key, char *arg, struct argp_state *state)
fs_probe = 0;
return 0;
case OPTION_SETUP:
if (!grub_strstr (arg, "setup"))
install_bootsector = 0;
return 0;
/* Accept and ignore for compatibility. */
case OPTION_FONT:
case OPTION_SETUP:
case OPTION_MKRELPATH:
case OPTION_PROBE:
case OPTION_EDITENV:
@ -170,6 +176,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
allow_floppy = 1;
return 0;
case OPTION_NO_BOOTSECTOR:
install_bootsector = 0;
return 0;
case OPTION_DEBUG:
verbosity++;
return 0;
@ -224,6 +234,10 @@ static struct argp_option options[] = {
{"no-nvram", OPTION_NO_NVRAM, 0, 0,
N_("don't update the `boot-device' NVRAM variable. "
"This option is only available on IEEE1275 targets."), 2},
{"skip-fs-probe",'s',0, 0,
N_("do not probe for filesystems in DEVICE"), 0},
{"no-bootsector", OPTION_NO_BOOTSECTOR, 0, 0,
N_("do not install bootsector"), 0},
{"debug", OPTION_DEBUG, 0, OPTION_HIDDEN, 0, 2},
{"no-floppy", OPTION_NO_FLOPPY, 0, OPTION_HIDDEN, 0, 2},
@ -235,9 +249,6 @@ static struct argp_option options[] = {
N_("the ID of bootloader. This option is only available on EFI."), 2},
{"efi-directory", OPTION_EFI_DIRECTORY, N_("DIR"), 0,
N_("use DIR as the EFI System Partition root."), 2},
{"skip-fs-probe",'s',0, 0,
N_("do not probe for filesystems in DEVICE"), 0},
{0, 0, 0, 0, 0, 0}
};
@ -1403,7 +1414,8 @@ main (int argc, char *argv[])
"boot.img");
grub_install_copy_file (boot_img_src, boot_img, 1);
grub_util_info ("grub_bios_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'",
grub_util_info ("%sgrub_bios_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'",
install_bootsector ? "" : "NOT RUNNING: ",
allow_floppy ? "--allow-floppy " : "",
verbosity ? "--verbose " : "",
force ? "--force " : "",
@ -1413,9 +1425,10 @@ main (int argc, char *argv[])
install_device);
/* Now perform the installation. */
grub_util_bios_setup (platdir, "boot.img", "core.img",
install_drive, force,
fs_probe, allow_floppy);
if (install_bootsector)
grub_util_bios_setup (platdir, "boot.img", "core.img",
install_drive, force,
fs_probe, allow_floppy);
break;
}
case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275:
@ -1427,7 +1440,8 @@ main (int argc, char *argv[])
"boot.img");
grub_install_copy_file (boot_img_src, boot_img, 1);
grub_util_info ("grub_sparc_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'",
grub_util_info ("%sgrub_sparc_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'",
install_bootsector ? "" : "NOT RUNNING: ",
allow_floppy ? "--allow-floppy " : "",
verbosity ? "--verbose " : "",
force ? "--force " : "",
@ -1437,9 +1451,10 @@ main (int argc, char *argv[])
install_drive);
/* Now perform the installation. */
grub_util_sparc_setup (platdir, "boot.img", "core.img",
install_device, force,
fs_probe, allow_floppy);
if (install_bootsector)
grub_util_sparc_setup (platdir, "boot.img", "core.img",
install_device, force,
fs_probe, allow_floppy);
break;
}

View File

@ -290,12 +290,24 @@ make_image_fwdisk_abs (enum grub_install_plat plat,
const char *mkimage_target,
const char *output)
{
char *load_cfg;
FILE *load_cfg_f;
if (!source_dirs[plat])
return;
grub_util_info (N_("enabling %s support ..."),
mkimage_target);
load_cfg = grub_util_make_temporary_file ();
load_cfg_f = grub_util_fopen (load_cfg, "wb");
write_part (load_cfg_f, source_dirs[plat]);
fclose (load_cfg_f);
grub_install_push_module ("iso9660");
grub_install_make_image_wrap (source_dirs[plat], "()/boot/grub", output,
0, 0, mkimage_target, 0,
0, load_cfg, mkimage_target, 0,
GRUB_COMPRESSION_AUTO);
grub_install_pop_module ();
}
@ -376,8 +388,7 @@ main (int argc, char *argv[])
xorriso_push ("-graft-points");
iso9660_dir = grub_util_make_temporary_dir ();
grub_util_info ("temporaray iso9660 dir is `%s'",
iso9660_dir);
grub_util_info ("temporary iso9660 dir is `%s'", iso9660_dir);
boot_grub = grub_util_path_concat (3, iso9660_dir, "boot", "grub");
grub_install_mkdir_p (boot_grub);
romdir = grub_util_path_concat (2, boot_grub, "roms");
@ -583,7 +594,7 @@ main (int argc, char *argv[])
free (label);
label_text = grub_util_path_concat (2, core_services, ".disk_label.contentDetails");
f = grub_util_fopen (label_text, "wb");
fprintf (f, "%s", label_string);
fprintf (f, "%s\n", label_string);
fclose (f);
free (label_string);
free (label_text);
@ -679,7 +690,7 @@ main (int argc, char *argv[])
char *grub_chrp = grub_util_path_concat (2, source_dirs[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275],
"grub.chrp");
char *bisrc = grub_util_path_concat (2, source_dirs[GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275],
"grub.chrp");
"bootinfo.txt");
char *bootx = grub_util_path_concat (2, core_services, "BootX");
char *ppc_chrp = grub_util_path_concat (3, iso9660_dir, "ppc", "chrp");
char *bitgt = grub_util_path_concat (3, iso9660_dir, "ppc", "bootinfo.txt");
@ -757,7 +768,7 @@ main (int argc, char *argv[])
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-loongson-elf", "loongson.elf", GRUB_COMPRESSION_XZ);
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-yeeloong-flash", "mipsel-yeeloong.bin", GRUB_COMPRESSION_XZ);
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-fulong2f-flash", "mipsel-fuloong2f.bin", GRUB_COMPRESSION_XZ);
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-fuloong2f-flash", "mipsel-fuloong2f.bin", GRUB_COMPRESSION_XZ);
make_image (GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS, "mips-qemu_mips-elf", "roms/mips-qemu_mips.elf", GRUB_COMPRESSION_AUTO);