Compare commits

..
Author SHA1 Message Date
Vladimir Serbinenko e8f07821cc * configure.ac: Set version to 2.02~beta2. 2013-12-24 21:53:23 +01:00
Vladimir Serbinenko dc3286ade4 * grub-core/disk/efi/efidisk.c (name_devices): Skip Apple ghosts. 2013-12-24 20:32:14 +01:00
Andrey Borzenkov 46f8d358ef * util/grub-probe.c: Improve help message and simplify list handling. 2013-12-24 20:30:16 +01:00
Vladimir Serbinenko 09c479006c Fix buffer overflow in grub_efi_print_device_path. 2013-12-24 19:04:46 +01:00
Vladimir Serbinenko 4d6c69536e Show SATA device path. 2013-12-24 18:10:28 +01:00
Vladimir Serbinenko faf4a65e1e Revert grub-file usage in grub-mkconfig. 2013-12-24 17:47:27 +01:00
Vladimir Serbinenko e5fa26e573 Make newly-created files other than grub.cfg world-readable. 2013-12-24 17:36:10 +01:00
Andrey Borzenkov 569766e49b * util/grub.d/00_header.in: Improve compatibility with old config. 2013-12-24 17:26:05 +01:00
Vladimir Serbinenko 4127206896 Make rijndael.c respect aliasing rules.
Trivial backport of dfb4673da8ee52d95e0a62c9f49ca8599943f22e.
2013-12-24 16:57:28 +01:00
Vladimir Serbinenko f7c7c4d4ad Make grub_util_device_is_mapped_stat available in grub-emu core. 2013-12-24 16:56:14 +01:00
Vladimir Serbinenko 57bc5d431b Add -Qn to TARGET_CFLAGS if it's supported.
Fixes compilation on cygwin.

	Reported by: Andrey Borzenkov.
	Suggested by: Andrey Borzenkov.
2013-12-24 15:00:46 +01:00
Vladimir Serbinenko 6a7957f9f5 Save TARGET_CC version in modinfo.sh.
Suggested by: Andrey Borzenkov.
2013-12-24 14:47:44 +01:00
Vladimir Serbinenko e88f0420b9 Make grub_util_devmapper_part_to_disk and grub_util_find_partition_start
follow the same algorithm to avoid method mismatch. Don't assume
	DMRAID- UUID to mean full disk but instead check that mapping is linear.
2013-12-24 14:16:57 +01:00
Vladimir Serbinenko da98622662 Declare GRUB_EFI_VENDOR_APPLE_GUID. 2013-12-24 14:14:19 +01:00
Vladimir Serbinenko fba31b5f69 Dump type and vendor specific data when printing device path. 2013-12-24 14:05:48 +01:00
54 changed files with 746 additions and 1059 deletions

No files matched your search

+70
View File
@@ -1,3 +1,73 @@
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Set version to 2.02~beta2.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/efi/efidisk.c (name_devices): Skip Apple ghosts.
2013-12-24 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub-probe.c: Improve help message and simplify list handling.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Fix buffer overflow in grub_efi_print_device_path.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Show SATA device path.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Revert grub-file usage in grub-mkconfig.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Make newly-created files other than grub.cfg world-readable.
2013-12-24 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub.d/00_header.in: Improve compatibility with old config.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Make rijndael.c respect aliasing rules.
Trivial backport of dfb4673da8ee52d95e0a62c9f49ca8599943f22e.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Make grub_util_device_is_mapped_stat available in grub-emu core.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Add -Qn to TARGET_CFLAGS if it's supported.
Fixes compilation on cygwin.
Reported by: Andrey Borzenkov.
Suggested by: Andrey Borzenkov.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Save TARGET_CC version in modinfo.sh.
Suggested by: Andrey Borzenkov.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Make grub_util_devmapper_part_to_disk and grub_util_find_partition_start
follow the same algorithm to avoid method mismatch. Don't assume
DMRAID- UUID to mean full disk but instead check that mapping is linear.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Declare GRUB_EFI_VENDOR_APPLE_GUID.
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Dump type and vendor specific data when printing device path.
2013-12-23 Colin Watson <cjwatson@debian.org>
Update some documentation to refer to Git rather than Bazaar.
+7 -1
View File
@@ -119,7 +119,6 @@ library = {
common = grub-core/fs/sfs.c;
common = grub-core/fs/squash4.c;
common = grub-core/fs/tar.c;
common = grub-core/fs/greffs.c;
common = grub-core/fs/udf.c;
common = grub-core/fs/ufs2.c;
common = grub-core/fs/ufs.c;
@@ -440,42 +439,49 @@ script = {
name = '10_hurd';
common = util/grub.d/10_hurd.in;
installdir = grubconf;
condition = COND_HOST_HURD;
};
script = {
name = '10_kfreebsd';
common = util/grub.d/10_kfreebsd.in;
installdir = grubconf;
condition = COND_HOST_KFREEBSD;
};
script = {
name = '10_illumos';
common = util/grub.d/10_illumos.in;
installdir = grubconf;
condition = COND_HOST_ILLUMOS;
};
script = {
name = '10_netbsd';
common = util/grub.d/10_netbsd.in;
installdir = grubconf;
condition = COND_HOST_NETBSD;
};
script = {
name = '10_linux';
common = util/grub.d/10_linux.in;
installdir = grubconf;
condition = COND_HOST_LINUX;
};
script = {
name = '10_xnu';
common = util/grub.d/10_xnu.in;
installdir = grubconf;
condition = COND_HOST_XNU;
};
script = {
name = '20_linux_xen';
common = util/grub.d/20_linux_xen.in;
installdir = grubconf;
condition = COND_HOST_LINUX;
};
script = {
+74
View File
@@ -210,6 +210,80 @@ fi
])
dnl Mass confusion!
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit
dnl instructions, but implicitly insert addr32 and data32 bytes so
dnl that the code works in real mode''.
dnl
dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit
dnl instructions,'' which seems right. This requires the programmer
dnl to explicitly insert addr32 and data32 instructions when they want
dnl them.
dnl
dnl We only support the newer versions, because the old versions cause
dnl major pain, by requiring manual assembly to get 16-bit instructions into
dnl asm files.
AC_DEFUN([grub_I386_ASM_ADDR32],
[AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT])
AC_MSG_CHECKING([for .code16 addr32 assembler support])
AC_CACHE_VAL(grub_cv_i386_asm_addr32,
[cat > conftest.s.in <<\EOF
.code16
l1: @ADDR32@ movb %al, l1
EOF
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s
else
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
fi
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
grub_cv_i386_asm_addr32=yes
else
grub_cv_i386_asm_addr32=no
fi
rm -f conftest*])
AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
dnl Later versions of GAS requires that addr32 and data32 prefixes
dnl appear in the same lines as the instructions they modify, while
dnl earlier versions requires that they appear in separate lines.
AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(dnl
[whether addr32 must be in the same line as the instruction])
AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement,
[cat > conftest.s <<\EOF
.code16
l1: addr32 movb %al, l1
EOF
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
grub_cv_i386_asm_prefix_requirement=yes
else
grub_cv_i386_asm_prefix_requirement=no
fi
rm -f conftest*])
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
grub_tmp_addr32="addr32"
grub_tmp_data32="data32"
else
grub_tmp_addr32="addr32;"
grub_tmp_data32="data32;"
fi
ADDR32=$grub_tmp_addr32
DATA32=$grub_tmp_data32
AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
dnl Check what symbol is defined as a bss start symbol.
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
+4
View File
@@ -31,6 +31,10 @@
#define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@
/* Define if C symbols get an underscore after compilation. */
#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */
#define ADDR32 @ADDR32@
/* Define it to \"data32\" or \"data32;\" to make GAS happy. */
#define DATA32 @DATA32@
/* Define it to one of __bss_start, edata and _edata. */
#define BSS_START_SYMBOL @BSS_START_SYMBOL@
/* Define it to either end or _end. */
+25 -24
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 type.
AC_INIT([GRUB],[2.02~beta1],[bug-grub@gnu.org])
AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
@@ -503,6 +503,8 @@ if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
fi
TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
@@ -538,33 +540,12 @@ AC_COMPILE_IFELSE(
# on arm clang doesn't support .arch directive
# on mips clang doesn't support privilegied instructions, doubleword store/load
# and crashes with hand-written assembly
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xarm \
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
|| test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \
|| test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
fi
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
|| test "x$target_cpu" = xx86_64 ); then
AC_CACHE_CHECK([if clang can handle .code16], [grub_cv_cc_target_clang_code16]
[
CFLAGS="$TARGET_CCASFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
asm volatile (".code16\n"
"xorw %ax, %ax\n"
#ifdef __x86_64__
".code64\n"
#else
".code32\n"
#endif
);
]])],
[grub_cv_cc_target_clang_code16=yes], [grub_cv_cc_target_clang_code16=no])])
if test x$grub_cv_cc_target_clang_code16 = xno ; then
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
fi
fi
if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then
AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame]
[
@@ -932,6 +913,15 @@ if test "x$target_cpu" = xarm; then
fi
fi
AC_CACHE_CHECK([whether option -Qn works], grub_cv_target_cc_qn, [
CFLAGS="$TARGET_CFLAGS -Qn -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_target_cc_qn=yes],
[grub_cv_target_cc_qn=no])])
if test "x$grub_cv_target_cc_qn" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -Qn"
fi
#
# Compiler features.
#
@@ -1067,6 +1057,8 @@ if test "x$target_cpu" = xi386; then
grub_CHECK_END_SYMBOL
fi
CFLAGS="$TARGET_CFLAGS"
grub_I386_ASM_PREFIX_REQUIREMENT
grub_I386_ASM_ADDR32
fi
grub_PROG_NM_WORKS
@@ -1587,6 +1579,8 @@ AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
[AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
AC_SUBST(HAVE_ASM_USCORE)
AC_SUBST(ADDR32)
AC_SUBST(DATA32)
AC_SUBST(BSS_START_SYMBOL)
AC_SUBST(END_SYMBOL)
AC_SUBST(PACKAGE)
@@ -1622,6 +1616,7 @@ AC_SUBST(TARGET_CPP)
AC_SUBST(TARGET_CCAS)
AC_SUBST(TARGET_OBJ2ELF)
AC_SUBST(TARGET_MODULE_FORMAT)
AC_SUBST(TARGET_CC_VERSION)
AC_SUBST(TARGET_CFLAGS)
AC_SUBST(TARGET_LDFLAGS)
@@ -1671,7 +1666,13 @@ AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
-5
View File
@@ -1399,11 +1399,6 @@ module = {
common = fs/tar.c;
};
module = {
name = greffs;
common = fs/greffs.c;
};
module = {
name = udf;
common = fs/udf.c;
+10 -10
View File
@@ -165,8 +165,8 @@ start:
* this area.
*/
.org GRUB_BOOT_MACHINE_BPB_START
.org 4
. = _start + GRUB_BOOT_MACHINE_BPB_START
. = _start + 4
#endif
#ifdef HYBRID_BOOT
floppy
@@ -174,7 +174,7 @@ start:
scratch
#endif
.org GRUB_BOOT_MACHINE_BPB_END
. = _start + GRUB_BOOT_MACHINE_BPB_END
/*
* End of BIOS parameter block.
*/
@@ -183,14 +183,14 @@ kernel_address:
.word GRUB_BOOT_MACHINE_KERNEL_ADDR
#ifndef HYBRID_BOOT
.org GRUB_BOOT_MACHINE_KERNEL_SECTOR
. = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR
kernel_sector:
.long 1
kernel_sector_high:
.long 0
#endif
.org GRUB_BOOT_MACHINE_BOOT_DRIVE
. = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE
boot_drive:
.byte 0xff /* the disk to load kernel from */
/* 0xff means use the boot drive */
@@ -208,7 +208,7 @@ LOCAL(after_BPB):
* possible boot drive. If GRUB is installed into a floppy,
* this does nothing (only jump).
*/
.org GRUB_BOOT_MACHINE_DRIVE_CHECK
. = _start + GRUB_BOOT_MACHINE_DRIVE_CHECK
boot_drive_check:
jmp 3f /* grub-setup may overwrite this jump */
testb $0x80, %dl
@@ -511,13 +511,13 @@ LOCAL(message):
*/
#ifdef HYBRID_BOOT
.org 0x1b0
. = _start + 0x1b0
kernel_sector:
.long 1
kernel_sector_high:
.long 0
#endif
.org GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
. = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
nt_magic:
.long 0
.word 0
@@ -528,7 +528,7 @@ nt_magic:
* sneaky, huh?
*/
.org GRUB_BOOT_MACHINE_PART_START
. = _start + GRUB_BOOT_MACHINE_PART_START
#ifndef HYBRID_BOOT
floppy
@@ -536,7 +536,7 @@ nt_magic:
scratch
#endif
.org GRUB_BOOT_MACHINE_PART_END
. = _start + GRUB_BOOT_MACHINE_PART_END
/* the last 2 bytes in the sector 0 contain the signature */
.word GRUB_BOOT_MACHINE_SIGNATURE
+2 -2
View File
@@ -43,7 +43,7 @@ _start:
LOCAL(next):
jmp 1f
.org 8
. = start + 8
bi_pvd:
.long 0 /* LBA of primary volume descriptor. */
@@ -168,6 +168,6 @@ err_noboot_msg:
err_cdfail_msg:
.ascii "cdrom read fails\0"
.org 0x7FF
. = start + 0x7FF
.byte 0
+1 -1
View File
@@ -362,7 +362,7 @@ LOCAL(message):
.word 0
.word 0
.org 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE
. = _start + 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE
LOCAL(firstlist): /* this label has to be before the first list entry!!! */
/* fill the first data listing with the default */
blocklist_default_start:
+2 -2
View File
@@ -41,7 +41,7 @@ data_start:
xorl %ebp, %ebp
jmp LOCAL(linux_next)
.org 0x1F1
. = data_start + 0x1F1
setup_sects:
.byte CODE_SECTORS
@@ -292,4 +292,4 @@ LOCAL(fail):
err_int15_msg:
.ascii "move memory fails\0"
.org (CODE_SECTORS + 1) * 512
. = _start + CODE_SECTORS * 512
+1 -1
View File
@@ -38,5 +38,5 @@ start:
/* This region is a junk. Do you say that this is wasteful?
But I like that the memory layout of the body is consistent
among different kernels rather than scamping just for 1.5KB. */
.org 0x8200 - 0x7C00 - 0x200 - 1
. = _start + 0x8200 - 0x7C00 - 0x200 - 1
.byte 0
+8 -8
View File
@@ -50,23 +50,23 @@ LOCAL (base):
* This is a special data area.
*/
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
LOCAL(compressed_size):
.long 0
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
LOCAL(uncompressed_size):
.long 0
.org GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
. = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
reed_solomon_redundancy:
.long 0
.org GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH
. = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH
.short (LOCAL(reed_solomon_part) - _start)
/*
* This is the area for all of the special variables.
*/
.org GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE
. = _start + GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE
LOCAL(boot_dev):
.byte 0xFF, 0xFF, 0xFF
LOCAL(boot_drive):
@@ -89,13 +89,13 @@ LOCAL (codestart):
sti /* we're safe again */
/* save the boot drive */
movb %dl, LOCAL(boot_drive)
ADDR32 movb %dl, LOCAL(boot_drive)
/* reset disk system (%ah = 0) */
int $0x13
/* transition to protected mode */
calll real_to_prot
DATA32 call real_to_prot
/* The ".code32" directive takes GAS out of 16-bit mode. */
.code32
@@ -149,7 +149,7 @@ gate_a20_try_bios:
movw $0x2401, %ax
int $0x15
calll real_to_prot
DATA32 call real_to_prot
.code32
popl %ebp
+4 -4
View File
@@ -31,7 +31,7 @@ _start:
jmp 1f
.org GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
. = _start + GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
VARIABLE(grub_core_entry_addr)
.long 0
1:
@@ -48,7 +48,7 @@ VARIABLE(grub_core_entry_addr)
/* Transition to protected mode. We use pushl to force generation
of a flat return address. */
pushl $1f
jmpl real_to_prot
DATA32 jmp real_to_prot
.code32
/* Ensure A20 is enabled. We're in qemu, so control port A works
and there is no need to wait since there is no real logic, it's
@@ -66,9 +66,9 @@ VARIABLE(grub_core_entry_addr)
/* Intel, in its infinite wisdom, decided to put the i8086 entry point
*right here* and this is why we need this kludge. */
.org GRUB_BOOT_MACHINE_SIZE - 16
. = GRUB_BOOT_MACHINE_SIZE - 16
.code16
jmp _start
.org GRUB_BOOT_MACHINE_SIZE
. = GRUB_BOOT_MACHINE_SIZE
+3 -3
View File
@@ -162,7 +162,7 @@ retry_cs5536:
b continue
.org GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START
. = start + GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START
tlb_refill:
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR
@@ -196,13 +196,13 @@ tlb_refill:
b fatal
addiu $a0, $a0, %lo(unhandled_tlb_refill)
.org GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START
. = start + GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START
cache_error:
lui $a0, %hi(unhandled_cache_error)
b fatal
addiu $a0, $a0, %lo(unhandled_cache_error)
.org GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START
. = start + GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START
other_exception:
mfc0 $s0, GRUB_CPU_LOONGSON_COP0_CAUSE
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
+3 -3
View File
@@ -39,13 +39,13 @@ start:
bal codestart
nop
base:
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
compressed_size:
.long 0
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
uncompressed_size:
.long 0
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
uncompressed_addr:
.long 0
codestart:
+4 -4
View File
@@ -41,9 +41,9 @@ pic_base:
* After loading in that block we will execute it by jumping to the
* load address plus the size of the prepended A.OUT header (32 bytes).
*/
.org GRUB_BOOT_MACHINE_BOOT_DEVPATH
. = _start + GRUB_BOOT_MACHINE_BOOT_DEVPATH
boot_path:
.org GRUB_BOOT_MACHINE_KERNEL_BYTE
. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
boot_path_end:
kernel_byte: .xword (2 << 9)
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
@@ -52,7 +52,7 @@ kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
#define boot_path_end (_start + 1024)
#include <grub/offsets.h>
.org 8
. = _start + 8
kernel_byte: .xword (2 << 9)
kernel_size: .word 512
kernel_address: .word GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
@@ -224,7 +224,7 @@ bootpath_known:
#else
nop
#endif
.org GRUB_BOOT_MACHINE_CODE_END
. = _start + GRUB_BOOT_MACHINE_CODE_END
/* the last 4 bytes in the sector 0 contain the signature */
.word GRUB_BOOT_MACHINE_SIGNATURE
+1 -1
View File
@@ -136,7 +136,7 @@ lastlist:
.word 0
.word 0
.org (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
. = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
blocklist_default_start:
.word 0
.word 2
+2 -14
View File
@@ -669,7 +669,6 @@ grub_efidisk_get_device_handle (grub_disk_t disk)
case 'h':
/* If this is the whole disk, just return its own data. */
grub_printf ("parent handle = %p\n", d->handle);
if (! disk->partition)
return d->handle;
@@ -680,24 +679,13 @@ grub_efidisk_get_device_handle (grub_disk_t disk)
struct grub_efidisk_data *c;
devices = make_devices ();
grub_efi_print_device_path (d->device_path);
for (c = devices; c; c = c->next)
FOR_CHILDREN (c, devices)
{
grub_efi_hard_drive_device_path_t *hd;
hd = (grub_efi_hard_drive_device_path_t *) c->last_device_path;
grub_efi_print_device_path (c->device_path);
grub_printf ("part %d = %x, %x, %x, %x, %x, %x\n",
is_child (c, d),
(int) GRUB_EFI_DEVICE_PATH_TYPE (c->last_device_path),
(int) GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path),
(int) hd->partition_start, (int) hd->partition_size,
(int) grub_partition_get_start (disk->partition),
(int) grub_partition_get_len (disk->partition));
if (is_child (c, d)
&& (GRUB_EFI_DEVICE_PATH_TYPE (c->last_device_path)
if ((GRUB_EFI_DEVICE_PATH_TYPE (c->last_device_path)
== GRUB_EFI_MEDIA_DEVICE_PATH_TYPE)
&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path)
== GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)
-314
View File
@@ -1,314 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/misc.h>
#include <grub/disk.h>
#include <grub/archelp.h>
#include <grub/file.h>
#include <grub/mm.h>
#include <grub/dl.h>
#include <grub/i18n.h>
#include <grub/greffs.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_greffs_data
{
grub_uint32_t dofs;
};
static grub_err_t
get_string (grub_disk_t disk,
const struct grub_greffs_header *head,
grub_uint32_t fn,
char **buf, grub_size_t *size)
{
grub_uint32_t desc[2];
grub_size_t read_size;
if (grub_disk_read (disk, 0,
grub_cpu_to_le32 (head->string_ptrs_offset)
+ fn * sizeof (desc[0]), sizeof (desc), &desc))
return grub_errno;
read_size = desc[1] - desc[0];
if (*size < read_size + 1)
{
grub_free (*buf);
*size = (read_size + 4) * 2;
*buf = grub_malloc (*size);
if (!*buf)
{
*size = 0;
return grub_errno;
}
}
if (grub_disk_read (disk, 0, desc[0], read_size, *buf))
return grub_errno;
(*buf)[read_size] = '\0';
return GRUB_ERR_NONE;
}
static grub_err_t
find_file (grub_disk_t disk,
struct grub_greffs_header *head,
const char *name_in, grub_uint32_t *f, int exact)
{
grub_uint32_t num_files, cur_file = 0;
int i;
char *buf = NULL;
grub_size_t buf_size = 0;
grub_err_t err;
num_files = grub_le_to_cpu32 (head->nfiles);
for (i = 31; i >= 0; i--)
{
int cmp;
if ((cur_file | (1 << i)) > num_files)
continue;
err = get_string (disk, head, (cur_file | (1 << i)) - 1, &buf, &buf_size);
if (err)
{
grub_free (buf);
return err;
}
cmp = grub_strcmp (buf, name_in);
if (cmp <= 0)
cur_file |= (1 << i);
if (cmp == 0)
{
grub_free (buf);
*f = cur_file - 1;
return GRUB_ERR_NONE;
}
}
grub_free (buf);
if (!exact)
{
*f = cur_file;
return GRUB_ERR_NONE;
}
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"),
name_in);
}
static char *
canonicalize (const char *name_in, int make_dir)
{
const char *iptr;
char *out, *optr;
out = grub_malloc (grub_strlen (name_in) + 2);
if (!out)
return NULL;
for (iptr = name_in, optr = out; *iptr; )
{
while (*iptr == '/')
iptr++;
if (iptr[0] == '.' && (iptr[1] == '/' || iptr[1] == 0))
{
iptr += 2;
continue;
}
if (iptr[0] == '.' && iptr[1] == '.' && (iptr[2] == '/' || iptr[2] == 0))
{
iptr += 3;
if (optr == out)
continue;
for (optr -= 2; optr >= out && *optr != '/'; optr--);
optr++;
continue;
}
while (*iptr && *iptr != '/')
*optr++ = *iptr++;
if (*iptr)
*optr++ = *iptr++;
else if (make_dir && optr != out)
*optr++ = '/';
}
*optr = 0;
return out;
}
static grub_err_t
grub_greffs_dir (grub_device_t device, const char *path_in,
grub_fs_dir_hook_t hook, void *hook_data)
{
grub_err_t err;
grub_uint32_t cur_file, num_files;
char *buf = 0;
grub_size_t buf_size = 0;
char *can;
grub_size_t len;
struct grub_greffs_header head;
if (grub_disk_read (device->disk, 0, 0, sizeof (head), &head))
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
if (grub_memcmp (head.magic, GRUB_GREFFS_MAGIC, sizeof (head.magic)) != 0)
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
can = canonicalize (path_in, 1);
if (!can)
return grub_errno;
if (can[0] == '\0')
cur_file = 0;
else
{
err = find_file (device->disk, &head, can, &cur_file, 0);
if (err)
goto fail;
}
num_files = grub_le_to_cpu32 (head.nfiles);
len = grub_strlen (can);
while (cur_file < num_files)
{
char *p, *n;
struct grub_dirhook_info info;
err = get_string (device->disk, &head, cur_file, &buf, &buf_size);
if (err)
goto fail;
if (grub_memcmp (can, buf, len) != 0)
break;
grub_memset (&info, 0, sizeof (info));
n = buf + len;
while (*n == '/')
n++;
p = grub_strchr (n, '/');
if (p)
*p = 0;
info.dir = (p != NULL);
if (hook (n, &info, hook_data))
goto fail;
if (!p)
cur_file++;
else
{
*p = '/' + 1;
p[1] = '\0';
err = find_file (device->disk, &head, buf, &cur_file, 0);
if (err)
goto fail;
}
}
fail:
grub_free (buf);
grub_free (can);
return grub_errno;
}
static grub_err_t
grub_greffs_open (grub_file_t file, const char *name_in)
{
struct grub_greffs_header head;
struct grub_greffs_data *data;
struct grub_greffs_inode inode;
grub_err_t err;
grub_uint32_t cur_file;
char *can;
if (grub_disk_read (file->device->disk, 0, 0, sizeof (head), &head))
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
if (grub_memcmp (head.magic, GRUB_GREFFS_MAGIC, sizeof (head.magic)) != 0)
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
can = canonicalize (name_in, 0);
if (!can)
return grub_errno;
err = find_file (file->device->disk, &head, can, &cur_file, 1);
grub_free (can);
if (err)
return err;
data = grub_malloc (sizeof (*data));
if (!data)
return grub_errno;
if (grub_disk_read (file->device->disk,
0, grub_le_to_cpu32 (head.inodes_offset)
+ sizeof (inode) * cur_file, sizeof (inode), &inode))
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
data->dofs = grub_cpu_to_le32 (inode.start);
file->size = grub_cpu_to_le32 (inode.size);
file->data = data;
return GRUB_ERR_NONE;
}
static grub_ssize_t
grub_greffs_read (grub_file_t file, char *buf, grub_size_t len)
{
struct grub_greffs_data *data;
grub_ssize_t ret;
data = file->data;
file->device->disk->read_hook = file->read_hook;
file->device->disk->read_hook_data = file->read_hook_data;
ret = (grub_disk_read (file->device->disk, 0, data->dofs + file->offset,
len, buf)) ? -1 : (grub_ssize_t) len;
file->device->disk->read_hook = 0;
return ret;
}
static grub_err_t
grub_greffs_close (grub_file_t file)
{
struct grub_greffs_data *data;
data = file->data;
grub_free (data);
return grub_errno;
}
static struct grub_fs grub_greffs_fs = {
.name = "greffs",
.dir = grub_greffs_dir,
.open = grub_greffs_open,
.read = grub_greffs_read,
.close = grub_greffs_close,
#ifdef GRUB_UTIL
.reserved_first_sector = 0,
.blocklist_install = 0,
#endif
};
GRUB_MOD_INIT (greffs)
{
grub_fs_register (&grub_greffs_fs);
}
GRUB_MOD_FINI (greffs)
{
grub_fs_unregister (&grub_greffs_fs);
}
+1 -1
View File
@@ -51,7 +51,7 @@ FUNCTION(_start)
b codestart
@ Size of final image integrated module blob - set by grub-mkimage
.org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
.org _start + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
VARIABLE(grub_total_module_size)
.long 0
+144 -132
View File
@@ -447,28 +447,28 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
{
case GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE:
{
grub_efi_pci_device_path_t pci;
grub_memcpy (&pci, dp, len);
grub_efi_pci_device_path_t *pci
= (grub_efi_pci_device_path_t *) dp;
grub_printf ("/PCI(%x,%x)",
(unsigned) pci.function, (unsigned) pci.device);
(unsigned) pci->function, (unsigned) pci->device);
}
break;
case GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE:
{
grub_efi_pccard_device_path_t pccard;
grub_memcpy (&pccard, dp, len);
grub_efi_pccard_device_path_t *pccard
= (grub_efi_pccard_device_path_t *) dp;
grub_printf ("/PCCARD(%x)",
(unsigned) pccard.function);
(unsigned) pccard->function);
}
break;
case GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE:
{
grub_efi_memory_mapped_device_path_t mmapped;
grub_memcpy (&mmapped, dp, len);
grub_efi_memory_mapped_device_path_t *mmapped
= (grub_efi_memory_mapped_device_path_t *) dp;
grub_printf ("/MMap(%x,%llx,%llx)",
(unsigned) mmapped.memory_type,
(unsigned long long) mmapped.start_address,
(unsigned long long) mmapped.end_address);
(unsigned) mmapped->memory_type,
(unsigned long long) mmapped->start_address,
(unsigned long long) mmapped->end_address);
}
break;
case GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE:
@@ -477,10 +477,10 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
break;
case GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE:
{
grub_efi_controller_device_path_t controller;
grub_memcpy (&controller, dp, len);
grub_efi_controller_device_path_t *controller
= (grub_efi_controller_device_path_t *) dp;
grub_printf ("/Ctrl(%x)",
(unsigned) controller.controller_number);
(unsigned) controller->controller_number);
}
break;
default:
@@ -494,31 +494,31 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
{
case GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE:
{
grub_efi_acpi_device_path_t acpi;
grub_memcpy (&acpi, dp, len);
grub_efi_acpi_device_path_t *acpi
= (grub_efi_acpi_device_path_t *) dp;
grub_printf ("/ACPI(%x,%x)",
(unsigned) acpi.hid,
(unsigned) acpi.uid);
(unsigned) acpi->hid,
(unsigned) acpi->uid);
}
break;
case GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE:
{
grub_efi_expanded_acpi_device_path_t eacpi;
grub_memcpy (&eacpi, dp, sizeof (eacpi));
grub_efi_expanded_acpi_device_path_t *eacpi
= (grub_efi_expanded_acpi_device_path_t *) dp;
grub_printf ("/ACPI(");
if (GRUB_EFI_EXPANDED_ACPI_HIDSTR (dp)[0] == '\0')
grub_printf ("%x,", (unsigned) eacpi.hid);
grub_printf ("%x,", (unsigned) eacpi->hid);
else
grub_printf ("%s,", GRUB_EFI_EXPANDED_ACPI_HIDSTR (dp));
if (GRUB_EFI_EXPANDED_ACPI_UIDSTR (dp)[0] == '\0')
grub_printf ("%x,", (unsigned) eacpi.uid);
grub_printf ("%x,", (unsigned) eacpi->uid);
else
grub_printf ("%s,", GRUB_EFI_EXPANDED_ACPI_UIDSTR (dp));
if (GRUB_EFI_EXPANDED_ACPI_CIDSTR (dp)[0] == '\0')
grub_printf ("%x)", (unsigned) eacpi.cid);
grub_printf ("%x)", (unsigned) eacpi->cid);
else
grub_printf ("%s)", GRUB_EFI_EXPANDED_ACPI_CIDSTR (dp));
}
@@ -534,149 +534,161 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
{
case GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE:
{
grub_efi_atapi_device_path_t atapi;
grub_memcpy (&atapi, dp, len);
grub_efi_atapi_device_path_t *atapi
= (grub_efi_atapi_device_path_t *) dp;
grub_printf ("/ATAPI(%x,%x,%x)",
(unsigned) atapi.primary_secondary,
(unsigned) atapi.slave_master,
(unsigned) atapi.lun);
(unsigned) atapi->primary_secondary,
(unsigned) atapi->slave_master,
(unsigned) atapi->lun);
}
break;
case GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE:
{
grub_efi_scsi_device_path_t scsi;
grub_memcpy (&scsi, dp, len);
grub_efi_scsi_device_path_t *scsi
= (grub_efi_scsi_device_path_t *) dp;
grub_printf ("/SCSI(%x,%x)",
(unsigned) scsi.pun,
(unsigned) scsi.lun);
(unsigned) scsi->pun,
(unsigned) scsi->lun);
}
break;
case GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE:
{
grub_efi_fibre_channel_device_path_t fc;
grub_memcpy (&fc, dp, len);
grub_efi_fibre_channel_device_path_t *fc
= (grub_efi_fibre_channel_device_path_t *) dp;
grub_printf ("/FibreChannel(%llx,%llx)",
(unsigned long long) fc.wwn,
(unsigned long long) fc.lun);
(unsigned long long) fc->wwn,
(unsigned long long) fc->lun);
}
break;
case GRUB_EFI_1394_DEVICE_PATH_SUBTYPE:
{
grub_efi_1394_device_path_t firewire;
grub_memcpy (&firewire, dp, len);
grub_printf ("/1394(%llx)", (unsigned long long) firewire.guid);
grub_efi_1394_device_path_t *firewire
= (grub_efi_1394_device_path_t *) dp;
grub_printf ("/1394(%llx)",
(unsigned long long) firewire->guid);
}
break;
case GRUB_EFI_USB_DEVICE_PATH_SUBTYPE:
{
grub_efi_usb_device_path_t usb;
grub_memcpy (&usb, dp, len);
grub_efi_usb_device_path_t *usb
= (grub_efi_usb_device_path_t *) dp;
grub_printf ("/USB(%x,%x)",
(unsigned) usb.parent_port_number,
(unsigned) usb.usb_interface);
(unsigned) usb->parent_port_number,
(unsigned) usb->usb_interface);
}
break;
case GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE:
{
grub_efi_usb_class_device_path_t usb_class;
grub_memcpy (&usb_class, dp, len);
grub_efi_usb_class_device_path_t *usb_class
= (grub_efi_usb_class_device_path_t *) dp;
grub_printf ("/USBClass(%x,%x,%x,%x,%x)",
(unsigned) usb_class.vendor_id,
(unsigned) usb_class.product_id,
(unsigned) usb_class.device_class,
(unsigned) usb_class.device_subclass,
(unsigned) usb_class.device_protocol);
(unsigned) usb_class->vendor_id,
(unsigned) usb_class->product_id,
(unsigned) usb_class->device_class,
(unsigned) usb_class->device_subclass,
(unsigned) usb_class->device_protocol);
}
break;
case GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE:
{
grub_efi_i2o_device_path_t i2o;
grub_memcpy (&i2o, dp, len);
grub_printf ("/I2O(%x)", (unsigned) i2o.tid);
grub_efi_i2o_device_path_t *i2o
= (grub_efi_i2o_device_path_t *) dp;
grub_printf ("/I2O(%x)", (unsigned) i2o->tid);
}
break;
case GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE:
{
grub_efi_mac_address_device_path_t mac;
grub_memcpy (&mac, dp, len);
grub_efi_mac_address_device_path_t *mac
= (grub_efi_mac_address_device_path_t *) dp;
grub_printf ("/MacAddr(%02x:%02x:%02x:%02x:%02x:%02x,%x)",
(unsigned) mac.mac_address[0],
(unsigned) mac.mac_address[1],
(unsigned) mac.mac_address[2],
(unsigned) mac.mac_address[3],
(unsigned) mac.mac_address[4],
(unsigned) mac.mac_address[5],
(unsigned) mac.if_type);
(unsigned) mac->mac_address[0],
(unsigned) mac->mac_address[1],
(unsigned) mac->mac_address[2],
(unsigned) mac->mac_address[3],
(unsigned) mac->mac_address[4],
(unsigned) mac->mac_address[5],
(unsigned) mac->if_type);
}
break;
case GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE:
{
grub_efi_ipv4_device_path_t ipv4;
grub_memcpy (&ipv4, dp, len);
grub_efi_ipv4_device_path_t *ipv4
= (grub_efi_ipv4_device_path_t *) dp;
grub_printf ("/IPv4(%u.%u.%u.%u,%u.%u.%u.%u,%u,%u,%x,%x)",
(unsigned) ipv4.local_ip_address[0],
(unsigned) ipv4.local_ip_address[1],
(unsigned) ipv4.local_ip_address[2],
(unsigned) ipv4.local_ip_address[3],
(unsigned) ipv4.remote_ip_address[0],
(unsigned) ipv4.remote_ip_address[1],
(unsigned) ipv4.remote_ip_address[2],
(unsigned) ipv4.remote_ip_address[3],
(unsigned) ipv4.local_port,
(unsigned) ipv4.remote_port,
(unsigned) ipv4.protocol,
(unsigned) ipv4.static_ip_address);
(unsigned) ipv4->local_ip_address[0],
(unsigned) ipv4->local_ip_address[1],
(unsigned) ipv4->local_ip_address[2],
(unsigned) ipv4->local_ip_address[3],
(unsigned) ipv4->remote_ip_address[0],
(unsigned) ipv4->remote_ip_address[1],
(unsigned) ipv4->remote_ip_address[2],
(unsigned) ipv4->remote_ip_address[3],
(unsigned) ipv4->local_port,
(unsigned) ipv4->remote_port,
(unsigned) ipv4->protocol,
(unsigned) ipv4->static_ip_address);
}
break;
case GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE:
{
grub_efi_ipv6_device_path_t ipv6;
grub_memcpy (&ipv6, dp, len);
grub_efi_ipv6_device_path_t *ipv6
= (grub_efi_ipv6_device_path_t *) dp;
grub_printf ("/IPv6(%x:%x:%x:%x:%x:%x:%x:%x,%x:%x:%x:%x:%x:%x:%x:%x,%u,%u,%x,%x)",
(unsigned) ipv6.local_ip_address[0],
(unsigned) ipv6.local_ip_address[1],
(unsigned) ipv6.local_ip_address[2],
(unsigned) ipv6.local_ip_address[3],
(unsigned) ipv6.local_ip_address[4],
(unsigned) ipv6.local_ip_address[5],
(unsigned) ipv6.local_ip_address[6],
(unsigned) ipv6.local_ip_address[7],
(unsigned) ipv6.remote_ip_address[0],
(unsigned) ipv6.remote_ip_address[1],
(unsigned) ipv6.remote_ip_address[2],
(unsigned) ipv6.remote_ip_address[3],
(unsigned) ipv6.remote_ip_address[4],
(unsigned) ipv6.remote_ip_address[5],
(unsigned) ipv6.remote_ip_address[6],
(unsigned) ipv6.remote_ip_address[7],
(unsigned) ipv6.local_port,
(unsigned) ipv6.remote_port,
(unsigned) ipv6.protocol,
(unsigned) ipv6.static_ip_address);
(unsigned) ipv6->local_ip_address[0],
(unsigned) ipv6->local_ip_address[1],
(unsigned) ipv6->local_ip_address[2],
(unsigned) ipv6->local_ip_address[3],
(unsigned) ipv6->local_ip_address[4],
(unsigned) ipv6->local_ip_address[5],
(unsigned) ipv6->local_ip_address[6],
(unsigned) ipv6->local_ip_address[7],
(unsigned) ipv6->remote_ip_address[0],
(unsigned) ipv6->remote_ip_address[1],
(unsigned) ipv6->remote_ip_address[2],
(unsigned) ipv6->remote_ip_address[3],
(unsigned) ipv6->remote_ip_address[4],
(unsigned) ipv6->remote_ip_address[5],
(unsigned) ipv6->remote_ip_address[6],
(unsigned) ipv6->remote_ip_address[7],
(unsigned) ipv6->local_port,
(unsigned) ipv6->remote_port,
(unsigned) ipv6->protocol,
(unsigned) ipv6->static_ip_address);
}
break;
case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE:
{
grub_efi_infiniband_device_path_t ib;
grub_memcpy (&ib, dp, len);
grub_efi_infiniband_device_path_t *ib
= (grub_efi_infiniband_device_path_t *) dp;
grub_printf ("/InfiniBand(%x,%llx,%llx,%llx)",
(unsigned) ib.port_gid[0], /* XXX */
(unsigned long long) ib.remote_id,
(unsigned long long) ib.target_port_id,
(unsigned long long) ib.device_id);
(unsigned) ib->port_gid[0], /* XXX */
(unsigned long long) ib->remote_id,
(unsigned long long) ib->target_port_id,
(unsigned long long) ib->device_id);
}
break;
case GRUB_EFI_UART_DEVICE_PATH_SUBTYPE:
{
grub_efi_uart_device_path_t uart;
grub_memcpy (&uart, dp, len);
grub_efi_uart_device_path_t *uart
= (grub_efi_uart_device_path_t *) dp;
grub_printf ("/UART(%llu,%u,%x,%x)",
(unsigned long long) uart.baud_rate,
uart.data_bits,
uart.parity,
uart.stop_bits);
(unsigned long long) uart->baud_rate,
uart->data_bits,
uart->parity,
uart->stop_bits);
}
break;
case GRUB_EFI_SATA_DEVICE_PATH_SUBTYPE:
{
grub_efi_sata_device_path_t *sata;
sata = (grub_efi_sata_device_path_t *) dp;
grub_printf ("/Sata(%x,%x,%x)",
sata->hba_port,
sata->multiplier_port,
sata->lun);
}
break;
case GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE:
dump_vendor_path ("Messaging",
(grub_efi_vendor_device_path_t *) dp);
@@ -711,12 +723,12 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
break;
case GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE:
{
grub_efi_cdrom_device_path_t cd;
grub_memcpy (&cd, dp, len);
grub_efi_cdrom_device_path_t *cd
= (grub_efi_cdrom_device_path_t *) dp;
grub_printf ("/CD(%u,%llx,%llx)",
cd.boot_entry,
(unsigned long long) cd.partition_start,
(unsigned long long) cd.partition_size);
cd->boot_entry,
(unsigned long long) cd->partition_start,
(unsigned long long) cd->partition_size);
}
break;
case GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE:
@@ -741,20 +753,20 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
break;
case GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE:
{
grub_efi_protocol_device_path_t proto;
grub_memcpy (&proto, dp, sizeof (proto));
grub_efi_protocol_device_path_t *proto
= (grub_efi_protocol_device_path_t *) dp;
grub_printf ("/Protocol(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
(unsigned) proto.guid.data1,
(unsigned) proto.guid.data2,
(unsigned) proto.guid.data3,
(unsigned) proto.guid.data4[0],
(unsigned) proto.guid.data4[1],
(unsigned) proto.guid.data4[2],
(unsigned) proto.guid.data4[3],
(unsigned) proto.guid.data4[4],
(unsigned) proto.guid.data4[5],
(unsigned) proto.guid.data4[6],
(unsigned) proto.guid.data4[7]);
(unsigned) proto->guid.data1,
(unsigned) proto->guid.data2,
(unsigned) proto->guid.data3,
(unsigned) proto->guid.data4[0],
(unsigned) proto->guid.data4[1],
(unsigned) proto->guid.data4[2],
(unsigned) proto->guid.data4[3],
(unsigned) proto->guid.data4[4],
(unsigned) proto->guid.data4[5],
(unsigned) proto->guid.data4[6],
(unsigned) proto->guid.data4[7]);
}
break;
default:
@@ -768,11 +780,11 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
{
case GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE:
{
grub_efi_bios_device_path_t bios;
grub_memcpy (&bios, dp, sizeof (bios));
grub_efi_bios_device_path_t *bios
= (grub_efi_bios_device_path_t *) dp;
grub_printf ("/BIOS(%x,%x,%s)",
(unsigned) bios.device_type,
(unsigned) bios.status_flags,
(unsigned) bios->device_type,
(unsigned) bios->status_flags,
(char *) (dp + 1));
}
break;
-2
View File
@@ -67,8 +67,6 @@ grub_file_open (const char *name)
const char *file_name;
grub_file_filter_id_t filter;
grub_boot_time ("Opening '%s'", name);
device_name = grub_file_get_device_name (name);
if (grub_errno)
goto fail;
+1 -1
View File
@@ -135,7 +135,7 @@ LOCAL(prot_to_real_addr):
.macro REAL_TO_PROT
movl LOCAL(real_to_prot_addr), %eax
calll *%eax
DATA32 call *%ax
.endm
/*
+1 -1
View File
@@ -28,7 +28,7 @@
_start:
jmp codestart
.org GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR
. = _start + GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR
VARIABLE(grub_core_entry_addr)
.long 0
+5 -5
View File
@@ -54,7 +54,7 @@ protstack:
.endm
.macro REAL_TO_PROT
calll real_to_prot
DATA32 call real_to_prot
.endm
/*
@@ -137,7 +137,7 @@ real_to_prot:
/* load the GDT register */
xorw %ax, %ax
movw %ax, %ds
lgdtl gdtdesc
DATA32 ADDR32 lgdt gdtdesc
/* turn on protected mode */
movl %cr0, %eax
@@ -145,7 +145,7 @@ real_to_prot:
movl %eax, %cr0
/* jump to relocation, flush prefetch queue, and reload %cs */
ljmpl $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg
DATA32 ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg
.code32
protcseg:
@@ -237,7 +237,7 @@ tmpcseg:
movl %eax, %cr0
/* flush prefetch queue, reload %cs */
ljmpl $0, $realcseg
DATA32 ljmp $0, $realcseg
realcseg:
/* we are in real mode now
@@ -258,6 +258,6 @@ realcseg:
#endif
/* return on new stack! */
retl
DATA32 ret
.code32
+1 -1
View File
@@ -36,7 +36,7 @@ start:
bal cont
nop
.org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
. = _start + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
VARIABLE(grub_total_modules_size)
.long 0
+1 -1
View File
@@ -27,7 +27,7 @@ _start:
ba codestart
mov %o4, %o0
.org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
. = EXT_C(_start) + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
VARIABLE(grub_total_module_size)
.word 0
+18 -18
View File
@@ -357,7 +357,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
for (j = KC-1; j >= 0; j--)
{
*((u32*)tk[j]) = *((u32*)k[j]);
*((u32_a_t*)tk[j]) = *((u32_a_t*)k[j]);
}
r = 0;
t = 0;
@@ -366,7 +366,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
{
for (; (j < KC) && (t < 4); j++, t++)
{
*((u32*)W[r][t]) = *((u32*)tk[j]);
*((u32_a_t*)W[r][t]) = *((u32_a_t*)tk[j]);
}
if (t == 4)
{
@@ -389,14 +389,14 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
{
for (j = 1; j < KC; j++)
{
*((u32*)tk[j]) ^= *((u32*)tk[j-1]);
*((u32_a_t*)tk[j]) ^= *((u32_a_t*)tk[j-1]);
}
}
else
{
for (j = 1; j < KC/2; j++)
{
*((u32*)tk[j]) ^= *((u32*)tk[j-1]);
*((u32_a_t*)tk[j]) ^= *((u32_a_t*)tk[j-1]);
}
tk[KC/2][0] ^= S[tk[KC/2 - 1][0]];
tk[KC/2][1] ^= S[tk[KC/2 - 1][1]];
@@ -404,7 +404,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
tk[KC/2][3] ^= S[tk[KC/2 - 1][3]];
for (j = KC/2 + 1; j < KC; j++)
{
*((u32*)tk[j]) ^= *((u32*)tk[j-1]);
*((u32_a_t*)tk[j]) ^= *((u32_a_t*)tk[j-1]);
}
}
@@ -413,7 +413,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen)
{
for (; (j < KC) && (t < 4); j++, t++)
{
*((u32*)W[r][t]) = *((u32*)tk[j]);
*((u32_a_t*)W[r][t]) = *((u32_a_t*)tk[j]);
}
if (t == 4)
{
@@ -483,29 +483,29 @@ prepare_decryption( RIJNDAEL_context *ctx )
for (r=0; r < MAXROUNDS+1; r++ )
{
*((u32*)ctx->keyschdec[r][0]) = *((u32*)ctx->keyschenc[r][0]);
*((u32*)ctx->keyschdec[r][1]) = *((u32*)ctx->keyschenc[r][1]);
*((u32*)ctx->keyschdec[r][2]) = *((u32*)ctx->keyschenc[r][2]);
*((u32*)ctx->keyschdec[r][3]) = *((u32*)ctx->keyschenc[r][3]);
*((u32_a_t*)ctx->keyschdec[r][0]) = *((u32_a_t*)ctx->keyschenc[r][0]);
*((u32_a_t*)ctx->keyschdec[r][1]) = *((u32_a_t*)ctx->keyschenc[r][1]);
*((u32_a_t*)ctx->keyschdec[r][2]) = *((u32_a_t*)ctx->keyschenc[r][2]);
*((u32_a_t*)ctx->keyschdec[r][3]) = *((u32_a_t*)ctx->keyschenc[r][3]);
}
#define W (ctx->keyschdec)
for (r = 1; r < ctx->rounds; r++)
{
w = W[r][0];
*((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]])
^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]);
*((u32_a_t*)w) = *((u32_a_t*)U1[w[0]]) ^ *((u32_a_t*)U2[w[1]])
^ *((u32_a_t*)U3[w[2]]) ^ *((u32_a_t*)U4[w[3]]);
w = W[r][1];
*((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]])
^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]);
*((u32_a_t*)w) = *((u32_a_t*)U1[w[0]]) ^ *((u32_a_t*)U2[w[1]])
^ *((u32_a_t*)U3[w[2]]) ^ *((u32_a_t*)U4[w[3]]);
w = W[r][2];
*((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]])
^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]);
*((u32_a_t*)w) = *((u32_a_t*)U1[w[0]]) ^ *((u32_a_t*)U2[w[1]])
^ *((u32_a_t*)U3[w[2]]) ^ *((u32_a_t*)U4[w[3]]);
w = W[r][3];
*((u32*)w) = *((u32*)U1[w[0]]) ^ *((u32*)U2[w[1]])
^ *((u32*)U3[w[2]]) ^ *((u32*)U4[w[3]]);
*((u32_a_t*)w) = *((u32_a_t*)U1[w[0]]) ^ *((u32_a_t*)U2[w[1]])
^ *((u32_a_t*)U3[w[2]]) ^ *((u32_a_t*)U4[w[3]]);
}
#undef W
#undef w
+1 -2
View File
@@ -249,8 +249,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
if (! dp)
{
grub_error (GRUB_ERR_BAD_DEVICE, "not a valid root device (%p, %p)",
dev_handle, dp);
grub_error (GRUB_ERR_BAD_DEVICE, "not a valid root device");
goto fail;
}
+3
View File
@@ -9,11 +9,14 @@ grub_have_font_source=@HAVE_FONT_SOURCE@
# Autodetected config
grub_have_asm_uscore=@HAVE_ASM_USCORE@
grub_i8086_addr32="@ADDR32@"
grub_i8086_data32="@DATA32@"
grub_bss_start_symbol="@BSS_START_SYMBOL@"
grub_end_symbol="@END_SYMBOL@"
# Build environment
grub_target_cc='@TARGET_CC@'
grub_target_cc_version='@TARGET_CC_VERSION@'
grub_target_cflags='@TARGET_CFLAGS@'
grub_target_cppflags='@TARGET_CPPFLAGS@'
grub_target_ccasflags='@TARGET_CCASFLAGS@'
-6
View File
@@ -230,18 +230,12 @@ read_lists (const char *val)
{
if (! grub_no_modules)
{
grub_boot_time ("Reading commands");
read_command_list (val);
grub_boot_time ("Reading filesystems");
read_fs_list (val);
grub_boot_time ("Reading crypto");
read_crypto_list (val);
grub_boot_time ("Reading terminal");
read_terminal_list (val);
}
grub_boot_time ("Reading gettext");
grub_gettext_reread_prefix (val);
grub_boot_time ("Lists reread");
}
static char *
+2 -2
View File
@@ -80,11 +80,11 @@ grub_util_fd_open (const char *os_dev, int flags)
flags |= O_BINARY;
#endif
ret = open (os_dev, flags, S_IRUSR | S_IWUSR);
ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
/* If we can't have exclusive access, try shared access */
if (ret < 0)
ret = open (os_dev, flags | O_SHLOCK, S_IRUSR | S_IWUSR);
ret = open (os_dev, flags | O_SHLOCK, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
return ret;
}
+1 -1
View File
@@ -180,7 +180,7 @@ grub_util_fd_open (const char *dev, int flg)
if (dev[0] != '/' || dev[1] != '/' || dev[2] != ':')
{
ret->type = GRUB_UTIL_FD_FILE;
ret->fd = open (dev, flg, S_IRUSR | S_IWUSR);
ret->fd = open (dev, flg, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
if (ret->fd < 0)
{
free (ret);
+1 -1
View File
@@ -90,7 +90,7 @@ grub_util_fd_open (const char *os_dev, int flags)
flags |= O_BINARY;
#endif
ret = open (os_dev, flags, S_IRUSR | S_IWUSR);
ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
if (ret >= 0)
configure_device_driver (fd);
return ret;
-22
View File
@@ -211,22 +211,6 @@ grub_util_devmapper_part_to_disk (struct stat *st,
return xstrdup (path);
}
int
grub_util_device_is_mapped_stat (struct stat *st)
{
#if GRUB_DISK_DEVS_ARE_CHAR
if (! S_ISCHR (st->st_mode))
#else
if (! S_ISBLK (st->st_mode))
#endif
return 0;
if (!grub_device_mapper_supported ())
return 0;
return dm_is_dm_major (major (st->st_rdev));
}
char *
grub_util_get_devmapper_grub_dev (const char *os_dev)
{
@@ -311,12 +295,6 @@ grub_util_pull_devmapper (const char *os_dev __attribute__ ((unused)))
return;
}
int
grub_util_device_is_mapped_stat (struct stat *st __attribute__ ((unused)))
{
return 0;
}
void
grub_util_devmapper_cleanup (void)
{
+23
View File
@@ -82,6 +82,23 @@ grub_util_device_is_mapped (const char *dev)
return dm_is_dm_major (major (st.st_rdev));
}
int
grub_util_device_is_mapped_stat (struct stat *st)
{
#if GRUB_DISK_DEVS_ARE_CHAR
if (! S_ISCHR (st->st_mode))
#else
if (! S_ISBLK (st->st_mode))
#endif
return 0;
if (!grub_device_mapper_supported ())
return 0;
return dm_is_dm_major (major (st->st_rdev));
}
int
grub_util_get_dm_node_linear_info (dev_t dev,
int *maj, int *min,
@@ -199,4 +216,10 @@ grub_util_get_dm_node_linear_info (dev_t dev __attribute__ ((unused)),
return 0;
}
int
grub_util_device_is_mapped_stat (struct stat *st __attribute__ ((unused)))
{
return 0;
}
#endif
+1 -1
View File
@@ -106,7 +106,7 @@ grub_util_fd_open (const char *os_dev, int flags)
return GRUB_UTIL_FD_INVALID;
}
ret = open (os_dev, flags, S_IRUSR | S_IWUSR);
ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
if (! (sysctl_oldflags & 0x10)
+1 -1
View File
@@ -181,7 +181,7 @@ grub_util_fd_open (const char *os_dev, int flags)
flags |= O_BINARY;
#endif
return open (os_dev, flags, S_IRUSR | S_IWUSR);
return open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
}
#endif
+1 -1
View File
@@ -46,5 +46,5 @@ message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
.byte 0
.org 510
. = base + 510
.short 0xaa55
+11
View File
@@ -819,6 +819,17 @@ struct grub_efi_uart_device_path
} GRUB_PACKED;
typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
#define GRUB_EFI_SATA_DEVICE_PATH_SUBTYPE 18
struct grub_efi_sata_device_path
{
grub_efi_device_path_t header;
grub_efi_uint16_t hba_port;
grub_efi_uint16_t multiplier_port;
grub_efi_uint16_t lun;
} GRUB_PACKED;
typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t;
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
/* Media Device Path. */
-55
View File
@@ -1,55 +0,0 @@
/*
* 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/>.
*/
#ifndef GRUB_GREFFS_HEADER
#define GRUB_GREFFS_HEADER 1
#include <grub/types.h>
/*
Layout:
header
grub_uint32_t[] pointers to names
inodes
names
contents.
Everything is little-endian.
*/
struct grub_greffs_header
{
char magic[4];
#define GRUB_GREFFS_MAGIC "gref"
grub_uint32_t nfiles;
/* must be divisible by 4. */
grub_uint32_t inodes_offset;
/* must be divisible by 4. */
grub_uint32_t string_ptrs_offset;
};
struct grub_greffs_inode
{
grub_uint32_t start;
grub_uint32_t size;
grub_uint32_t mtime;
/* Currently always 0. If we ever need symlinks,
it could be added. */
grub_uint32_t type;
};
#endif
+1 -1
View File
@@ -68,7 +68,7 @@ grub_util_rename (const char *from, const char *to)
return rename (from, to);
}
#define grub_util_mkdir(a) mkdir (a, 0700)
#define grub_util_mkdir(a) mkdir ((a), 0755)
struct grub_util_fd
{
+1 -1
View File
@@ -71,7 +71,7 @@ grub_util_rename (const char *from, const char *to)
return rename (from, to);
}
#define grub_util_mkdir(a) mkdir ((a), 0700)
#define grub_util_mkdir(a) mkdir ((a), 0755)
#if defined (__NetBSD__)
/* NetBSD uses /boot for its boot block. */
+8 -47
View File
@@ -55,7 +55,6 @@ usage () {
gettext "Generate a grub config file"; echo
echo
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
print_option_help "-r, --root-directory=$(gettext DIR)" "$(gettext "use DIR as root directory [default=/]")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
echo
@@ -73,8 +72,6 @@ argument () {
echo $1
}
GRUB_ROOT=
# Check the arguments.
while test $# -gt 0
do
@@ -93,11 +90,6 @@ do
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
;;
-r | --root-directory)
GRUB_ROOT=`argument $option "$@"`; shift;;
--root-directory=*)
GRUB_ROOT=`echo "$option" | sed 's/--output=//'`
;;
-*)
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
usage
@@ -137,19 +129,19 @@ else
fi
# Device containing our userland. Typically used for root= parameter.
GRUB_DEVICE="`${grub_probe} --target=device "$GRUB_ROOT"/`"
GRUB_DEVICE="`${grub_probe} --target=device /`"
GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
# Device containing our /boot partition. Usually the same as GRUB_DEVICE.
GRUB_DEVICE_BOOT="`${grub_probe} --target=device "$GRUB_ROOT"/boot`"
GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
# Filesystem for the device containing our userland. Used for stuff like
# choosing Hurd filesystem module.
GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
if [ x"$GRUB_FS" = x ] || [ x"$GRUB_FS" = xunknown ]; then
GRUB_FS="$(stat -f --printf=%T "$GRUB_ROOT"/ || echo unknown)"
if [ x"$GRUB_FS" = xunknown ]; then
GRUB_FS="$(stat -f --printf=%T / || echo unknown)"
fi
if test -f ${sysconfdir}/default/grub ; then
@@ -186,7 +178,6 @@ if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub
# These are defined in this script, export them here so that user can
# override them.
export GRUB_DEVICE \
GRUB_ROOT \
GRUB_DEVICE_UUID \
GRUB_DEVICE_BOOT \
GRUB_DEVICE_BOOT_UUID \
@@ -256,46 +247,16 @@ EOF
for i in "${grub_mkconfig_dir}"/* ; do
case "$i" in
"${grub_mkconfig_dir}"/00_header \
| "${grub_mkconfig_dir}"/30_os-prober \
| "${grub_mkconfig_dir}"/40_custom \
| "${grub_mkconfig_dir}"/41_custom)
if test -x "$i" ; then
echo
echo "### BEGIN $i ###"
"$i"
echo "### END $i ###"
fi
;;
# emacsen backup files. FIXME: support other editors
*~) ;;
# emacsen autosave files. FIXME: support other editors
*/\#*\#) ;;
*)
if grub_file_is_not_garbage "$i" && test -x "$i" ; then
for platform in x86 i386-xen-pae x86_64-xen mips mipsel sparc64 powerpc ia64 arm arm64; do
GRUB_PLATFORM=$platform
export GRUB_PLATFORM
buf="$($i)"
if [ x"$buf" != x ]; then
echo
echo "### BEGIN $i ($platform) ###"
case x$platform in
xx86)
echo "if [ x\"\$grub_platform\" != xxen -a \\( x\"\$grub_cpu\" = xi386 -o x\"\$grub_cpu\" = xx86_64 -o x\"\$grub_platform\" = x \\) ]; then" ;;
xi386-xen-pae)
echo "if [ x\"\$grub_cpu-\$grub_platform\" = xi386-xen -o x\"\$grub_cpu-\$grub_platform\" = x- ]; then" ;;
xx86_64-xen)
echo "if [ x\"\$grub_cpu-\$grub_platform\" = xx86_64-xen -o x\"\$grub_cpu-\$grub_platform\" = x- ]; then" ;;
*)
echo "if [ x\"\$grub_cpu\" = x$platform -o x\"\$grub_platform\" = x ]; then" ;;
esac
echo "$buf"
echo "fi"
echo "### END $i ($platform) ###"
fi
done
echo
echo "### BEGIN $i ###"
"$i"
echo "### END $i ###"
fi
;;
esac
+124 -155
View File
@@ -21,7 +21,6 @@
#include <grub/util/install.h>
#include <grub/util/misc.h>
#include <grub/emu/config.h>
#include <grub/greffs.h>
#include <string.h>
@@ -35,6 +34,7 @@ static char *output_image;
static char **files;
static int nfiles;
const struct grub_install_image_target_desc *format;
static FILE *memdisk;
enum
{
@@ -116,56 +116,91 @@ struct argp argp = {
NULL, help_filter, NULL
};
struct file_desc
/* tar support */
#define MAGIC "ustar"
struct head
{
char *name;
char *source;
grub_size_t size;
grub_size_t mtime;
};
static struct file_desc *file_descs;
static size_t n_file_descs, alloc_file_descs;
char name[100];
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char chksum[8];
char typeflag;
char linkname[100];
char magic[6];
char version[2];
char uname[32];
char gname[32];
char devmajor[8];
char devminor[8];
char prefix[155];
char pad[12];
} GRUB_PACKED;
static inline void
canonicalize (char *name)
static void
write_zeros (unsigned rsz)
{
char *iptr, *optr;
for (iptr = name, optr = name; *iptr; )
{
while (*iptr == '/')
iptr++;
if (iptr[0] == '.' && (iptr[1] == '/' || iptr[1] == 0))
{
iptr += 2;
continue;
}
if (iptr[0] == '.' && iptr[1] == '.' && (iptr[2] == '/' || iptr[2] == 0))
{
iptr += 3;
if (optr == name)
continue;
for (optr -= 2; optr >= name && *optr != '/'; optr--);
optr++;
continue;
}
while (*iptr && *iptr != '/')
*optr++ = *iptr++;
if (*iptr)
*optr++ = *iptr++;
}
*optr = 0;
char buf[512];
memset (buf, 0, 512);
fwrite (buf, 1, rsz, memdisk);
}
static void
write_pad (unsigned sz)
{
write_zeros ((~sz + 1) & 511);
}
static void
set_tar_value (char *field, grub_uint32_t val,
unsigned len)
{
unsigned i;
for (i = 0; i < len - 1; i++)
field[len - 2 - i] = '0' + ((val >> (3 * i)) & 7);
}
static void
compute_checksum (struct head *hd)
{
unsigned int chk = 0;
unsigned char *ptr;
memset (hd->chksum, ' ', 8);
for (ptr = (unsigned char *) hd; ptr < (unsigned char *) (hd + 1); ptr++)
chk += *ptr;
set_tar_value (hd->chksum, chk, 8);
}
static void
add_tar_file (const char *from,
const char *to)
{
char *tcn;
const char *iptr;
char *optr;
struct head hd;
grub_util_fd_t in;
size_t idx;
ssize_t r;
grub_uint32_t mtime = 0;
grub_uint32_t size;
COMPILE_TIME_ASSERT (sizeof (hd) == 512);
if (grub_util_is_special_file (from))
return;
mtime = grub_util_get_mtime (from);
optr = tcn = xmalloc (strlen (to) + 1);
for (iptr = to; *iptr == '/'; iptr++);
for (; *iptr; iptr++)
if (!(iptr[0] == '/' && iptr[1] == '/'))
*optr++ = *iptr;
*optr = '\0';
if (grub_util_is_directory (from))
{
grub_util_fd_dir_t d;
@@ -186,138 +221,69 @@ add_tar_file (const char *from,
free (fp);
}
grub_util_fd_closedir (d);
free (tcn);
return;
}
idx = n_file_descs++;
if (idx >= alloc_file_descs)
if (optr - tcn > 99)
{
alloc_file_descs = 2 * n_file_descs;
file_descs = xrealloc (file_descs, alloc_file_descs
* sizeof (file_descs[0]));
memset (&hd, 0, sizeof (hd));
memcpy (hd.name, tcn, 99);
memcpy (hd.mode, "0000600", 7);
memcpy (hd.uid, "0001750", 7);
memcpy (hd.gid, "0001750", 7);
set_tar_value (hd.size, optr - tcn, 12);
set_tar_value (hd.mtime, mtime, 12);
hd.typeflag = 'L';
memcpy (hd.magic, "ustar ", 7);
memcpy (hd.uname, "grub", 4);
memcpy (hd.gname, "grub", 4);
compute_checksum (&hd);
fwrite (&hd, 1, sizeof (hd), memdisk);
fwrite (tcn, 1, optr - tcn, memdisk);
write_pad (optr - tcn);
}
in = grub_util_fd_open (from, GRUB_UTIL_FD_O_RDONLY);
if (!GRUB_UTIL_FD_IS_VALID (in))
grub_util_error (_("cannot open `%s': %s"), from, grub_util_fd_strerror ());
file_descs[idx].name = xstrdup (to);
file_descs[idx].source = xstrdup (from);
canonicalize (file_descs[idx].name);
file_descs[idx].mtime = grub_util_get_mtime (from);
file_descs[idx].size = grub_util_get_fd_size (in, from, NULL);
grub_util_fd_close (in);
}
static int
filecmp (const void *p1, const void *p2)
{
const struct file_desc *a = p1, *b = p2;
/* Don't use strcmp, it's buggy on some systems. */
return grub_strcmp (a->name, b->name);
}
static void
write_memdisk (char *memdisk_img)
{
FILE *memdisk;
struct grub_greffs_header head;
struct grub_greffs_inode inode;
size_t total_strlen = 0, i;
size_t name_pad = 0;
grub_uint32_t file_offset;
qsort (file_descs, n_file_descs, sizeof (file_descs[0]), filecmp);
for (i = 0; i < n_file_descs; i++)
total_strlen += grub_strlen (file_descs[i].name);
name_pad = ALIGN_UP (total_strlen, 4) - total_strlen;
total_strlen += name_pad;
grub_memcpy (head.magic, GRUB_GREFFS_MAGIC, sizeof (head.magic));
head.nfiles = grub_cpu_to_le32 (n_file_descs);
head.inodes_offset = grub_cpu_to_le32 (sizeof (head)
+ sizeof (grub_uint32_t)
* (n_file_descs + 1));
head.string_ptrs_offset = grub_cpu_to_le32 (sizeof (head));
memdisk = grub_util_fopen (memdisk_img, "wb");
if (!memdisk)
grub_util_error (_("Can't create file: %s"), strerror (errno));
fwrite (&head, 1, sizeof (head), memdisk);
grub_uint32_t curname = sizeof (head) + sizeof (grub_uint32_t)
* (n_file_descs + 1) + sizeof (inode) * n_file_descs;
for (i = 0; i <= n_file_descs; i++)
{
grub_uint32_t curname_le = grub_cpu_to_le32 (curname);
fwrite (&curname_le, 1, sizeof (curname_le), memdisk);
if (i != n_file_descs)
curname += grub_strlen (file_descs[i].name);
}
file_offset = sizeof (head) + sizeof (grub_uint32_t)
* (n_file_descs + 1) + sizeof (inode) * n_file_descs + total_strlen;
for (i = 0; i < n_file_descs; i++)
{
inode.start = grub_cpu_to_le32 (file_offset);
inode.size = grub_cpu_to_le32 (file_descs[i].size);
inode.mtime = grub_cpu_to_le32 (file_descs[i].mtime);
inode.type = 0;
fwrite (&inode, 1, sizeof (inode), memdisk);
file_offset += file_descs[i].size;
}
for (i = 0; i < n_file_descs; i++)
fwrite (file_descs[i].name, 1, grub_strlen (file_descs[i].name), memdisk);
if (!grub_install_copy_buffer)
grub_install_copy_buffer = xmalloc (GRUB_INSTALL_COPY_BUFFER_SIZE);
grub_memset (grub_install_copy_buffer, 0, 4);
fwrite (grub_install_copy_buffer, 1, name_pad, memdisk);
size = grub_util_get_fd_size (in, from, NULL);
for (i = 0; i < n_file_descs; i++)
{
grub_util_fd_t in;
size_t remaining = file_descs[i].size;
in = grub_util_fd_open (file_descs[i].source, GRUB_UTIL_FD_O_RDONLY);
if (!GRUB_UTIL_FD_IS_VALID (in))
grub_util_error (_("cannot open `%s': %s"),
file_descs[i].source, grub_util_fd_strerror ());
memset (&hd, 0, sizeof (hd));
memcpy (hd.name, tcn, optr - tcn < 99 ? optr - tcn : 99);
memcpy (hd.mode, "0000600", 7);
memcpy (hd.uid, "0001750", 7);
memcpy (hd.gid, "0001750", 7);
set_tar_value (hd.size, size, 12);
set_tar_value (hd.mtime, mtime, 12);
hd.typeflag = '0';
memcpy (hd.magic, "ustar ", 7);
memcpy (hd.uname, "grub", 4);
memcpy (hd.gname, "grub", 4);
compute_checksum (&hd);
fwrite (&hd, 1, sizeof (hd), memdisk);
while (remaining)
{
size_t toread = remaining;
ssize_t r;
if (remaining > GRUB_INSTALL_COPY_BUFFER_SIZE)
toread = GRUB_INSTALL_COPY_BUFFER_SIZE;
r = grub_util_fd_read (in, grub_install_copy_buffer, toread);
if (r <= 0)
break;
fwrite (grub_install_copy_buffer, 1, r, memdisk);
if (r >= remaining)
remaining = 0;
else
remaining -= r;
}
grub_util_fd_close (in);
grub_memset (grub_install_copy_buffer, 0, GRUB_INSTALL_COPY_BUFFER_SIZE);
while (remaining)
{
size_t toread = remaining;
if (remaining > GRUB_INSTALL_COPY_BUFFER_SIZE)
toread = GRUB_INSTALL_COPY_BUFFER_SIZE;
fwrite (grub_install_copy_buffer, 1, toread, memdisk);
remaining -= toread;
}
while (1)
{
r = grub_util_fd_read (in, grub_install_copy_buffer, GRUB_INSTALL_COPY_BUFFER_SIZE);
if (r <= 0)
break;
fwrite (grub_install_copy_buffer, 1, r, memdisk);
}
grub_util_fd_close (in);
fclose (memdisk);
write_pad (size);
}
int
@@ -353,6 +319,8 @@ main (int argc, char *argv[])
char *memdisk_img = grub_util_make_temporary_file ();
memdisk = grub_util_fopen (memdisk_img, "wb");
add_tar_file (memdisk_dir, "");
for (i = 0; i < nfiles; i++)
{
@@ -373,12 +341,14 @@ main (int argc, char *argv[])
to++;
add_tar_file (from, to);
}
write_zeros (512);
fclose (memdisk);
write_memdisk (memdisk_img);
grub_util_unlink_recursive (memdisk_dir);
grub_install_push_module ("memdisk");
grub_install_push_module ("greffs");
grub_install_push_module ("tar");
grub_install_make_image_wrap (grub_install_source_directory,
"(memdisk)/boot/grub", output_image,
@@ -386,6 +356,5 @@ main (int argc, char *argv[])
grub_util_get_target_name (format), 0);
grub_util_unlink (memdisk_img);
return 0;
}
+72 -42
View File
@@ -77,9 +77,58 @@ enum {
PRINT_DISK
};
static const char *targets[] =
{
[PRINT_FS] = "fs",
[PRINT_FS_UUID] = "fs_uuid",
[PRINT_FS_LABEL] = "fs_label",
[PRINT_DRIVE] = "drive",
[PRINT_DEVICE] = "device",
[PRINT_PARTMAP] = "partmap",
[PRINT_ABSTRACTION] = "abstraction",
[PRINT_CRYPTODISK_UUID] = "cryptodisk_uuid",
[PRINT_HINT_STR] = "hints_string",
[PRINT_BIOS_HINT] = "bios_hints",
[PRINT_IEEE1275_HINT] = "ieee1275_hints",
[PRINT_BAREMETAL_HINT] = "baremetal_hints",
[PRINT_EFI_HINT] = "efi_hints",
[PRINT_ARC_HINT] = "arc_hints",
[PRINT_COMPATIBILITY_HINT] = "compatibility_hint",
[PRINT_MSDOS_PARTTYPE] = "msdos_parttype",
[PRINT_GPT_PARTTYPE] = "gpt_parttype",
[PRINT_ZERO_CHECK] = "zero_check",
[PRINT_DISK] = "disk",
};
static int print = PRINT_FS;
static unsigned int argument_is_device = 0;
static char *
get_targets_string (void)
{
char **arr = xmalloc (sizeof (targets));
int len = 0;
char *str;
char *ptr;
unsigned i;
memcpy (arr, targets, sizeof (targets));
qsort (arr, ARRAY_SIZE (targets), sizeof (char *), grub_qsort_strcmp);
for (i = 0; i < ARRAY_SIZE (targets); i++)
len += grub_strlen (targets[i]) + 2;
ptr = str = xmalloc (len);
for (i = 0; i < ARRAY_SIZE (targets); i++)
{
ptr = grub_stpcpy (ptr, arr[i]);
*ptr++ = ',';
*ptr++ = ' ';
}
ptr[-2] = '\0';
free (arr);
return str;
}
static void
do_print (const char *x)
{
@@ -660,8 +709,7 @@ static struct argp_option options[] = {
N_("given argument is a system device, not a path"), 0},
{"device-map", 'm', N_("FILE"), 0,
N_("use FILE as the device map [default=%s]"), 0},
{"target", 't', "(fs|fs_uuid|fs_label|drive|device|partmap|abstraction|cryptodisk_uuid|msdos_parttype)", 0,
N_("print filesystem module, GRUB drive, system device, partition map module, abstraction module or cryptographic container UUID [default=fs]"), 0},
{"target", 't', N_("TARGET"), 0, 0, 0},
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
{ 0, 0, 0, 0, 0, 0 }
};
@@ -676,6 +724,16 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
case 'm':
return xasprintf (text, DEFAULT_DEVICE_MAP);
case 't':
{
char *ret, *t = get_targets_string ();
ret = xasprintf ("%s\n%s %s [default=%s]", _("print TARGET"),
_("available targets:"), t, targets[print]);
free (t);
return ret;
}
default:
return (char *) text;
}
@@ -713,46 +771,18 @@ argp_parser (int key, char *arg, struct argp_state *state)
break;
case 't':
if (!strcmp (arg, "fs"))
print = PRINT_FS;
else if (!strcmp (arg, "fs_uuid"))
print = PRINT_FS_UUID;
else if (!strcmp (arg, "fs_label"))
print = PRINT_FS_LABEL;
else if (!strcmp (arg, "drive"))
print = PRINT_DRIVE;
else if (!strcmp (arg, "device"))
print = PRINT_DEVICE;
else if (!strcmp (arg, "partmap"))
print = PRINT_PARTMAP;
else if (!strcmp (arg, "abstraction"))
print = PRINT_ABSTRACTION;
else if (!strcmp (arg, "cryptodisk_uuid"))
print = PRINT_CRYPTODISK_UUID;
else if (!strcmp (arg, "msdos_parttype"))
print = PRINT_MSDOS_PARTTYPE;
else if (!strcmp (arg, "gpt_parttype"))
print = PRINT_GPT_PARTTYPE;
else if (!strcmp (arg, "hints_string"))
print = PRINT_HINT_STR;
else if (!strcmp (arg, "bios_hints"))
print = PRINT_BIOS_HINT;
else if (!strcmp (arg, "ieee1275_hints"))
print = PRINT_IEEE1275_HINT;
else if (!strcmp (arg, "baremetal_hints"))
print = PRINT_BAREMETAL_HINT;
else if (!strcmp (arg, "efi_hints"))
print = PRINT_EFI_HINT;
else if (!strcmp (arg, "arc_hints"))
print = PRINT_ARC_HINT;
else if (!strcmp (arg, "compatibility_hint"))
print = PRINT_COMPATIBILITY_HINT;
else if (strcmp (arg, "zero_check") == 0)
print = PRINT_ZERO_CHECK;
else if (!strcmp (arg, "disk"))
print = PRINT_DISK;
else
argp_usage (state);
{
int i;
for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++)
if (strcmp (arg, targets[i]) == 0)
{
print = i;
break;
}
if (i == ARRAY_SIZE (targets))
argp_usage (state);
}
break;
case '0':
+31 -29
View File
@@ -152,7 +152,7 @@ if [ "x$gfxterm" = x1 ]; then
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
EOF
else
for dir in "${pkgdatadir}" "`echo "$GRUB_ROOT"'/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`" "`echo "$GRUB_ROOT"'/usr/share/grub' | sed "s,//*,/,g"`" ; do
for dir in "${pkgdatadir}" "`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`" /usr/share/grub ; do
for basename in unicode unifont ascii; do
path="${dir}/${basename}.pf2"
if is_path_readable_by_grub "${path}" > /dev/null ; then
@@ -282,48 +282,50 @@ fi
make_timeout ()
{
if [ "x${1}${3}" != "x" ] ; then
if [ "x${3}" != "x" ] ; then
timeout="${2}"
style="${3}"
else
# Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
timeout="${1}"
if [ "x${2}" != "x0" ] ; then
grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.")"
fi
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
style="hidden"
else
style="countdown"
fi
if [ "x${3}" != "x" ] ; then
timeout="${2}"
style="${3}"
elif [ "x${1}" != "x" -a "x${1}" != "x0" ] ; then
# Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
timeout="${1}"
if [ "x${2}" != "x0" ] ; then
grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.")"
fi
if [ "x${style}" = "xcountdown" ] ; then
verbose=" --verbose"
else
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
style="hidden"
verbose=
else
style="countdown"
verbose=" --verbose"
fi
cat << EOF
else
# No hidden timeout, so treat as GRUB_TIMEOUT_STYLE=menu
timeout="${2}"
style="menu"
fi
cat << EOF
if [ x\$feature_timeout_style = xy ] ; then
set timeout_style=${style}
set timeout=${timeout}
EOF
if [ "x${style}" != "xmenu" ] ; then
cat << EOF
if [ "x${style}" = "xmenu" ] ; then
cat << EOF
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=${timeout}
EOF
else
cat << EOF
# Fallback hidden-timeout code in case the timeout_style feature is
# unavailable.
elif sleep${verbose} --interruptible ${timeout} ; then
set timeout=0
EOF
fi
cat << EOF
fi
cat << EOF
fi
EOF
else
cat << EOF
set timeout=${2}
EOF
fi
}
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
+8 -18
View File
@@ -21,16 +21,6 @@ prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
if [ x$GRUB_PLATFORM = xx86 ]; then
check=--is-x86-multiboot
elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
check=--is-i386-xen-pae-domu
elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
check=--is-x86_64-xen-domu
else
exit 0
fi
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
@@ -50,11 +40,11 @@ all_of_them=true
# FIXME: add l4 here?
kernel=
for i in "$GRUB_ROOT"/boot/gnumach* ; do
if test -f "$i" && "${grub_file}" $check "$i" ; then
basename=`basename "$i"`
dirname=`dirname "$i"`
rel_dirname=`make_system_path_relative_to_its_root "$dirname"`
for i in /boot/gnumach* ; do
if test -e $i ; then
basename=`basename $i`
dirname=`dirname $i`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
gettext_printf "Found GNU Mach: %s" "$i" >&2
echo >&2
kernels="${kernels} ${rel_dirname}/${basename}"
@@ -68,8 +58,8 @@ case "${GRUB_FS}" in
*) hurd_fs="${GRUB_FS}fs" ;;
esac
for i in "$GRUB_ROOT"/hurd/${hurd_fs}.static "$GRUB_ROOT"/hurd/exec ; do
if test -f "$i" ; then
for i in /hurd/${hurd_fs}.static /hurd/exec ; do
if test -e "$i" ; then
gettext_printf "Found Hurd module: %s" "$i" >&2
echo >&2
at_least_one=true
@@ -83,7 +73,7 @@ if ${at_least_one} ; then : ; else
exit 0
fi
if ${all_of_them} && test -f "$GRUB_ROOT"/lib/ld.so.1 ; then : ; else
if ${all_of_them} && test -e /lib/ld.so.1 ; then : ; else
gettext "Some Hurd stuff found, but not enough to boot." >&2
echo >&2
exit 1
+1 -16
View File
@@ -27,21 +27,6 @@ export TEXTDOMAINDIR="@localedir@"
CLASS="--class os"
if [ x$GRUB_PLATFORM = xx86 ]; then
check=--is-x86-multiboot
elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
check=--is-i386-xen-pae-domu
elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
check=--is-x86_64-xen-domu
else
exit 0
fi
if ! test -f "$GRUB_ROOT"/platform/i86pc/kernel || ! "${grub_file}" $check "$GRUB_ROOT"/platform/i86pc/kernel; then
exit 0
fi
case "${GRUB_DISTRIBUTOR}" in
*)
OS="Illumos"
@@ -60,7 +45,7 @@ message="$(gettext_printf "Loading kernel of Illumos ...")"
else
ISADIR=
fi
zfs-bootfs $($grub_mkrelpath "$GRUB_ROOT"/) ZFS_BOOTFS
zfs-bootfs $($grub_mkrelpath /) ZFS_BOOTFS
echo '$(echo "$message" | grub_quote)'
multiboot $($grub_mkrelpath /platform/i86pc/kernel)/\$ISADIR/unix /platform/i86pc/kernel/\$ISADIR/unix -B \$ZFS_BOOTFS,console=text
module $($grub_mkrelpath /platform/i86pc)/\$ISADIR/boot_archive /platform/i86pc/\$ISADIR/boot_archive
+10 -20
View File
@@ -27,16 +27,6 @@ export TEXTDOMAINDIR="@localedir@"
CLASS="--class os"
if [ x$GRUB_PLATFORM = xx86 ]; then
check=--is-x86-kfreebsd
elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
check=--is-i386-xen-pae-domu
elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
check=--is-x86_64-xen-domu
else
exit 0
fi
case "${GRUB_DISTRIBUTOR}" in
Debian)
OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD"
@@ -132,10 +122,10 @@ EOF
zfs)
load_kfreebsd_module opensolaris false
ls "$GRUB_ROOT/boot/zfs/zpool.cache" > /dev/null
ls "/boot/zfs/zpool.cache" > /dev/null
printf '%s\n' "${prepare_boot_cache}"
sed "s/^/$submenu_indentation/" << EOF
kfreebsd_module $(make_system_path_relative_to_its_root $GRUB_ROOT/boot)/zfs/zpool.cache type=/boot/zfs/zpool.cache
kfreebsd_module $(make_system_path_relative_to_its_root /boot)/zfs/zpool.cache type=/boot/zfs/zpool.cache
EOF
;;
esac
@@ -153,8 +143,8 @@ EOF
EOF
}
list=`for i in $GRUB_ROOT/boot/kfreebsd-* $GRUB_ROOT/boot/kernel/kernel ; do
if grub_file_is_not_garbage "$i" && ${grub_file} $check "$i"; then echo -n "$i " ; fi
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=
boot_device_id=
@@ -173,8 +163,8 @@ while [ "x$list" != "x" ] ; do
dirname=`dirname $kfreebsd`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
if [ -f "$GRUB_ROOT"/boot/device.hints ] ; then
devices="$GRUB_ROOT"/boot/device.hints
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`
@@ -191,14 +181,14 @@ while [ "x$list" != "x" ] ; do
# zpool name
kfreebsd_device=$(${grub_probe} -t fs_label --device ${GRUB_DEVICE})
# filesystem name (empty string for the main filesystem)
kfreebsd_device="${kfreebsd_device}$(${grub_mkrelpath} "$GRUB_ROOT"/ | sed -e "s,/*@$,,")"
kfreebsd_device="${kfreebsd_device}$(${grub_mkrelpath} / | sed -e "s,/*@$,,")"
;;
*)
kfreebsd_device=${kfreebsd_fs}id/${GRUB_DEVICE_UUID}
# Debian GNU/kFreeBSD can't remount root if it's supplied as UUID but
# as an UUID
if [ "x${GRUB_DISTRIBUTOR}" = "xDebian" ] \
&& ! (cat "$GRUB_ROOT"/etc/fstab | awk '!/^[[:space:]]*#/ && $2=="/" { print $1; }' \
&& ! (cat /etc/fstab | awk '!/^[[:space:]]*#/ && $2=="/" { print $1; }' \
| grep "${kfreebsd_fs}id/${GRUB_DEVICE_UUID}" > /dev/null); then
kfreebsd_device=${GRUB_DEVICE}
fi
@@ -209,8 +199,8 @@ while [ "x$list" != "x" ] ; do
alt_version=`echo $version | sed -e "s,\.old$,,g"`
module_dir=
for i in "$GRUB_ROOT/lib/modules/${version}" "$GRUB_ROOT/lib/modules/${alt_version}" \
"$GRUB_ROOT/boot/kernel"; do
for i in "/lib/modules/${version}" "/lib/modules/${alt_version}" \
"/boot/kernel"; do
if test -e "$i" ; then
module_dir="$i"
break
+19 -32
View File
@@ -26,31 +26,6 @@ datarootdir="@datarootdir@"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
if [ x$GRUB_PLATFORM = xx86 ]; then
check=--is-x86-linux32
elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
check=--is-i386-xen-pae-domu
elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
check=--is-x86_64-xen-domu
else
check=--is-${GRUB_PLATFORM}-linux
fi
case "x$GRUB_PLATFORM" in
xx86)
list=`for i in "$GRUB_ROOT"/boot/vmlinuz-* "$GRUB_ROOT"/vmlinuz-* "$GRUB_ROOT"/boot/kernel-* ; do
if grub_file_is_not_garbage "$i" && "${grub_file}" $check "$i" ; then echo -n "$i " ; fi
done` ;;
*)
list=`for i in "$GRUB_ROOT"/boot/vmlinuz-* "$GRUB_ROOT"/boot/vmlinux-* "$GRUB_ROOT"/vmlinuz-* "$GRUB_ROOT"/vmlinux-* "$GRUB_ROOT"/boot/kernel-* ; do
if grub_file_is_not_garbage "$i" && "${grub_file}" $check "$i" ; then echo -n "$i " ; fi
done` ;;
esac
if [ x"$list" = x ]; then
exit 0
fi
CLASS="--class gnu-linux --class gnu --class os"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
@@ -78,14 +53,14 @@ fi
case x"$GRUB_FS" in
xbtrfs)
rootsubvol="`make_system_path_relative_to_its_root "$GRUB_ROOT"/`"
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root "$GRUB_ROOT"/ | sed -e "s,@$,,"`"
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
;;
esac
@@ -140,7 +115,7 @@ linux_entry ()
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
if [ x$dirname = x"$GRUB_ROOT"/ ]; then
if [ x$dirname = x/ ]; then
if [ -z "${prepare_root_cache}" ]; then
prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
fi
@@ -169,12 +144,24 @@ EOF
EOF
}
case "$GRUB_PLATFORM" in
x86 | i386-xen-pae | x86_64-xen) GENKERNEL_ARCH="x86" ;;
machine=`uname -m`
case "x$machine" in
xi?86 | xx86_64)
list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done` ;;
*)
list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done` ;;
esac
case "$machine" in
i?86) GENKERNEL_ARCH="x86" ;;
mips|mips64) GENKERNEL_ARCH="mips" ;;
mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
arm*) GENKERNEL_ARCH="arm" ;;
*) GENKERNEL_ARCH="$GRUB_PLATFORM" ;;
*) GENKERNEL_ARCH="$machine" ;;
esac
prepare_boot_cache=
@@ -213,7 +200,7 @@ while [ "x$list" != "x" ] ; do
done
config=
for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "$GRUB_ROOT/etc/kernels/kernel-config-${version}" ; do
for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
if test -e "${i}" ; then
config="${i}"
break
+13 -24
View File
@@ -22,16 +22,6 @@ exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
if [ x$GRUB_PLATFORM = xx86 ]; then
check=--is-x86-kfreebsd
elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
check=--is-i386-xen-pae-domu
elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
check=--is-x86_64-xen-domu
else
exit 0
fi
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
@@ -46,13 +36,19 @@ netbsd_load_fs_module ()
loader="$1" # "knetbsd" or "multiboot"
kernel="$2" # absolute path to the kernel file
if "${grub_file}" --is-x86_64-kfreebsd "${kernel}"; then
karch="amd64"
else
case $(zcat -f "${kernel}" | file -bL - | cut -d , -f 2 | tr -d ' ') in
Intel80386)
karch="i386"
fi
;;
x86-64)
karch="amd64"
;;
*)
return
;;
esac
case $GRUB_FS in
case $(${grub_probe} --target=fs -d ${GRUB_DEVICE}) in
ext2)
kmod="ext2fs"
;;
@@ -71,7 +67,7 @@ netbsd_load_fs_module ()
esac
kversion=$(zcat -f "${kernel}" | strings | sed -n -e '/^@(#)NetBSD/ { s/^@(#)NetBSD \([0-9\.]*\) .*$/\1/g ; p ; q ; }')
kmodule="$GRUB_ROOT/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod"
kmodule="/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod"
if test -z "$karch" -o -z "$kversion" -o ! -f "${kmodule}"; then
return
@@ -98,10 +94,6 @@ netbsd_entry ()
type="$3"
args="$4" # extra arguments appended to loader command
if [ "x${loader}" = xmultiboot ] && [ x$GRUB_PLATFORM = xx86 ] && ! "$grub_file" --is-x86-multiboot "$kernel"; then
return
fi
kroot_device="$(echo ${GRUB_DEVICE} | sed -e 's,^/dev/r,,')"
if [ -z "$boot_device_id" ]; then
@@ -155,13 +147,10 @@ pattern="^ELF[^,]*executable.*statically linked"
submenu_indentation=""
is_top_level=true
for k in "$GRUB_ROOT"/netbsd $(ls -t "$GRUB_ROOT"/netbsd?* 2>/dev/null) ; do
for k in /netbsd $(ls -t /netbsd?* 2>/dev/null) ; do
if ! grub_file_is_not_garbage "$k" ; then
continue
fi
if ! "$grub_file" $check "$k"; then
continue
fi
if ! (zcat -f "$k" | file -bL - | grep -q "${pattern}") 2>/dev/null ; then
continue
fi
+3 -12
View File
@@ -26,28 +26,18 @@ export TEXTDOMAINDIR="@localedir@"
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
if [ x$GRUB_PLATFORM != xx86 ]; then
exit 0
fi
osx_entry() {
if [ x$2 = x32 ]; then
# TRANSLATORS: it refers to kernel architecture (32-bit)
bitstr="$(gettext "(32-bit)")"
if ! [ -f "$GRUB_ROOT"/mach_kernel ] || ! "${grub_file}" --is-i386-xnu "$GRUB_ROOT"/mach_kernel; then
return;
fi
else
# TRANSLATORS: it refers to kernel architecture (64-bit)
bitstr="$(gettext "(64-bit)")"
if ! [ -f "$GRUB_ROOT"/mach_kernel ] || ! "${grub_file}" --is-x86_64-xnu "$GRUB_ROOT"/mach_kernel; then
return;
fi
fi
# TRANSLATORS: it refers on the OS residing on device %s
onstr="$(gettext_printf "(on %s)" "${GRUB_DEVICE}")"
cat << EOF
menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'xnu-$2-$(grub_get_device_id "${GRUB_DEVICE}")' {
menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${GRUB_DEVICE}")' {
EOF
save_default_entry | grub_add_tab
prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab
@@ -60,7 +50,7 @@ EOF
fi
fi
if [ \$do_resume = 0 ]; then
xnu_uuid ${GRUB_DEVICE_UUID} uuid
xnu_uuid ${OSXUUID} uuid
if [ -f /Extra/DSDT.aml ]; then
acpi -e /Extra/DSDT.aml
fi
@@ -100,5 +90,6 @@ EOF
EOF
}
OSXUUID="`${grub_probe} --target=fs_uuid --device ${GRUB_DEVICE} 2> /dev/null`"
osx_entry xnu_kernel 32
osx_entry xnu_kernel64 64
+17 -11
View File
@@ -26,10 +26,6 @@ datarootdir="@datarootdir@"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
if [ x$GRUB_PLATFORM != xx86 ]; then
exit 0
fi
CLASS="--class gnu-linux --class gnu --class os --class xen"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
@@ -65,14 +61,14 @@ fi
case x"$GRUB_FS" in
xbtrfs)
rootsubvol="`make_system_path_relative_to_its_root "$GRUB_ROOT"/`"
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root "$GRUB_ROOT"/ | sed -e "s,@$,,"`"
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
;;
esac
@@ -141,9 +137,19 @@ EOF
EOF
}
linux_list=`for i in "$GRUB_ROOT"/boot/vmlinu[xz]-* "$GRUB_ROOT"/vmlinu[xz]-* "$GRUB_ROOT"/boot/kernel-*; do
if grub_file_is_not_garbage "$i" && "${grub_file}" --is-x86-xen-dom0 "$i"; then
echo -n "$i " ;
linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
if grub_file_is_not_garbage "$i"; then
basename=$(basename $i)
version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
dirname=$(dirname $i)
config=
for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
if test -e "${j}" ; then
config="${j}"
break
fi
done
if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then echo -n "$i " ; fi
fi
done`
if [ "x${linux_list}" = "x" ] ; then
@@ -159,8 +165,8 @@ file_is_not_sym () {
esac
}
xen_list=`for i in "$GRUB_ROOT"/boot/xen*; do
if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" && ${grub_file} --is-x86-multiboot "$i"; then echo -n "$i " ; fi
xen_list=`for i in /boot/xen*; do
if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
boot_device_id=