Merge branch 'master' into leiflindholm/arm64

Conflicts:
	include/grub/util/install.h
This commit is contained in:
Vladimir Serbinenko 2013-11-25 13:02:27 +01:00
commit d6c92cdc34
82 changed files with 2897 additions and 353 deletions

67
util/garbage-gen.c Normal file
View file

@ -0,0 +1,67 @@
/*
* 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/>.
*/
/* Standard random generator is slow. For FS testing we need just some
garbage files, we don't need them to be high-quality random.
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
static unsigned long long buffer[1048576];
int
main (int argc, char **argv)
{
unsigned long long high = 0, low = 1;
unsigned long i, j;
unsigned long long cnt = strtoull (argv[1], 0, 0);
struct timeval tv;
gettimeofday (&tv, NULL);
high = tv.tv_sec;
low = tv.tv_usec;
if (!high)
high = 1;
if (!low)
low = 2;
for (j = 0; j < (cnt + sizeof (buffer) - 1) / sizeof (buffer); j++)
{
for (i = 0; i < sizeof (buffer) / sizeof (buffer[0]); i += 2)
{
int c1 = 0, c2 = 0;
buffer[i] = low;
buffer[i+1] = high;
if (low & (1ULL << 63))
c1 = 1;
low <<= 1;
if (high & (1ULL << 63))
c2 = 1;
high = (high << 1) | c1;
if (c2)
low ^= 0x87;
}
if (sizeof (buffer) < cnt - sizeof (buffer) * j)
fwrite (buffer, 1, sizeof (buffer), stdout);
else
fwrite (buffer, 1, cnt - sizeof (buffer) * j, stdout);
}
return 0;
}

View file

@ -558,7 +558,7 @@ copy_locales (const char *dstd)
grub_util_fd_dirent_t de;
const char *locale_dir = grub_util_get_localedir ();
d = grub_util_fd_opendir (LOCALEDIR);
d = grub_util_fd_opendir (locale_dir);
if (!d)
{
grub_util_warn (_("cannot open directory `%s': %s"),
@ -597,6 +597,8 @@ static struct
[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_I386_XEN] = { "i386", "xen" },
[GRUB_INSTALL_PLATFORM_X86_64_XEN] = { "x86_64", "xen" },
[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" },
@ -707,6 +709,8 @@ grub_install_copy_files (const char *src,
}
else
{
const char *locale_dir = grub_util_get_localedir ();
for (i = 0; i < install_locales.n_entries; i++)
{
char *srcf = grub_util_path_concat_ext (3, src,
@ -724,7 +728,7 @@ grub_install_copy_files (const char *src,
}
free (srcf);
srcf = grub_util_path_concat_ext (4,
LOCALEDIR,
locale_dir,
install_locales.entries[i],
"LC_MESSAGES",
PACKAGE,

View file

@ -233,7 +233,7 @@ static struct argp_option options[] = {
"This option is only available on BIOS target."), 2},
{"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},
"This option is only available on EFI and 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,
@ -418,6 +418,9 @@ have_bootdev (enum grub_install_plat pl)
case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
case GRUB_INSTALL_PLATFORM_I386_XEN:
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
return 0;
/* pacify warning. */
@ -758,6 +761,8 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
case GRUB_INSTALL_PLATFORM_MIPS_ARC:
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
case GRUB_INSTALL_PLATFORM_I386_XEN:
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
break;
case GRUB_INSTALL_PLATFORM_I386_QEMU:
@ -798,6 +803,8 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:
case GRUB_INSTALL_PLATFORM_I386_XEN:
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
free (install_device);
install_device = NULL;
break;
@ -1217,6 +1224,8 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_MIPS_ARC:
case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
case GRUB_INSTALL_PLATFORM_I386_XEN:
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
grub_util_warn ("%s", _("no hints available for your platform. Expect reduced performance"));
break;
/* pacify warning. */
@ -1304,6 +1313,8 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT:
case GRUB_INSTALL_PLATFORM_I386_IEEE1275:
case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
case GRUB_INSTALL_PLATFORM_I386_XEN:
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
core_name = "core.elf";
snprintf (mkimage_target, sizeof (mkimage_target),
"%s-%s",
@ -1395,6 +1406,8 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
case GRUB_INSTALL_PLATFORM_I386_QEMU:
case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275:
case GRUB_INSTALL_PLATFORM_I386_XEN:
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
break;
/* pacify warning. */
case GRUB_INSTALL_PLATFORM_MAX:
@ -1414,7 +1427,7 @@ main (int argc, char *argv[])
"boot.img");
grub_install_copy_file (boot_img_src, boot_img, 1);
grub_util_info ("%sgrub_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 " : "",
@ -1440,7 +1453,7 @@ main (int argc, char *argv[])
"boot.img");
grub_install_copy_file (boot_img_src, boot_img, 1);
grub_util_info ("%sgrub_sparc_setup %s %s %s %s --directory='%s' --device-map='%s' '%s'",
grub_util_info ("%sgrub-sparc64-setup %s %s %s %s --directory='%s' --device-map='%s' '%s'",
install_bootsector ? "" : "NOT RUNNING: ",
allow_floppy ? "--allow-floppy " : "",
verbosity ? "--verbose " : "",
@ -1525,7 +1538,7 @@ main (int argc, char *argv[])
grub_install_copy_file (imgfile, dst, 1);
free (dst);
}
if (!removable)
if (!removable && update_nvram)
{
char * efidir_disk;
int efidir_part;
@ -1552,6 +1565,8 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
case GRUB_INSTALL_PLATFORM_I386_QEMU:
case GRUB_INSTALL_PLATFORM_I386_XEN:
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
grub_util_warn ("%s",
_("WARNING: no platform-specific install was performed"));
break;

View file

@ -216,6 +216,7 @@ export GRUB_DEFAULT \
GRUB_SAVEDEFAULT \
GRUB_ENABLE_CRYPTODISK \
GRUB_BADRAM \
GRUB_OS_PROBER_SKIP_LIST \
GRUB_DISABLE_SUBMENU
if test "x${grub_cfg}" != "x"; then
@ -224,7 +225,7 @@ if test "x${grub_cfg}" != "x"; then
exec > "${grub_cfg}.new"
umask $oldumask
fi
gettext "Generating grub.cfg ..." >&2
gettext "Generating grub configuration file ..." >&2
echo >&2
cat << EOF

View file

@ -1376,7 +1376,6 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
*kernel_sz = ALIGN_UP (*kernel_sz, 16);
grub_ia64_dl_get_tramp_got_size (e, &tramp, &got);
tramp *= sizeof (struct grub_ia64_trampoline);
ia64_toff = *kernel_sz;
*kernel_sz += ALIGN_UP (tramp, 16);
@ -1387,7 +1386,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
*kernel_sz += 16 * ia64jmpnum;
ia64_got_off = *kernel_sz;
*kernel_sz += ALIGN_UP (got * sizeof (grub_uint64_t), 16);
*kernel_sz += ALIGN_UP (got, 16);
}
#endif

View file

@ -396,11 +396,12 @@ main (int argc, char *argv[])
if (!grub_install_source_directory)
{
const char *pkglibdir = grub_util_get_pkglibdir ();
enum grub_install_plat plat;
for (plat = 0; plat < GRUB_INSTALL_PLATFORM_MAX; plat++)
{
char *platdir = grub_util_path_concat (2, pkgdatadir,
char *platdir = grub_util_path_concat (2, pkglibdir,
grub_install_get_platform_name (plat));
if (!grub_util_is_directory (platdir))

View file

@ -112,6 +112,18 @@ for OS in ${OSPROBED} ; do
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
BOOT="`echo ${OS} | cut -d ':' -f 4`"
UUID="`grub-probe --target=fs_uuid --device ${DEVICE%@*}`"
EXPUUID="$UUID"
if [ x"${DEVICE#*@}" != x ] ; then
EXPUUID="${EXPUUID}@${DEVICE#*@}"
fi
if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" -a "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
continue
fi
BTRFS="`echo ${OS} | cut -d ':' -f 5`"
if [ "x$BTRFS" = "xbtrfs" ]; then
BTRFSuuid="`echo ${OS} | cut -d ':' -f 6`"
@ -265,7 +277,7 @@ EOF
echo "$title_correction_code"
;;
macosx)
OSXUUID="`${grub_probe} --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
OSXUUID="${UUID}"
osx_entry xnu_kernel 32
osx_entry xnu_kernel64 64
;;

View file

@ -137,11 +137,13 @@ for cipher_file in cipher_files:
ciphernames = []
mdnames = []
mdctxsizes = []
pknames = []
hold = False
skip = 0
skip2 = False
ismd = False
mdarg = 0
ispk = False
iscipher = False
iscryptostart = False
@ -174,6 +176,11 @@ for cipher_file in cipher_files:
sg = s.groups()[0]
cryptolist.write (("%s: %s\n") % (sg, modname))
iscryptostart = False
if ismd:
spl = line.split (",")
if mdarg + len (spl) > 9 and mdarg <= 9 and ("sizeof" in spl[9-mdarg]):
mdctxsizes.append (spl[9-mdarg].lstrip ().rstrip())
mdarg = mdarg + len (spl) - 1
if ismd or iscipher or ispk:
if not re.search (" *};", line) is None:
if not iscomma:
@ -189,6 +196,7 @@ for cipher_file in cipher_files:
fw.write (" .blocksize = %s\n"
% mdblocksizes [mdname])
ismd = False
mdarg = 0
iscipher = False
ispk = False
iscomma = not re.search (",$", line) is None
@ -283,6 +291,7 @@ for cipher_file in cipher_files:
mdname = re.match("[a-zA-Z0-9_]*",mdname).group ()
mdnames.append (mdname)
ismd = True
mdarg = 0
iscryptostart = True
m = re.match ("static const char \*selftest.*;$", line)
if not m is None:
@ -423,6 +432,8 @@ for cipher_file in cipher_files:
chmsg = "Register cipher %s" % ciphername
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_cipher_register (&%s);\n" % ciphername)
for ctxsize in mdctxsizes:
fw.write (" COMPILE_TIME_ASSERT(%s <= GRUB_CRYPTO_MAX_MD_CONTEXT_SIZE);\n" % ctxsize)
for mdname in mdnames:
chmsg = "Register digest %s" % mdname
chlognew = "%s\n %s" % (chlognew, chmsg)