mirror of
https://git.proxmox.com/git/grub2
synced 2025-07-27 09:19:51 +00:00
Merge branch 'upstream' into experimental
This commit is contained in:
commit
8b25ef4a30
251
ChangeLog
251
ChangeLog
@ -1,3 +1,254 @@
|
|||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/ia64/efi/init.c (grub_arch_sync_caches): Move to ...
|
||||||
|
* grub-core/kern/ia64/cache.c (grub_arch_sync_caches): ... here.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/emu/main.c: Silence missing prototypes to allow emu
|
||||||
|
compilation with GCC <= 4.2.
|
||||||
|
* grub-core/kern/emu/argp_common.c: Likewise.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/kernel.h [__sparc__]: Restrict sparc64-ieee1275 to
|
||||||
|
right platform rather than leaking to sparc64-emu.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/osdep/windows/emuconsole.c: Remove unsigned comparison >= 0.
|
||||||
|
But ensure that the variables in question are indeed unsigned.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/emu/lite.c: Add missing include of ../ia64/dl_helper.c.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Remove grub_memalign on emu.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/ia64/efi/init.c: Fix alignment code so it doesn't
|
||||||
|
truncate incomplete lines but instead flushes them.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Move OS-dependent mprotect for module loading to grub-core/osdep/*/dl.c
|
||||||
|
and implement windows variant.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Fix mips-emu compilation.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Check for freetype library usability.
|
||||||
|
|
||||||
|
2013-12-08 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Make arm-emu work.
|
||||||
|
|
||||||
|
2013-12-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-mkfont.c: Replace stpcpy with grub_stpcpy.
|
||||||
|
|
||||||
|
2013-12-07 Andrey Borzenkov <arvidjaar@gmail.com>
|
||||||
|
|
||||||
|
* docs/grub.texi (Environment): Update color_normal and color_highlight
|
||||||
|
defaults (light-gray instead of white).
|
||||||
|
|
||||||
|
2013-12-07 Andrey Borzenkov <arvidjaar@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/normal/main.c (INIT): Set default color to light-gray
|
||||||
|
to match GRUB_TERM_DEFAULT_NORMAL_COLOR (i.e. rescue mode), Linux
|
||||||
|
and apparently BIOS defaults.
|
||||||
|
|
||||||
|
2013-12-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Transform -C option to grub-mkstandalone to --core-compress available
|
||||||
|
in all grub-install flavours.
|
||||||
|
|
||||||
|
2013-12-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Merge GRUBFS and GRUB_FS variables.
|
||||||
|
|
||||||
|
2013-12-07 Andrey Borzenkov <arvidjaar@gmail.com>
|
||||||
|
|
||||||
|
Revert commit 69ca97c820, it caused failures when using OS device name
|
||||||
|
in grub-install. Instead just strip off parenthesis in grub-install
|
||||||
|
if (hdX) was passed.
|
||||||
|
|
||||||
|
2013-12-07 Andrey Borzenkov <arvidjaar@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-install.c (push_partmap_module): Add helper to convert
|
||||||
|
partmap names to module names and use it in probe_mods(). Fixes
|
||||||
|
failure to find partmap modules in diskfilter case.
|
||||||
|
|
||||||
|
2013-12-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Make unifont mandatory on coreboot.
|
||||||
|
|
||||||
|
2013-12-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Skip unifont 6.3 pcf and bdf.
|
||||||
|
|
||||||
|
2013-12-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* Makefile.am: Remove partial font files if generation failed.
|
||||||
|
|
||||||
|
2013-12-07 Andrey Borzenkov <arvidjaar@gmail.com>
|
||||||
|
|
||||||
|
* util/misc.c (grub_qsort_strcmp): Add qsort helper function to sort
|
||||||
|
strings.
|
||||||
|
* include/grub/util/misc.h: Define it ...
|
||||||
|
* util/grub-install.c (device_map_check_duplicates): ... and use it.
|
||||||
|
|
||||||
|
2013-12-07 Andrey Borzenkov <arvidjaar@gmail.com>
|
||||||
|
|
||||||
|
* util/grub.d/30_os-prober.in: Fix use of grub-probe instead of
|
||||||
|
${grub_probe}.
|
||||||
|
|
||||||
|
2013-12-06 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Don't add -mlong-calls when compiling with clang.
|
||||||
|
|
||||||
|
2013-12-06 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Fix a typo.
|
||||||
|
|
||||||
|
2013-12-06 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Revamp relocation handling.
|
||||||
|
|
||||||
|
Move more code to common dl.c. Add missing veneers for arm and arm64.
|
||||||
|
Decreases kernel size by 70 bytes on i386-pc (40-50 compressed)
|
||||||
|
|
||||||
|
2013-12-05 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-mkimagexx.c: Fix reloc section generation for ia64.
|
||||||
|
|
||||||
|
2013-12-05 Mike Gilbert <floppym@gentoo.org>
|
||||||
|
|
||||||
|
* INSTALL: Raise minimum python version to 2.6.
|
||||||
|
* gentpl.py: Use python3-style print function.
|
||||||
|
|
||||||
|
2013-12-05 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-install.c: Mention Boot* variable.
|
||||||
|
|
||||||
|
2013-12-05 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* grub-core/osdep/linux/hostdisk.c
|
||||||
|
(grub_util_find_partition_start_os): Initialise start to avoid
|
||||||
|
spurious compiler warning.
|
||||||
|
|
||||||
|
2013-12-05 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
On Linux, read partition start offsets from sysfs if possible, to
|
||||||
|
cope with block device drivers that don't implement HDIO_GETGEO.
|
||||||
|
Fixes Ubuntu bug #1237519.
|
||||||
|
|
||||||
|
* grub-core/osdep/linux/hostdisk.c (sysfs_partition_path): New
|
||||||
|
function.
|
||||||
|
(sysfs_partition_start): Likewise.
|
||||||
|
(grub_util_find_partition_start_os): Try sysfs_partition_start
|
||||||
|
before HDIO_GETGEO.
|
||||||
|
|
||||||
|
2013-12-05 Leif Lindholm <leif.lindholm@linaro.org>
|
||||||
|
|
||||||
|
* grub-core/kern/fdt.c: Update struct size when adding node.
|
||||||
|
|
||||||
|
2013-12-05 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Handle unaligned .bss on sparc64.
|
||||||
|
|
||||||
|
Current code improperly assumes that both __bss_start and _end are
|
||||||
|
aligned to 8-bytes. Eliminating this assumption and explicitly align
|
||||||
|
modules.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/boot/sparc64/ieee1275/boot.S [CDBOOT]: Move scratchpad
|
||||||
|
so it doesn't land in the middle of loaded image.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Move all warning options that may be absent in
|
||||||
|
gcc >= 3.1 to optional.
|
||||||
|
|
||||||
|
Note: while this allows to compile with older GCC, official requirements
|
||||||
|
remain the same and no support for older GCC.
|
||||||
|
|
||||||
|
2013-12-04 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
Copying the themes directory in grub-shell isn't
|
||||||
|
parallel-test-friendly and breaks on the second test when the source
|
||||||
|
directory is read-only (as in "make distcheck"). Instead, add a
|
||||||
|
hidden --themes-directory option to grub-mkrescue et al, and use it
|
||||||
|
in grub-shell.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* conf/Makefile.common (CFLAGS_GNULIB): Remove -Wno-old-style-definition
|
||||||
|
as it's no longer necessarry.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Allow compilation with older GCC for ARM.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Add -no-integrated-as if {addme|ame} isn't supported.
|
||||||
|
* INSTALL: Note that GRUBwas successfully compiled with clang 3.2 for
|
||||||
|
ppc.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/emu/main.c: Ignore missing prototype for main.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Pass font config to config.h and not by TARGET_CFLAGS as adding
|
||||||
|
arguments doesn't work if TARGET_CFLAGS is specified on command
|
||||||
|
line.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac: Add -Wvla if compiler supports it.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/osdep/windows/emuconsole.c (grub_console_putchar):
|
||||||
|
Remove variable length arrays.
|
||||||
|
* grub-core/term/efi/console.c (grub_console_putchar): Likewise.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/i386/qemu/init.c: Remove variable length arrays.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/types.h: Declare all byteswaps as inline functions
|
||||||
|
except compile-time ones.
|
||||||
|
|
||||||
|
Solves variable shadowing in constructions like
|
||||||
|
cpu_to_le (le_to_cpu(x) + 1).
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/efi/efi.c: Remove variable length arrays.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71
|
||||||
|
minutes.
|
||||||
|
|
||||||
|
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/disk/ieee1275/ofdisk.c: Remove variable length arrays.
|
||||||
|
* grub-core/net/drivers/ieee1275/ofnet.c: Likewise.
|
||||||
|
|
||||||
2013-12-03 Colin Watson <cjwatson@ubuntu.com>
|
2013-12-03 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
* grub-core/Makefile.core.def (setjmp): Distribute
|
* grub-core/Makefile.core.def (setjmp): Distribute
|
||||||
|
6
INSTALL
6
INSTALL
@ -23,8 +23,8 @@ configuring the GRUB.
|
|||||||
Note: clang 3.3 or later works for mips(el)
|
Note: clang 3.3 or later works for mips(el)
|
||||||
earlier versions fail to generate .reginfo and hence gprel relocations
|
earlier versions fail to generate .reginfo and hence gprel relocations
|
||||||
fail.
|
fail.
|
||||||
Note: clang 3.4 or later works for powerpc
|
Note: clang 3.2 or later works for powerpc
|
||||||
earlier versions suffer from vacopy bug (#15286)
|
earlier versions not tested
|
||||||
Note: clang has no support for generating 64-bit sparc code and hence you
|
Note: clang has no support for generating 64-bit sparc code and hence you
|
||||||
can't compile GRUB for sparc64 with clang
|
can't compile GRUB for sparc64 with clang
|
||||||
Note: clang has no support for ia64 and hence you can't compile GRUB
|
Note: clang has no support for ia64 and hence you can't compile GRUB
|
||||||
@ -54,7 +54,7 @@ To build GRUB's graphical terminal (gfxterm), you need:
|
|||||||
If you use a development snapshot or want to hack on GRUB you may
|
If you use a development snapshot or want to hack on GRUB you may
|
||||||
need the following.
|
need the following.
|
||||||
|
|
||||||
* Python 2.5.2 or later
|
* Python 2.6 or later
|
||||||
* Autoconf 2.60 or later
|
* Autoconf 2.60 or later
|
||||||
* Automake 1.10.1 or later
|
* Automake 1.10.1 or later
|
||||||
|
|
||||||
|
10
Makefile.am
10
Makefile.am
@ -103,7 +103,7 @@ EXTRA_DIST += $(starfield_theme_files)
|
|||||||
EXTRA_DIST += $(srcdir)/themes/starfield/src/slider_s.xcf $(srcdir)/themes/starfield/src/slider_n.xcf $(srcdir)/themes/starfield/src/slider_c.xcf $(srcdir)/themes/starfield/src/blob_nw.xcf $(srcdir)/themes/starfield/src/bootmenu/center.xcf $(srcdir)/themes/starfield/src/bootmenu/corner.xcf $(srcdir)/themes/starfield/src/bootmenu/side.xcf $(srcdir)/themes/starfield/src/terminalbox/side.xcf $(srcdir)/themes/starfield/src/terminalbox/corner.xcf $(srcdir)/themes/starfield/src/terminalbox/center.xcf
|
EXTRA_DIST += $(srcdir)/themes/starfield/src/slider_s.xcf $(srcdir)/themes/starfield/src/slider_n.xcf $(srcdir)/themes/starfield/src/slider_c.xcf $(srcdir)/themes/starfield/src/blob_nw.xcf $(srcdir)/themes/starfield/src/bootmenu/center.xcf $(srcdir)/themes/starfield/src/bootmenu/corner.xcf $(srcdir)/themes/starfield/src/bootmenu/side.xcf $(srcdir)/themes/starfield/src/terminalbox/side.xcf $(srcdir)/themes/starfield/src/terminalbox/corner.xcf $(srcdir)/themes/starfield/src/terminalbox/center.xcf
|
||||||
|
|
||||||
unicode.pf2: $(FONT_SOURCE) build-grub-mkfont
|
unicode.pf2: $(FONT_SOURCE) build-grub-mkfont
|
||||||
./build-grub-mkfont -o $@ $(FONT_SOURCE)
|
./build-grub-mkfont -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1)
|
||||||
CLEANFILES += unicode.pf2
|
CLEANFILES += unicode.pf2
|
||||||
|
|
||||||
# Arrows and lines are needed to draw the menu, so always include them
|
# Arrows and lines are needed to draw the menu, so always include them
|
||||||
@ -111,19 +111,19 @@ UNICODE_ARROWS=0x2190-0x2193
|
|||||||
UNICODE_LINES=0x2501-0x251B
|
UNICODE_LINES=0x2501-0x251B
|
||||||
|
|
||||||
ascii.pf2: $(FONT_SOURCE) build-grub-mkfont
|
ascii.pf2: $(FONT_SOURCE) build-grub-mkfont
|
||||||
./build-grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
|
./build-grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
||||||
CLEANFILES += ascii.pf2
|
CLEANFILES += ascii.pf2
|
||||||
|
|
||||||
euro.pf2: $(FONT_SOURCE) build-grub-mkfont
|
euro.pf2: $(FONT_SOURCE) build-grub-mkfont
|
||||||
./build-grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES)
|
./build-grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
||||||
CLEANFILES += euro.pf2
|
CLEANFILES += euro.pf2
|
||||||
|
|
||||||
ascii.h: $(FONT_SOURCE) build-grub-gen-asciih
|
ascii.h: $(FONT_SOURCE) build-grub-gen-asciih
|
||||||
./build-grub-gen-asciih $(FONT_SOURCE) $@
|
./build-grub-gen-asciih $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
||||||
CLEANFILES += ascii.h
|
CLEANFILES += ascii.h
|
||||||
|
|
||||||
widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec
|
widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec
|
||||||
./build-grub-gen-widthspec $(FONT_SOURCE) $@
|
./build-grub-gen-widthspec $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
||||||
CLEANFILES += widthspec.h
|
CLEANFILES += widthspec.h
|
||||||
|
|
||||||
# Install config.h into platformdir
|
# Install config.h into platformdir
|
||||||
|
@ -11,10 +11,12 @@ if COND_sparc64_ieee1275
|
|||||||
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
|
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
|
||||||
endif
|
endif
|
||||||
if COND_arm
|
if COND_arm
|
||||||
CFLAGS_PLATFORM += -mthumb-interwork -mlong-calls
|
CFLAGS_PLATFORM += -mthumb-interwork
|
||||||
CCASFLAGS_PLATFORM = -mthumb-interwork
|
CCASFLAGS_PLATFORM = -mthumb-interwork
|
||||||
|
if !COND_emu
|
||||||
LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
|
LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
if COND_arm64
|
if COND_arm64
|
||||||
CFLAGS_PLATFORM += -mcmodel=large
|
CFLAGS_PLATFORM += -mcmodel=large
|
||||||
endif
|
endif
|
||||||
@ -73,7 +75,7 @@ grubconfdir = $(sysconfdir)/grub.d
|
|||||||
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
|
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
|
||||||
starfielddir = $(pkgdatadir)/themes/starfield
|
starfielddir = $(pkgdatadir)/themes/starfield
|
||||||
|
|
||||||
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition
|
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion
|
||||||
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
|
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
|
||||||
|
|
||||||
CFLAGS_POSIX = -fno-builtin
|
CFLAGS_POSIX = -fno-builtin
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#elif defined (GRUB_UTIL) || !defined (GRUB_MACHINE)
|
#elif defined (GRUB_UTIL) || !defined (GRUB_MACHINE)
|
||||||
#include <config-util.h>
|
#include <config-util.h>
|
||||||
#else
|
#else
|
||||||
|
#define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@
|
||||||
/* Define if C symbols get an underscore after compilation. */
|
/* Define if C symbols get an underscore after compilation. */
|
||||||
#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
|
#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
|
||||||
/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */
|
/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */
|
||||||
|
116
configure.ac
116
configure.ac
@ -422,6 +422,26 @@ esac
|
|||||||
# For gnulib.
|
# For gnulib.
|
||||||
gl_INIT
|
gl_INIT
|
||||||
|
|
||||||
|
WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes"
|
||||||
|
EXTRA_WARN_FLAGS="-Wold-style-definition -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign"
|
||||||
|
|
||||||
|
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([which extra warnings work], [grub_cv_cc_w_extra_flags], [
|
||||||
|
SAVED_CFLAGS="$CFLAGS"
|
||||||
|
grub_cv_cc_w_extra_flags=
|
||||||
|
for x in $EXTRA_WARN_FLAGS; do
|
||||||
|
CFLAGS="$HOST_CFLAGS $x -Werror"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
|
||||||
|
if test x$flag = x1 ; then
|
||||||
|
grub_cv_cc_w_extra_flags="$grub_cv_cc_w_extra_flags $x"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
CFLAGS="$SAVED_CFLAGS"
|
||||||
|
])
|
||||||
|
|
||||||
|
HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for target programs.
|
# Check for target programs.
|
||||||
#
|
#
|
||||||
@ -472,8 +492,6 @@ LDFLAGS="$TARGET_LDFLAGS"
|
|||||||
LIBS=""
|
LIBS=""
|
||||||
|
|
||||||
# debug flags.
|
# debug flags.
|
||||||
WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Wattributes -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
|
|
||||||
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
|
TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
|
||||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
|
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
|
||||||
|
|
||||||
@ -481,8 +499,25 @@ if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
|
|||||||
TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
|
TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
|
||||||
|
LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
|
||||||
|
|
||||||
|
grub_cv_target_cc_w_extra_flags=
|
||||||
|
for x in $EXTRA_WARN_FLAGS; do
|
||||||
|
CFLAGS="$TARGET_CFLAGS $x -Werror"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
|
||||||
|
if test x$flag = x1 ; then
|
||||||
|
grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
])
|
||||||
|
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags"
|
||||||
|
|
||||||
AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
|
AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
|
||||||
[AC_COMPILE_IFELSE(
|
[
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
[AC_LANG_PROGRAM([], [[
|
[AC_LANG_PROGRAM([], [[
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#error "is clang"
|
#error "is clang"
|
||||||
@ -500,6 +535,26 @@ if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
|
|||||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
|
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]
|
||||||
|
[
|
||||||
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([], [[
|
||||||
|
unsigned int a = 0, b = 0;
|
||||||
|
asm volatile ("{ame|addme} %0,%1" : "=r" (a) : "r" (b));
|
||||||
|
if (a)
|
||||||
|
return 1;
|
||||||
|
]])],
|
||||||
|
[grub_cv_cc_target_clang_ame=yes], [grub_cv_cc_target_clang_ame=no])])
|
||||||
|
# clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly
|
||||||
|
# used by gcrypt
|
||||||
|
if test x$grub_cv_cc_target_clang_ame = xno ; then
|
||||||
|
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -no-integrated-as"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
|
if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
|
TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
|
||||||
fi
|
fi
|
||||||
@ -793,6 +848,18 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then
|
|||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
|
TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "x$target_cpu" = xarm; then
|
||||||
|
AC_CACHE_CHECK([whether option -mlong-calls works], grub_cv_cc_mlong_calls, [
|
||||||
|
CFLAGS="$TARGET_CFLAGS -mlong-calls -Werror"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_mlong_calls=yes],
|
||||||
|
[grub_cv_cc_mlong_calls=no])
|
||||||
|
])
|
||||||
|
if test "x$grub_cv_cc_mlong_calls" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -mlong-calls"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Compiler features.
|
# Compiler features.
|
||||||
#
|
#
|
||||||
@ -848,7 +915,7 @@ CFLAGS="$TARGET_CFLAGS"
|
|||||||
# -mno-unaligned-access -mstrict-align
|
# -mno-unaligned-access -mstrict-align
|
||||||
if test "$target_cpu" = arm; then
|
if test "$target_cpu" = arm; then
|
||||||
AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [
|
AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [
|
||||||
grub_cv_target_cc_strict_align=unknown
|
grub_cv_target_cc_strict_align=
|
||||||
for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do
|
for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do
|
||||||
CFLAGS="$TARGET_CFLAGS $arg -Werror"
|
CFLAGS="$TARGET_CFLAGS $arg -Werror"
|
||||||
LDFLAGS="$TARGET_LDFLAGS"
|
LDFLAGS="$TARGET_LDFLAGS"
|
||||||
@ -859,13 +926,21 @@ if test "$target_cpu" = arm; then
|
|||||||
fi
|
fi
|
||||||
done])
|
done])
|
||||||
|
|
||||||
if test x"$grub_cv_target_cc_strict_align" = xunknown; then
|
|
||||||
AC_MSG_ERROR([couldnt instruct compiler not to use unaligned access])
|
|
||||||
fi
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align"
|
TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align"
|
||||||
if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then
|
if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments"
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments"
|
||||||
fi
|
fi
|
||||||
|
AC_CACHE_CHECK([if compiler generates unaligned accesses], [grub_cv_cc_target_emits_unaligned],
|
||||||
|
[CFLAGS="$TARGET_CFLAGS"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
|
||||||
|
#ifdef __ARM_FEATURE_UNALIGNED
|
||||||
|
#error "unaligned"
|
||||||
|
#endif
|
||||||
|
]])],
|
||||||
|
[grub_cv_cc_target_emits_unaligned=no], [grub_cv_cc_target_emits_unaligned=yes])])
|
||||||
|
if test x$grub_cv_cc_target_emits_unaligned = xyes; then
|
||||||
|
AC_MSG_ERROR([compiler generates unaligned accesses])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set them to their new values for the tests below.
|
# Set them to their new values for the tests below.
|
||||||
@ -1126,10 +1201,14 @@ if test x"$grub_mkfont_excuse" = x ; then
|
|||||||
freetype_cflags=`$FREETYPE --cflags`
|
freetype_cflags=`$FREETYPE --cflags`
|
||||||
freetype_libs=`$FREETYPE --libs`
|
freetype_libs=`$FREETYPE --libs`
|
||||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||||
|
SAVED_LIBS="$LIBS"
|
||||||
CPPFLAGS="$CPPFLAGS $freetype_cflags"
|
CPPFLAGS="$CPPFLAGS $freetype_cflags"
|
||||||
|
LIBS="$LIBS $freetype_libs"
|
||||||
AC_CHECK_HEADERS([ft2build.h], [],
|
AC_CHECK_HEADERS([ft2build.h], [],
|
||||||
[grub_mkfont_excuse=["need freetype2 headers"]])
|
[grub_mkfont_excuse=["need freetype2 headers"]])
|
||||||
|
AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
|
||||||
CPPFLAGS="$SAVED_CPPFLAGS"
|
CPPFLAGS="$SAVED_CPPFLAGS"
|
||||||
|
LIBS="$SAVED_LIBS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
|
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
|
||||||
@ -1181,9 +1260,13 @@ if test x"$grub_build_mkfont_excuse" = x ; then
|
|||||||
build_freetype_cflags=`$BUILD_FREETYPE --cflags`
|
build_freetype_cflags=`$BUILD_FREETYPE --cflags`
|
||||||
build_freetype_libs=`$BUILD_FREETYPE --libs`
|
build_freetype_libs=`$BUILD_FREETYPE --libs`
|
||||||
SAVED_CPPFLAGS_2="$CPPFLAGS"
|
SAVED_CPPFLAGS_2="$CPPFLAGS"
|
||||||
|
SAVED_LIBS="$LIBS"
|
||||||
CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
|
CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
|
||||||
|
LIBS="$LIBS $build_freetype_libs"
|
||||||
AC_CHECK_HEADERS([ft2build.h], [],
|
AC_CHECK_HEADERS([ft2build.h], [],
|
||||||
[grub_build_mkfont_excuse=["need freetype2 headers"]])
|
[grub_build_mkfont_excuse=["need freetype2 headers"]])
|
||||||
|
AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
|
||||||
|
LIBS="$SAVED_LIBS"
|
||||||
CPPFLAGS="$SAVED_CPPFLAGS_2"
|
CPPFLAGS="$SAVED_CPPFLAGS_2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1195,8 +1278,8 @@ if test x"$grub_build_mkfont_excuse" = x ; then
|
|||||||
else
|
else
|
||||||
enable_build_grub_mkfont=no
|
enable_build_grub_mkfont=no
|
||||||
fi
|
fi
|
||||||
if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 ); then
|
if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xcoreboot ); then
|
||||||
AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports needs build-time grub-mkfont])
|
AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_SUBST([build_freetype_cflags])
|
AC_SUBST([build_freetype_cflags])
|
||||||
@ -1249,6 +1332,11 @@ FONT_SOURCE=
|
|||||||
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
||||||
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni /usr/share/fonts/truetype/unifont /usr/share/fonts/misc; do
|
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni /usr/share/fonts/truetype/unifont /usr/share/fonts/misc; do
|
||||||
if test -f "$dir/unifont.$ext"; then
|
if test -f "$dir/unifont.$ext"; then
|
||||||
|
md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')"
|
||||||
|
# PCF and BDF from version 6.3 isn't hanled properly by libfreetype.
|
||||||
|
if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then
|
||||||
|
continue;
|
||||||
|
fi
|
||||||
FONT_SOURCE="$dir/unifont.$ext"
|
FONT_SOURCE="$dir/unifont.$ext"
|
||||||
break 2
|
break 2
|
||||||
fi
|
fi
|
||||||
@ -1259,8 +1347,8 @@ if test x"$enable_build_grub_mkfont" = xno ; then
|
|||||||
FONT_SOURCE=
|
FONT_SOURCE=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 ); then
|
if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xcoreboot ); then
|
||||||
AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports need unifont])
|
AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_SUBST([FONT_SOURCE])
|
AC_SUBST([FONT_SOURCE])
|
||||||
@ -1577,6 +1665,12 @@ AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
|||||||
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
||||||
AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
|
AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
|
||||||
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
||||||
|
if test x$FONT_SOURCE != x ; then
|
||||||
|
HAVE_FONT_SOURCE=1
|
||||||
|
else
|
||||||
|
HAVE_FONT_SOURCE=0
|
||||||
|
fi
|
||||||
|
AC_SUBST(HAVE_FONT_SOURCE)
|
||||||
AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
|
AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
|
||||||
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
|
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
|
||||||
AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
|
AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
|
||||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
|||||||
grub2 (2.00+20131203-1) UNRELEASED; urgency=low
|
grub2 (2.00+20131208-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* New upstream snapshot.
|
* New upstream snapshot.
|
||||||
- Skip issuing cursor on/off sequences on Macs (closes: #683068).
|
- Skip issuing cursor on/off sequences on Macs (closes: #683068).
|
||||||
|
4
debian/patches/core_in_fs.patch
vendored
4
debian/patches/core_in_fs.patch
vendored
@ -11,7 +11,7 @@ Index: b/util/setup.c
|
|||||||
/* On SPARC this program fills in various fields inside of the 'boot' and 'core'
|
/* On SPARC this program fills in various fields inside of the 'boot' and 'core'
|
||||||
* image files.
|
* image files.
|
||||||
*
|
*
|
||||||
@@ -601,6 +603,8 @@
|
@@ -577,6 +579,8 @@
|
||||||
|
|
||||||
grub_free (sectors);
|
grub_free (sectors);
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ Index: b/util/setup.c
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,6 +647,10 @@
|
@@ -619,6 +623,10 @@
|
||||||
/* The core image must be put on a filesystem unfortunately. */
|
/* The core image must be put on a filesystem unfortunately. */
|
||||||
grub_util_info ("will leave the core image on the filesystem");
|
grub_util_info ("will leave the core image on the filesystem");
|
||||||
|
|
||||||
|
4
debian/patches/default_grub_d.patch
vendored
4
debian/patches/default_grub_d.patch
vendored
@ -2,7 +2,7 @@ Description: Read /etc/default/grub.d/*.cfg after /etc/default/grub
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/901600
|
Bug-Ubuntu: https://bugs.launchpad.net/bugs/901600
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-11-19
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/grub-core/osdep/unix/config.c
|
Index: b/grub-core/osdep/unix/config.c
|
||||||
===================================================================
|
===================================================================
|
||||||
@ -92,7 +92,7 @@ Index: b/util/grub-mkconfig.in
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub-mkconfig.in
|
--- a/util/grub-mkconfig.in
|
||||||
+++ b/util/grub-mkconfig.in
|
+++ b/util/grub-mkconfig.in
|
||||||
@@ -149,6 +149,11 @@
|
@@ -153,6 +153,11 @@
|
||||||
if test -f ${sysconfdir}/default/grub ; then
|
if test -f ${sysconfdir}/default/grub ; then
|
||||||
. ${sysconfdir}/default/grub
|
. ${sysconfdir}/default/grub
|
||||||
fi
|
fi
|
||||||
|
10
debian/patches/gfxpayload_dynamic.patch
vendored
10
debian/patches/gfxpayload_dynamic.patch
vendored
@ -5,13 +5,13 @@ Description: Add configure option to enable gfxpayload=keep dynamically
|
|||||||
Author: Evan Broder <evan@ebroder.net>
|
Author: Evan Broder <evan@ebroder.net>
|
||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/configure.ac
|
Index: b/configure.ac
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -1446,6 +1446,17 @@
|
@@ -1534,6 +1534,17 @@
|
||||||
fi
|
fi
|
||||||
AC_SUBST([QUICK_BOOT])
|
AC_SUBST([QUICK_BOOT])
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ Index: b/grub-core/Makefile.core.def
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/grub-core/Makefile.core.def
|
--- a/grub-core/Makefile.core.def
|
||||||
+++ b/grub-core/Makefile.core.def
|
+++ b/grub-core/Makefile.core.def
|
||||||
@@ -894,6 +894,15 @@
|
@@ -897,6 +897,15 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
@ -212,7 +212,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
|
|
||||||
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
||||||
|
|
||||||
@@ -139,9 +140,10 @@
|
@@ -133,9 +134,10 @@
|
||||||
if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
|
if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
|
||||||
echo " load_video" | sed "s/^/$submenu_indentation/"
|
echo " load_video" | sed "s/^/$submenu_indentation/"
|
||||||
fi
|
fi
|
||||||
@ -226,7 +226,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
||||||
@@ -214,6 +216,35 @@
|
@@ -208,6 +210,35 @@
|
||||||
boot_device_id=
|
boot_device_id=
|
||||||
title_correction_code=
|
title_correction_code=
|
||||||
|
|
||||||
|
4
debian/patches/gfxpayload_keep_default.patch
vendored
4
debian/patches/gfxpayload_keep_default.patch
vendored
@ -11,13 +11,13 @@ Description: Disable gfxpayload=keep by default
|
|||||||
Author: Colin Watson <cjwatson@debian.org>
|
Author: Colin Watson <cjwatson@debian.org>
|
||||||
Bug-Debian: http://bugs.debian.org/567245
|
Bug-Debian: http://bugs.debian.org/567245
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2010-03-09
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/util/grub.d/10_linux.in
|
Index: b/util/grub.d/10_linux.in
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub.d/10_linux.in
|
--- a/util/grub.d/10_linux.in
|
||||||
+++ b/util/grub.d/10_linux.in
|
+++ b/util/grub.d/10_linux.in
|
||||||
@@ -108,10 +108,6 @@
|
@@ -102,10 +102,6 @@
|
||||||
# FIXME: We need an interface to select vesafb in case efifb can't be used.
|
# FIXME: We need an interface to select vesafb in case efifb can't be used.
|
||||||
if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
|
if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
|
||||||
echo " load_video" | sed "s/^/$submenu_indentation/"
|
echo " load_video" | sed "s/^/$submenu_indentation/"
|
||||||
|
2
debian/patches/grub.cfg_400.patch
vendored
2
debian/patches/grub.cfg_400.patch
vendored
@ -2,7 +2,7 @@ Index: b/util/grub-mkconfig.in
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub-mkconfig.in
|
--- a/util/grub-mkconfig.in
|
||||||
+++ b/util/grub-mkconfig.in
|
+++ b/util/grub-mkconfig.in
|
||||||
@@ -256,6 +256,10 @@
|
@@ -260,6 +260,10 @@
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ Description: Cope with Kubuntu setting GRUB_DISTRIBUTOR
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1242417
|
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1242417
|
||||||
Forwarded: not-needed
|
Forwarded: not-needed
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/util/grub-install.c
|
Index: b/util/grub-install.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub-install.c
|
--- a/util/grub-install.c
|
||||||
+++ b/util/grub-install.c
|
+++ b/util/grub-install.c
|
||||||
@@ -945,6 +945,8 @@
|
@@ -950,6 +950,8 @@
|
||||||
*/
|
*/
|
||||||
char *t;
|
char *t;
|
||||||
efi_distributor = bootloader_id;
|
efi_distributor = bootloader_id;
|
||||||
|
14
debian/patches/install_locale_langpack.patch
vendored
14
debian/patches/install_locale_langpack.patch
vendored
@ -2,13 +2,13 @@ Description: Prefer translations from Ubuntu language packs if available
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/537998
|
Bug-Ubuntu: https://bugs.launchpad.net/bugs/537998
|
||||||
Forwarded: not-needed
|
Forwarded: not-needed
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/util/grub-install-common.c
|
Index: b/util/grub-install-common.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub-install-common.c
|
--- a/util/grub-install-common.c
|
||||||
+++ b/util/grub-install-common.c
|
+++ b/util/grub-install-common.c
|
||||||
@@ -567,17 +567,24 @@
|
@@ -590,17 +590,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -36,7 +36,7 @@ Index: b/util/grub-install-common.c
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,14 +601,14 @@
|
@@ -617,14 +624,14 @@
|
||||||
if (ext && (grub_strcmp (ext, ".mo") == 0
|
if (ext && (grub_strcmp (ext, ".mo") == 0
|
||||||
|| grub_strcmp (ext, ".gmo") == 0))
|
|| grub_strcmp (ext, ".gmo") == 0))
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ Index: b/util/grub-install-common.c
|
|||||||
"LC_MESSAGES", PACKAGE, ".mo");
|
"LC_MESSAGES", PACKAGE, ".mo");
|
||||||
dstf = grub_util_path_concat_ext (2, dstd, de->d_name, ".mo");
|
dstf = grub_util_path_concat_ext (2, dstd, de->d_name, ".mo");
|
||||||
}
|
}
|
||||||
@@ -610,6 +617,7 @@
|
@@ -633,6 +640,7 @@
|
||||||
free (dstf);
|
free (dstf);
|
||||||
}
|
}
|
||||||
grub_util_fd_closedir (d);
|
grub_util_fd_closedir (d);
|
||||||
@ -61,7 +61,7 @@ Index: b/util/grub-install-common.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
@@ -732,12 +740,14 @@
|
@@ -756,12 +764,14 @@
|
||||||
{
|
{
|
||||||
char *srcd = grub_util_path_concat (2, src, "po");
|
char *srcd = grub_util_path_concat (2, src, "po");
|
||||||
copy_by_ext (srcd, dst_locale, ".mo", 0);
|
copy_by_ext (srcd, dst_locale, ".mo", 0);
|
||||||
@ -77,7 +77,7 @@ Index: b/util/grub-install-common.c
|
|||||||
|
|
||||||
for (i = 0; i < install_locales.n_entries; i++)
|
for (i = 0; i < install_locales.n_entries; i++)
|
||||||
{
|
{
|
||||||
@@ -756,6 +766,19 @@
|
@@ -780,6 +790,19 @@
|
||||||
}
|
}
|
||||||
free (srcf);
|
free (srcf);
|
||||||
srcf = grub_util_path_concat_ext (4,
|
srcf = grub_util_path_concat_ext (4,
|
||||||
@ -97,7 +97,7 @@ Index: b/util/grub-install-common.c
|
|||||||
locale_dir,
|
locale_dir,
|
||||||
install_locales.entries[i],
|
install_locales.entries[i],
|
||||||
"LC_MESSAGES",
|
"LC_MESSAGES",
|
||||||
@@ -770,6 +793,8 @@
|
@@ -794,6 +817,8 @@
|
||||||
grub_util_error (_("cannot find locale `%s'"),
|
grub_util_error (_("cannot find locale `%s'"),
|
||||||
install_locales.entries[i]);
|
install_locales.entries[i]);
|
||||||
}
|
}
|
||||||
|
14
debian/patches/install_signed.patch
vendored
14
debian/patches/install_signed.patch
vendored
@ -3,7 +3,7 @@ Author: Colin Watson <cjwatson@ubuntu.com>
|
|||||||
Author: Stéphane Graber <stgraber@ubuntu.com>
|
Author: Stéphane Graber <stgraber@ubuntu.com>
|
||||||
Author: Steve Langasek <steve.langasek@ubuntu.com>
|
Author: Steve Langasek <steve.langasek@ubuntu.com>
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/util/grub-install.c
|
Index: b/util/grub-install.c
|
||||||
===================================================================
|
===================================================================
|
||||||
@ -58,7 +58,7 @@ Index: b/util/grub-install.c
|
|||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -689,7 +708,8 @@
|
@@ -694,7 +713,8 @@
|
||||||
{
|
{
|
||||||
int is_efi = 0;
|
int is_efi = 0;
|
||||||
const char *efi_distributor = NULL;
|
const char *efi_distributor = NULL;
|
||||||
@ -68,7 +68,7 @@ Index: b/util/grub-install.c
|
|||||||
char **grub_devices;
|
char **grub_devices;
|
||||||
grub_fs_t grub_fs;
|
grub_fs_t grub_fs;
|
||||||
grub_device_t grub_dev = NULL;
|
grub_device_t grub_dev = NULL;
|
||||||
@@ -925,6 +945,31 @@
|
@@ -930,6 +950,31 @@
|
||||||
*/
|
*/
|
||||||
char *t;
|
char *t;
|
||||||
efi_distributor = bootloader_id;
|
efi_distributor = bootloader_id;
|
||||||
@ -100,7 +100,7 @@ Index: b/util/grub-install.c
|
|||||||
if (removable)
|
if (removable)
|
||||||
{
|
{
|
||||||
/* The specification makes stricter requirements of removable
|
/* The specification makes stricter requirements of removable
|
||||||
@@ -933,54 +978,16 @@
|
@@ -938,54 +983,16 @@
|
||||||
must have a specific file name depending on the architecture.
|
must have a specific file name depending on the architecture.
|
||||||
*/
|
*/
|
||||||
efi_distributor = "BOOT";
|
efi_distributor = "BOOT";
|
||||||
@ -159,7 +159,7 @@ Index: b/util/grub-install.c
|
|||||||
}
|
}
|
||||||
t = grub_util_path_concat (3, efidir, "EFI", efi_distributor);
|
t = grub_util_path_concat (3, efidir, "EFI", efi_distributor);
|
||||||
free (efidir);
|
free (efidir);
|
||||||
@@ -1110,6 +1117,31 @@
|
@@ -1120,6 +1127,31 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ Index: b/util/grub-install.c
|
|||||||
if (!have_abstractions)
|
if (!have_abstractions)
|
||||||
{
|
{
|
||||||
if ((disk_module && grub_strcmp (disk_module, "biosdisk") != 0)
|
if ((disk_module && grub_strcmp (disk_module, "biosdisk") != 0)
|
||||||
@@ -1117,7 +1149,8 @@
|
@@ -1127,7 +1159,8 @@
|
||||||
|| (!install_drive
|
|| (!install_drive
|
||||||
&& platform != GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275)
|
&& platform != GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275)
|
||||||
|| (install_drive && !is_same_disk (grub_drives[0], install_drive))
|
|| (install_drive && !is_same_disk (grub_drives[0], install_drive))
|
||||||
@ -201,7 +201,7 @@ Index: b/util/grub-install.c
|
|||||||
{
|
{
|
||||||
char *uuid = NULL;
|
char *uuid = NULL;
|
||||||
/* generic method (used on coreboot and ata mod). */
|
/* generic method (used on coreboot and ata mod). */
|
||||||
@@ -1549,7 +1582,47 @@
|
@@ -1557,7 +1590,47 @@
|
||||||
case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
||||||
{
|
{
|
||||||
char *dst = grub_util_path_concat (2, efidir, efi_file);
|
char *dst = grub_util_path_concat (2, efidir, efi_file);
|
||||||
|
@ -2,7 +2,7 @@ Description: If GRUB Legacy is still around, tell packaging to ignore it
|
|||||||
Author: Colin Watson <cjwatson@debian.org>
|
Author: Colin Watson <cjwatson@debian.org>
|
||||||
Bug-Debian: http://bugs.debian.org/586143
|
Bug-Debian: http://bugs.debian.org/586143
|
||||||
Forwarded: not-needed
|
Forwarded: not-needed
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/util/grub-install.c
|
Index: b/util/grub-install.c
|
||||||
===================================================================
|
===================================================================
|
||||||
@ -16,7 +16,7 @@ Index: b/util/grub-install.c
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -1442,6 +1443,19 @@
|
@@ -1450,6 +1451,19 @@
|
||||||
grub_util_bios_setup (platdir, "boot.img", "core.img",
|
grub_util_bios_setup (platdir, "boot.img", "core.img",
|
||||||
install_drive, force,
|
install_drive, force,
|
||||||
fs_probe, allow_floppy);
|
fs_probe, allow_floppy);
|
||||||
|
4
debian/patches/linuxefi.patch
vendored
4
debian/patches/linuxefi.patch
vendored
@ -2,13 +2,13 @@ Description: Add "linuxefi" loader which avoids ExitBootServices
|
|||||||
Author: Matthew Garrett <mjg@redhat.com>
|
Author: Matthew Garrett <mjg@redhat.com>
|
||||||
Origin: vendor, http://pkgs.fedoraproject.org/cgit/grub2.git/tree/grub2-linuxefi.patch
|
Origin: vendor, http://pkgs.fedoraproject.org/cgit/grub2.git/tree/grub2-linuxefi.patch
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/grub-core/Makefile.core.def
|
Index: b/grub-core/Makefile.core.def
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/grub-core/Makefile.core.def
|
--- a/grub-core/Makefile.core.def
|
||||||
+++ b/grub-core/Makefile.core.def
|
+++ b/grub-core/Makefile.core.def
|
||||||
@@ -1688,6 +1688,14 @@
|
@@ -1691,6 +1691,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
|
4
debian/patches/linuxefi_amd64_only.patch
vendored
4
debian/patches/linuxefi_amd64_only.patch
vendored
@ -1,13 +1,13 @@
|
|||||||
Description: Only build linuxefi on amd64
|
Description: Only build linuxefi on amd64
|
||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/grub-core/Makefile.core.def
|
Index: b/grub-core/Makefile.core.def
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/grub-core/Makefile.core.def
|
--- a/grub-core/Makefile.core.def
|
||||||
+++ b/grub-core/Makefile.core.def
|
+++ b/grub-core/Makefile.core.def
|
||||||
@@ -1691,7 +1691,6 @@
|
@@ -1694,7 +1694,6 @@
|
||||||
name = linuxefi;
|
name = linuxefi;
|
||||||
efi = loader/i386/efi/linux.c;
|
efi = loader/i386/efi/linux.c;
|
||||||
efi = lib/cmdline.c;
|
efi = lib/cmdline.c;
|
||||||
|
10
debian/patches/maybe_quiet.patch
vendored
10
debian/patches/maybe_quiet.patch
vendored
@ -25,7 +25,7 @@ Author: Colin Watson <cjwatson@ubuntu.com>
|
|||||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/386922
|
Bug-Ubuntu: https://bugs.launchpad.net/bugs/386922
|
||||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/861048
|
Bug-Ubuntu: https://bugs.launchpad.net/bugs/861048
|
||||||
Forwarded: (partial) http://lists.gnu.org/archive/html/grub-devel/2009-09/msg00056.html
|
Forwarded: (partial) http://lists.gnu.org/archive/html/grub-devel/2009-09/msg00056.html
|
||||||
Last-Update: 2013-12-04
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/config.h.in
|
Index: b/config.h.in
|
||||||
===================================================================
|
===================================================================
|
||||||
@ -44,7 +44,7 @@ Index: b/configure.ac
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -1424,6 +1424,17 @@
|
@@ -1512,6 +1512,17 @@
|
||||||
fi
|
fi
|
||||||
AC_SUBST([UBUNTU_RECOVERY])
|
AC_SUBST([UBUNTU_RECOVERY])
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ Index: b/configure.ac
|
|||||||
LIBS=""
|
LIBS=""
|
||||||
|
|
||||||
AC_SUBST([FONT_SOURCE])
|
AC_SUBST([FONT_SOURCE])
|
||||||
@@ -1673,5 +1684,10 @@
|
@@ -1767,5 +1778,10 @@
|
||||||
else
|
else
|
||||||
echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
|
echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
|
||||||
fi
|
fi
|
||||||
@ -331,7 +331,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
|
|
||||||
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
||||||
|
|
||||||
@@ -152,10 +153,12 @@
|
@@ -146,10 +147,12 @@
|
||||||
fi
|
fi
|
||||||
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
|
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
|
||||||
fi
|
fi
|
||||||
@ -346,7 +346,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
if test -d /sys/firmware/efi && test -e "${linux}.efi.signed"; then
|
if test -d /sys/firmware/efi && test -e "${linux}.efi.signed"; then
|
||||||
sed "s/^/$submenu_indentation/" << EOF
|
sed "s/^/$submenu_indentation/" << EOF
|
||||||
linux ${rel_dirname}/${basename}.efi.signed root=${linux_root_device_thisversion} ro ${args}
|
linux ${rel_dirname}/${basename}.efi.signed root=${linux_root_device_thisversion} ro ${args}
|
||||||
@@ -167,9 +170,13 @@
|
@@ -161,9 +164,13 @@
|
||||||
fi
|
fi
|
||||||
if test -n "${initrd}" ; then
|
if test -n "${initrd}" ; then
|
||||||
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
||||||
|
10
debian/patches/mkconfig_recovery_title.patch
vendored
10
debian/patches/mkconfig_recovery_title.patch
vendored
@ -3,7 +3,7 @@ Description: Add GRUB_RECOVERY_TITLE option
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1240360
|
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1240360
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/docs/grub.texi
|
Index: b/docs/grub.texi
|
||||||
===================================================================
|
===================================================================
|
||||||
@ -25,7 +25,7 @@ Index: b/util/grub-mkconfig.in
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub-mkconfig.in
|
--- a/util/grub-mkconfig.in
|
||||||
+++ b/util/grub-mkconfig.in
|
+++ b/util/grub-mkconfig.in
|
||||||
@@ -181,6 +181,10 @@
|
@@ -185,6 +185,10 @@
|
||||||
|
|
||||||
if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub_editenv}" - list | sed -n '/^saved_entry=/ s,^saved_entry=,,p'`" ; fi
|
if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub_editenv}" - list | sed -n '/^saved_entry=/ s,^saved_entry=,,p'`" ; fi
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ Index: b/util/grub-mkconfig.in
|
|||||||
|
|
||||||
# These are defined in this script, export them here so that user can
|
# These are defined in this script, export them here so that user can
|
||||||
# override them.
|
# override them.
|
||||||
@@ -232,7 +236,8 @@
|
@@ -236,7 +240,8 @@
|
||||||
GRUB_BADRAM \
|
GRUB_BADRAM \
|
||||||
GRUB_OS_PROBER_SKIP_LIST \
|
GRUB_OS_PROBER_SKIP_LIST \
|
||||||
GRUB_DISABLE_SUBMENU \
|
GRUB_DISABLE_SUBMENU \
|
||||||
@ -78,7 +78,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub.d/10_linux.in
|
--- a/util/grub.d/10_linux.in
|
||||||
+++ b/util/grub.d/10_linux.in
|
+++ b/util/grub.d/10_linux.in
|
||||||
@@ -120,7 +120,7 @@
|
@@ -114,7 +114,7 @@
|
||||||
if [ x$type != xsimple ] ; then
|
if [ x$type != xsimple ] ; then
|
||||||
case $type in
|
case $type in
|
||||||
recovery)
|
recovery)
|
||||||
@ -104,7 +104,7 @@ Index: b/util/grub.d/20_linux_xen.in
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub.d/20_linux_xen.in
|
--- a/util/grub.d/20_linux_xen.in
|
||||||
+++ b/util/grub.d/20_linux_xen.in
|
+++ b/util/grub.d/20_linux_xen.in
|
||||||
@@ -99,7 +99,7 @@
|
@@ -93,7 +93,7 @@
|
||||||
fi
|
fi
|
||||||
if [ x$type != xsimple ] ; then
|
if [ x$type != xsimple ] ; then
|
||||||
if [ x$type = xrecovery ] ; then
|
if [ x$type = xrecovery ] ; then
|
||||||
|
6
debian/patches/mkconfig_signed_kernel.patch
vendored
6
debian/patches/mkconfig_signed_kernel.patch
vendored
@ -1,13 +1,13 @@
|
|||||||
Description: Generate configuration for signed UEFI kernels if available
|
Description: Generate configuration for signed UEFI kernels if available
|
||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-11-14
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/util/grub.d/10_linux.in
|
Index: b/util/grub.d/10_linux.in
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub.d/10_linux.in
|
--- a/util/grub.d/10_linux.in
|
||||||
+++ b/util/grub.d/10_linux.in
|
+++ b/util/grub.d/10_linux.in
|
||||||
@@ -155,8 +155,16 @@
|
@@ -149,8 +149,16 @@
|
||||||
message="$(gettext_printf "Loading Linux %s ..." ${version})"
|
message="$(gettext_printf "Loading Linux %s ..." ${version})"
|
||||||
sed "s/^/$submenu_indentation/" << EOF
|
sed "s/^/$submenu_indentation/" << EOF
|
||||||
echo '$(echo "$message" | grub_quote)'
|
echo '$(echo "$message" | grub_quote)'
|
||||||
@ -24,7 +24,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
if test -n "${initrd}" ; then
|
if test -n "${initrd}" ; then
|
||||||
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
||||||
message="$(gettext_printf "Loading initial ramdisk ...")"
|
message="$(gettext_printf "Loading initial ramdisk ...")"
|
||||||
@@ -202,6 +210,13 @@
|
@@ -196,6 +204,13 @@
|
||||||
is_top_level=true
|
is_top_level=true
|
||||||
while [ "x$list" != "x" ] ; do
|
while [ "x$list" != "x" ] ; do
|
||||||
linux=`version_find_latest $list`
|
linux=`version_find_latest $list`
|
||||||
|
10
debian/patches/mkconfig_ubuntu_recovery.patch
vendored
10
debian/patches/mkconfig_ubuntu_recovery.patch
vendored
@ -6,13 +6,13 @@ Description: "single" -> "recovery" when friendly-recovery is installed
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Author: Stéphane Graber <stgraber@ubuntu.com>
|
Author: Stéphane Graber <stgraber@ubuntu.com>
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/configure.ac
|
Index: b/configure.ac
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -1413,6 +1413,17 @@
|
@@ -1501,6 +1501,17 @@
|
||||||
AC_SUBST([LIBZFS])
|
AC_SUBST([LIBZFS])
|
||||||
AC_SUBST([LIBNVPAIR])
|
AC_SUBST([LIBNVPAIR])
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
|
|
||||||
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
||||||
|
|
||||||
@@ -78,6 +79,15 @@
|
@@ -72,6 +73,15 @@
|
||||||
|
|
||||||
title_correction_code=
|
title_correction_code=
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
linux_entry ()
|
linux_entry ()
|
||||||
{
|
{
|
||||||
os="$1"
|
os="$1"
|
||||||
@@ -117,7 +127,9 @@
|
@@ -111,7 +121,9 @@
|
||||||
if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
|
if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
|
||||||
echo " load_video" | sed "s/^/$submenu_indentation/"
|
echo " load_video" | sed "s/^/$submenu_indentation/"
|
||||||
fi
|
fi
|
||||||
@ -69,7 +69,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
||||||
@@ -245,7 +257,7 @@
|
@@ -239,7 +251,7 @@
|
||||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||||
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
||||||
linux_entry "${OS}" "${version}" recovery \
|
linux_entry "${OS}" "${version}" recovery \
|
||||||
|
4
debian/patches/mkrescue_efi_modules.patch
vendored
4
debian/patches/mkrescue_efi_modules.patch
vendored
@ -3,13 +3,13 @@ Author: Mario Limonciello <Mario_Limonciello@dell.com>
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/677758
|
Bug-Ubuntu: https://bugs.launchpad.net/bugs/677758
|
||||||
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2011-01/msg00028.html
|
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2011-01/msg00028.html
|
||||||
Last-Update: 2013-11-29
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/util/grub-mkrescue.c
|
Index: b/util/grub-mkrescue.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub-mkrescue.c
|
--- a/util/grub-mkrescue.c
|
||||||
+++ b/util/grub-mkrescue.c
|
+++ b/util/grub-mkrescue.c
|
||||||
@@ -638,12 +638,18 @@
|
@@ -631,12 +631,18 @@
|
||||||
make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname);
|
make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname);
|
||||||
free (imgname);
|
free (imgname);
|
||||||
|
|
||||||
|
8
debian/patches/no_insmod_on_sb.patch
vendored
8
debian/patches/no_insmod_on_sb.patch
vendored
@ -3,14 +3,14 @@ Author: Matthew Garrett <mjg@redhat.com>
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Origin: vendor, http://pkgs.fedoraproject.org/cgit/grub2.git/tree/grub-2.00-no-insmod-on-sb.patch
|
Origin: vendor, http://pkgs.fedoraproject.org/cgit/grub2.git/tree/grub-2.00-no-insmod-on-sb.patch
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-11-26
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/grub-core/kern/dl.c
|
Index: b/grub-core/kern/dl.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/grub-core/kern/dl.c
|
--- a/grub-core/kern/dl.c
|
||||||
+++ b/grub-core/kern/dl.c
|
+++ b/grub-core/kern/dl.c
|
||||||
@@ -42,6 +42,10 @@
|
@@ -38,6 +38,10 @@
|
||||||
#include <sys/mman.h>
|
#define GRUB_MODULES_MACHINE_READONLY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
+#ifdef GRUB_MACHINE_EFI
|
+#ifdef GRUB_MACHINE_EFI
|
||||||
@ -20,7 +20,7 @@ Index: b/grub-core/kern/dl.c
|
|||||||
|
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
@@ -654,6 +658,15 @@
|
@@ -678,6 +682,15 @@
|
||||||
void *core = 0;
|
void *core = 0;
|
||||||
grub_dl_t mod = 0;
|
grub_dl_t mod = 0;
|
||||||
|
|
||||||
|
8
debian/patches/quick_boot.patch
vendored
8
debian/patches/quick_boot.patch
vendored
@ -14,13 +14,13 @@ Description: Add configure option to bypass boot menu if possible
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Author: Richard Laager <rlaager@wiktel.com>
|
Author: Richard Laager <rlaager@wiktel.com>
|
||||||
Forwarded: no
|
Forwarded: no
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/configure.ac
|
Index: b/configure.ac
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -1435,6 +1435,17 @@
|
@@ -1523,6 +1523,17 @@
|
||||||
fi
|
fi
|
||||||
AC_SUBST([QUIET_BOOT])
|
AC_SUBST([QUIET_BOOT])
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ Index: b/util/grub-mkconfig.in
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/util/grub-mkconfig.in
|
--- a/util/grub-mkconfig.in
|
||||||
+++ b/util/grub-mkconfig.in
|
+++ b/util/grub-mkconfig.in
|
||||||
@@ -231,7 +231,8 @@
|
@@ -235,7 +235,8 @@
|
||||||
GRUB_ENABLE_CRYPTODISK \
|
GRUB_ENABLE_CRYPTODISK \
|
||||||
GRUB_BADRAM \
|
GRUB_BADRAM \
|
||||||
GRUB_OS_PROBER_SKIP_LIST \
|
GRUB_OS_PROBER_SKIP_LIST \
|
||||||
@ -224,7 +224,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
|
|
||||||
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
||||||
|
|
||||||
@@ -123,6 +124,9 @@
|
@@ -117,6 +118,9 @@
|
||||||
else
|
else
|
||||||
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
||||||
fi
|
fi
|
||||||
|
10
debian/patches/vt_handoff.patch
vendored
10
debian/patches/vt_handoff.patch
vendored
@ -4,13 +4,13 @@ Description: Add configure option to use vt.handoff=7
|
|||||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
Author: Andy Whitcroft <apw@canonical.com>
|
Author: Andy Whitcroft <apw@canonical.com>
|
||||||
Forwarded: not-needed
|
Forwarded: not-needed
|
||||||
Last-Update: 2013-12-03
|
Last-Update: 2013-12-08
|
||||||
|
|
||||||
Index: b/configure.ac
|
Index: b/configure.ac
|
||||||
===================================================================
|
===================================================================
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -1457,6 +1457,17 @@
|
@@ -1545,6 +1545,17 @@
|
||||||
fi
|
fi
|
||||||
AC_SUBST([GFXPAYLOAD_DYNAMIC])
|
AC_SUBST([GFXPAYLOAD_DYNAMIC])
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
|
|
||||||
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
||||||
|
|
||||||
@@ -98,6 +99,14 @@
|
@@ -92,6 +93,14 @@
|
||||||
GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY nomodeset"
|
GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY nomodeset"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
linux_entry ()
|
linux_entry ()
|
||||||
{
|
{
|
||||||
os="$1"
|
os="$1"
|
||||||
@@ -143,7 +152,7 @@
|
@@ -137,7 +146,7 @@
|
||||||
fi
|
fi
|
||||||
if ([ "$ubuntu_recovery" = 0 ] || [ x$type != xrecovery ]) && \
|
if ([ "$ubuntu_recovery" = 0 ] || [ x$type != xrecovery ]) && \
|
||||||
([ "x$GRUB_GFXPAYLOAD_LINUX" != x ] || [ "$gfxpayload_dynamic" = 1 ]); then
|
([ "x$GRUB_GFXPAYLOAD_LINUX" != x ] || [ "$gfxpayload_dynamic" = 1 ]); then
|
||||||
@ -64,7 +64,7 @@ Index: b/util/grub.d/10_linux.in
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
||||||
@@ -216,6 +225,23 @@
|
@@ -210,6 +219,23 @@
|
||||||
boot_device_id=
|
boot_device_id=
|
||||||
title_correction_code=
|
title_correction_code=
|
||||||
|
|
||||||
|
@ -3137,7 +3137,7 @@ This variable contains the ``highlight'' foreground and background terminal
|
|||||||
colors, separated by a slash (@samp{/}). Setting this variable changes
|
colors, separated by a slash (@samp{/}). Setting this variable changes
|
||||||
those colors. For the available color names, @pxref{color_normal}.
|
those colors. For the available color names, @pxref{color_normal}.
|
||||||
|
|
||||||
The default is @samp{black/white}.
|
The default is @samp{black/light-gray}.
|
||||||
|
|
||||||
|
|
||||||
@node color_normal
|
@node color_normal
|
||||||
@ -3166,7 +3166,7 @@ those colors. Each color must be a name from the following list:
|
|||||||
@item white
|
@item white
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
The default is @samp{white/black}.
|
The default is @samp{light-gray/black}.
|
||||||
|
|
||||||
The color support support varies from terminal to terminal.
|
The color support support varies from terminal to terminal.
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
@ -434,7 +436,7 @@ def output(s, section=''):
|
|||||||
|
|
||||||
def write_output(section=''):
|
def write_output(section=''):
|
||||||
for s in outputs.get(section, []):
|
for s in outputs.get(section, []):
|
||||||
print s,
|
print(s, end='')
|
||||||
|
|
||||||
#
|
#
|
||||||
# Global variables
|
# Global variables
|
||||||
|
@ -10,10 +10,6 @@ CCAS=$(TARGET_CC)
|
|||||||
RANLIB=$(TARGET_RANLIB)
|
RANLIB=$(TARGET_RANLIB)
|
||||||
STRIP=$(TARGET_STRIP)
|
STRIP=$(TARGET_STRIP)
|
||||||
|
|
||||||
if COND_HAVE_FONT_SOURCE
|
|
||||||
TARGET_CFLAGS += -DUSE_ASCII_FALLBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
MACHO2IMG=$(top_builddir)/grub-macho2img
|
MACHO2IMG=$(top_builddir)/grub-macho2img
|
||||||
|
|
||||||
AM_CFLAGS = $(TARGET_CFLAGS)
|
AM_CFLAGS = $(TARGET_CFLAGS)
|
||||||
@ -173,7 +169,6 @@ endif
|
|||||||
if COND_mips_qemu_mips
|
if COND_mips_qemu_mips
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||||
@ -185,7 +180,6 @@ if COND_mips_loongson
|
|||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
|
||||||
|
@ -88,7 +88,6 @@ kernel = {
|
|||||||
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
|
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
|
||||||
|
|
||||||
mips_arc_cppflags = '-DGRUB_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
mips_arc_cppflags = '-DGRUB_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||||
mips_loongson_cppflags = '-DUSE_ASCII_FALLBACK';
|
|
||||||
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
||||||
emu_cflags = '$(CFLAGS_GNULIB)';
|
emu_cflags = '$(CFLAGS_GNULIB)';
|
||||||
emu_cppflags = '$(CPPFLAGS_GNULIB)';
|
emu_cppflags = '$(CPPFLAGS_GNULIB)';
|
||||||
@ -194,6 +193,7 @@ kernel = {
|
|||||||
ia64_efi = kern/ia64/efi/init.c;
|
ia64_efi = kern/ia64/efi/init.c;
|
||||||
ia64_efi = kern/ia64/dl.c;
|
ia64_efi = kern/ia64/dl.c;
|
||||||
ia64_efi = kern/ia64/dl_helper.c;
|
ia64_efi = kern/ia64/dl_helper.c;
|
||||||
|
ia64_efi = kern/ia64/cache.c;
|
||||||
|
|
||||||
arm_efi = kern/arm/efi/init.c;
|
arm_efi = kern/arm/efi/init.c;
|
||||||
arm_efi = kern/arm/efi/misc.c;
|
arm_efi = kern/arm/efi/misc.c;
|
||||||
@ -283,6 +283,9 @@ kernel = {
|
|||||||
emu = osdep/emuconsole.c;
|
emu = osdep/emuconsole.c;
|
||||||
extra_dist = osdep/unix/emuconsole.c;
|
extra_dist = osdep/unix/emuconsole.c;
|
||||||
extra_dist = osdep/windows/emuconsole.c;
|
extra_dist = osdep/windows/emuconsole.c;
|
||||||
|
emu = osdep/dl.c;
|
||||||
|
extra_dist = osdep/unix/dl.c;
|
||||||
|
extra_dist = osdep/windows/dl.c;
|
||||||
emu = osdep/sleep.c;
|
emu = osdep/sleep.c;
|
||||||
emu = osdep/init.c;
|
emu = osdep/init.c;
|
||||||
emu = osdep/emunet.c;
|
emu = osdep/emunet.c;
|
||||||
|
@ -48,7 +48,7 @@ kernel_byte: .xword (2 << 9)
|
|||||||
boot_path_end:
|
boot_path_end:
|
||||||
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
|
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
|
||||||
#else
|
#else
|
||||||
#define boot_path (_start + 512)
|
#define boot_path (_start + 512 + SCRATCH_PAD_BOOT_SIZE)
|
||||||
#define boot_path_end (_start + 1024)
|
#define boot_path_end (_start + 1024)
|
||||||
#include <grub/offsets.h>
|
#include <grub/offsets.h>
|
||||||
|
|
||||||
@ -140,7 +140,11 @@ prom_call:
|
|||||||
|
|
||||||
boot_continue:
|
boot_continue:
|
||||||
mov %o7, PIC_REG /* PIC base */
|
mov %o7, PIC_REG /* PIC base */
|
||||||
|
#ifndef CDBOOT
|
||||||
sethi %hi(SCRATCH_PAD_BOOT), %l1 /* OF argument slots */
|
sethi %hi(SCRATCH_PAD_BOOT), %l1 /* OF argument slots */
|
||||||
|
#else
|
||||||
|
GET_ABS(_start + 512, %l1) /* OF argument slots */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Find the /chosen node so we can fetch the stdout handle,
|
/* Find the /chosen node so we can fetch the stdout handle,
|
||||||
* and thus perform console output.
|
* and thus perform console output.
|
||||||
|
@ -31,11 +31,14 @@ static grub_ieee1275_ihandle_t last_ihandle;
|
|||||||
struct ofdisk_hash_ent
|
struct ofdisk_hash_ent
|
||||||
{
|
{
|
||||||
char *devpath;
|
char *devpath;
|
||||||
|
char *open_path;
|
||||||
|
char *grub_devpath;
|
||||||
int is_boot;
|
int is_boot;
|
||||||
int is_cdrom;
|
int is_cdrom;
|
||||||
/* Pointer to shortest available name on nodes representing canonical names,
|
/* Pointer to shortest available name on nodes representing canonical names,
|
||||||
otherwise NULL. */
|
otherwise NULL. */
|
||||||
const char *shortest;
|
const char *shortest;
|
||||||
|
const char *grub_shortest;
|
||||||
struct ofdisk_hash_ent *next;
|
struct ofdisk_hash_ent *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,12 +73,50 @@ ofdisk_hash_add_real (char *devpath)
|
|||||||
{
|
{
|
||||||
struct ofdisk_hash_ent *p;
|
struct ofdisk_hash_ent *p;
|
||||||
struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)];
|
struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)];
|
||||||
|
const char *iptr;
|
||||||
|
char *optr;
|
||||||
|
|
||||||
p = grub_zalloc (sizeof (*p));
|
p = grub_zalloc (sizeof (*p));
|
||||||
if (!p)
|
if (!p)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p->devpath = devpath;
|
p->devpath = devpath;
|
||||||
|
|
||||||
|
p->grub_devpath = grub_malloc (sizeof ("ieee1275/")
|
||||||
|
+ 2 * grub_strlen (p->devpath));
|
||||||
|
|
||||||
|
if (!p->grub_devpath)
|
||||||
|
{
|
||||||
|
grub_free (p);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PARTITION_0))
|
||||||
|
{
|
||||||
|
p->open_path = grub_malloc (grub_strlen (p->devpath) + 3);
|
||||||
|
if (!p->open_path)
|
||||||
|
{
|
||||||
|
grub_free (p->grub_devpath);
|
||||||
|
grub_free (p);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
optr = grub_stpcpy (p->open_path, p->devpath);
|
||||||
|
*optr++ = ':';
|
||||||
|
*optr++ = '0';
|
||||||
|
*optr = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p->open_path = p->devpath;
|
||||||
|
|
||||||
|
optr = grub_stpcpy (p->grub_devpath, "ieee1275/");
|
||||||
|
for (iptr = p->devpath; *iptr; )
|
||||||
|
{
|
||||||
|
if (*iptr == ',')
|
||||||
|
*optr++ = '\\';
|
||||||
|
*optr++ = *iptr++;
|
||||||
|
}
|
||||||
|
*optr = 0;
|
||||||
|
|
||||||
p->next = *head;
|
p->next = *head;
|
||||||
*head = p;
|
*head = p;
|
||||||
return p;
|
return p;
|
||||||
@ -104,7 +145,8 @@ ofdisk_hash_add (char *devpath, char *curcan)
|
|||||||
|
|
||||||
if (!curcan)
|
if (!curcan)
|
||||||
{
|
{
|
||||||
p->shortest = devpath;
|
p->shortest = p->devpath;
|
||||||
|
p->grub_shortest = p->grub_devpath;
|
||||||
if (check_string_cdrom (devpath))
|
if (check_string_cdrom (devpath))
|
||||||
p->is_cdrom = 1;
|
p->is_cdrom = 1;
|
||||||
return p;
|
return p;
|
||||||
@ -125,7 +167,10 @@ ofdisk_hash_add (char *devpath, char *curcan)
|
|||||||
{
|
{
|
||||||
if (!pcan->shortest
|
if (!pcan->shortest
|
||||||
|| grub_strlen (pcan->shortest) > grub_strlen (devpath))
|
|| grub_strlen (pcan->shortest) > grub_strlen (devpath))
|
||||||
pcan->shortest = devpath;
|
{
|
||||||
|
pcan->shortest = p->devpath;
|
||||||
|
pcan->grub_shortest = p->grub_devpath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
@ -288,21 +333,8 @@ grub_ofdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
|
|||||||
if (!ent->is_boot && ent->is_cdrom)
|
if (!ent->is_boot && ent->is_cdrom)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
{
|
if (hook (ent->grub_shortest, hook_data))
|
||||||
char buffer[sizeof ("ieee1275/") + 2 * grub_strlen (ent->shortest)];
|
return 1;
|
||||||
const char *iptr;
|
|
||||||
char *optr;
|
|
||||||
optr = grub_stpcpy (buffer, "ieee1275/");
|
|
||||||
for (iptr = ent->shortest; *iptr; )
|
|
||||||
{
|
|
||||||
if (*iptr == ',')
|
|
||||||
*optr++ = '\\';
|
|
||||||
*optr++ = *iptr++;
|
|
||||||
}
|
|
||||||
*optr = 0;
|
|
||||||
if (hook (buffer, hook_data))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -396,7 +428,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
|||||||
if (!op)
|
if (!op)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
disk->id = (unsigned long) op;
|
disk->id = (unsigned long) op;
|
||||||
disk->data = op->devpath;
|
disk->data = op->open_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -428,20 +460,7 @@ grub_ofdisk_prepare (grub_disk_t disk, grub_disk_addr_t sector)
|
|||||||
last_ihandle = 0;
|
last_ihandle = 0;
|
||||||
last_devpath = NULL;
|
last_devpath = NULL;
|
||||||
|
|
||||||
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PARTITION_0))
|
grub_ieee1275_open (disk->data, &last_ihandle);
|
||||||
{
|
|
||||||
char name2[grub_strlen (disk->data) + 3];
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
grub_strcpy (name2, disk->data);
|
|
||||||
p = name2 + grub_strlen (name2);
|
|
||||||
*p++ = ':';
|
|
||||||
*p++ = '0';
|
|
||||||
*p = 0;
|
|
||||||
grub_ieee1275_open (name2, &last_ihandle);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_ieee1275_open (disk->data, &last_ihandle);
|
|
||||||
if (! last_ihandle)
|
if (! last_ihandle)
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
|
||||||
last_devpath = disk->data;
|
last_devpath = disk->data;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
#ifdef USE_ASCII_FALLBACK
|
#if HAVE_FONT_SOURCE
|
||||||
#include "ascii.h"
|
#include "ascii.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -110,14 +110,14 @@ static struct grub_font null_font;
|
|||||||
/* Flag to ensure module is initialized only once. */
|
/* Flag to ensure module is initialized only once. */
|
||||||
static grub_uint8_t font_loader_initialized;
|
static grub_uint8_t font_loader_initialized;
|
||||||
|
|
||||||
#ifdef USE_ASCII_FALLBACK
|
#if HAVE_FONT_SOURCE
|
||||||
static struct grub_font_glyph *ascii_font_glyph[0x80];
|
static struct grub_font_glyph *ascii_font_glyph[0x80];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct grub_font_glyph *
|
static struct grub_font_glyph *
|
||||||
ascii_glyph_lookup (grub_uint32_t code)
|
ascii_glyph_lookup (grub_uint32_t code)
|
||||||
{
|
{
|
||||||
#ifdef USE_ASCII_FALLBACK
|
#if HAVE_FONT_SOURCE
|
||||||
static int ascii_failback_initialized = 0;
|
static int ascii_failback_initialized = 0;
|
||||||
|
|
||||||
if (code >= 0x80)
|
if (code >= 0x80)
|
||||||
|
@ -25,45 +25,113 @@
|
|||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/arm/reloc.h>
|
#include <grub/arm/reloc.h>
|
||||||
|
|
||||||
|
struct trampoline_arm
|
||||||
|
{
|
||||||
|
#define ARM_LOAD_IP 0xe59fc000
|
||||||
|
#define ARM_BX 0xe12fff1c
|
||||||
|
#define ARM_MOV_PC 0xe1a0f00c
|
||||||
|
grub_uint32_t load_ip; /* ldr ip, [pc] */
|
||||||
|
grub_uint32_t bx; /* bx ip or mov pc, ip*/
|
||||||
|
grub_uint32_t addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
static grub_uint16_t thumb_template[8] =
|
||||||
|
{
|
||||||
|
0x468c, /* mov ip, r1 */
|
||||||
|
0x4903, /* ldr r1, [pc, #12] ; (10 <.text+0x10>) */
|
||||||
|
/* Exchange R1 and IP in limited Thumb instruction set.
|
||||||
|
IP gets negated but we compensate it by C code. */
|
||||||
|
/* R1 IP */
|
||||||
|
/* -A R1 */
|
||||||
|
0x4461, /* add r1, ip */ /* R1-A R1 */
|
||||||
|
0x4249, /* negs r1, r1 */ /* A-R1 R1 */
|
||||||
|
0x448c, /* add ip, r1 */ /* A-R1 A */
|
||||||
|
0x4249, /* negs r1, r1 */ /* R1-A A */
|
||||||
|
0x4461, /* add r1, ip */ /* R1 A */
|
||||||
|
0x4760 /* bx ip */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct trampoline_thumb
|
||||||
|
{
|
||||||
|
grub_uint16_t template[8];
|
||||||
|
grub_uint32_t neg_addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||||
|
grub_size_t *got)
|
||||||
|
{
|
||||||
|
const Elf_Ehdr *e = ehdr;
|
||||||
|
const Elf_Shdr *s;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
*tramp = 0;
|
||||||
|
*got = 0;
|
||||||
|
|
||||||
|
for (i = 0, s = (const Elf_Shdr *) ((grub_addr_t) e + e->e_shoff);
|
||||||
|
i < e->e_shnum;
|
||||||
|
i++, s = (const Elf_Shdr *) ((grub_addr_t) s + e->e_shentsize))
|
||||||
|
if (s->sh_type == SHT_REL)
|
||||||
|
{
|
||||||
|
const Elf_Rel *rel, *max;
|
||||||
|
|
||||||
|
for (rel = (const Elf_Rel *) ((grub_addr_t) e + s->sh_offset),
|
||||||
|
max = rel + s->sh_size / s->sh_entsize;
|
||||||
|
rel < max;
|
||||||
|
rel++)
|
||||||
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
|
{
|
||||||
|
case R_ARM_CALL:
|
||||||
|
case R_ARM_JUMP24:
|
||||||
|
{
|
||||||
|
*tramp += sizeof (struct trampoline_arm);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case R_ARM_THM_CALL:
|
||||||
|
case R_ARM_THM_JUMP24:
|
||||||
|
case R_ARM_THM_JUMP19:
|
||||||
|
{
|
||||||
|
*tramp += sizeof (struct trampoline_thumb);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_dprintf ("dl", "trampoline size %x\n", *tramp);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
* Runtime dynamic linker with helper functions. *
|
* Runtime dynamic linker with helper functions. *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
static grub_err_t
|
grub_err_t
|
||||||
do_relocations (Elf_Shdr * relhdr, Elf_Ehdr * e, grub_dl_t mod)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
grub_dl_segment_t seg;
|
Elf_Rel *rel, *max;
|
||||||
Elf_Rel *rel;
|
|
||||||
Elf_Sym *sym;
|
|
||||||
int i, entnum;
|
|
||||||
|
|
||||||
entnum = relhdr->sh_size / sizeof (Elf_Rel);
|
for (rel = (Elf_Rel *) ((char *) ehdr + s->sh_offset),
|
||||||
|
max = (Elf_Rel *) ((char *) rel + s->sh_size);
|
||||||
/* Find the target segment for this relocation section. */
|
rel < max;
|
||||||
for (seg = mod->segment ; seg ; seg = seg->next)
|
rel = (Elf_Rel *) ((char *) rel + s->sh_entsize))
|
||||||
if (seg->section == relhdr->sh_info)
|
|
||||||
break;
|
|
||||||
if (!seg)
|
|
||||||
return grub_error (GRUB_ERR_EOF, N_("relocation segment not found"));
|
|
||||||
|
|
||||||
rel = (Elf_Rel *) ((grub_addr_t) e + relhdr->sh_offset);
|
|
||||||
|
|
||||||
/* Step through all relocations */
|
|
||||||
for (i = 0, sym = mod->symtab; i < entnum; i++)
|
|
||||||
{
|
{
|
||||||
Elf_Addr *target, sym_addr;
|
Elf_Addr *target, sym_addr;
|
||||||
int relsym, reltype;
|
|
||||||
grub_err_t retval;
|
grub_err_t retval;
|
||||||
|
Elf_Sym *sym;
|
||||||
|
|
||||||
if (seg->size < rel[i].r_offset)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
"reloc offset is out of the segment");
|
"reloc offset is out of the segment");
|
||||||
relsym = ELF_R_SYM (rel[i].r_info);
|
target = (void *) ((char *) seg->addr + rel->r_offset);
|
||||||
reltype = ELF_R_TYPE (rel[i].r_info);
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
target = (void *) ((grub_addr_t) seg->addr + rel[i].r_offset);
|
+ mod->symsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
sym_addr = sym[relsym].st_value;
|
sym_addr = sym->st_value;
|
||||||
|
|
||||||
switch (reltype)
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
{
|
{
|
||||||
case R_ARM_ABS32:
|
case R_ARM_ABS32:
|
||||||
{
|
{
|
||||||
@ -76,16 +144,58 @@ do_relocations (Elf_Shdr * relhdr, Elf_Ehdr * e, grub_dl_t mod)
|
|||||||
case R_ARM_CALL:
|
case R_ARM_CALL:
|
||||||
case R_ARM_JUMP24:
|
case R_ARM_JUMP24:
|
||||||
{
|
{
|
||||||
retval = grub_arm_reloc_jump24 (target, sym_addr);
|
grub_int32_t offset;
|
||||||
if (retval != GRUB_ERR_NONE)
|
|
||||||
return retval;
|
sym_addr += grub_arm_jump24_get_offset (target);
|
||||||
|
offset = sym_addr - (grub_uint32_t) target;
|
||||||
|
|
||||||
|
if ((sym_addr & 1) || !grub_arm_jump24_check_offset (offset))
|
||||||
|
{
|
||||||
|
struct trampoline_arm *tp = mod->trampptr;
|
||||||
|
mod->trampptr = tp + 1;
|
||||||
|
tp->load_ip = ARM_LOAD_IP;
|
||||||
|
tp->bx = (sym_addr & 1) ? ARM_BX : ARM_MOV_PC;
|
||||||
|
tp->addr = sym_addr + 8;
|
||||||
|
offset = (grub_uint8_t *) tp - (grub_uint8_t *) target - 8;
|
||||||
|
}
|
||||||
|
if (!grub_arm_jump24_check_offset (offset))
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"trampoline out of range");
|
||||||
|
grub_arm_jump24_set_offset (target, offset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R_ARM_THM_CALL:
|
case R_ARM_THM_CALL:
|
||||||
case R_ARM_THM_JUMP24:
|
case R_ARM_THM_JUMP24:
|
||||||
{
|
{
|
||||||
/* Thumb instructions can be 16-bit aligned */
|
/* Thumb instructions can be 16-bit aligned */
|
||||||
retval = grub_arm_reloc_thm_call ((grub_uint16_t *) target, sym_addr);
|
grub_int32_t offset;
|
||||||
|
|
||||||
|
sym_addr += grub_arm_thm_call_get_offset ((grub_uint16_t *) target);
|
||||||
|
|
||||||
|
grub_dprintf ("dl", " sym_addr = 0x%08x\n", sym_addr);
|
||||||
|
|
||||||
|
offset = sym_addr - (grub_uint32_t) target;
|
||||||
|
|
||||||
|
grub_dprintf("dl", " BL*: target=%p, sym_addr=0x%08x, offset=%d\n",
|
||||||
|
target, sym_addr, offset);
|
||||||
|
|
||||||
|
if (!(sym_addr & 1) || (offset < -0x200000 || offset >= 0x200000))
|
||||||
|
{
|
||||||
|
struct trampoline_thumb *tp = mod->trampptr;
|
||||||
|
mod->trampptr = tp + 1;
|
||||||
|
grub_memcpy (tp->template, thumb_template, sizeof (tp->template));
|
||||||
|
tp->neg_addr = -sym_addr - 4;
|
||||||
|
offset = ((grub_uint8_t *) tp - (grub_uint8_t *) target - 4) | 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset < -0x200000 || offset >= 0x200000)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"trampoline out of range");
|
||||||
|
|
||||||
|
grub_dprintf ("dl", " relative destination = %p\n",
|
||||||
|
(char *) target + offset);
|
||||||
|
|
||||||
|
retval = grub_arm_thm_call_set_offset ((grub_uint16_t *) target, offset);
|
||||||
if (retval != GRUB_ERR_NONE)
|
if (retval != GRUB_ERR_NONE)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -98,15 +208,37 @@ do_relocations (Elf_Shdr * relhdr, Elf_Ehdr * e, grub_dl_t mod)
|
|||||||
case R_ARM_THM_JUMP19:
|
case R_ARM_THM_JUMP19:
|
||||||
{
|
{
|
||||||
/* Thumb instructions can be 16-bit aligned */
|
/* Thumb instructions can be 16-bit aligned */
|
||||||
retval = grub_arm_reloc_thm_jump19 ((grub_uint16_t *) target, sym_addr);
|
grub_int32_t offset;
|
||||||
if (retval != GRUB_ERR_NONE)
|
|
||||||
return retval;
|
if (!(sym_addr & 1))
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
N_("Relocation targeting wrong execution state"));
|
||||||
|
|
||||||
|
sym_addr += grub_arm_thm_jump19_get_offset ((grub_uint16_t *) target);
|
||||||
|
|
||||||
|
offset = sym_addr - (grub_uint32_t) target;
|
||||||
|
|
||||||
|
if (!grub_arm_thm_jump19_check_offset (offset)
|
||||||
|
|| !(sym_addr & 1))
|
||||||
|
{
|
||||||
|
struct trampoline_thumb *tp = mod->gotptr;
|
||||||
|
mod->gotptr = tp + 1;
|
||||||
|
grub_memcpy (tp->template, thumb_template, sizeof (tp->template));
|
||||||
|
tp->neg_addr = -sym_addr - 4;
|
||||||
|
offset = ((grub_uint8_t *) tp - (grub_uint8_t *) target - 4) | 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!grub_arm_thm_jump19_check_offset (offset))
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"trampoline out of range");
|
||||||
|
|
||||||
|
grub_arm_thm_jump19_set_offset ((grub_uint16_t *) target, offset);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
reltype);
|
ELF_R_TYPE (rel->r_info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,77 +262,3 @@ grub_arch_dl_check_header (void *ehdr)
|
|||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Verify that provided ELF header contains reference to a symbol table
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
has_symtab (Elf_Ehdr * e)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
Elf_Shdr *s;
|
|
||||||
|
|
||||||
for (i = 0, s = (Elf_Shdr *) ((grub_uint32_t) e + e->e_shoff);
|
|
||||||
i < e->e_shnum;
|
|
||||||
i++, s = (Elf_Shdr *) ((grub_uint32_t) s + e->e_shentsize))
|
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* grub_arch_dl_relocate_symbols():
|
|
||||||
* Only externally visible function in this file.
|
|
||||||
* Locates the relocations section of the ELF object, and calls
|
|
||||||
* do_relocations() to deal with it.
|
|
||||||
*/
|
|
||||||
grub_err_t
|
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|
||||||
{
|
|
||||||
Elf_Ehdr *e = ehdr;
|
|
||||||
Elf_Shdr *s;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
if (!has_symtab (e))
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
|
||||||
|
|
||||||
#define FIRST_SHDR(x) ((Elf_Shdr *) ((grub_addr_t)(x) + (x)->e_shoff))
|
|
||||||
#define NEXT_SHDR(x, y) ((Elf_Shdr *) ((grub_addr_t)(y) + (x)->e_shentsize))
|
|
||||||
|
|
||||||
for (i = 0, s = FIRST_SHDR (e); i < e->e_shnum; i++, s = NEXT_SHDR (e, s))
|
|
||||||
{
|
|
||||||
grub_err_t ret;
|
|
||||||
|
|
||||||
switch (s->sh_type)
|
|
||||||
{
|
|
||||||
case SHT_REL:
|
|
||||||
{
|
|
||||||
/* Relocations, no addends */
|
|
||||||
ret = do_relocations (s, e, mod);
|
|
||||||
if (ret != GRUB_ERR_NONE)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SHT_NULL:
|
|
||||||
case SHT_PROGBITS:
|
|
||||||
case SHT_SYMTAB:
|
|
||||||
case SHT_STRTAB:
|
|
||||||
case SHT_NOBITS:
|
|
||||||
case SHT_ARM_ATTRIBUTES:
|
|
||||||
break;
|
|
||||||
case SHT_RELA:
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
grub_dprintf ("dl", "unhandled section_type: %d (0x%08x)\n",
|
|
||||||
s->sh_type, s->sh_type);
|
|
||||||
return GRUB_ERR_NOT_IMPLEMENTED_YET;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FIRST_SHDR
|
|
||||||
#undef NEXT_SHDR
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
@ -38,8 +38,6 @@ grub_arm_reloc_abs32 (Elf32_Word *target, Elf32_Addr sym_addr)
|
|||||||
tmp = grub_le_to_cpu32 (*target);
|
tmp = grub_le_to_cpu32 (*target);
|
||||||
tmp += sym_addr;
|
tmp += sym_addr;
|
||||||
*target = grub_cpu_to_le32 (tmp);
|
*target = grub_cpu_to_le32 (tmp);
|
||||||
grub_dprintf ("dl", " %s: reloc_abs32 0x%08x => 0x%08x", __FUNCTION__,
|
|
||||||
(unsigned int) sym_addr, (unsigned int) tmp);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
@ -51,37 +49,16 @@ grub_arm_reloc_abs32 (Elf32_Word *target, Elf32_Addr sym_addr)
|
|||||||
* little-endian, requiring some additional fiddling. *
|
* little-endian, requiring some additional fiddling. *
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
/*
|
grub_int32_t
|
||||||
* R_ARM_THM_CALL/THM_JUMP24
|
grub_arm_thm_call_get_offset (grub_uint16_t *target)
|
||||||
*
|
|
||||||
* Relocate Thumb (T32) instruction set relative branches:
|
|
||||||
* B.W, BL and BLX
|
|
||||||
*/
|
|
||||||
grub_err_t
|
|
||||||
grub_arm_reloc_thm_call (grub_uint16_t *target, Elf32_Addr sym_addr)
|
|
||||||
{
|
{
|
||||||
grub_int32_t offset, offset_low, offset_high;
|
grub_uint32_t sign, j1, j2;
|
||||||
grub_uint32_t sign, j1, j2, is_blx;
|
grub_uint32_t insword;
|
||||||
grub_uint32_t insword, insmask;
|
grub_int32_t offset;
|
||||||
|
|
||||||
/* Extract instruction word in alignment-safe manner */
|
/* Extract instruction word in alignment-safe manner */
|
||||||
insword = (grub_le_to_cpu16 (*target) << 16)
|
insword = (grub_le_to_cpu16 (*target) << 16)
|
||||||
| (grub_le_to_cpu16(*(target + 1)));
|
| (grub_le_to_cpu16(*(target + 1)));
|
||||||
insmask = 0xf800d000;
|
|
||||||
|
|
||||||
/* B.W/BL or BLX? Affects range and expected target state */
|
|
||||||
if (((insword >> 12) & 0xd) == 0xc)
|
|
||||||
is_blx = 1;
|
|
||||||
else
|
|
||||||
is_blx = 0;
|
|
||||||
|
|
||||||
/* If BLX, target symbol must be ARM (target address LSB == 0) */
|
|
||||||
if (is_blx && (sym_addr & 1))
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
N_("Relocation targeting wrong execution state"));
|
|
||||||
|
|
||||||
offset_low = -16777216;
|
|
||||||
offset_high = is_blx ? 16777212 : 16777214;
|
|
||||||
|
|
||||||
/* Extract bitfields from instruction words */
|
/* Extract bitfields from instruction words */
|
||||||
sign = (insword >> 26) & 1;
|
sign = (insword >> 26) & 1;
|
||||||
@ -95,22 +72,32 @@ grub_arm_reloc_thm_call (grub_uint16_t *target, Elf32_Addr sym_addr)
|
|||||||
if (offset & (1 << 24))
|
if (offset & (1 << 24))
|
||||||
offset -= (1 << 25);
|
offset -= (1 << 25);
|
||||||
|
|
||||||
grub_dprintf ("dl", " sym_addr = 0x%08x", sym_addr);
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
offset += sym_addr;
|
grub_err_t
|
||||||
#ifndef GRUB_UTIL
|
grub_arm_thm_call_set_offset (grub_uint16_t *target, grub_int32_t offset)
|
||||||
offset -= (grub_uint32_t) target;
|
{
|
||||||
#endif
|
grub_uint32_t sign, j1, j2;
|
||||||
|
const grub_uint32_t insmask = 0xf800d000;
|
||||||
|
grub_uint32_t insword;
|
||||||
|
int is_blx;
|
||||||
|
|
||||||
grub_dprintf("dl", " %s: target=%p, sym_addr=0x%08x, offset=%d\n",
|
/* Extract instruction word in alignment-safe manner */
|
||||||
is_blx ? "BLX" : "BL", target, sym_addr, offset);
|
insword = (grub_le_to_cpu16 (*target) << 16)
|
||||||
|
| (grub_le_to_cpu16(*(target + 1)));
|
||||||
|
|
||||||
if ((offset < offset_low) || (offset > offset_high))
|
if (((insword >> 12) & 0xd) == 0xc)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
is_blx = 1;
|
||||||
N_("THM_CALL Relocation out of range."));
|
else
|
||||||
|
is_blx = 0;
|
||||||
|
|
||||||
grub_dprintf ("dl", " relative destination = %p",
|
if (!is_blx && !(offset & 1))
|
||||||
(char *) target + offset);
|
return grub_error (GRUB_ERR_BAD_MODULE, "bl/b.w targettting ARM");
|
||||||
|
|
||||||
|
/* Transform blx into bl if necessarry. */
|
||||||
|
if (is_blx && (offset & 1))
|
||||||
|
insword |= (1 << 12);
|
||||||
|
|
||||||
/* Reassemble instruction word */
|
/* Reassemble instruction word */
|
||||||
sign = (offset >> 24) & 1;
|
sign = (offset >> 24) & 1;
|
||||||
@ -130,21 +117,15 @@ grub_arm_reloc_thm_call (grub_uint16_t *target, Elf32_Addr sym_addr)
|
|||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
grub_int32_t
|
||||||
* R_ARM_THM_JUMP19
|
grub_arm_thm_jump19_get_offset (grub_uint16_t *target)
|
||||||
*
|
|
||||||
* Relocate conditional Thumb (T32) B<c>.W
|
|
||||||
*/
|
|
||||||
grub_err_t
|
|
||||||
grub_arm_reloc_thm_jump19 (grub_uint16_t *target, Elf32_Addr sym_addr)
|
|
||||||
{
|
{
|
||||||
grub_int32_t offset;
|
grub_int32_t offset;
|
||||||
grub_uint32_t insword, insmask;
|
grub_uint32_t insword;
|
||||||
|
|
||||||
/* Extract instruction word in alignment-safe manner */
|
/* Extract instruction word in alignment-safe manner */
|
||||||
insword = grub_le_to_cpu16 ((*target)) << 16
|
insword = (grub_le_to_cpu16 (*target) << 16)
|
||||||
| grub_le_to_cpu16 (*(target + 1));
|
| (grub_le_to_cpu16(*(target + 1)));
|
||||||
insmask = 0xfbc0d000;
|
|
||||||
|
|
||||||
/* Extract and sign extend offset */
|
/* Extract and sign extend offset */
|
||||||
offset = ((insword >> 26) & 1) << 19
|
offset = ((insword >> 26) & 1) << 19
|
||||||
@ -156,18 +137,22 @@ grub_arm_reloc_thm_jump19 (grub_uint16_t *target, Elf32_Addr sym_addr)
|
|||||||
if (offset & (1 << 20))
|
if (offset & (1 << 20))
|
||||||
offset -= (1 << 21);
|
offset -= (1 << 21);
|
||||||
|
|
||||||
/* Adjust and re-truncate offset */
|
return offset;
|
||||||
offset += sym_addr;
|
}
|
||||||
#ifndef GRUB_UTIL
|
|
||||||
offset -= (grub_uint32_t) target;
|
void
|
||||||
#endif
|
grub_arm_thm_jump19_set_offset (grub_uint16_t *target, grub_int32_t offset)
|
||||||
if ((offset > 1048574) || (offset < -1048576))
|
{
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
grub_uint32_t insword;
|
||||||
N_("THM_JUMP19 Relocation out of range."));
|
const grub_uint32_t insmask = 0xfbc0d000;
|
||||||
|
|
||||||
offset >>= 1;
|
offset >>= 1;
|
||||||
offset &= 0xfffff;
|
offset &= 0xfffff;
|
||||||
|
|
||||||
|
/* Extract instruction word in alignment-safe manner */
|
||||||
|
insword = grub_le_to_cpu16 ((*target)) << 16
|
||||||
|
| grub_le_to_cpu16 (*(target + 1));
|
||||||
|
|
||||||
/* Reassemble instruction word and write back */
|
/* Reassemble instruction word and write back */
|
||||||
insword &= insmask;
|
insword &= insmask;
|
||||||
insword |= ((offset >> 19) & 1) << 26
|
insword |= ((offset >> 19) & 1) << 26
|
||||||
@ -177,9 +162,15 @@ grub_arm_reloc_thm_jump19 (grub_uint16_t *target, Elf32_Addr sym_addr)
|
|||||||
| (offset & 0x7ff);
|
| (offset & 0x7ff);
|
||||||
*target = grub_cpu_to_le16 (insword >> 16);
|
*target = grub_cpu_to_le16 (insword >> 16);
|
||||||
*(target + 1) = grub_cpu_to_le16 (insword & 0xffff);
|
*(target + 1) = grub_cpu_to_le16 (insword & 0xffff);
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
grub_arm_thm_jump19_check_offset (grub_int32_t offset)
|
||||||
|
{
|
||||||
|
if ((offset > 1048574) || (offset < -1048576))
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
@ -188,35 +179,38 @@ grub_arm_reloc_thm_jump19 (grub_uint16_t *target, Elf32_Addr sym_addr)
|
|||||||
* ARM instructions are 32-bit in size and 32-bit aligned. *
|
* ARM instructions are 32-bit in size and 32-bit aligned. *
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
|
|
||||||
/*
|
grub_int32_t
|
||||||
* R_ARM_JUMP24
|
grub_arm_jump24_get_offset (grub_uint32_t *target)
|
||||||
*
|
|
||||||
* Relocate ARM (A32) B
|
|
||||||
*/
|
|
||||||
grub_err_t
|
|
||||||
grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr sym_addr)
|
|
||||||
{
|
{
|
||||||
grub_uint32_t insword;
|
|
||||||
grub_int32_t offset;
|
grub_int32_t offset;
|
||||||
|
grub_uint32_t insword;
|
||||||
if (sym_addr & 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
N_("Relocation targeting wrong execution state"));
|
|
||||||
|
|
||||||
insword = grub_le_to_cpu32 (*target);
|
insword = grub_le_to_cpu32 (*target);
|
||||||
|
|
||||||
offset = (insword & 0x00ffffff) << 2;
|
offset = (insword & 0x00ffffff) << 2;
|
||||||
if (offset & 0x02000000)
|
if (offset & 0x02000000)
|
||||||
offset -= 0x04000000;
|
offset -= 0x04000000;
|
||||||
offset += sym_addr;
|
return offset;
|
||||||
#ifndef GRUB_UTIL
|
}
|
||||||
offset -= (grub_uint32_t) target;
|
|
||||||
#endif
|
int
|
||||||
|
grub_arm_jump24_check_offset (grub_int32_t offset)
|
||||||
|
{
|
||||||
|
if (offset >= 0x02000000 || offset < -0x02000000)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_arm_jump24_set_offset (grub_uint32_t *target,
|
||||||
|
grub_int32_t offset)
|
||||||
|
{
|
||||||
|
grub_uint32_t insword;
|
||||||
|
|
||||||
|
insword = grub_le_to_cpu32 (*target);
|
||||||
|
|
||||||
insword &= 0xff000000;
|
insword &= 0xff000000;
|
||||||
insword |= (offset >> 2) & 0x00ffffff;
|
insword |= (offset >> 2) & 0x00ffffff;
|
||||||
|
|
||||||
*target = grub_cpu_to_le32 (insword);
|
*target = grub_cpu_to_le32 (insword);
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,15 @@
|
|||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/cpu/reloc.h>
|
#include <grub/cpu/reloc.h>
|
||||||
|
|
||||||
|
struct trampoline
|
||||||
|
{
|
||||||
|
#define LDR 0x58000050
|
||||||
|
#define BR 0xd61f0200
|
||||||
|
grub_uint32_t ldr; /* ldr x16, 8 */
|
||||||
|
grub_uint32_t br; /* br x16 */
|
||||||
|
grub_uint64_t addr;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if EHDR is a valid ELF header.
|
* Check if EHDR is a valid ELF header.
|
||||||
*/
|
*/
|
||||||
@ -42,59 +51,76 @@ grub_arch_dl_check_header (void *ehdr)
|
|||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||||
|
grub_size_t *got)
|
||||||
|
{
|
||||||
|
const Elf_Ehdr *e = ehdr;
|
||||||
|
const Elf_Shdr *s;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
*tramp = 0;
|
||||||
|
*got = 0;
|
||||||
|
|
||||||
|
for (i = 0, s = (const Elf_Shdr *) ((grub_addr_t) e + e->e_shoff);
|
||||||
|
i < e->e_shnum;
|
||||||
|
i++, s = (const Elf_Shdr *) ((grub_addr_t) s + e->e_shentsize))
|
||||||
|
if (s->sh_type == SHT_REL || s->sh_type == SHT_RELA)
|
||||||
|
{
|
||||||
|
const Elf_Rel *rel, *max;
|
||||||
|
|
||||||
|
for (rel = (const Elf_Rel *) ((grub_addr_t) e + s->sh_offset),
|
||||||
|
max = rel + s->sh_size / s->sh_entsize;
|
||||||
|
rel < max;
|
||||||
|
rel = (const Elf_Rel *) ((grub_addr_t) rel + s->sh_entsize))
|
||||||
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
|
{
|
||||||
|
case R_AARCH64_CALL26:
|
||||||
|
case R_AARCH64_JUMP26:
|
||||||
|
{
|
||||||
|
*tramp += sizeof (struct trampoline);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unified function for both REL and RELA
|
* Unified function for both REL and RELA
|
||||||
*/
|
*/
|
||||||
static grub_err_t
|
grub_err_t
|
||||||
do_relX (Elf_Shdr * relhdr, Elf_Ehdr * e, grub_dl_t mod)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
grub_err_t retval;
|
Elf_Rel *rel, *max;
|
||||||
grub_dl_segment_t segment;
|
|
||||||
Elf_Rel *rel;
|
|
||||||
Elf_Rela *rela;
|
|
||||||
Elf_Sym *symbol;
|
|
||||||
int i, entnum;
|
|
||||||
unsigned long long entsize;
|
|
||||||
|
|
||||||
/* Find the target segment for this relocation section. */
|
for (rel = (Elf_Rel *) ((char *) ehdr + s->sh_offset),
|
||||||
for (segment = mod->segment ; segment != 0 ; segment = segment->next)
|
max = (Elf_Rel *) ((char *) rel + s->sh_size);
|
||||||
if (segment->section == relhdr->sh_info)
|
rel < max;
|
||||||
break;
|
rel = (Elf_Rel *) ((char *) rel + s->sh_entsize))
|
||||||
if (!segment)
|
|
||||||
return grub_error (GRUB_ERR_EOF, N_("relocation segment not found"));
|
|
||||||
|
|
||||||
rel = (Elf_Rel *) ((grub_addr_t) e + relhdr->sh_offset);
|
|
||||||
rela = (Elf_Rela *) rel;
|
|
||||||
if (relhdr->sh_type == SHT_RELA)
|
|
||||||
entsize = sizeof (Elf_Rela);
|
|
||||||
else
|
|
||||||
entsize = sizeof (Elf_Rel);
|
|
||||||
|
|
||||||
entnum = relhdr->sh_size / entsize;
|
|
||||||
retval = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
grub_dprintf("dl", "Processing %d relocation entries.\n", entnum);
|
|
||||||
|
|
||||||
/* Step through all relocations */
|
|
||||||
for (i = 0, symbol = mod->symtab; i < entnum; i++)
|
|
||||||
{
|
{
|
||||||
|
Elf_Sym *sym;
|
||||||
void *place;
|
void *place;
|
||||||
grub_uint64_t sym_addr, symidx, reltype;
|
grub_uint64_t sym_addr;
|
||||||
|
|
||||||
if (rel->r_offset >= segment->size)
|
if (rel->r_offset >= seg->size)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
"reloc offset is out of the segment");
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
symidx = ELF_R_SYM (rel->r_info);
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
reltype = ELF_R_TYPE (rel->r_info);
|
+ mod->symsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
sym_addr = symbol[symidx].st_value;
|
sym_addr = sym->st_value;
|
||||||
if (relhdr->sh_type == SHT_RELA)
|
if (s->sh_type == SHT_RELA)
|
||||||
sym_addr += rela->r_addend;
|
sym_addr += ((Elf_Rela *) rel)->r_addend;
|
||||||
|
|
||||||
place = (void *) ((grub_addr_t) segment->addr + rel->r_offset);
|
place = (void *) ((grub_addr_t) seg->addr + rel->r_offset);
|
||||||
|
|
||||||
switch (reltype)
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
{
|
{
|
||||||
case R_AARCH64_ABS64:
|
case R_AARCH64_ABS64:
|
||||||
{
|
{
|
||||||
@ -108,92 +134,32 @@ do_relX (Elf_Shdr * relhdr, Elf_Ehdr * e, grub_dl_t mod)
|
|||||||
break;
|
break;
|
||||||
case R_AARCH64_CALL26:
|
case R_AARCH64_CALL26:
|
||||||
case R_AARCH64_JUMP26:
|
case R_AARCH64_JUMP26:
|
||||||
retval = grub_arm64_reloc_xxxx26 (place, sym_addr);
|
{
|
||||||
|
grub_int64_t offset = sym_addr - (grub_uint64_t) place;
|
||||||
|
|
||||||
|
if (!grub_arm_64_check_xxxx26_offset (offset))
|
||||||
|
{
|
||||||
|
struct trampoline *tp = mod->trampptr;
|
||||||
|
mod->trampptr = tp + 1;
|
||||||
|
tp->ldr = LDR;
|
||||||
|
tp->br = BR;
|
||||||
|
tp->addr = sym_addr;
|
||||||
|
offset = (grub_uint8_t *) tp - (grub_uint8_t *) place;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!grub_arm_64_check_xxxx26_offset (offset))
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
N_("Trampoline out of range"));
|
||||||
|
|
||||||
|
grub_arm64_set_xxxx26_offset (place, offset);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
reltype);
|
ELF_R_TYPE (rel->r_info));
|
||||||
}
|
|
||||||
|
|
||||||
if (retval != GRUB_ERR_NONE)
|
|
||||||
break;
|
|
||||||
|
|
||||||
rel = (Elf_Rel *) ((grub_addr_t) rel + entsize);
|
|
||||||
rela++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Verify that provided ELF header contains reference to a symbol table
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
has_symtab (Elf_Ehdr * e)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
Elf_Shdr *s;
|
|
||||||
|
|
||||||
for (i = 0, s = (Elf_Shdr *) ((grub_addr_t) e + e->e_shoff);
|
|
||||||
i < e->e_shnum;
|
|
||||||
i++, s = (Elf_Shdr *) ((grub_addr_t) s + e->e_shentsize))
|
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* grub_arch_dl_relocate_symbols():
|
|
||||||
* Locates the relocations section of the ELF object, and calls
|
|
||||||
* do_relX() to deal with it.
|
|
||||||
*/
|
|
||||||
grub_err_t
|
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|
||||||
{
|
|
||||||
Elf_Ehdr *e = ehdr;
|
|
||||||
Elf_Shdr *s;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
if (!has_symtab (e))
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
|
||||||
|
|
||||||
#define FIRST_SHDR(x) ((Elf_Shdr *) ((grub_addr_t)(x) + (x)->e_shoff))
|
|
||||||
#define NEXT_SHDR(x, y) ((Elf_Shdr *) ((grub_addr_t)(y) + (x)->e_shentsize))
|
|
||||||
|
|
||||||
for (i = 0, s = FIRST_SHDR (e); i < e->e_shnum; i++, s = NEXT_SHDR (e, s))
|
|
||||||
{
|
|
||||||
grub_err_t ret;
|
|
||||||
|
|
||||||
switch (s->sh_type)
|
|
||||||
{
|
|
||||||
case SHT_REL:
|
|
||||||
case SHT_RELA:
|
|
||||||
{
|
|
||||||
ret = do_relX (s, e, mod);
|
|
||||||
if (ret != GRUB_ERR_NONE)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SHT_ARM_ATTRIBUTES:
|
|
||||||
case SHT_NOBITS:
|
|
||||||
case SHT_NULL:
|
|
||||||
case SHT_PROGBITS:
|
|
||||||
case SHT_SYMTAB:
|
|
||||||
case SHT_STRTAB:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
grub_dprintf ("dl", "unhandled section_type: %d (0x%08x)\n",
|
|
||||||
s->sh_type, s->sh_type);
|
|
||||||
return GRUB_ERR_NOT_IMPLEMENTED_YET;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef FIRST_SHDR
|
|
||||||
#undef NEXT_SHDR
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -25,46 +25,31 @@
|
|||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/arm64/reloc.h>
|
#include <grub/arm64/reloc.h>
|
||||||
|
|
||||||
static grub_ssize_t
|
|
||||||
sign_compress_offset (grub_ssize_t offset, int bitpos)
|
|
||||||
{
|
|
||||||
return offset & ((1LL << (bitpos + 1)) - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* grub_arm64_reloc_xxxx26():
|
* grub_arm64_reloc_xxxx26():
|
||||||
*
|
*
|
||||||
* JUMP26/CALL26 relocations for B and BL instructions.
|
* JUMP26/CALL26 relocations for B and BL instructions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
grub_err_t
|
int
|
||||||
grub_arm64_reloc_xxxx26 (grub_uint32_t *place, Elf64_Addr adjust)
|
grub_arm_64_check_xxxx26_offset (grub_int64_t offset)
|
||||||
{
|
{
|
||||||
grub_uint32_t insword, insmask;
|
|
||||||
grub_ssize_t offset;
|
|
||||||
const grub_ssize_t offset_low = -(1 << 27), offset_high = (1 << 27) - 1;
|
const grub_ssize_t offset_low = -(1 << 27), offset_high = (1 << 27) - 1;
|
||||||
|
|
||||||
insword = grub_le_to_cpu32 (*place);
|
|
||||||
insmask = 0xfc000000;
|
|
||||||
|
|
||||||
offset = adjust;
|
|
||||||
#ifndef GRUB_UTIL
|
|
||||||
offset -= (grub_addr_t) place;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((offset < offset_low) || (offset > offset_high))
|
if ((offset < offset_low) || (offset > offset_high))
|
||||||
{
|
return 0;
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return 1;
|
||||||
N_("CALL26 Relocation out of range"));
|
}
|
||||||
}
|
|
||||||
|
void
|
||||||
|
grub_arm64_set_xxxx26_offset (grub_uint32_t *place, grub_int64_t offset)
|
||||||
|
{
|
||||||
|
const grub_uint32_t insmask = grub_cpu_to_le32_compile_time (0xfc000000);
|
||||||
|
|
||||||
grub_dprintf ("dl", " reloc_xxxx64 %p %c= 0x%llx\n",
|
grub_dprintf ("dl", " reloc_xxxx64 %p %c= 0x%llx\n",
|
||||||
place, offset > 0 ? '+' : '-',
|
place, offset > 0 ? '+' : '-',
|
||||||
offset < 0 ? (long long) -(unsigned long long) offset : offset);
|
offset < 0 ? (long long) -(unsigned long long) offset : offset);
|
||||||
|
|
||||||
offset = sign_compress_offset (offset, 27) >> 2;
|
*place &= insmask;
|
||||||
|
*place |= grub_cpu_to_le32 (offset >> 2) & ~insmask;
|
||||||
*place = grub_cpu_to_le32 ((insword & insmask) | offset);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,6 @@
|
|||||||
#define GRUB_MODULES_MACHINE_READONLY
|
#define GRUB_MODULES_MACHINE_READONLY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EMU
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
#endif
|
#endif
|
||||||
@ -233,7 +229,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
Elf_Shdr *s;
|
Elf_Shdr *s;
|
||||||
grub_size_t tsize = 0, talign = 1;
|
grub_size_t tsize = 0, talign = 1;
|
||||||
#if defined (__ia64__) || defined (__powerpc__) || defined (__mips__)
|
#if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc__)
|
||||||
grub_size_t tramp;
|
grub_size_t tramp;
|
||||||
grub_size_t got;
|
grub_size_t got;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
@ -249,7 +245,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
|
|||||||
talign = s->sh_addralign;
|
talign = s->sh_addralign;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (__ia64__) || defined (__powerpc__) || defined (__mips__)
|
#if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc__)
|
||||||
err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got);
|
err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
@ -262,21 +258,15 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EMU
|
#ifdef GRUB_MACHINE_EMU
|
||||||
if (talign < 8192 * 16)
|
mod->base = grub_osdep_dl_memalign (talign, tsize);
|
||||||
talign = 8192 * 16;
|
#else
|
||||||
tsize = ALIGN_UP (tsize, 8192 * 16);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mod->base = grub_memalign (talign, tsize);
|
mod->base = grub_memalign (talign, tsize);
|
||||||
|
#endif
|
||||||
if (!mod->base)
|
if (!mod->base)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
mod->sz = tsize;
|
mod->sz = tsize;
|
||||||
ptr = mod->base;
|
ptr = mod->base;
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EMU
|
|
||||||
mprotect (mod->base, tsize, PROT_READ | PROT_WRITE | PROT_EXEC);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0, s = (Elf_Shdr *)((char *) e + e->e_shoff);
|
for (i = 0, s = (Elf_Shdr *)((char *) e + e->e_shoff);
|
||||||
i < e->e_shnum;
|
i < e->e_shnum;
|
||||||
i++, s = (Elf_Shdr *)((char *) s + e->e_shentsize))
|
i++, s = (Elf_Shdr *)((char *) s + e->e_shentsize))
|
||||||
@ -318,12 +308,14 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
|
|||||||
mod->segment = seg;
|
mod->segment = seg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined (__ia64__) || defined (__powerpc__) || defined (__mips__)
|
#if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc__)
|
||||||
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
|
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
|
||||||
mod->tramp = ptr;
|
mod->tramp = ptr;
|
||||||
|
mod->trampptr = ptr;
|
||||||
ptr += tramp;
|
ptr += tramp;
|
||||||
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALIGN);
|
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALIGN);
|
||||||
mod->got = ptr;
|
mod->got = ptr;
|
||||||
|
mod->gotptr = ptr;
|
||||||
ptr += got;
|
ptr += got;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -356,6 +348,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
|
|||||||
#else
|
#else
|
||||||
mod->symtab = (Elf_Sym *) ((char *) e + s->sh_offset);
|
mod->symtab = (Elf_Sym *) ((char *) e + s->sh_offset);
|
||||||
#endif
|
#endif
|
||||||
|
mod->symsize = s->sh_entsize;
|
||||||
sym = mod->symtab;
|
sym = mod->symtab;
|
||||||
size = s->sh_size;
|
size = s->sh_size;
|
||||||
entsize = s->sh_entsize;
|
entsize = s->sh_entsize;
|
||||||
@ -565,6 +558,37 @@ grub_dl_flush_cache (grub_dl_t mod)
|
|||||||
grub_arch_sync_caches (mod->base, mod->sz);
|
grub_arch_sync_caches (mod->base, mod->sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||||
|
{
|
||||||
|
Elf_Ehdr *e = ehdr;
|
||||||
|
Elf_Shdr *s;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
||||||
|
i < e->e_shnum;
|
||||||
|
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
||||||
|
if (s->sh_type == SHT_REL || s->sh_type == SHT_RELA)
|
||||||
|
{
|
||||||
|
grub_dl_segment_t seg;
|
||||||
|
grub_err_t err;
|
||||||
|
|
||||||
|
/* Find the target segment. */
|
||||||
|
for (seg = mod->segment; seg; seg = seg->next)
|
||||||
|
if (seg->section == s->sh_info)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (seg)
|
||||||
|
{
|
||||||
|
err = grub_arch_dl_relocate_symbols (mod, ehdr, s, seg);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load a module from core memory. */
|
/* Load a module from core memory. */
|
||||||
grub_dl_t
|
grub_dl_t
|
||||||
grub_dl_load_core_noinit (void *addr, grub_size_t size)
|
grub_dl_load_core_noinit (void *addr, grub_size_t size)
|
||||||
@ -611,7 +635,7 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size)
|
|||||||
|| grub_dl_resolve_dependencies (mod, e)
|
|| grub_dl_resolve_dependencies (mod, e)
|
||||||
|| grub_dl_load_segments (mod, e)
|
|| grub_dl_load_segments (mod, e)
|
||||||
|| grub_dl_resolve_symbols (mod, e)
|
|| grub_dl_resolve_symbols (mod, e)
|
||||||
|| grub_arch_dl_relocate_symbols (mod, e))
|
|| grub_dl_relocate_symbols (mod, e))
|
||||||
{
|
{
|
||||||
mod->fini = 0;
|
mod->fini = 0;
|
||||||
grub_dl_unload (mod);
|
grub_dl_unload (mod);
|
||||||
@ -761,7 +785,11 @@ grub_dl_unload (grub_dl_t mod)
|
|||||||
grub_free (dep);
|
grub_free (dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GRUB_MACHINE_EMU
|
||||||
|
grub_dl_osdep_dl_free (mod->base);
|
||||||
|
#else
|
||||||
grub_free (mod->base);
|
grub_free (mod->base);
|
||||||
|
#endif
|
||||||
grub_free (mod->name);
|
grub_free (mod->name);
|
||||||
#ifdef GRUB_MODULES_MACHINE_READONLY
|
#ifdef GRUB_MODULES_MACHINE_READONLY
|
||||||
grub_free (mod->symtab);
|
grub_free (mod->symtab);
|
||||||
|
@ -769,12 +769,17 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
|||||||
case GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE:
|
case GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE:
|
||||||
{
|
{
|
||||||
grub_efi_file_path_device_path_t *fp;
|
grub_efi_file_path_device_path_t *fp;
|
||||||
grub_uint8_t buf[(len - 4) * 2 + 1];
|
grub_uint8_t *buf;
|
||||||
fp = (grub_efi_file_path_device_path_t *) dp;
|
fp = (grub_efi_file_path_device_path_t *) dp;
|
||||||
*grub_utf16_to_utf8 (buf, fp->path_name,
|
buf = grub_malloc ((len - 4) * 2 + 1);
|
||||||
(len - 4) / sizeof (grub_efi_char16_t))
|
if (buf)
|
||||||
= '\0';
|
*grub_utf16_to_utf8 (buf, fp->path_name,
|
||||||
|
(len - 4) / sizeof (grub_efi_char16_t))
|
||||||
|
= '\0';
|
||||||
|
else
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
grub_printf ("/File(%s)", buf);
|
grub_printf ("/File(%s)", buf);
|
||||||
|
grub_free (buf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE:
|
case GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE:
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <config-util.h>
|
#include <config-util.h>
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
#if defined(__ia64__)
|
|
||||||
#include <grub/cache.h>
|
#include <grub/cache.h>
|
||||||
|
|
||||||
|
#if defined(__ia64__) || defined (__arm__) || defined (__aarch64__)
|
||||||
|
|
||||||
void __clear_cache (char *beg, char *end);
|
void __clear_cache (char *beg, char *end);
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -9,5 +10,15 @@ grub_arch_sync_caches (void *address, grub_size_t len)
|
|||||||
{
|
{
|
||||||
__clear_cache (address, (char *) address + len);
|
__clear_cache (address, (char *) address + len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined (__mips__)
|
||||||
|
void _flush_cache (void *address, grub_size_t len, int type);
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_arch_sync_caches (void *address, grub_size_t len)
|
||||||
|
{
|
||||||
|
return _flush_cache (address, len, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -6,24 +6,9 @@
|
|||||||
/* Nothing is necessary. */
|
/* Nothing is necessary. */
|
||||||
#elif defined(__sparc__)
|
#elif defined(__sparc__)
|
||||||
#include "../sparc64/cache.S"
|
#include "../sparc64/cache.S"
|
||||||
#elif defined(__mips__)
|
|
||||||
/* On MIPS we must go through standard functions. */
|
|
||||||
#include <grub/symbol.h>
|
|
||||||
|
|
||||||
FUNCTION (grub_cpu_flush_cache)
|
|
||||||
FUNCTION (grub_arch_sync_caches)
|
|
||||||
.set nomacro
|
|
||||||
.set noreorder
|
|
||||||
lui $t0, %hi(_flush_cache)
|
|
||||||
addui $t0, $t0, %lo(_flush_cache)
|
|
||||||
move $a3, $zero
|
|
||||||
jr $t0
|
|
||||||
nop
|
|
||||||
.set reorder
|
|
||||||
.set macro
|
|
||||||
#elif defined(__powerpc__)
|
#elif defined(__powerpc__)
|
||||||
#include "../powerpc/cache.S"
|
#include "../powerpc/cache.S"
|
||||||
#elif defined(__ia64__)
|
#elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || defined(__mips__)
|
||||||
#else
|
#else
|
||||||
#error "No target cpu type is defined"
|
#error "No target cpu type is defined"
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,19 +39,24 @@ grub_arch_dl_check_header (void *ehdr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
(void) mod;
|
(void) mod;
|
||||||
(void) ehdr;
|
(void) ehdr;
|
||||||
|
(void) s;
|
||||||
|
(void) seg;
|
||||||
return GRUB_ERR_BAD_MODULE;
|
return GRUB_ERR_BAD_MODULE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (__ia64__) || defined (__powerpc__) || defined (__mips__)
|
#if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc__)
|
||||||
void grub_arch_dl_get_tramp_got_size (const void *ehdr __attribute__ ((unused)),
|
grub_err_t
|
||||||
grub_size_t *tramp, grub_size_t *got)
|
grub_arch_dl_get_tramp_got_size (const void *ehdr __attribute__ ((unused)),
|
||||||
|
grub_size_t *tramp, grub_size_t *got)
|
||||||
{
|
{
|
||||||
*tramp = 0;
|
*tramp = 0;
|
||||||
*got = 0;
|
*got = 0;
|
||||||
|
return GRUB_ERR_BAD_MODULE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -16,7 +16,14 @@
|
|||||||
#elif defined(__powerpc__)
|
#elif defined(__powerpc__)
|
||||||
#include "../powerpc/dl.c"
|
#include "../powerpc/dl.c"
|
||||||
#elif defined(__ia64__)
|
#elif defined(__ia64__)
|
||||||
|
#include "../ia64/dl_helper.c"
|
||||||
#include "../ia64/dl.c"
|
#include "../ia64/dl.c"
|
||||||
|
#elif defined(__arm__)
|
||||||
|
#include "../arm/dl_helper.c"
|
||||||
|
#include "../arm/dl.c"
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#include "../arm64/dl_helper.c"
|
||||||
|
#include "../arm64/dl.c"
|
||||||
#else
|
#else
|
||||||
#error "No target cpu type is defined"
|
#error "No target cpu type is defined"
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
#include <grub/util/misc.h>
|
#include <grub/util/misc.h>
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
#include "progname.h"
|
#include "progname.h"
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
|
|
||||||
@ -166,6 +168,8 @@ static struct argp argp = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -62,26 +62,3 @@ grub_realloc (void *ptr, grub_size_t size)
|
|||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_MEMALIGN)
|
|
||||||
void *
|
|
||||||
grub_memalign (grub_size_t align, grub_size_t size)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
if (align < sizeof (void *))
|
|
||||||
align = sizeof (void *);
|
|
||||||
|
|
||||||
#if defined(HAVE_POSIX_MEMALIGN)
|
|
||||||
if (posix_memalign (&p, align, size) != 0)
|
|
||||||
p = 0;
|
|
||||||
#elif defined(HAVE_MEMALIGN)
|
|
||||||
p = memalign (align, size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!p)
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -40,75 +40,42 @@ grub_arch_dl_check_header (void *ehdr)
|
|||||||
|
|
||||||
/* Relocate symbols. */
|
/* Relocate symbols. */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
Elf_Ehdr *e = ehdr;
|
Elf_Rel *rel, *max;
|
||||||
Elf_Shdr *s;
|
|
||||||
Elf_Word entsize;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
/* Find a symbol table. */
|
for (rel = (Elf_Rel *) ((char *) ehdr + s->sh_offset),
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
max = (Elf_Rel *) ((char *) rel + s->sh_size);
|
||||||
i < e->e_shnum;
|
rel < max;
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
rel = (Elf_Rel *) ((char *) rel + s->sh_entsize))
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
{
|
||||||
break;
|
Elf_Word *addr;
|
||||||
|
Elf_Sym *sym;
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
||||||
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
|
+ mod->symsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
i < e->e_shnum;
|
{
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
case R_386_32:
|
||||||
if (s->sh_type == SHT_REL)
|
*addr += sym->st_value;
|
||||||
{
|
break;
|
||||||
grub_dl_segment_t seg;
|
|
||||||
|
|
||||||
/* Find the target segment. */
|
case R_386_PC32:
|
||||||
for (seg = mod->segment; seg; seg = seg->next)
|
*addr += (sym->st_value - (grub_addr_t) addr);
|
||||||
if (seg->section == s->sh_info)
|
break;
|
||||||
break;
|
default:
|
||||||
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
if (seg)
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
{
|
ELF_R_TYPE (rel->r_info));
|
||||||
Elf_Rel *rel, *max;
|
}
|
||||||
|
}
|
||||||
for (rel = (Elf_Rel *) ((char *) e + s->sh_offset),
|
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
|
||||||
rel < max;
|
|
||||||
rel++)
|
|
||||||
{
|
|
||||||
Elf_Word *addr;
|
|
||||||
Elf_Sym *sym;
|
|
||||||
|
|
||||||
if (seg->size < rel->r_offset)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
"reloc offset is out of the segment");
|
|
||||||
|
|
||||||
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
|
||||||
sym = (Elf_Sym *) ((char *) mod->symtab
|
|
||||||
+ entsize * ELF_R_SYM (rel->r_info));
|
|
||||||
|
|
||||||
switch (ELF_R_TYPE (rel->r_info))
|
|
||||||
{
|
|
||||||
case R_386_32:
|
|
||||||
*addr += sym->st_value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R_386_PC32:
|
|
||||||
*addr += (sym->st_value - (Elf_Word) seg->addr
|
|
||||||
- rel->r_offset);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
|
||||||
ELF_R_TYPE (rel->r_info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -96,17 +96,8 @@ struct iterator_ctx
|
|||||||
grub_size_t nresources;
|
grub_size_t nresources;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
/* We don't support bridges, so can't have more than 32 devices. */
|
||||||
count_cards (grub_pci_device_t dev __attribute__ ((unused)),
|
#define MAX_DEVICES 32
|
||||||
grub_pci_id_t pciid __attribute__ ((unused)),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
int *cnt = data;
|
|
||||||
|
|
||||||
(*cnt)++;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_resources (grub_pci_device_t dev,
|
find_resources (grub_pci_device_t dev,
|
||||||
@ -116,6 +107,9 @@ find_resources (grub_pci_device_t dev,
|
|||||||
struct iterator_ctx *ctx = data;
|
struct iterator_ctx *ctx = data;
|
||||||
int bar;
|
int bar;
|
||||||
|
|
||||||
|
if (ctx->nresources >= MAX_DEVICES * 6)
|
||||||
|
return 1;
|
||||||
|
|
||||||
for (bar = 0; bar < 6; bar++)
|
for (bar = 0; bar < 6; bar++)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
@ -190,13 +184,10 @@ enable_cards (grub_pci_device_t dev,
|
|||||||
static void
|
static void
|
||||||
grub_pci_assign_addresses (void)
|
grub_pci_assign_addresses (void)
|
||||||
{
|
{
|
||||||
int ncards = 0;
|
|
||||||
struct iterator_ctx ctx;
|
struct iterator_ctx ctx;
|
||||||
|
|
||||||
grub_pci_iterate (count_cards, &ncards);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
struct resource resources[ncards * 6];
|
struct resource resources[MAX_DEVICES * 6];
|
||||||
int done;
|
int done;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
ctx.nresources = 0;
|
ctx.nresources = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* cache.h - Flush the processor's cache. */
|
/* init.c - initialize an ia64-based EFI system */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2004,2007 Free Software Foundation, Inc.
|
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,11 +17,19 @@
|
|||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GRUB_CPU_CACHE_H
|
|
||||||
#define GRUB_CPU_CACHE_H 1
|
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
#include <grub/cache.h>
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_cpu_flush_cache) (void *start, grub_size_t size, int type);
|
void
|
||||||
#endif
|
grub_arch_sync_caches (void *address, grub_size_t len)
|
||||||
|
{
|
||||||
|
/* Cache line length is at least 32. */
|
||||||
|
len += (grub_uint64_t)address & 0x1f;
|
||||||
|
grub_uint64_t a = (grub_uint64_t)address & ~0x1f;
|
||||||
|
|
||||||
|
/* Flush data. */
|
||||||
|
for (len = (len + 31) & ~0x1f; len > 0; len -= 0x20, a += 0x20)
|
||||||
|
asm volatile ("fc.i %0" : : "r" (a));
|
||||||
|
/* Sync and serialize. Maybe extra. */
|
||||||
|
asm volatile (";; sync.i;; srlz.i;;");
|
||||||
|
}
|
@ -46,118 +46,82 @@ grub_arch_dl_check_header (void *ehdr)
|
|||||||
|
|
||||||
/* Relocate symbols. */
|
/* Relocate symbols. */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
Elf_Ehdr *e = ehdr;
|
Elf_Rela *rel, *max;
|
||||||
Elf_Shdr *s;
|
|
||||||
Elf_Word entsize;
|
|
||||||
unsigned i;
|
|
||||||
grub_uint64_t *gp, *gpptr;
|
|
||||||
struct grub_ia64_trampoline *tr;
|
|
||||||
|
|
||||||
gp = (grub_uint64_t *) mod->base;
|
for (rel = (Elf_Rela *) ((char *) ehdr + s->sh_offset),
|
||||||
gpptr = (grub_uint64_t *) mod->got;
|
max = (Elf_Rela *) ((char *) rel + s->sh_size);
|
||||||
tr = mod->tramp;
|
rel < max;
|
||||||
|
rel = (Elf_Rela *) ((char *) rel + s->sh_entsize))
|
||||||
|
{
|
||||||
|
grub_addr_t addr;
|
||||||
|
Elf_Sym *sym;
|
||||||
|
grub_uint64_t value;
|
||||||
|
|
||||||
/* Find a symbol table. */
|
if (seg->size < (rel->r_offset & ~3))
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
i < e->e_shnum;
|
"reloc offset is out of the segment");
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
addr = (grub_addr_t) seg->addr + rel->r_offset;
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
|
+ mod->symsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
/* On the PPC the value does not have an explicit
|
||||||
|
addend, add it. */
|
||||||
|
value = sym->st_value + rel->r_addend;
|
||||||
|
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
i < e->e_shnum;
|
{
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
case R_IA64_PCREL21B:
|
||||||
if (s->sh_type == SHT_RELA)
|
|
||||||
{
|
|
||||||
grub_dl_segment_t seg;
|
|
||||||
|
|
||||||
/* Find the target segment. */
|
|
||||||
for (seg = mod->segment; seg; seg = seg->next)
|
|
||||||
if (seg->section == s->sh_info)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (seg)
|
|
||||||
{
|
{
|
||||||
Elf_Rela *rel, *max;
|
grub_uint64_t noff;
|
||||||
|
struct grub_ia64_trampoline *tr = mod->trampptr;
|
||||||
|
grub_ia64_make_trampoline (tr, value);
|
||||||
|
noff = ((char *) tr - (char *) (addr & ~3)) >> 4;
|
||||||
|
mod->trampptr = tr + 1;
|
||||||
|
|
||||||
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
|
if (noff & ~MASK19)
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
return grub_error (GRUB_ERR_BAD_OS,
|
||||||
rel < max;
|
"trampoline offset too big (%lx)", noff);
|
||||||
rel++)
|
grub_ia64_add_value_to_slot_20b (addr, noff);
|
||||||
{
|
|
||||||
grub_addr_t addr;
|
|
||||||
Elf_Sym *sym;
|
|
||||||
grub_uint64_t value;
|
|
||||||
|
|
||||||
if (seg->size < (rel->r_offset & ~3))
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
"reloc offset is out of the segment");
|
|
||||||
|
|
||||||
addr = (grub_addr_t) seg->addr + rel->r_offset;
|
|
||||||
sym = (Elf_Sym *) ((char *) mod->symtab
|
|
||||||
+ entsize * ELF_R_SYM (rel->r_info));
|
|
||||||
|
|
||||||
/* On the PPC the value does not have an explicit
|
|
||||||
addend, add it. */
|
|
||||||
value = sym->st_value + rel->r_addend;
|
|
||||||
|
|
||||||
switch (ELF_R_TYPE (rel->r_info))
|
|
||||||
{
|
|
||||||
case R_IA64_PCREL21B:
|
|
||||||
{
|
|
||||||
grub_uint64_t noff;
|
|
||||||
grub_ia64_make_trampoline (tr, value);
|
|
||||||
noff = ((char *) tr - (char *) (addr & ~3)) >> 4;
|
|
||||||
tr++;
|
|
||||||
|
|
||||||
if (noff & ~MASK19)
|
|
||||||
return grub_error (GRUB_ERR_BAD_OS,
|
|
||||||
"trampoline offset too big (%lx)", noff);
|
|
||||||
grub_ia64_add_value_to_slot_20b (addr, noff);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case R_IA64_SEGREL64LSB:
|
|
||||||
*(grub_uint64_t *) addr += value - (grub_addr_t) seg->addr;
|
|
||||||
break;
|
|
||||||
case R_IA64_FPTR64LSB:
|
|
||||||
case R_IA64_DIR64LSB:
|
|
||||||
*(grub_uint64_t *) addr += value;
|
|
||||||
break;
|
|
||||||
case R_IA64_PCREL64LSB:
|
|
||||||
*(grub_uint64_t *) addr += value - addr;
|
|
||||||
break;
|
|
||||||
case R_IA64_GPREL22:
|
|
||||||
grub_ia64_add_value_to_slot_21 (addr, value - (grub_addr_t) gp);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R_IA64_LTOFF22X:
|
|
||||||
case R_IA64_LTOFF22:
|
|
||||||
if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
|
|
||||||
value = *(grub_uint64_t *) sym->st_value + rel->r_addend;
|
|
||||||
case R_IA64_LTOFF_FPTR22:
|
|
||||||
*gpptr = value;
|
|
||||||
grub_ia64_add_value_to_slot_21 (addr, (grub_addr_t) gpptr - (grub_addr_t) gp);
|
|
||||||
gpptr++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* We treat LTOFF22X as LTOFF22, so we can ignore LDXMOV. */
|
|
||||||
case R_IA64_LDXMOV:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
|
||||||
ELF_R_TYPE (rel->r_info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
case R_IA64_SEGREL64LSB:
|
||||||
|
*(grub_uint64_t *) addr += value - (grub_addr_t) seg->addr;
|
||||||
|
break;
|
||||||
|
case R_IA64_FPTR64LSB:
|
||||||
|
case R_IA64_DIR64LSB:
|
||||||
|
*(grub_uint64_t *) addr += value;
|
||||||
|
break;
|
||||||
|
case R_IA64_PCREL64LSB:
|
||||||
|
*(grub_uint64_t *) addr += value - addr;
|
||||||
|
break;
|
||||||
|
case R_IA64_GPREL22:
|
||||||
|
grub_ia64_add_value_to_slot_21 (addr, value - (grub_addr_t) mod->base);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R_IA64_LTOFF22X:
|
||||||
|
case R_IA64_LTOFF22:
|
||||||
|
if (ELF_ST_TYPE (sym->st_info) == STT_FUNC)
|
||||||
|
value = *(grub_uint64_t *) sym->st_value + rel->r_addend;
|
||||||
|
case R_IA64_LTOFF_FPTR22:
|
||||||
|
{
|
||||||
|
grub_uint64_t *gpptr = mod->gotptr;
|
||||||
|
*gpptr = value;
|
||||||
|
grub_ia64_add_value_to_slot_21 (addr, (grub_addr_t) gpptr - (grub_addr_t) mod->base);
|
||||||
|
mod->gotptr = gpptr + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* We treat LTOFF22X as LTOFF22, so we can ignore LDXMOV. */
|
||||||
|
case R_IA64_LDXMOV:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
|
ELF_R_TYPE (rel->r_info));
|
||||||
|
}
|
||||||
|
}
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/cache.h>
|
|
||||||
#include <grub/kernel.h>
|
#include <grub/kernel.h>
|
||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
@ -74,16 +73,3 @@ grub_machine_fini (int flags)
|
|||||||
if (flags & GRUB_LOADER_FLAG_NORETURN)
|
if (flags & GRUB_LOADER_FLAG_NORETURN)
|
||||||
grub_efi_fini ();
|
grub_efi_fini ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
grub_arch_sync_caches (void *address, grub_size_t len)
|
|
||||||
{
|
|
||||||
/* Cache line length is at least 32. */
|
|
||||||
grub_uint64_t a = (grub_uint64_t)address & ~0x1f;
|
|
||||||
|
|
||||||
/* Flush data. */
|
|
||||||
for (len = (len + 31) & ~0x1f; len > 0; len -= 0x20, a += 0x20)
|
|
||||||
asm volatile ("fc.i %0" : : "r" (a));
|
|
||||||
/* Sync and serialize. Maybe extra. */
|
|
||||||
asm volatile (";; sync.i;; srlz.i;;");
|
|
||||||
}
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
.set noreorder
|
.set noreorder
|
||||||
.set nomacro
|
.set nomacro
|
||||||
|
|
||||||
FUNCTION (grub_cpu_flush_cache)
|
|
||||||
FUNCTION (grub_arch_sync_caches)
|
FUNCTION (grub_arch_sync_caches)
|
||||||
#include "cache_flush.S"
|
#include "cache_flush.S"
|
||||||
j $ra
|
j $ra
|
||||||
|
@ -58,23 +58,13 @@ grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
|||||||
{
|
{
|
||||||
const Elf_Ehdr *e = ehdr;
|
const Elf_Ehdr *e = ehdr;
|
||||||
const Elf_Shdr *s;
|
const Elf_Shdr *s;
|
||||||
unsigned i;
|
|
||||||
/* FIXME: suboptimal. */
|
/* FIXME: suboptimal. */
|
||||||
grub_size_t gp_size = 0;
|
grub_size_t gp_size = 0;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
*tramp = 0;
|
*tramp = 0;
|
||||||
*got = 0;
|
*got = 0;
|
||||||
|
|
||||||
/* Find a symbol table. */
|
|
||||||
for (i = 0, s = (const Elf_Shdr *) ((const char *) e + e->e_shoff);
|
|
||||||
i < e->e_shnum;
|
|
||||||
i++, s = (const Elf_Shdr *) ((const char *) s + e->e_shentsize))
|
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
|
||||||
|
|
||||||
for (i = 0, s = (const Elf_Shdr *) ((const char *) e + e->e_shoff);
|
for (i = 0, s = (const Elf_Shdr *) ((const char *) e + e->e_shoff);
|
||||||
i < e->e_shnum;
|
i < e->e_shnum;
|
||||||
i++, s = (const Elf_Shdr *) ((const char *) s + e->e_shentsize))
|
i++, s = (const Elf_Shdr *) ((const char *) s + e->e_shentsize))
|
||||||
@ -106,192 +96,166 @@ grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
|||||||
|
|
||||||
/* Relocate symbols. */
|
/* Relocate symbols. */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
Elf_Ehdr *e = ehdr;
|
|
||||||
Elf_Shdr *s;
|
|
||||||
Elf_Word entsize;
|
|
||||||
unsigned i;
|
|
||||||
/* FIXME: suboptimal. */
|
|
||||||
grub_uint32_t *gp, *gpptr;
|
|
||||||
grub_uint32_t gp0;
|
grub_uint32_t gp0;
|
||||||
|
Elf_Ehdr *e = ehdr;
|
||||||
|
|
||||||
/* Find a symbol table. */
|
if (!mod->reginfo)
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
{
|
||||||
i < e->e_shnum;
|
unsigned i;
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
Elf_Shdr *ri;
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
/* Find reginfo. */
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
for (i = 0, ri = (Elf_Shdr *) ((char *) ehdr + e->e_shoff);
|
||||||
|
i < e->e_shnum;
|
||||||
|
i++, ri = (Elf_Shdr *) ((char *) ri + e->e_shentsize))
|
||||||
|
if (ri->sh_type == SHT_MIPS_REGINFO)
|
||||||
|
break;
|
||||||
|
if (i == e->e_shnum)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE, "no reginfo found");
|
||||||
|
mod->reginfo = (grub_uint32_t *)((char *) ehdr + ri->sh_offset);
|
||||||
|
}
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
gp0 = mod->reginfo[5];
|
||||||
|
Elf_Rel *rel, *max;
|
||||||
|
|
||||||
/* Find reginfo. */
|
for (rel = (Elf_Rel *) ((char *) e + s->sh_offset),
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
max = (Elf_Rel *) ((char *) rel + s->sh_size);
|
||||||
i < e->e_shnum;
|
rel < max;
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
rel = (Elf_Rel *) ((char *) rel + s->sh_entsize))
|
||||||
if (s->sh_type == SHT_MIPS_REGINFO)
|
{
|
||||||
break;
|
grub_uint8_t *addr;
|
||||||
|
Elf_Sym *sym;
|
||||||
|
grub_uint32_t sym_value;
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, "no reginfo found");
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
gp0 = ((grub_uint32_t *)((char *) e + s->sh_offset))[5];
|
addr = (grub_uint8_t *) ((char *) seg->addr + rel->r_offset);
|
||||||
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
gpptr = gp = mod->got;
|
+ mod->symsize * ELF_R_SYM (rel->r_info));
|
||||||
|
sym_value = sym->st_value;
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
if (sym_value == (grub_addr_t) &__gnu_local_gp_dummy)
|
||||||
i < e->e_shnum;
|
sym_value = (grub_addr_t) mod->got;
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
else if (sym_value == (grub_addr_t) &_gp_disp_dummy)
|
||||||
if (s->sh_type == SHT_REL)
|
{
|
||||||
{
|
sym_value = (grub_addr_t) mod->got - (grub_addr_t) addr;
|
||||||
grub_dl_segment_t seg;
|
if (ELF_R_TYPE (rel->r_info) == R_MIPS_LO16)
|
||||||
|
/* ABI mandates +4 even if partner lui doesn't
|
||||||
/* Find the target segment. */
|
immediately precede addiu. */
|
||||||
for (seg = mod->segment; seg; seg = seg->next)
|
sym_value += 4;
|
||||||
if (seg->section == s->sh_info)
|
}
|
||||||
break;
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
|
{
|
||||||
if (seg)
|
case R_MIPS_HI16:
|
||||||
{
|
{
|
||||||
Elf_Rel *rel, *max;
|
grub_uint32_t value;
|
||||||
|
Elf_Rel *rel2;
|
||||||
for (rel = (Elf_Rel *) ((char *) e + s->sh_offset),
|
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
|
||||||
rel < max;
|
|
||||||
rel++)
|
|
||||||
{
|
|
||||||
grub_uint8_t *addr;
|
|
||||||
Elf_Sym *sym;
|
|
||||||
grub_uint32_t sym_value;
|
|
||||||
|
|
||||||
if (seg->size < rel->r_offset)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
"reloc offset is out of the segment");
|
|
||||||
|
|
||||||
addr = (grub_uint8_t *) ((char *) seg->addr + rel->r_offset);
|
|
||||||
sym = (Elf_Sym *) ((char *) mod->symtab
|
|
||||||
+ entsize * ELF_R_SYM (rel->r_info));
|
|
||||||
sym_value = sym->st_value;
|
|
||||||
if (sym_value == (grub_addr_t) &__gnu_local_gp_dummy)
|
|
||||||
sym_value = (grub_addr_t) gp;
|
|
||||||
else if (sym_value == (grub_addr_t) &_gp_disp_dummy)
|
|
||||||
{
|
|
||||||
sym_value = (grub_addr_t) gp - (grub_addr_t) addr;
|
|
||||||
if (ELF_R_TYPE (rel->r_info) == R_MIPS_LO16)
|
|
||||||
/* ABI mandates +4 even if partner lui doesn't
|
|
||||||
immediately precede addiu. */
|
|
||||||
sym_value += 4;
|
|
||||||
}
|
|
||||||
switch (ELF_R_TYPE (rel->r_info))
|
|
||||||
{
|
|
||||||
case R_MIPS_HI16:
|
|
||||||
{
|
|
||||||
grub_uint32_t value;
|
|
||||||
Elf_Rel *rel2;
|
|
||||||
|
|
||||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
addr += 2;
|
addr += 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Handle partner lo16 relocation. Lower part is
|
/* Handle partner lo16 relocation. Lower part is
|
||||||
treated as signed. Hence add 0x8000 to compensate.
|
treated as signed. Hence add 0x8000 to compensate.
|
||||||
*/
|
*/
|
||||||
value = (*(grub_uint16_t *) addr << 16)
|
value = (*(grub_uint16_t *) addr << 16)
|
||||||
+ sym_value + 0x8000;
|
+ sym_value + 0x8000;
|
||||||
for (rel2 = rel + 1; rel2 < max; rel2++)
|
for (rel2 = rel + 1; rel2 < max; rel2++)
|
||||||
if (ELF_R_SYM (rel2->r_info)
|
if (ELF_R_SYM (rel2->r_info)
|
||||||
== ELF_R_SYM (rel->r_info)
|
== ELF_R_SYM (rel->r_info)
|
||||||
&& ELF_R_TYPE (rel2->r_info) == R_MIPS_LO16)
|
&& ELF_R_TYPE (rel2->r_info) == R_MIPS_LO16)
|
||||||
{
|
{
|
||||||
value += *(grub_int16_t *)
|
value += *(grub_int16_t *)
|
||||||
((char *) seg->addr + rel2->r_offset
|
((char *) seg->addr + rel2->r_offset
|
||||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
+ 2
|
+ 2
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*(grub_uint16_t *) addr = (value >> 16) & 0xffff;
|
*(grub_uint16_t *) addr = (value >> 16) & 0xffff;
|
||||||
}
|
|
||||||
break;
|
|
||||||
case R_MIPS_LO16:
|
|
||||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
|
||||||
addr += 2;
|
|
||||||
#endif
|
|
||||||
*(grub_uint16_t *) addr += sym_value & 0xffff;
|
|
||||||
break;
|
|
||||||
case R_MIPS_32:
|
|
||||||
*(grub_uint32_t *) addr += sym_value;
|
|
||||||
break;
|
|
||||||
case R_MIPS_GPREL32:
|
|
||||||
*(grub_uint32_t *) addr = sym_value
|
|
||||||
+ *(grub_uint32_t *) addr + gp0 - (grub_uint32_t)gp;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R_MIPS_26:
|
|
||||||
{
|
|
||||||
grub_uint32_t value;
|
|
||||||
grub_uint32_t raw;
|
|
||||||
raw = (*(grub_uint32_t *) addr) & 0x3ffffff;
|
|
||||||
value = raw << 2;
|
|
||||||
value += sym_value;
|
|
||||||
raw = (value >> 2) & 0x3ffffff;
|
|
||||||
|
|
||||||
*(grub_uint32_t *) addr =
|
|
||||||
raw | ((*(grub_uint32_t *) addr) & 0xfc000000);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case R_MIPS_GOT16:
|
|
||||||
if (ELF_ST_BIND (sym->st_info) == STB_LOCAL)
|
|
||||||
{
|
|
||||||
Elf_Rel *rel2;
|
|
||||||
/* Handle partner lo16 relocation. Lower part is
|
|
||||||
treated as signed. Hence add 0x8000 to compensate.
|
|
||||||
*/
|
|
||||||
sym_value += (*(grub_uint16_t *) addr << 16)
|
|
||||||
+ 0x8000;
|
|
||||||
for (rel2 = rel + 1; rel2 < max; rel2++)
|
|
||||||
if (ELF_R_SYM (rel2->r_info)
|
|
||||||
== ELF_R_SYM (rel->r_info)
|
|
||||||
&& ELF_R_TYPE (rel2->r_info) == R_MIPS_LO16)
|
|
||||||
{
|
|
||||||
sym_value += *(grub_int16_t *)
|
|
||||||
((char *) seg->addr + rel2->r_offset
|
|
||||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
|
||||||
+ 2
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sym_value &= 0xffff0000;
|
|
||||||
*(grub_uint16_t *) addr = 0;
|
|
||||||
}
|
|
||||||
case R_MIPS_CALL16:
|
|
||||||
/* FIXME: reuse*/
|
|
||||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
|
||||||
addr += 2;
|
|
||||||
#endif
|
|
||||||
*gpptr = sym_value + *(grub_uint16_t *) addr;
|
|
||||||
*(grub_uint16_t *) addr
|
|
||||||
= sizeof (grub_uint32_t) * (gpptr - gp);
|
|
||||||
gpptr++;
|
|
||||||
break;
|
|
||||||
case R_MIPS_JALR:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
|
||||||
ELF_R_TYPE (rel->r_info));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
case R_MIPS_LO16:
|
||||||
|
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
|
addr += 2;
|
||||||
|
#endif
|
||||||
|
*(grub_uint16_t *) addr += sym_value & 0xffff;
|
||||||
|
break;
|
||||||
|
case R_MIPS_32:
|
||||||
|
*(grub_uint32_t *) addr += sym_value;
|
||||||
|
break;
|
||||||
|
case R_MIPS_GPREL32:
|
||||||
|
*(grub_uint32_t *) addr = sym_value
|
||||||
|
+ *(grub_uint32_t *) addr + gp0 - (grub_uint32_t)mod->got;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R_MIPS_26:
|
||||||
|
{
|
||||||
|
grub_uint32_t value;
|
||||||
|
grub_uint32_t raw;
|
||||||
|
raw = (*(grub_uint32_t *) addr) & 0x3ffffff;
|
||||||
|
value = raw << 2;
|
||||||
|
value += sym_value;
|
||||||
|
raw = (value >> 2) & 0x3ffffff;
|
||||||
|
|
||||||
|
*(grub_uint32_t *) addr =
|
||||||
|
raw | ((*(grub_uint32_t *) addr) & 0xfc000000);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case R_MIPS_GOT16:
|
||||||
|
if (ELF_ST_BIND (sym->st_info) == STB_LOCAL)
|
||||||
|
{
|
||||||
|
Elf_Rel *rel2;
|
||||||
|
/* Handle partner lo16 relocation. Lower part is
|
||||||
|
treated as signed. Hence add 0x8000 to compensate.
|
||||||
|
*/
|
||||||
|
sym_value += (*(grub_uint16_t *) addr << 16)
|
||||||
|
+ 0x8000;
|
||||||
|
for (rel2 = rel + 1; rel2 < max; rel2++)
|
||||||
|
if (ELF_R_SYM (rel2->r_info)
|
||||||
|
== ELF_R_SYM (rel->r_info)
|
||||||
|
&& ELF_R_TYPE (rel2->r_info) == R_MIPS_LO16)
|
||||||
|
{
|
||||||
|
sym_value += *(grub_int16_t *)
|
||||||
|
((char *) seg->addr + rel2->r_offset
|
||||||
|
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
|
+ 2
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sym_value &= 0xffff0000;
|
||||||
|
*(grub_uint16_t *) addr = 0;
|
||||||
|
}
|
||||||
|
case R_MIPS_CALL16:
|
||||||
|
{
|
||||||
|
grub_uint32_t *gpptr = mod->gotptr;
|
||||||
|
/* FIXME: reuse*/
|
||||||
|
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
|
addr += 2;
|
||||||
|
#endif
|
||||||
|
*gpptr = sym_value + *(grub_uint16_t *) addr;
|
||||||
|
*(grub_uint16_t *) addr
|
||||||
|
= sizeof (grub_uint32_t) * (gpptr - (grub_uint32_t *) mod->got);
|
||||||
|
mod->gotptr = gpptr + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case R_MIPS_JALR:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
|
ELF_R_TYPE (rel->r_info));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
|
|||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GRUB_UTIL
|
#if !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
||||||
|
|
||||||
#if defined (__arm__)
|
#if defined (__arm__)
|
||||||
|
|
||||||
|
@ -101,109 +101,77 @@ grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
|||||||
|
|
||||||
/* Relocate symbols. */
|
/* Relocate symbols. */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
Elf_Ehdr *e = ehdr;
|
Elf_Rela *rel, *max;
|
||||||
Elf_Shdr *s;
|
|
||||||
Elf_Word entsize;
|
|
||||||
unsigned i;
|
|
||||||
struct trampoline *tptr = mod->tramp;
|
|
||||||
|
|
||||||
/* Find a symbol table. */
|
for (rel = (Elf_Rela *) ((char *) ehdr + s->sh_offset),
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
max = (Elf_Rela *) ((char *) rel + s->sh_size);
|
||||||
i < e->e_shnum;
|
rel < max;
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
rel = (Elf_Rela *) ((char *) rel + s->sh_entsize))
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
{
|
||||||
break;
|
Elf_Word *addr;
|
||||||
|
Elf_Sym *sym;
|
||||||
|
grub_uint32_t value;
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
||||||
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
|
+ mod->symsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
/* On the PPC the value does not have an explicit
|
||||||
i < e->e_shnum;
|
addend, add it. */
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
value = sym->st_value + rel->r_addend;
|
||||||
if (s->sh_type == SHT_RELA)
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
{
|
{
|
||||||
grub_dl_segment_t seg;
|
case GRUB_ELF_R_PPC_ADDR16_LO:
|
||||||
|
*(Elf_Half *) addr = value;
|
||||||
|
break;
|
||||||
|
|
||||||
/* Find the target segment. */
|
case GRUB_ELF_R_PPC_REL24:
|
||||||
for (seg = mod->segment; seg; seg = seg->next)
|
|
||||||
if (seg->section == s->sh_info)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (seg)
|
|
||||||
{
|
{
|
||||||
Elf_Rela *rel, *max;
|
Elf_Sword delta = value - (Elf_Word) addr;
|
||||||
|
|
||||||
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
|
if (delta << 6 >> 6 != delta)
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
|
||||||
rel < max;
|
|
||||||
rel++)
|
|
||||||
{
|
{
|
||||||
Elf_Word *addr;
|
struct trampoline *tptr = mod->trampptr;
|
||||||
Elf_Sym *sym;
|
grub_memcpy (tptr, &trampoline_template,
|
||||||
grub_uint32_t value;
|
sizeof (*tptr));
|
||||||
|
delta = (grub_uint8_t *) tptr - (grub_uint8_t *) addr;
|
||||||
if (seg->size < rel->r_offset)
|
tptr->lis |= (((value) >> 16) & 0xffff);
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
tptr->ori |= ((value) & 0xffff);
|
||||||
"reloc offset is out of the segment");
|
mod->trampptr = tptr + 1;
|
||||||
|
|
||||||
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
|
||||||
sym = (Elf_Sym *) ((char *) mod->symtab
|
|
||||||
+ entsize * ELF_R_SYM (rel->r_info));
|
|
||||||
|
|
||||||
/* On the PPC the value does not have an explicit
|
|
||||||
addend, add it. */
|
|
||||||
value = sym->st_value + rel->r_addend;
|
|
||||||
switch (ELF_R_TYPE (rel->r_info))
|
|
||||||
{
|
|
||||||
case GRUB_ELF_R_PPC_ADDR16_LO:
|
|
||||||
*(Elf_Half *) addr = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_ELF_R_PPC_REL24:
|
|
||||||
{
|
|
||||||
Elf_Sword delta = value - (Elf_Word) addr;
|
|
||||||
|
|
||||||
if (delta << 6 >> 6 != delta)
|
|
||||||
{
|
|
||||||
grub_memcpy (tptr, &trampoline_template,
|
|
||||||
sizeof (*tptr));
|
|
||||||
delta = (grub_uint8_t *) tptr - (grub_uint8_t *) addr;
|
|
||||||
tptr->lis |= (((value) >> 16) & 0xffff);
|
|
||||||
tptr->ori |= ((value) & 0xffff);
|
|
||||||
tptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delta << 6 >> 6 != delta)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
"relocation overflow");
|
|
||||||
*addr = (*addr & 0xfc000003) | (delta & 0x3fffffc);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case GRUB_ELF_R_PPC_ADDR16_HA:
|
|
||||||
*(Elf_Half *) addr = (value + 0x8000) >> 16;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_ELF_R_PPC_ADDR32:
|
|
||||||
*addr = value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_ELF_R_PPC_REL32:
|
|
||||||
*addr = value - (Elf_Word) addr;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
|
||||||
ELF_R_TYPE (rel->r_info));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (delta << 6 >> 6 != delta)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"relocation overflow");
|
||||||
|
*addr = (*addr & 0xfc000003) | (delta & 0x3fffffc);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
case GRUB_ELF_R_PPC_ADDR16_HA:
|
||||||
|
*(Elf_Half *) addr = (value + 0x8000) >> 16;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GRUB_ELF_R_PPC_ADDR32:
|
||||||
|
*addr = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GRUB_ELF_R_PPC_REL32:
|
||||||
|
*addr = value - (Elf_Word) addr;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
|
ELF_R_TYPE (rel->r_info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -42,106 +42,74 @@ grub_arch_dl_check_header (void *ehdr)
|
|||||||
|
|
||||||
/* Relocate symbols. */
|
/* Relocate symbols. */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
Elf_Ehdr *e = ehdr;
|
Elf_Rela *rel, *max;
|
||||||
Elf_Shdr *s;
|
|
||||||
Elf_Word entsize;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
/* Find a symbol table. */
|
for (rel = (Elf_Rela *) ((char *) ehdr + s->sh_offset),
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
max = (Elf_Rela *) ((char *) rel + s->sh_size);
|
||||||
i < e->e_shnum;
|
rel < max;
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
rel = (Elf_Rela *) ((char *) rel + s->sh_entsize))
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
{
|
||||||
break;
|
Elf_Word *addr;
|
||||||
|
Elf_Sym *sym;
|
||||||
|
Elf_Addr value;
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
||||||
|
sym = (Elf_Sym *) ((char *) mod->symtab
|
||||||
|
+ mod->symsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
|
value = sym->st_value + rel->r_addend;
|
||||||
i < e->e_shnum;
|
switch (ELF_R_TYPE (rel->r_info) & 0xff)
|
||||||
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
|
{
|
||||||
if (s->sh_type == SHT_RELA)
|
case R_SPARC_32: /* 3 V-word32 */
|
||||||
{
|
if (value & 0xFFFFFFFF00000000)
|
||||||
grub_dl_segment_t seg;
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"address out of 32 bits range");
|
||||||
/* Find the target segment. */
|
*addr = value;
|
||||||
for (seg = mod->segment; seg; seg = seg->next)
|
break;
|
||||||
if (seg->section == s->sh_info)
|
case R_SPARC_WDISP30: /* 7 V-disp30 */
|
||||||
break;
|
if (((value - (Elf_Addr) addr) & 0xFFFFFFFF00000000) &&
|
||||||
|
(((value - (Elf_Addr) addr) & 0xFFFFFFFF00000000)
|
||||||
if (seg)
|
!= 0xFFFFFFFF00000000))
|
||||||
{
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
Elf_Rela *rel, *max;
|
"displacement out of 30 bits range");
|
||||||
|
*addr = (*addr & 0xC0000000) |
|
||||||
for (rel = (Elf_Rela *) ((char *) e + s->sh_offset),
|
(((grub_int32_t) ((value - (Elf_Addr) addr) >> 2)) &
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
0x3FFFFFFF);
|
||||||
rel < max;
|
break;
|
||||||
rel++)
|
case R_SPARC_HH22: /* 9 V-imm22 */
|
||||||
{
|
*addr = (*addr & 0xFFC00000) | ((value >> 42) & 0x3FFFFF);
|
||||||
Elf_Word *addr;
|
break;
|
||||||
Elf_Sym *sym;
|
case R_SPARC_HM10: /* 12 T-simm13 */
|
||||||
Elf_Addr value;
|
*addr = (*addr & 0xFFFFFC00) | ((value >> 32) & 0x3FF);
|
||||||
|
break;
|
||||||
if (seg->size < rel->r_offset)
|
case R_SPARC_HI22: /* 9 V-imm22 */
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
*addr = (*addr & 0xFFC00000) | ((value >> 10) & 0x3FFFFF);
|
||||||
"reloc offset is out of the segment");
|
break;
|
||||||
|
case R_SPARC_LO10: /* 12 T-simm13 */
|
||||||
addr = (Elf_Word *) ((char *) seg->addr + rel->r_offset);
|
*addr = (*addr & 0xFFFFFC00) | (value & 0x3FF);
|
||||||
sym = (Elf_Sym *) ((char *) mod->symtab
|
break;
|
||||||
+ entsize * ELF_R_SYM (rel->r_info));
|
case R_SPARC_64: /* 32 V-xwords64 */
|
||||||
|
*(Elf_Xword *) addr = value;
|
||||||
value = sym->st_value + rel->r_addend;
|
break;
|
||||||
switch (ELF_R_TYPE (rel->r_info) & 0xff)
|
case R_SPARC_OLO10:
|
||||||
{
|
*addr = (*addr & ~0x1fff)
|
||||||
case R_SPARC_32: /* 3 V-word32 */
|
| (((value & 0x3ff) +
|
||||||
if (value & 0xFFFFFFFF00000000)
|
(ELF_R_TYPE (rel->r_info) >> 8))
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
& 0x1fff);
|
||||||
"address out of 32 bits range");
|
break;
|
||||||
*addr = value;
|
default:
|
||||||
break;
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
case R_SPARC_WDISP30: /* 7 V-disp30 */
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
if (((value - (Elf_Addr) addr) & 0xFFFFFFFF00000000) &&
|
ELF_R_TYPE (rel->r_info));
|
||||||
(((value - (Elf_Addr) addr) & 0xFFFFFFFF00000000)
|
}
|
||||||
!= 0xFFFFFFFF00000000))
|
}
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
"displacement out of 30 bits range");
|
|
||||||
*addr = (*addr & 0xC0000000) |
|
|
||||||
(((grub_int32_t) ((value - (Elf_Addr) addr) >> 2)) &
|
|
||||||
0x3FFFFFFF);
|
|
||||||
break;
|
|
||||||
case R_SPARC_HH22: /* 9 V-imm22 */
|
|
||||||
*addr = (*addr & 0xFFC00000) | ((value >> 42) & 0x3FFFFF);
|
|
||||||
break;
|
|
||||||
case R_SPARC_HM10: /* 12 T-simm13 */
|
|
||||||
*addr = (*addr & 0xFFFFFC00) | ((value >> 32) & 0x3FF);
|
|
||||||
break;
|
|
||||||
case R_SPARC_HI22: /* 9 V-imm22 */
|
|
||||||
*addr = (*addr & 0xFFC00000) | ((value >> 10) & 0x3FFFFF);
|
|
||||||
break;
|
|
||||||
case R_SPARC_LO10: /* 12 T-simm13 */
|
|
||||||
*addr = (*addr & 0xFFFFFC00) | (value & 0x3FF);
|
|
||||||
break;
|
|
||||||
case R_SPARC_64: /* 32 V-xwords64 */
|
|
||||||
*(Elf_Xword *) addr = value;
|
|
||||||
break;
|
|
||||||
case R_SPARC_OLO10:
|
|
||||||
*addr = (*addr & ~0x1fff)
|
|
||||||
| (((value & 0x3ff) +
|
|
||||||
(ELF_R_TYPE (rel->r_info) >> 8))
|
|
||||||
& 0x1fff);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
|
||||||
ELF_R_TYPE (rel->r_info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,14 @@ codestart:
|
|||||||
/* Copy the modules past the end of the kernel image.
|
/* Copy the modules past the end of the kernel image.
|
||||||
* They are currently sitting in the BSS.
|
* They are currently sitting in the BSS.
|
||||||
*/
|
*/
|
||||||
sethi %hi(__bss_start), %o2
|
sethi %hi(__bss_start + GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN - 1), %o2
|
||||||
or %o2, %lo(__bss_start), %o2
|
or %o2, %lo(__bss_start + GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN - 1), %o2
|
||||||
sethi %hi(_end), %o3
|
srl %o2, GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN, %o2
|
||||||
or %o3, %lo(_end), %o3
|
sll %o2, GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN, %o2
|
||||||
|
sethi %hi(_end + GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN - 1), %o3
|
||||||
|
or %o3, %lo(_end + GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN - 1), %o3
|
||||||
|
srl %o3, GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN, %o3
|
||||||
|
sll %o3, GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN, %o3
|
||||||
sethi %hi(grub_total_module_size), %o4
|
sethi %hi(grub_total_module_size), %o4
|
||||||
lduw [%o4 + %lo(grub_total_module_size)], %o4
|
lduw [%o4 + %lo(grub_total_module_size)], %o4
|
||||||
|
|
||||||
@ -67,16 +71,34 @@ codestart:
|
|||||||
/* Now it's safe to clear out the BSS. */
|
/* Now it's safe to clear out the BSS. */
|
||||||
sethi %hi(__bss_start), %o2
|
sethi %hi(__bss_start), %o2
|
||||||
or %o2, %lo(__bss_start), %o2
|
or %o2, %lo(__bss_start), %o2
|
||||||
sethi %hi(_end), %o3
|
1: stb %g0, [%o2]
|
||||||
or %o3, %lo(_end), %o3
|
add %o2, 1, %o2
|
||||||
|
and %o2, 7, %o3
|
||||||
|
brnz %o3, 1b
|
||||||
|
nop
|
||||||
|
|
||||||
|
sethi %hi(_end - 1), %o3
|
||||||
|
or %o3, %lo(_end - 1), %o3
|
||||||
|
srl %o3, 3, %o3
|
||||||
|
sll %o3, 3, %o3
|
||||||
1: stx %g0, [%o2]
|
1: stx %g0, [%o2]
|
||||||
add %o2, 8, %o2
|
add %o2, 8, %o2
|
||||||
cmp %o2, %o3
|
cmp %o2, %o3
|
||||||
blt,pt %xcc, 1b
|
blt,pt %xcc, 1b
|
||||||
nop
|
nop
|
||||||
|
|
||||||
|
sethi %hi(_end), %o3
|
||||||
|
or %o3, %lo(_end), %o3
|
||||||
|
1: stb %g0, [%o2]
|
||||||
|
add %o2, 1, %o2
|
||||||
|
cmp %o2, %o3
|
||||||
|
blt,pt %xcc, 1b
|
||||||
|
nop
|
||||||
|
|
||||||
sethi %hi(grub_ieee1275_original_stack), %o2
|
sethi %hi(grub_ieee1275_original_stack), %o2
|
||||||
stx %o1, [%o2 + %lo(grub_ieee1275_original_stack)]
|
stx %o1, [%o2 + %lo(grub_ieee1275_original_stack)]
|
||||||
sethi %hi(grub_ieee1275_entry_fn), %o2
|
sethi %hi(grub_ieee1275_entry_fn), %o2
|
||||||
call grub_main
|
call grub_main
|
||||||
stx %o0, [%o2 + %lo(grub_ieee1275_entry_fn)]
|
stx %o0, [%o2 + %lo(grub_ieee1275_entry_fn)]
|
||||||
1: ba,a 1b
|
1: ba,a 1b
|
||||||
|
nop
|
||||||
|
@ -61,7 +61,13 @@ grub_uboot_get_boot_data (void)
|
|||||||
static grub_uint64_t
|
static grub_uint64_t
|
||||||
uboot_timer_ms (void)
|
uboot_timer_ms (void)
|
||||||
{
|
{
|
||||||
return (grub_uint64_t) grub_uboot_get_timer (timer_start) / 1000;
|
static grub_uint32_t last = 0, high = 0;
|
||||||
|
grub_uint32_t cur = grub_uboot_get_timer (timer_start);
|
||||||
|
if (cur < last)
|
||||||
|
high++;
|
||||||
|
last = cur;
|
||||||
|
return grub_divmod64 ((((grub_uint64_t) high) << 32) | cur,
|
||||||
|
1000, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -40,101 +40,69 @@ grub_arch_dl_check_header (void *ehdr)
|
|||||||
|
|
||||||
/* Relocate symbols. */
|
/* Relocate symbols. */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg)
|
||||||
{
|
{
|
||||||
Elf64_Ehdr *e = ehdr;
|
Elf64_Rela *rel, *max;
|
||||||
Elf64_Shdr *s;
|
|
||||||
Elf64_Word entsize;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
/* Find a symbol table. */
|
for (rel = (Elf64_Rela *) ((char *) ehdr + s->sh_offset),
|
||||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + e->e_shoff);
|
max = (Elf64_Rela *) ((char *) rel + s->sh_size);
|
||||||
i < e->e_shnum;
|
rel < max;
|
||||||
i++, s = (Elf64_Shdr *) ((char *) s + e->e_shentsize))
|
rel = (Elf64_Rela *) ((char *) rel + s->sh_entsize))
|
||||||
if (s->sh_type == SHT_SYMTAB)
|
{
|
||||||
break;
|
Elf64_Word *addr32;
|
||||||
|
Elf64_Xword *addr64;
|
||||||
|
Elf64_Sym *sym;
|
||||||
|
|
||||||
if (i == e->e_shnum)
|
if (seg->size < rel->r_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, N_("no symbol table"));
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"reloc offset is out of the segment");
|
||||||
|
|
||||||
entsize = s->sh_entsize;
|
addr32 = (Elf64_Word *) ((char *) seg->addr + rel->r_offset);
|
||||||
|
addr64 = (Elf64_Xword *) addr32;
|
||||||
|
sym = (Elf64_Sym *) ((char *) mod->symtab
|
||||||
|
+ mod->symsize * ELF_R_SYM (rel->r_info));
|
||||||
|
|
||||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + e->e_shoff);
|
switch (ELF_R_TYPE (rel->r_info))
|
||||||
i < e->e_shnum;
|
{
|
||||||
i++, s = (Elf64_Shdr *) ((char *) s + e->e_shentsize))
|
case R_X86_64_64:
|
||||||
if (s->sh_type == SHT_RELA)
|
*addr64 += rel->r_addend + sym->st_value;
|
||||||
{
|
break;
|
||||||
grub_dl_segment_t seg;
|
|
||||||
|
|
||||||
/* Find the target segment. */
|
case R_X86_64_PC32:
|
||||||
for (seg = mod->segment; seg; seg = seg->next)
|
|
||||||
if (seg->section == s->sh_info)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (seg)
|
|
||||||
{
|
{
|
||||||
Elf64_Rela *rel, *max;
|
grub_int64_t value;
|
||||||
|
value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
|
||||||
for (rel = (Elf64_Rela *) ((char *) e + s->sh_offset),
|
(Elf64_Xword) seg->addr - rel->r_offset;
|
||||||
max = rel + s->sh_size / s->sh_entsize;
|
if (value != (grub_int32_t) value)
|
||||||
rel < max;
|
return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
|
||||||
rel++)
|
*addr32 = value;
|
||||||
{
|
|
||||||
Elf64_Word *addr32;
|
|
||||||
Elf64_Xword *addr64;
|
|
||||||
Elf64_Sym *sym;
|
|
||||||
|
|
||||||
if (seg->size < rel->r_offset)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
|
||||||
"reloc offset is out of the segment");
|
|
||||||
|
|
||||||
addr32 = (Elf64_Word *) ((char *) seg->addr + rel->r_offset);
|
|
||||||
addr64 = (Elf64_Xword *) addr32;
|
|
||||||
sym = (Elf64_Sym *) ((char *) mod->symtab
|
|
||||||
+ entsize * ELF_R_SYM (rel->r_info));
|
|
||||||
|
|
||||||
switch (ELF_R_TYPE (rel->r_info))
|
|
||||||
{
|
|
||||||
case R_X86_64_64:
|
|
||||||
*addr64 += rel->r_addend + sym->st_value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R_X86_64_PC32:
|
|
||||||
{
|
|
||||||
grub_int64_t value;
|
|
||||||
value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
|
|
||||||
(Elf64_Xword) seg->addr - rel->r_offset;
|
|
||||||
if (value != (grub_int32_t) value)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
|
|
||||||
*addr32 = value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R_X86_64_32:
|
|
||||||
{
|
|
||||||
grub_uint64_t value = *addr32 + rel->r_addend + sym->st_value;
|
|
||||||
if (value != (grub_uint32_t) value)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
|
|
||||||
*addr32 = value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case R_X86_64_32S:
|
|
||||||
{
|
|
||||||
grub_int64_t value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value;
|
|
||||||
if (value != (grub_int32_t) value)
|
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
|
|
||||||
*addr32 = value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
||||||
N_("relocation 0x%x is not implemented yet"),
|
|
||||||
ELF_R_TYPE (rel->r_info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
case R_X86_64_32:
|
||||||
|
{
|
||||||
|
grub_uint64_t value = *addr32 + rel->r_addend + sym->st_value;
|
||||||
|
if (value != (grub_uint32_t) value)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
|
||||||
|
*addr32 = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case R_X86_64_32S:
|
||||||
|
{
|
||||||
|
grub_int64_t value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value;
|
||||||
|
if (value != (grub_int32_t) value)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
|
||||||
|
*addr32 = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
|
N_("relocation 0x%x is not implemented yet"),
|
||||||
|
ELF_R_TYPE (rel->r_info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -132,6 +132,7 @@ static int add_subnode (void *fdt, int parentoffset, const char *name)
|
|||||||
+ parentoffset);
|
+ parentoffset);
|
||||||
grub_uint32_t *end = (void *) struct_end (fdt);
|
grub_uint32_t *end = (void *) struct_end (fdt);
|
||||||
unsigned int entry_size = node_entry_size (name);
|
unsigned int entry_size = node_entry_size (name);
|
||||||
|
unsigned int struct_size = grub_fdt_get_size_dt_struct(fdt);
|
||||||
char *node_name;
|
char *node_name;
|
||||||
|
|
||||||
SKIP_NODE_NAME(node_name, token, end);
|
SKIP_NODE_NAME(node_name, token, end);
|
||||||
@ -167,6 +168,7 @@ insert:
|
|||||||
token[entry_size / sizeof(*token) - 2] = 0; /* padding bytes */
|
token[entry_size / sizeof(*token) - 2] = 0; /* padding bytes */
|
||||||
grub_strcpy((char *) (token + 1), name);
|
grub_strcpy((char *) (token + 1), name);
|
||||||
token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE);
|
token[entry_size / sizeof(*token) - 1] = grub_cpu_to_be32(FDT_END_NODE);
|
||||||
|
grub_fdt_set_size_dt_struct (fdt, struct_size + entry_size);
|
||||||
return ((grub_addr_t) token - (grub_addr_t) fdt
|
return ((grub_addr_t) token - (grub_addr_t) fdt
|
||||||
- grub_fdt_get_off_dt_struct(fdt));
|
- grub_fdt_get_off_dt_struct(fdt));
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||||||
struct grub_ofnetcard_data
|
struct grub_ofnetcard_data
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
|
char *suffix;
|
||||||
grub_ieee1275_ihandle_t handle;
|
grub_ieee1275_ihandle_t handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -37,18 +38,7 @@ card_open (struct grub_net_card *dev)
|
|||||||
int status;
|
int status;
|
||||||
struct grub_ofnetcard_data *data = dev->data;
|
struct grub_ofnetcard_data *data = dev->data;
|
||||||
|
|
||||||
if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX))
|
status = grub_ieee1275_open (data->path, &(data->handle));
|
||||||
{
|
|
||||||
char path[grub_strlen (data->path) +
|
|
||||||
sizeof (":speed=auto,duplex=auto,1.1.1.1,dummy,1.1.1.1,1.1.1.1,5,5,1.1.1.1,512")];
|
|
||||||
|
|
||||||
/* The full string will prevent a bootp packet to be sent. Just put some valid ip in there. */
|
|
||||||
grub_snprintf (path, sizeof (path), "%s%s", data->path,
|
|
||||||
":speed=auto,duplex=auto,1.1.1.1,dummy,1.1.1.1,1.1.1.1,5,5,1.1.1.1,512");
|
|
||||||
status = grub_ieee1275_open (path, &(data->handle));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
status = grub_ieee1275_open (data->path, &(data->handle));
|
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
return grub_error (GRUB_ERR_IO, "Couldn't open network card.");
|
return grub_error (GRUB_ERR_IO, "Couldn't open network card.");
|
||||||
@ -146,8 +136,9 @@ grub_ieee1275_net_config_real (const char *devpath, char **device, char **path)
|
|||||||
FOR_NET_CARDS (card)
|
FOR_NET_CARDS (card)
|
||||||
{
|
{
|
||||||
char *bootp_response;
|
char *bootp_response;
|
||||||
char *cardpath;
|
|
||||||
char *canon;
|
char *canon;
|
||||||
|
char c;
|
||||||
|
struct grub_ofnetcard_data *data;
|
||||||
|
|
||||||
grub_ssize_t size = -1;
|
grub_ssize_t size = -1;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -155,8 +146,11 @@ grub_ieee1275_net_config_real (const char *devpath, char **device, char **path)
|
|||||||
if (card->driver != &ofdriver)
|
if (card->driver != &ofdriver)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cardpath = ((struct grub_ofnetcard_data *) card->data)->path;
|
data = card->data;
|
||||||
canon = grub_ieee1275_canonicalise_devname (cardpath);
|
c = *data->suffix;
|
||||||
|
*data->suffix = '\0';
|
||||||
|
canon = grub_ieee1275_canonicalise_devname (data->path);
|
||||||
|
*data->suffix = c;
|
||||||
if (grub_strcmp (devpath, canon) != 0)
|
if (grub_strcmp (devpath, canon) != 0)
|
||||||
{
|
{
|
||||||
grub_free (canon);
|
grub_free (canon);
|
||||||
@ -224,7 +218,22 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ofdata->path = grub_strdup (alias->path);
|
#define SUFFIX ":speed=auto,duplex=auto,1.1.1.1,dummy,1.1.1.1,1.1.1.1,5,5,1.1.1.1,512"
|
||||||
|
|
||||||
|
if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX))
|
||||||
|
ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX));
|
||||||
|
else
|
||||||
|
ofdata->path = grub_malloc (grub_strlen (alias->path) + 1);
|
||||||
|
if (!ofdata->path)
|
||||||
|
{
|
||||||
|
grub_print_error ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ofdata->suffix = grub_stpcpy (ofdata->path, alias->path);
|
||||||
|
if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX))
|
||||||
|
grub_memcpy (ofdata->suffix, SUFFIX, sizeof (SUFFIX));
|
||||||
|
else
|
||||||
|
*ofdata->suffix = '\0';
|
||||||
|
|
||||||
grub_ieee1275_finddevice (ofdata->path, &devhandle);
|
grub_ieee1275_finddevice (ofdata->path, &devhandle);
|
||||||
|
|
||||||
|
@ -83,7 +83,11 @@ grub_netbuff_alloc (grub_size_t len)
|
|||||||
len = NETBUFFMINLEN;
|
len = NETBUFFMINLEN;
|
||||||
|
|
||||||
len = ALIGN_UP (len, NETBUFF_ALIGN);
|
len = ALIGN_UP (len, NETBUFF_ALIGN);
|
||||||
|
#ifdef GRUB_MACHINE_EMU
|
||||||
|
data = grub_malloc (len + sizeof (*nb));
|
||||||
|
#else
|
||||||
data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb));
|
data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb));
|
||||||
|
#endif
|
||||||
if (!data)
|
if (!data)
|
||||||
return NULL;
|
return NULL;
|
||||||
nb = (struct grub_net_buff *) ((grub_properly_aligned_t *) data
|
nb = (struct grub_net_buff *) ((grub_properly_aligned_t *) data
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNIFONT_WIDTHSPEC
|
#if HAVE_FONT_SOURCE
|
||||||
#include "widthspec.h"
|
#include "widthspec.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ grub_unicode_get_comb_type (grub_uint32_t c)
|
|||||||
return GRUB_UNICODE_COMB_NONE;
|
return GRUB_UNICODE_COMB_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_UNIFONT_WIDTHSPEC
|
#if HAVE_FONT_SOURCE
|
||||||
|
|
||||||
grub_size_t
|
grub_size_t
|
||||||
grub_unicode_estimate_width (const struct grub_unicode_glyph *c)
|
grub_unicode_estimate_width (const struct grub_unicode_glyph *c)
|
||||||
|
@ -583,8 +583,8 @@ GRUB_MOD_INIT(normal)
|
|||||||
grub_env_export ("color_highlight");
|
grub_env_export ("color_highlight");
|
||||||
|
|
||||||
/* Set default color names. */
|
/* Set default color names. */
|
||||||
grub_env_set ("color_normal", "white/black");
|
grub_env_set ("color_normal", "light-gray/black");
|
||||||
grub_env_set ("color_highlight", "black/white");
|
grub_env_set ("color_highlight", "black/light-gray");
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE (features); i++)
|
for (i = 0; i < ARRAY_SIZE (features); i++)
|
||||||
{
|
{
|
||||||
|
5
grub-core/osdep/dl.c
Normal file
5
grub-core/osdep/dl.c
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#if defined (__MINGW32__) || defined (__CYGWIN__)
|
||||||
|
#include "windows/dl.c"
|
||||||
|
#else
|
||||||
|
#include "unix/dl.c"
|
||||||
|
#endif
|
@ -27,6 +27,7 @@
|
|||||||
#include <grub/emu/misc.h>
|
#include <grub/emu/misc.h>
|
||||||
#include <grub/emu/hostdisk.h>
|
#include <grub/emu/hostdisk.h>
|
||||||
#include <grub/emu/getroot.h>
|
#include <grub/emu/getroot.h>
|
||||||
|
#include <grub/emu/exec.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/list.h>
|
#include <grub/list.h>
|
||||||
@ -39,6 +40,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@ -93,12 +95,99 @@ grub_util_get_fd_size_os (grub_util_fd_t fd, const char *name, unsigned *log_sec
|
|||||||
return nr;
|
return nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
sysfs_partition_path (const char *dev, const char *entry)
|
||||||
|
{
|
||||||
|
const char *argv[7];
|
||||||
|
int fd;
|
||||||
|
pid_t pid;
|
||||||
|
FILE *udevadm;
|
||||||
|
char *buf = NULL;
|
||||||
|
size_t len = 0;
|
||||||
|
char *path = NULL;
|
||||||
|
|
||||||
|
argv[0] = "udevadm";
|
||||||
|
argv[1] = "info";
|
||||||
|
argv[2] = "--query";
|
||||||
|
argv[3] = "path";
|
||||||
|
argv[4] = "--name";
|
||||||
|
argv[5] = dev;
|
||||||
|
argv[6] = NULL;
|
||||||
|
|
||||||
|
pid = grub_util_exec_pipe (argv, &fd);
|
||||||
|
|
||||||
|
if (!pid)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Parent. Read udevadm's output. */
|
||||||
|
udevadm = fdopen (fd, "r");
|
||||||
|
if (!udevadm)
|
||||||
|
{
|
||||||
|
grub_util_warn (_("Unable to open stream from %s: %s"),
|
||||||
|
"udevadm", strerror (errno));
|
||||||
|
close (fd);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getline (&buf, &len, udevadm) > 0)
|
||||||
|
{
|
||||||
|
char *newline;
|
||||||
|
|
||||||
|
newline = strchr (buf, '\n');
|
||||||
|
if (newline)
|
||||||
|
*newline = '\0';
|
||||||
|
path = xasprintf ("/sys%s/%s", buf, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (udevadm)
|
||||||
|
fclose (udevadm);
|
||||||
|
waitpid (pid, NULL, 0);
|
||||||
|
free (buf);
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
sysfs_partition_start (const char *dev, grub_disk_addr_t *start)
|
||||||
|
{
|
||||||
|
char *path;
|
||||||
|
FILE *fp;
|
||||||
|
unsigned long long val;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
path = sysfs_partition_path (dev, "start");
|
||||||
|
if (!path)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
fp = grub_util_fopen (path, "r");
|
||||||
|
if (!fp)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (fscanf (fp, "%llu", &val) == 1)
|
||||||
|
{
|
||||||
|
*start = (grub_disk_addr_t) val;
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
free (path);
|
||||||
|
if (fp)
|
||||||
|
fclose (fp);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
grub_disk_addr_t
|
grub_disk_addr_t
|
||||||
grub_util_find_partition_start_os (const char *dev)
|
grub_util_find_partition_start_os (const char *dev)
|
||||||
{
|
{
|
||||||
|
grub_disk_addr_t start = 0;
|
||||||
grub_util_fd_t fd;
|
grub_util_fd_t fd;
|
||||||
struct hd_geometry hdg;
|
struct hd_geometry hdg;
|
||||||
|
|
||||||
|
if (sysfs_partition_start (dev, &start))
|
||||||
|
return start;
|
||||||
|
|
||||||
fd = open (dev, O_RDONLY);
|
fd = open (dev, O_RDONLY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
|
61
grub-core/osdep/unix/dl.c
Normal file
61
grub-core/osdep/unix/dl.c
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <config-util.h>
|
||||||
|
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void *
|
||||||
|
grub_osdep_dl_memalign (grub_size_t align, grub_size_t size)
|
||||||
|
{
|
||||||
|
void *ret;
|
||||||
|
if (align < 8192 * 16)
|
||||||
|
align = 8192 * 16;
|
||||||
|
size = ALIGN_UP (size, 8192 * 16);
|
||||||
|
|
||||||
|
#if defined(HAVE_POSIX_MEMALIGN)
|
||||||
|
if (posix_memalign (&ret, align, size) != 0)
|
||||||
|
ret = 0;
|
||||||
|
#elif defined(HAVE_MEMALIGN)
|
||||||
|
ret = memalign (align, size);
|
||||||
|
#else
|
||||||
|
#error "Complete this"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mprotect (ret, size, PROT_READ | PROT_WRITE | PROT_EXEC);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_dl_osdep_dl_free (void *ptr)
|
||||||
|
{
|
||||||
|
if (ptr)
|
||||||
|
free (ptr);
|
||||||
|
}
|
59
grub-core/osdep/windows/dl.c
Normal file
59
grub-core/osdep/windows/dl.c
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <config-util.h>
|
||||||
|
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
void *
|
||||||
|
grub_osdep_dl_memalign (grub_size_t align, grub_size_t size)
|
||||||
|
{
|
||||||
|
void *ret;
|
||||||
|
if (align > 4096)
|
||||||
|
{
|
||||||
|
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, N_("too large alignment"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
size = ALIGN_UP (size, 4096);
|
||||||
|
|
||||||
|
ret = VirtualAlloc (NULL, size, MEM_COMMIT | MEM_RESERVE,
|
||||||
|
PAGE_EXECUTE_READWRITE);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_dl_osdep_dl_free (void *ptr)
|
||||||
|
{
|
||||||
|
if (!ptr)
|
||||||
|
return;
|
||||||
|
VirtualFree (ptr, 0, MEM_RELEASE);
|
||||||
|
}
|
@ -37,7 +37,7 @@ static void
|
|||||||
grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
||||||
const struct grub_unicode_glyph *c)
|
const struct grub_unicode_glyph *c)
|
||||||
{
|
{
|
||||||
TCHAR str[2 + c->ncomb];
|
TCHAR str[2 + 30];
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
DWORD written;
|
DWORD written;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
|||||||
else
|
else
|
||||||
str[0] = (c->base & 0xffff);
|
str[0] = (c->base & 0xffff);
|
||||||
j = 1;
|
j = 1;
|
||||||
for (i = 0; i < c->ncomb; i++)
|
for (i = 0; i < c->ncomb && j+1 < ARRAY_SIZE (str); i++)
|
||||||
if (c->base < 0xffff)
|
if (c->base < 0xffff)
|
||||||
str[j++] = grub_unicode_get_comb (c)[i].code;
|
str[j++] = grub_unicode_get_comb (c)[i].code;
|
||||||
str[j] = 0;
|
str[j] = 0;
|
||||||
@ -108,11 +108,9 @@ grub_console_getkey (struct grub_term_input *term __attribute__ ((unused)))
|
|||||||
ret = ir.Event.KeyEvent.uChar.UnicodeChar;
|
ret = ir.Event.KeyEvent.uChar.UnicodeChar;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
if (ir.Event.KeyEvent.wVirtualKeyCode >= 0
|
unsigned kc = ir.Event.KeyEvent.wVirtualKeyCode;
|
||||||
&& ir.Event.KeyEvent.wVirtualKeyCode
|
if (kc < ARRAY_SIZE (windows_codes) && windows_codes[kc])
|
||||||
< ARRAY_SIZE (windows_codes)
|
ret = windows_codes[kc];
|
||||||
&& windows_codes[(int) ir.Event.KeyEvent.wVirtualKeyCode])
|
|
||||||
ret = windows_codes[(int) ir.Event.KeyEvent.wVirtualKeyCode];
|
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
if (ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)
|
if (ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)
|
||||||
|
@ -69,7 +69,7 @@ static void
|
|||||||
grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
||||||
const struct grub_unicode_glyph *c)
|
const struct grub_unicode_glyph *c)
|
||||||
{
|
{
|
||||||
grub_efi_char16_t str[2 + c->ncomb];
|
grub_efi_char16_t str[2 + 30];
|
||||||
grub_efi_simple_text_output_interface_t *o;
|
grub_efi_simple_text_output_interface_t *o;
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
|||||||
else
|
else
|
||||||
str[0] = (grub_efi_char16_t) map_char (c->base & 0xffff);
|
str[0] = (grub_efi_char16_t) map_char (c->base & 0xffff);
|
||||||
j = 1;
|
j = 1;
|
||||||
for (i = 0; i < c->ncomb; i++)
|
for (i = 0; i < c->ncomb && j + 1 < ARRAY_SIZE (str); i++)
|
||||||
if (c->base < 0xffff)
|
if (c->base < 0xffff)
|
||||||
str[j++] = grub_unicode_get_comb (c)[i].code;
|
str[j++] = grub_unicode_get_comb (c)[i].code;
|
||||||
str[j] = 0;
|
str[j] = 0;
|
||||||
|
@ -350,7 +350,7 @@ grub_video_capture_write_bmp (const char *fname,
|
|||||||
|
|
||||||
for (y = mode_info->height - 1; y >= 0; y--)
|
for (y = mode_info->height - 1; y >= 0; y--)
|
||||||
{
|
{
|
||||||
grub_uint32_t *iptr = (grub_uint32_t *) ((grub_uint8_t *) ptr + mode_info->pitch * y);
|
grub_uint32_t *iptr = (grub_uint32_t *) ptr + (mode_info->pitch / 4) * y;
|
||||||
int x;
|
int x;
|
||||||
grub_uint8_t *optr = buffer;
|
grub_uint8_t *optr = buffer;
|
||||||
for (x = 0; x < (int) mode_info->width; x++)
|
for (x = 0; x < (int) mode_info->width; x++)
|
||||||
@ -421,7 +421,7 @@ grub_video_capture_write_bmp (const char *fname,
|
|||||||
|
|
||||||
for (y = mode_info->height - 1; y >= 0; y--)
|
for (y = mode_info->height - 1; y >= 0; y--)
|
||||||
{
|
{
|
||||||
grub_uint16_t *iptr = (grub_uint16_t *) ((grub_uint8_t *) ptr + mode_info->pitch * y);
|
grub_uint16_t *iptr = (grub_uint16_t *) ptr + (mode_info->pitch / 2) * y;
|
||||||
int x;
|
int x;
|
||||||
grub_uint8_t *optr = buffer;
|
grub_uint8_t *optr = buffer;
|
||||||
for (x = 0; x < (int) mode_info->width; x++)
|
for (x = 0; x < (int) mode_info->width; x++)
|
||||||
|
@ -20,8 +20,27 @@
|
|||||||
#define GRUB_ARM_RELOC_H 1
|
#define GRUB_ARM_RELOC_H 1
|
||||||
|
|
||||||
grub_err_t grub_arm_reloc_abs32 (grub_uint32_t *addr, Elf32_Addr sym_addr);
|
grub_err_t grub_arm_reloc_abs32 (grub_uint32_t *addr, Elf32_Addr sym_addr);
|
||||||
grub_err_t grub_arm_reloc_jump24 (grub_uint32_t *addr, Elf32_Addr sym_addr);
|
|
||||||
grub_err_t grub_arm_reloc_thm_call (grub_uint16_t *addr, Elf32_Addr sym_addr);
|
int
|
||||||
grub_err_t grub_arm_reloc_thm_jump19 (grub_uint16_t *addr, Elf32_Addr sym_addr);
|
grub_arm_thm_call_check_offset (grub_int32_t offset, int is_thumb);
|
||||||
|
grub_int32_t
|
||||||
|
grub_arm_thm_call_get_offset (grub_uint16_t *target);
|
||||||
|
grub_err_t
|
||||||
|
grub_arm_thm_call_set_offset (grub_uint16_t *target, grub_int32_t offset);
|
||||||
|
|
||||||
|
grub_int32_t
|
||||||
|
grub_arm_thm_jump19_get_offset (grub_uint16_t *target);
|
||||||
|
void
|
||||||
|
grub_arm_thm_jump19_set_offset (grub_uint16_t *target, grub_int32_t offset);
|
||||||
|
int
|
||||||
|
grub_arm_thm_jump19_check_offset (grub_int32_t offset);
|
||||||
|
|
||||||
|
grub_int32_t
|
||||||
|
grub_arm_jump24_get_offset (grub_uint32_t *target);
|
||||||
|
int
|
||||||
|
grub_arm_jump24_check_offset (grub_int32_t offset);
|
||||||
|
void
|
||||||
|
grub_arm_jump24_set_offset (grub_uint32_t *target,
|
||||||
|
grub_int32_t offset);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#ifndef GRUB_ARM64_RELOC_H
|
#ifndef GRUB_ARM64_RELOC_H
|
||||||
#define GRUB_ARM64_RELOC_H 1
|
#define GRUB_ARM64_RELOC_H 1
|
||||||
|
|
||||||
grub_err_t grub_arm64_reloc_xxxx26 (grub_uint32_t *target, Elf64_Addr sym_addr);
|
int grub_arm_64_check_xxxx26_offset (grub_int64_t offset);
|
||||||
|
void
|
||||||
|
grub_arm64_set_xxxx26_offset (grub_uint32_t *place, grub_int64_t offset);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,10 +23,6 @@
|
|||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
|
||||||
#ifdef _mips
|
|
||||||
#include <grub/mips/cache.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (__i386__) || defined (__x86_64__)
|
#if defined (__i386__) || defined (__x86_64__)
|
||||||
static inline void
|
static inline void
|
||||||
grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
||||||
@ -37,6 +33,7 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
|||||||
void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
|
void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GRUB_MACHINE_EMU
|
||||||
#ifdef _mips
|
#ifdef _mips
|
||||||
void EXPORT_FUNC(grub_arch_sync_dma_caches) (void *address, grub_size_t len);
|
void EXPORT_FUNC(grub_arch_sync_dma_caches) (void *address, grub_size_t len);
|
||||||
#else
|
#else
|
||||||
@ -46,5 +43,6 @@ grub_arch_sync_dma_caches (void *address __attribute__ ((unused)),
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ! GRUB_CACHE_HEADER */
|
#endif /* ! GRUB_CACHE_HEADER */
|
||||||
|
@ -177,11 +177,17 @@ struct grub_dl
|
|||||||
grub_dl_dep_t dep;
|
grub_dl_dep_t dep;
|
||||||
grub_dl_segment_t segment;
|
grub_dl_segment_t segment;
|
||||||
Elf_Sym *symtab;
|
Elf_Sym *symtab;
|
||||||
|
grub_size_t symsize;
|
||||||
void (*init) (struct grub_dl *mod);
|
void (*init) (struct grub_dl *mod);
|
||||||
void (*fini) (void);
|
void (*fini) (void);
|
||||||
#if defined (__ia64__) || defined (__powerpc__) || defined (__mips__)
|
#if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc__)
|
||||||
void *got;
|
void *got;
|
||||||
|
void *gotptr;
|
||||||
void *tramp;
|
void *tramp;
|
||||||
|
void *trampptr;
|
||||||
|
#endif
|
||||||
|
#ifdef __mips__
|
||||||
|
grub_uint32_t *reginfo;
|
||||||
#endif
|
#endif
|
||||||
void *base;
|
void *base;
|
||||||
grub_size_t sz;
|
grub_size_t sz;
|
||||||
@ -204,6 +210,13 @@ extern grub_dl_t EXPORT_VAR(grub_dl_head);
|
|||||||
|
|
||||||
#define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head))
|
#define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head))
|
||||||
|
|
||||||
|
#ifdef GRUB_MACHINE_EMU
|
||||||
|
void *
|
||||||
|
grub_osdep_dl_memalign (grub_size_t align, grub_size_t size);
|
||||||
|
void
|
||||||
|
grub_dl_osdep_dl_free (void *ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_dl_init (grub_dl_t mod)
|
grub_dl_init (grub_dl_t mod)
|
||||||
{
|
{
|
||||||
@ -232,7 +245,11 @@ grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
|||||||
int isfunc, grub_dl_t mod);
|
int isfunc, grub_dl_t mod);
|
||||||
|
|
||||||
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
||||||
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
#ifndef GRUB_UTIL
|
||||||
|
grub_err_t
|
||||||
|
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
|
Elf_Shdr *s, grub_dl_segment_t seg);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (_mips)
|
#if defined (_mips)
|
||||||
#define GRUB_LINKER_HAVE_INIT 1
|
#define GRUB_LINKER_HAVE_INIT 1
|
||||||
@ -256,11 +273,16 @@ grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
|||||||
grub_size_t *got);
|
grub_size_t *got);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__powerpc__) || defined (__mips__)
|
#if defined (__powerpc__) || defined (__mips__) || defined (__arm__)
|
||||||
#define GRUB_ARCH_DL_TRAMP_ALIGN 4
|
#define GRUB_ARCH_DL_TRAMP_ALIGN 4
|
||||||
#define GRUB_ARCH_DL_GOT_ALIGN 4
|
#define GRUB_ARCH_DL_GOT_ALIGN 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (__aarch64__)
|
||||||
|
#define GRUB_ARCH_DL_TRAMP_ALIGN 8
|
||||||
|
#define GRUB_ARCH_DL_GOT_ALIGN 8
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ! GRUB_DL_H */
|
#endif /* ! GRUB_DL_H */
|
||||||
|
@ -78,7 +78,7 @@ struct grub_module_info64
|
|||||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) \
|
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) \
|
||||||
|| defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) \
|
|| defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) \
|
||||||
|| defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_ARC) \
|
|| defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_ARC) \
|
||||||
|| defined (__sparc__) || defined (GRUB_MACHINE_UBOOT) || defined (GRUB_MACHINE_XEN)
|
|| (defined (__sparc__) && defined (GRUB_MACHINE_IEEE1275)) || defined (GRUB_MACHINE_UBOOT) || defined (GRUB_MACHINE_XEN)
|
||||||
/* FIXME: stack is between 2 heap regions. Move it. */
|
/* FIXME: stack is between 2 heap regions. Move it. */
|
||||||
#define GRUB_KERNEL_PRELOAD_SPACE_REUSABLE 1
|
#define GRUB_KERNEL_PRELOAD_SPACE_REUSABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -429,7 +429,7 @@ void __attribute__ ((noreturn)) EXPORT_FUNC (abort) (void);
|
|||||||
/* Halt the system, using APM if possible. If NO_APM is true, don't
|
/* Halt the system, using APM if possible. If NO_APM is true, don't
|
||||||
* use APM even if it is available. */
|
* use APM even if it is available. */
|
||||||
void grub_halt (int no_apm) __attribute__ ((noreturn));
|
void grub_halt (int no_apm) __attribute__ ((noreturn));
|
||||||
#elif defined (__mips__)
|
#elif defined (__mips__) && !defined (GRUB_MACHINE_EMU)
|
||||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||||
#else
|
#else
|
||||||
void grub_halt (void) __attribute__ ((noreturn));
|
void grub_halt (void) __attribute__ ((noreturn));
|
||||||
|
@ -33,7 +33,9 @@ void *EXPORT_FUNC(grub_malloc) (grub_size_t size);
|
|||||||
void *EXPORT_FUNC(grub_zalloc) (grub_size_t size);
|
void *EXPORT_FUNC(grub_zalloc) (grub_size_t size);
|
||||||
void EXPORT_FUNC(grub_free) (void *ptr);
|
void EXPORT_FUNC(grub_free) (void *ptr);
|
||||||
void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
|
void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
|
||||||
|
#ifndef GRUB_MACHINE_EMU
|
||||||
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
|
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
|
||||||
|
#endif
|
||||||
|
|
||||||
void grub_mm_check_real (const char *file, int line);
|
void grub_mm_check_real (const char *file, int line);
|
||||||
#define grub_mm_check() grub_mm_check_real (GRUB_FILE, __LINE__);
|
#define grub_mm_check() grub_mm_check_real (GRUB_FILE, __LINE__);
|
||||||
|
@ -111,7 +111,8 @@
|
|||||||
#define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0
|
#define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0
|
||||||
|
|
||||||
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
|
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
|
||||||
#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN 0x1
|
#define GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN 3
|
||||||
|
#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN (1 << GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN)
|
||||||
|
|
||||||
#define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
|
#define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
|
||||||
#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
|
#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#define SCRATCH_PAD_BOOT 0x5000
|
#define SCRATCH_PAD_BOOT 0x5000
|
||||||
#define SCRATCH_PAD_DISKBOOT 0x4000
|
#define SCRATCH_PAD_DISKBOOT 0x4000
|
||||||
|
#define SCRATCH_PAD_BOOT_SIZE 0x110
|
||||||
|
|
||||||
#define GET_ABS(symbol, reg) \
|
#define GET_ABS(symbol, reg) \
|
||||||
add PIC_REG, (symbol - pic_base), reg
|
add PIC_REG, (symbol - pic_base), reg
|
||||||
|
@ -398,7 +398,7 @@ grub_term_cls (struct grub_term_output *term)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_UNIFONT_WIDTHSPEC
|
#if HAVE_FONT_SOURCE
|
||||||
|
|
||||||
grub_size_t
|
grub_size_t
|
||||||
grub_unicode_estimate_width (const struct grub_unicode_glyph *c);
|
grub_unicode_estimate_width (const struct grub_unicode_glyph *c);
|
||||||
|
@ -21,7 +21,14 @@
|
|||||||
|
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
|
#ifndef GRUB_MACHINE_EMU
|
||||||
#include <grub/cpu/time.h>
|
#include <grub/cpu/time.h>
|
||||||
|
#else
|
||||||
|
static inline void
|
||||||
|
grub_cpu_idle(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_millisleep) (grub_uint32_t ms);
|
void EXPORT_FUNC(grub_millisleep) (grub_uint32_t ms);
|
||||||
grub_uint64_t EXPORT_FUNC(grub_get_time_ms) (void);
|
grub_uint64_t EXPORT_FUNC(grub_get_time_ms) (void);
|
||||||
|
@ -153,11 +153,10 @@ typedef grub_uint64_t grub_off_t;
|
|||||||
typedef grub_uint64_t grub_disk_addr_t;
|
typedef grub_uint64_t grub_disk_addr_t;
|
||||||
|
|
||||||
/* Byte-orders. */
|
/* Byte-orders. */
|
||||||
#define grub_swap_bytes16(x) \
|
static inline grub_uint16_t grub_swap_bytes16(grub_uint16_t _x)
|
||||||
({ \
|
{
|
||||||
grub_uint16_t _x = (x); \
|
return (grub_uint16_t) ((_x << 8) | (_x >> 8));
|
||||||
(grub_uint16_t) ((_x << 8) | (_x >> 8)); \
|
}
|
||||||
})
|
|
||||||
|
|
||||||
#define grub_swap_bytes16_compile_time(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
|
#define grub_swap_bytes16_compile_time(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
|
||||||
#define grub_swap_bytes32_compile_time(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000UL) >> 24))
|
#define grub_swap_bytes32_compile_time(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000UL) >> 24))
|
||||||
@ -185,27 +184,25 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||||||
return __builtin_bswap64(x);
|
return __builtin_bswap64(x);
|
||||||
}
|
}
|
||||||
#else /* not gcc 4.3 or newer */
|
#else /* not gcc 4.3 or newer */
|
||||||
#define grub_swap_bytes32(x) \
|
static inline grub_uint32_t grub_swap_bytes32(grub_uint32_t _x)
|
||||||
({ \
|
{
|
||||||
grub_uint32_t _x = (x); \
|
return ((_x << 24)
|
||||||
(grub_uint32_t) ((_x << 24) \
|
| ((_x & (grub_uint32_t) 0xFF00UL) << 8)
|
||||||
| ((_x & (grub_uint32_t) 0xFF00UL) << 8) \
|
| ((_x & (grub_uint32_t) 0xFF0000UL) >> 8)
|
||||||
| ((_x & (grub_uint32_t) 0xFF0000UL) >> 8) \
|
| (_x >> 24));
|
||||||
| (_x >> 24)); \
|
}
|
||||||
})
|
|
||||||
|
|
||||||
#define grub_swap_bytes64(x) \
|
static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t _x)
|
||||||
({ \
|
{
|
||||||
grub_uint64_t _x = (x); \
|
return ((_x << 56)
|
||||||
(grub_uint64_t) ((_x << 56) \
|
| ((_x & (grub_uint64_t) 0xFF00ULL) << 40)
|
||||||
| ((_x & (grub_uint64_t) 0xFF00ULL) << 40) \
|
| ((_x & (grub_uint64_t) 0xFF0000ULL) << 24)
|
||||||
| ((_x & (grub_uint64_t) 0xFF0000ULL) << 24) \
|
| ((_x & (grub_uint64_t) 0xFF000000ULL) << 8)
|
||||||
| ((_x & (grub_uint64_t) 0xFF000000ULL) << 8) \
|
| ((_x & (grub_uint64_t) 0xFF00000000ULL) >> 8)
|
||||||
| ((_x & (grub_uint64_t) 0xFF00000000ULL) >> 8) \
|
| ((_x & (grub_uint64_t) 0xFF0000000000ULL) >> 24)
|
||||||
| ((_x & (grub_uint64_t) 0xFF0000000000ULL) >> 24) \
|
| ((_x & (grub_uint64_t) 0xFF000000000000ULL) >> 40)
|
||||||
| ((_x & (grub_uint64_t) 0xFF000000000000ULL) >> 40) \
|
| (_x >> 56));
|
||||||
| (_x >> 56)); \
|
}
|
||||||
})
|
|
||||||
#endif /* not gcc 4.3 or newer */
|
#endif /* not gcc 4.3 or newer */
|
||||||
|
|
||||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
{ "compress", GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS, \
|
{ "compress", GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS, \
|
||||||
"no,xz,gz,lzo", OPTION_ARG_OPTIONAL, \
|
"no,xz,gz,lzo", OPTION_ARG_OPTIONAL, \
|
||||||
N_("compress GRUB files [optional]"), 1 }, \
|
N_("compress GRUB files [optional]"), 1 }, \
|
||||||
|
{"core-compress", GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, \
|
||||||
|
N_("xz|none|auto"), \
|
||||||
|
0, N_("choose the compression to use for core image"), 2}, \
|
||||||
/* TRANSLATORS: platform here isn't identifier. It can be translated. */ \
|
/* TRANSLATORS: platform here isn't identifier. It can be translated. */ \
|
||||||
{ "directory", 'd', N_("DIR"), 0, \
|
{ "directory", 'd', N_("DIR"), 0, \
|
||||||
N_("use images and modules under DIR [default=%s/<platform>]"), 1 }, \
|
N_("use images and modules under DIR [default=%s/<platform>]"), 1 }, \
|
||||||
@ -50,6 +53,9 @@
|
|||||||
{ "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, \
|
{ "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, \
|
||||||
N_("DIR"), 0, \
|
N_("DIR"), 0, \
|
||||||
N_("use translations under DIR [default=%s]"), 1 }, \
|
N_("use translations under DIR [default=%s]"), 1 }, \
|
||||||
|
{ "themes-directory", GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, \
|
||||||
|
N_("DIR"), OPTION_HIDDEN, \
|
||||||
|
N_("use themes under DIR [default=%s]"), 1 }, \
|
||||||
{ "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, \
|
{ "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, \
|
||||||
"FILE", OPTION_HIDDEN, 0, 1 }, \
|
"FILE", OPTION_HIDDEN, 0, 1 }, \
|
||||||
/* TRANSLATORS: "embed" is a verb (command description). "*/ \
|
/* TRANSLATORS: "embed" is a verb (command description). "*/ \
|
||||||
@ -107,7 +113,9 @@ enum grub_install_options {
|
|||||||
GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS,
|
GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS,
|
||||||
GRUB_INSTALL_OPTIONS_DIRECTORY2,
|
GRUB_INSTALL_OPTIONS_DIRECTORY2,
|
||||||
GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,
|
GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,
|
||||||
GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE
|
GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY,
|
||||||
|
GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE,
|
||||||
|
GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS
|
||||||
};
|
};
|
||||||
|
|
||||||
extern char *grub_install_source_directory;
|
extern char *grub_install_source_directory;
|
||||||
@ -142,15 +150,13 @@ void
|
|||||||
grub_install_make_image_wrap (const char *dir, const char *prefix,
|
grub_install_make_image_wrap (const char *dir, const char *prefix,
|
||||||
const char *outname, char *memdisk_path,
|
const char *outname, char *memdisk_path,
|
||||||
char *config_path,
|
char *config_path,
|
||||||
const char *format, int note,
|
const char *format, int note);
|
||||||
grub_compression_t comp);
|
|
||||||
void
|
void
|
||||||
grub_install_make_image_wrap_file (const char *dir, const char *prefix,
|
grub_install_make_image_wrap_file (const char *dir, const char *prefix,
|
||||||
FILE *fp, const char *outname,
|
FILE *fp, const char *outname,
|
||||||
char *memdisk_path,
|
char *memdisk_path,
|
||||||
char *config_path,
|
char *config_path,
|
||||||
const char *mkimage_target, int note,
|
const char *mkimage_target, int note);
|
||||||
grub_compression_t comp);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_install_copy_file (const char *src,
|
grub_install_copy_file (const char *src,
|
||||||
|
@ -47,4 +47,6 @@ void grub_util_init_nls (void);
|
|||||||
|
|
||||||
void grub_util_host_init (int *argc, char ***argv);
|
void grub_util_host_init (int *argc, char ***argv);
|
||||||
|
|
||||||
|
int grub_qsort_strcmp (const void *, const void *);
|
||||||
|
|
||||||
#endif /* ! GRUB_UTIL_MISC_HEADER */
|
#endif /* ! GRUB_UTIL_MISC_HEADER */
|
||||||
|
@ -347,9 +347,10 @@ if test -z "$debug"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x$boot != xnet ] && [ x$boot != xemu ]; then
|
if [ x$boot != xnet ] && [ x$boot != xemu ]; then
|
||||||
cp -R "@srcdir@/themes" "@builddir@"
|
|
||||||
pkgdatadir="@builddir@" "@builddir@/grub-mkrescue" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \
|
pkgdatadir="@builddir@" "@builddir@/grub-mkrescue" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \
|
||||||
--rom-directory="${rom_directory}" $mkimage_extra_arg ${mkrescue_args} \
|
--rom-directory="${rom_directory}" \
|
||||||
|
--themes-directory="@srcdir@/themes" \
|
||||||
|
$mkimage_extra_arg ${mkrescue_args} \
|
||||||
"/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
|
"/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
|
||||||
${files} >/dev/null 2>&1
|
${files} >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -60,6 +60,8 @@ grub_install_help_filter (int key, const char *text,
|
|||||||
return xasprintf(text, grub_util_get_pkglibdir ());
|
return xasprintf(text, grub_util_get_pkglibdir ());
|
||||||
case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY:
|
case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY:
|
||||||
return xasprintf(text, grub_util_get_localedir ());
|
return xasprintf(text, grub_util_get_localedir ());
|
||||||
|
case GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY:
|
||||||
|
return grub_util_path_concat (2, grub_util_get_pkgdatadir (), "themes");
|
||||||
default:
|
default:
|
||||||
return (char *) text;
|
return (char *) text;
|
||||||
}
|
}
|
||||||
@ -220,6 +222,7 @@ struct install_list install_fonts = { 1, 0, 0, 0 };
|
|||||||
struct install_list install_themes = { 1, 0, 0, 0 };
|
struct install_list install_themes = { 1, 0, 0, 0 };
|
||||||
char *grub_install_source_directory = NULL;
|
char *grub_install_source_directory = NULL;
|
||||||
char *grub_install_locale_directory = NULL;
|
char *grub_install_locale_directory = NULL;
|
||||||
|
char *grub_install_themes_directory = NULL;
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_install_push_module (const char *val)
|
grub_install_push_module (const char *val)
|
||||||
@ -294,12 +297,30 @@ handle_install_list (struct install_list *il, const char *val,
|
|||||||
|
|
||||||
static char **pubkeys;
|
static char **pubkeys;
|
||||||
static size_t npubkeys;
|
static size_t npubkeys;
|
||||||
|
static grub_compression_t compression;
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_install_parse (int key, char *arg)
|
grub_install_parse (int key, char *arg)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
|
case 'C':
|
||||||
|
if (grub_strcmp (arg, "xz") == 0)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_LIBLZMA
|
||||||
|
compression = GRUB_COMPRESSION_XZ;
|
||||||
|
#else
|
||||||
|
grub_util_error ("%s",
|
||||||
|
_("grub-mkimage is compiled without XZ support"));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (grub_strcmp (arg, "none") == 0)
|
||||||
|
compression = GRUB_COMPRESSION_NONE;
|
||||||
|
else if (grub_strcmp (arg, "auto") == 0)
|
||||||
|
compression = GRUB_COMPRESSION_AUTO;
|
||||||
|
else
|
||||||
|
grub_util_error (_("Unknown compression format %s"), arg);
|
||||||
|
return 1;
|
||||||
case 'k':
|
case 'k':
|
||||||
pubkeys = xrealloc (pubkeys,
|
pubkeys = xrealloc (pubkeys,
|
||||||
sizeof (pubkeys[0])
|
sizeof (pubkeys[0])
|
||||||
@ -320,6 +341,10 @@ grub_install_parse (int key, char *arg)
|
|||||||
free (grub_install_locale_directory);
|
free (grub_install_locale_directory);
|
||||||
grub_install_locale_directory = xstrdup (arg);
|
grub_install_locale_directory = xstrdup (arg);
|
||||||
return 1;
|
return 1;
|
||||||
|
case GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY:
|
||||||
|
free (grub_install_themes_directory);
|
||||||
|
grub_install_themes_directory = xstrdup (arg);
|
||||||
|
return 1;
|
||||||
case GRUB_INSTALL_OPTIONS_INSTALL_MODULES:
|
case GRUB_INSTALL_OPTIONS_INSTALL_MODULES:
|
||||||
handle_install_list (&install_modules, arg, 0);
|
handle_install_list (&install_modules, arg, 0);
|
||||||
return 1;
|
return 1;
|
||||||
@ -394,8 +419,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix,
|
|||||||
FILE *fp, const char *outname,
|
FILE *fp, const char *outname,
|
||||||
char *memdisk_path,
|
char *memdisk_path,
|
||||||
char *config_path,
|
char *config_path,
|
||||||
const char *mkimage_target, int note,
|
const char *mkimage_target, int note)
|
||||||
grub_compression_t comp)
|
|
||||||
{
|
{
|
||||||
const struct grub_install_image_target_desc *tgt;
|
const struct grub_install_image_target_desc *tgt;
|
||||||
const char *const compnames[] =
|
const char *const compnames[] =
|
||||||
@ -461,7 +485,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix,
|
|||||||
"--format '%s' --compression '%s' %s %s\n",
|
"--format '%s' --compression '%s' %s %s\n",
|
||||||
dir, prefix,
|
dir, prefix,
|
||||||
outname, mkimage_target,
|
outname, mkimage_target,
|
||||||
compnames[comp], note ? "--note" : "", s);
|
compnames[compression], note ? "--note" : "", s);
|
||||||
|
|
||||||
tgt = grub_install_get_image_target (mkimage_target);
|
tgt = grub_install_get_image_target (mkimage_target);
|
||||||
if (!tgt)
|
if (!tgt)
|
||||||
@ -470,7 +494,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix,
|
|||||||
grub_install_generate_image (dir, prefix, fp, outname,
|
grub_install_generate_image (dir, prefix, fp, outname,
|
||||||
modules.entries, memdisk_path,
|
modules.entries, memdisk_path,
|
||||||
pubkeys, npubkeys, config_path, tgt,
|
pubkeys, npubkeys, config_path, tgt,
|
||||||
note, comp);
|
note, compression);
|
||||||
while (dc--)
|
while (dc--)
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
}
|
}
|
||||||
@ -479,8 +503,7 @@ void
|
|||||||
grub_install_make_image_wrap (const char *dir, const char *prefix,
|
grub_install_make_image_wrap (const char *dir, const char *prefix,
|
||||||
const char *outname, char *memdisk_path,
|
const char *outname, char *memdisk_path,
|
||||||
char *config_path,
|
char *config_path,
|
||||||
const char *mkimage_target, int note,
|
const char *mkimage_target, int note)
|
||||||
grub_compression_t comp)
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
@ -490,7 +513,7 @@ grub_install_make_image_wrap (const char *dir, const char *prefix,
|
|||||||
strerror (errno));
|
strerror (errno));
|
||||||
grub_install_make_image_wrap_file (dir, prefix, fp, outname,
|
grub_install_make_image_wrap_file (dir, prefix, fp, outname,
|
||||||
memdisk_path, config_path,
|
memdisk_path, config_path,
|
||||||
mkimage_target, note, comp);
|
mkimage_target, note);
|
||||||
grub_util_file_sync (fp);
|
grub_util_file_sync (fp);
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
}
|
}
|
||||||
@ -675,6 +698,7 @@ grub_install_copy_files (const char *src,
|
|||||||
{
|
{
|
||||||
char *dst_platform, *dst_locale, *dst_fonts;
|
char *dst_platform, *dst_locale, *dst_fonts;
|
||||||
const char *pkgdatadir = grub_util_get_pkgdatadir ();
|
const char *pkgdatadir = grub_util_get_pkgdatadir ();
|
||||||
|
char *themes_dir;
|
||||||
|
|
||||||
{
|
{
|
||||||
char *platform;
|
char *platform;
|
||||||
@ -806,14 +830,20 @@ grub_install_copy_files (const char *src,
|
|||||||
install_themes.entries[1] = NULL;
|
install_themes.entries[1] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (grub_install_themes_directory)
|
||||||
|
themes_dir = xstrdup (grub_install_themes_directory);
|
||||||
|
else
|
||||||
|
themes_dir = grub_util_path_concat (2, grub_util_get_pkgdatadir (),
|
||||||
|
"themes");
|
||||||
|
|
||||||
for (i = 0; i < install_themes.n_entries; i++)
|
for (i = 0; i < install_themes.n_entries; i++)
|
||||||
{
|
{
|
||||||
char *srcf = grub_util_path_concat (4, pkgdatadir, "themes",
|
char *srcf = grub_util_path_concat (3, themes_dir,
|
||||||
install_themes.entries[i],
|
install_themes.entries[i],
|
||||||
"theme.txt");
|
"theme.txt");
|
||||||
if (grub_util_is_regular (srcf))
|
if (grub_util_is_regular (srcf))
|
||||||
{
|
{
|
||||||
char *srcd = grub_util_path_concat (3, pkgdatadir, "themes",
|
char *srcd = grub_util_path_concat (2, themes_dir,
|
||||||
install_themes.entries[i]);
|
install_themes.entries[i]);
|
||||||
char *dstd = grub_util_path_concat (3, dst, "themes",
|
char *dstd = grub_util_path_concat (3, dst, "themes",
|
||||||
install_themes.entries[i]);
|
install_themes.entries[i]);
|
||||||
@ -825,6 +855,8 @@ grub_install_copy_files (const char *src,
|
|||||||
free (srcf);
|
free (srcf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free (themes_dir);
|
||||||
|
|
||||||
if (install_fonts.is_default)
|
if (install_fonts.is_default)
|
||||||
{
|
{
|
||||||
install_fonts.is_default = 0;
|
install_fonts.is_default = 0;
|
||||||
|
@ -244,7 +244,7 @@ static struct argp_option options[] = {
|
|||||||
N_("disk module to use (biosdisk or native). "
|
N_("disk module to use (biosdisk or native). "
|
||||||
"This option is only available on BIOS target."), 2},
|
"This option is only available on BIOS target."), 2},
|
||||||
{"no-nvram", OPTION_NO_NVRAM, 0, 0,
|
{"no-nvram", OPTION_NO_NVRAM, 0, 0,
|
||||||
N_("don't update the `boot-device' NVRAM variable. "
|
N_("don't update the `boot-device'/`Boot*' NVRAM variables. "
|
||||||
"This option is only available on EFI and IEEE1275 targets."), 2},
|
"This option is only available on EFI and IEEE1275 targets."), 2},
|
||||||
{"skip-fs-probe",'s',0, 0,
|
{"skip-fs-probe",'s',0, 0,
|
||||||
N_("do not probe for filesystems in DEVICE"), 0},
|
N_("do not probe for filesystems in DEVICE"), 0},
|
||||||
@ -342,6 +342,21 @@ probe_raid_level (grub_disk_t disk)
|
|||||||
return ((struct grub_diskfilter_lv *) disk->data)->segments->type;
|
return ((struct grub_diskfilter_lv *) disk->data)->segments->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
push_partmap_module (const char *map)
|
||||||
|
{
|
||||||
|
char buf[50];
|
||||||
|
|
||||||
|
if (strcmp (map, "openbsd") == 0 || strcmp (map, "netbsd") == 0)
|
||||||
|
{
|
||||||
|
grub_install_push_module ("part_bsd");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf (buf, sizeof (buf), "part_%s", map);
|
||||||
|
grub_install_push_module (buf);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
probe_mods (grub_disk_t disk)
|
probe_mods (grub_disk_t disk)
|
||||||
{
|
{
|
||||||
@ -353,21 +368,11 @@ probe_mods (grub_disk_t disk)
|
|||||||
grub_util_info ("no partition map found for %s", disk->name);
|
grub_util_info ("no partition map found for %s", disk->name);
|
||||||
|
|
||||||
for (part = disk->partition; part; part = part->parent)
|
for (part = disk->partition; part; part = part->parent)
|
||||||
{
|
push_partmap_module (part->partmap->name);
|
||||||
char buf[50];
|
|
||||||
if (strcmp (part->partmap->name, "openbsd") == 0
|
|
||||||
|| strcmp (part->partmap->name, "netbsd") == 0)
|
|
||||||
{
|
|
||||||
grub_install_push_module ("part_bsd");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
snprintf (buf, sizeof (buf), "part_%s", part->partmap->name);
|
|
||||||
grub_install_push_module (buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID)
|
if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID)
|
||||||
{
|
{
|
||||||
grub_diskfilter_get_partmap (disk, grub_install_push_module);
|
grub_diskfilter_get_partmap (disk, push_partmap_module);
|
||||||
have_abstractions = 1;
|
have_abstractions = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,7 +611,7 @@ device_map_check_duplicates (const char *dev_map)
|
|||||||
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
qsort (d, filled, sizeof (d[0]), (int (*) (const void *, const void *))strcmp);
|
qsort (d, filled, sizeof (d[0]), grub_qsort_strcmp);
|
||||||
|
|
||||||
for (i = 0; i + 1 < filled; i++)
|
for (i = 0; i + 1 < filled; i++)
|
||||||
if (strcmp (d[i], d[i+1]) == 0)
|
if (strcmp (d[i], d[i+1]) == 0)
|
||||||
@ -1108,7 +1113,12 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (install_device[0] == '('
|
if (install_device[0] == '('
|
||||||
&& install_device[grub_strlen (install_device) - 1] == ')')
|
&& install_device[grub_strlen (install_device) - 1] == ')')
|
||||||
install_drive = xstrdup (install_device);
|
{
|
||||||
|
size_t len = grub_strlen (install_device) - 2;
|
||||||
|
install_drive = xmalloc (len + 1);
|
||||||
|
memcpy (install_drive, install_device + 1, len);
|
||||||
|
install_drive[len] = '\0';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_util_pull_device (install_device);
|
grub_util_pull_device (install_device);
|
||||||
@ -1394,8 +1404,7 @@ main (int argc, char *argv[])
|
|||||||
/* output */ imgfile,
|
/* output */ imgfile,
|
||||||
/* memdisk */ NULL,
|
/* memdisk */ NULL,
|
||||||
have_load_cfg ? load_cfg : NULL,
|
have_load_cfg ? load_cfg : NULL,
|
||||||
/* image target */ mkimage_target,
|
/* image target */ mkimage_target, 0);
|
||||||
0, GRUB_COMPRESSION_AUTO);
|
|
||||||
/* Backward-compatibility kludges. */
|
/* Backward-compatibility kludges. */
|
||||||
switch (platform)
|
switch (platform)
|
||||||
{
|
{
|
||||||
@ -1425,8 +1434,7 @@ main (int argc, char *argv[])
|
|||||||
/* output */ dst,
|
/* output */ dst,
|
||||||
/* memdisk */ NULL,
|
/* memdisk */ NULL,
|
||||||
have_load_cfg ? load_cfg : NULL,
|
have_load_cfg ? load_cfg : NULL,
|
||||||
/* image target */ mkimage_target,
|
/* image target */ mkimage_target, 0);
|
||||||
0, GRUB_COMPRESSION_AUTO);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
||||||
|
@ -146,6 +146,10 @@ GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_u
|
|||||||
# choosing Hurd filesystem module.
|
# choosing Hurd filesystem module.
|
||||||
GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
|
GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
|
||||||
|
|
||||||
|
if [ x"$GRUB_FS" = xunknown ]; then
|
||||||
|
GRUB_FS="$(stat -f --printf=%T / || echo unknown)"
|
||||||
|
fi
|
||||||
|
|
||||||
if test -f ${sysconfdir}/default/grub ; then
|
if test -f ${sysconfdir}/default/grub ; then
|
||||||
. ${sysconfdir}/default/grub
|
. ${sysconfdir}/default/grub
|
||||||
fi
|
fi
|
||||||
|
@ -821,9 +821,9 @@ write_font_pf2 (struct grub_font_info *font_info, char *output_file)
|
|||||||
|
|
||||||
font_name = xmalloc (strlen (font_info->name) + strlen (&style_name[1])
|
font_name = xmalloc (strlen (font_info->name) + strlen (&style_name[1])
|
||||||
+ 3 + 20);
|
+ 3 + 20);
|
||||||
ptr = stpcpy (font_name, font_info->name);
|
ptr = grub_stpcpy (font_name, font_info->name);
|
||||||
*ptr++ = ' ';
|
*ptr++ = ' ';
|
||||||
ptr = stpcpy (ptr, &style_name[1]);
|
ptr = grub_stpcpy (ptr, &style_name[1]);
|
||||||
*ptr++ = ' ';
|
*ptr++ = ' ';
|
||||||
snprintf (ptr, 20, "%d", font_info->size);
|
snprintf (ptr, 20, "%d", font_info->size);
|
||||||
|
|
||||||
|
@ -493,6 +493,85 @@ SUFFIX (count_funcs) (Elf_Ehdr *e, Elf_Shdr *symtab_section,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKIMAGE_ELF32
|
||||||
|
/* Deal with relocation information. This function relocates addresses
|
||||||
|
within the virtual address space starting from 0. So only relative
|
||||||
|
addresses can be fully resolved. Absolute addresses must be relocated
|
||||||
|
again by a PE32 relocator when loaded. */
|
||||||
|
static grub_size_t
|
||||||
|
arm_get_trampoline_size (Elf_Ehdr *e,
|
||||||
|
Elf_Shdr *sections,
|
||||||
|
Elf_Half section_entsize,
|
||||||
|
Elf_Half num_sections,
|
||||||
|
const struct grub_install_image_target_desc *image_target)
|
||||||
|
{
|
||||||
|
Elf_Half i;
|
||||||
|
Elf_Shdr *s;
|
||||||
|
grub_size_t ret = 0;
|
||||||
|
|
||||||
|
for (i = 0, s = sections;
|
||||||
|
i < num_sections;
|
||||||
|
i++, s = (Elf_Shdr *) ((char *) s + section_entsize))
|
||||||
|
if ((s->sh_type == grub_host_to_target32 (SHT_REL)) ||
|
||||||
|
(s->sh_type == grub_host_to_target32 (SHT_RELA)))
|
||||||
|
{
|
||||||
|
Elf_Rela *r;
|
||||||
|
Elf_Word rtab_size, r_size, num_rs;
|
||||||
|
Elf_Off rtab_offset;
|
||||||
|
Elf_Shdr *symtab_section;
|
||||||
|
Elf_Word j;
|
||||||
|
|
||||||
|
symtab_section = (Elf_Shdr *) ((char *) sections
|
||||||
|
+ (grub_target_to_host32 (s->sh_link)
|
||||||
|
* section_entsize));
|
||||||
|
|
||||||
|
rtab_size = grub_target_to_host (s->sh_size);
|
||||||
|
r_size = grub_target_to_host (s->sh_entsize);
|
||||||
|
rtab_offset = grub_target_to_host (s->sh_offset);
|
||||||
|
num_rs = rtab_size / r_size;
|
||||||
|
|
||||||
|
for (j = 0, r = (Elf_Rela *) ((char *) e + rtab_offset);
|
||||||
|
j < num_rs;
|
||||||
|
j++, r = (Elf_Rela *) ((char *) r + r_size))
|
||||||
|
{
|
||||||
|
Elf_Addr info;
|
||||||
|
Elf_Addr sym_addr;
|
||||||
|
|
||||||
|
info = grub_target_to_host (r->r_info);
|
||||||
|
sym_addr = SUFFIX (get_symbol_address) (e, symtab_section,
|
||||||
|
ELF_R_SYM (info), image_target);
|
||||||
|
|
||||||
|
sym_addr += (s->sh_type == grub_target_to_host32 (SHT_RELA)) ?
|
||||||
|
grub_target_to_host (r->r_addend) : 0;
|
||||||
|
|
||||||
|
switch (ELF_R_TYPE (info))
|
||||||
|
{
|
||||||
|
case R_ARM_ABS32:
|
||||||
|
case R_ARM_V4BX:
|
||||||
|
break;
|
||||||
|
case R_ARM_THM_CALL:
|
||||||
|
case R_ARM_THM_JUMP24:
|
||||||
|
case R_ARM_THM_JUMP19:
|
||||||
|
if (!(sym_addr & 1))
|
||||||
|
ret += 8;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R_ARM_CALL:
|
||||||
|
case R_ARM_JUMP24:
|
||||||
|
if (sym_addr & 1)
|
||||||
|
ret += 16;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
grub_util_error (_("relocation 0x%x is not implemented yet!"), ELF_R_TYPE (info));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Deal with relocation information. This function relocates addresses
|
/* Deal with relocation information. This function relocates addresses
|
||||||
within the virtual address space starting from 0. So only relative
|
within the virtual address space starting from 0. So only relative
|
||||||
addresses can be fully resolved. Absolute addresses must be relocated
|
addresses can be fully resolved. Absolute addresses must be relocated
|
||||||
@ -512,6 +591,8 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
|
|||||||
struct grub_ia64_trampoline *tr = (void *) (pe_target + tramp_off);
|
struct grub_ia64_trampoline *tr = (void *) (pe_target + tramp_off);
|
||||||
grub_uint64_t *gpptr = (void *) (pe_target + got_off);
|
grub_uint64_t *gpptr = (void *) (pe_target + got_off);
|
||||||
#define MASK19 ((1 << 19) - 1)
|
#define MASK19 ((1 << 19) - 1)
|
||||||
|
#else
|
||||||
|
grub_uint32_t *tr = (void *) (pe_target + tramp_off);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0, s = sections;
|
for (i = 0, s = sections;
|
||||||
@ -731,13 +812,13 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
|
|||||||
case R_AARCH64_JUMP26:
|
case R_AARCH64_JUMP26:
|
||||||
case R_AARCH64_CALL26:
|
case R_AARCH64_CALL26:
|
||||||
{
|
{
|
||||||
grub_err_t err;
|
|
||||||
sym_addr -= offset;
|
sym_addr -= offset;
|
||||||
sym_addr -= SUFFIX (entry_point);
|
sym_addr -= SUFFIX (entry_point);
|
||||||
err = grub_arm64_reloc_xxxx26((grub_uint32_t *)target,
|
if (!grub_arm_64_check_xxxx26_offset (sym_addr))
|
||||||
|
grub_util_error ("%s", _("CALL26 Relocation out of range"));
|
||||||
|
|
||||||
|
grub_arm64_set_xxxx26_offset((grub_uint32_t *)target,
|
||||||
sym_addr);
|
sym_addr);
|
||||||
if (err)
|
|
||||||
grub_util_error ("%s", grub_errmsg);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -764,32 +845,74 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
|
|||||||
*target = grub_host_to_target32 (grub_target_to_host32 (*target) + sym_addr);
|
*target = grub_host_to_target32 (grub_target_to_host32 (*target) + sym_addr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/* Happens when compiled with -march=armv4.
|
||||||
|
Since currently we need at least armv5, keep bx as-is.
|
||||||
|
*/
|
||||||
|
case R_ARM_V4BX:
|
||||||
|
break;
|
||||||
case R_ARM_THM_CALL:
|
case R_ARM_THM_CALL:
|
||||||
case R_ARM_THM_JUMP24:
|
case R_ARM_THM_JUMP24:
|
||||||
{
|
|
||||||
grub_err_t err;
|
|
||||||
grub_util_info (" THM_JUMP24:\ttarget=0x%08lx\toffset=(0x%08x)", (unsigned long) target, sym_addr);
|
|
||||||
sym_addr -= offset;
|
|
||||||
/* Thumb instructions can be 16-bit aligned */
|
|
||||||
err = grub_arm_reloc_thm_call ((grub_uint16_t *) target,
|
|
||||||
sym_addr);
|
|
||||||
if (err)
|
|
||||||
grub_util_error ("%s", grub_errmsg);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case R_ARM_THM_JUMP19:
|
case R_ARM_THM_JUMP19:
|
||||||
{
|
{
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
grub_util_info (" THM_JUMP19:\toffset=%d\t(0x%08x)",
|
grub_util_info (" THM_JUMP24:\ttarget=0x%08lx\toffset=(0x%08x)", (unsigned long) target, sym_addr);
|
||||||
sym_addr, sym_addr);
|
if (!(sym_addr & 1))
|
||||||
sym_addr -= offset;
|
{
|
||||||
|
grub_uint32_t tr_addr;
|
||||||
|
grub_int32_t new_offset;
|
||||||
|
tr_addr = (char *) tr - (char *) pe_target
|
||||||
|
- target_section_addr;
|
||||||
|
new_offset = sym_addr - tr_addr - 12;
|
||||||
|
|
||||||
|
if (!grub_arm_jump24_check_offset (new_offset))
|
||||||
|
return grub_util_error ("jump24 relocation out of range");
|
||||||
|
|
||||||
|
tr[0] = grub_host_to_target32 (0x46c04778); /* bx pc; nop */
|
||||||
|
tr[1] = grub_host_to_target32 (((new_offset >> 2) & 0xffffff) | 0xea000000); /* b new_offset */
|
||||||
|
tr += 2;
|
||||||
|
sym_addr = tr_addr | 1;
|
||||||
|
}
|
||||||
|
sym_addr -= offset;
|
||||||
/* Thumb instructions can be 16-bit aligned */
|
/* Thumb instructions can be 16-bit aligned */
|
||||||
err = grub_arm_reloc_thm_jump19 ((grub_uint16_t *) target, sym_addr);
|
if (ELF_R_TYPE (info) == R_ARM_THM_JUMP19)
|
||||||
|
err = grub_arm_reloc_thm_jump19 ((grub_uint16_t *) target, sym_addr);
|
||||||
|
else
|
||||||
|
err = grub_arm_reloc_thm_call ((grub_uint16_t *) target,
|
||||||
|
sym_addr);
|
||||||
if (err)
|
if (err)
|
||||||
grub_util_error ("%s", grub_errmsg);
|
grub_util_error ("%s", grub_errmsg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R_ARM_CALL:
|
||||||
|
case R_ARM_JUMP24:
|
||||||
|
{
|
||||||
|
grub_err_t err;
|
||||||
|
grub_util_info (" JUMP24:\ttarget=0x%08lx\toffset=(0x%08x)", (unsigned long) target, sym_addr);
|
||||||
|
if (sym_addr & 1)
|
||||||
|
{
|
||||||
|
grub_uint32_t tr_addr;
|
||||||
|
grub_int32_t new_offset;
|
||||||
|
tr_addr = (char *) tr - (char *) pe_target
|
||||||
|
- target_section_addr;
|
||||||
|
new_offset = sym_addr - tr_addr - 12;
|
||||||
|
|
||||||
|
/* There is no immediate version of bx, only register one... */
|
||||||
|
tr[0] = grub_host_to_target32 (0xe59fc004); /* ldr ip, [pc, #4] */
|
||||||
|
tr[1] = grub_host_to_target32 (0xe08cc00f); /* add ip, ip, pc */
|
||||||
|
tr[2] = grub_host_to_target32 (0xe12fff1c); /* bx ip */
|
||||||
|
tr[3] = grub_host_to_target32 (new_offset | 1);
|
||||||
|
tr += 4;
|
||||||
|
sym_addr = tr_addr;
|
||||||
|
}
|
||||||
|
sym_addr -= offset;
|
||||||
|
err = grub_arm_reloc_jump24 (target,
|
||||||
|
sym_addr);
|
||||||
|
if (err)
|
||||||
|
grub_util_error ("%s", grub_errmsg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
grub_util_error (_("relocation 0x%x is not implemented yet!"), ELF_R_TYPE (info));
|
grub_util_error (_("relocation 0x%x is not implemented yet!"), ELF_R_TYPE (info));
|
||||||
break;
|
break;
|
||||||
@ -1054,11 +1177,13 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out,
|
|||||||
case EM_ARM:
|
case EM_ARM:
|
||||||
switch (ELF_R_TYPE (info))
|
switch (ELF_R_TYPE (info))
|
||||||
{
|
{
|
||||||
|
case R_ARM_V4BX:
|
||||||
/* Relative relocations do not require fixup entries. */
|
/* Relative relocations do not require fixup entries. */
|
||||||
case R_ARM_JUMP24:
|
case R_ARM_JUMP24:
|
||||||
case R_ARM_THM_CALL:
|
case R_ARM_THM_CALL:
|
||||||
case R_ARM_THM_JUMP19:
|
case R_ARM_THM_JUMP19:
|
||||||
case R_ARM_THM_JUMP24:
|
case R_ARM_THM_JUMP24:
|
||||||
|
case R_ARM_CALL:
|
||||||
{
|
{
|
||||||
Elf_Addr addr;
|
Elf_Addr addr;
|
||||||
|
|
||||||
@ -1280,7 +1405,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
|
|||||||
Elf_Off section_offset;
|
Elf_Off section_offset;
|
||||||
Elf_Half section_entsize;
|
Elf_Half section_entsize;
|
||||||
grub_size_t kernel_size;
|
grub_size_t kernel_size;
|
||||||
grub_size_t ia64jmp_off = 0, ia64_toff = 0, ia64_got_off = 0;
|
grub_size_t ia64jmp_off = 0, tramp_off = 0, ia64_got_off = 0;
|
||||||
unsigned ia64jmpnum = 0;
|
unsigned ia64jmpnum = 0;
|
||||||
Elf_Shdr *symtab_section = 0;
|
Elf_Shdr *symtab_section = 0;
|
||||||
grub_size_t got = 0;
|
grub_size_t got = 0;
|
||||||
@ -1356,6 +1481,11 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
|
|||||||
else
|
else
|
||||||
*bss_size = 0;
|
*bss_size = 0;
|
||||||
|
|
||||||
|
if (image_target->id == IMAGE_SPARC64_AOUT
|
||||||
|
|| image_target->id == IMAGE_SPARC64_RAW
|
||||||
|
|| image_target->id == IMAGE_SPARC64_CDCORE)
|
||||||
|
*kernel_sz = ALIGN_UP (*kernel_sz, image_target->mod_align);
|
||||||
|
|
||||||
if (image_target->id == IMAGE_EFI)
|
if (image_target->id == IMAGE_EFI)
|
||||||
{
|
{
|
||||||
symtab_section = NULL;
|
symtab_section = NULL;
|
||||||
@ -1368,6 +1498,21 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MKIMAGE_ELF32
|
||||||
|
if (image_target->elf_target == EM_ARM)
|
||||||
|
{
|
||||||
|
grub_size_t tramp;
|
||||||
|
|
||||||
|
*kernel_sz = ALIGN_UP (*kernel_sz, 16);
|
||||||
|
|
||||||
|
tramp = arm_get_trampoline_size (e, sections, section_entsize,
|
||||||
|
num_sections, image_target);
|
||||||
|
|
||||||
|
tramp_off = *kernel_sz;
|
||||||
|
*kernel_sz += ALIGN_UP (tramp, 16);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MKIMAGE_ELF64
|
#ifdef MKIMAGE_ELF64
|
||||||
if (image_target->elf_target == EM_IA_64)
|
if (image_target->elf_target == EM_IA_64)
|
||||||
{
|
{
|
||||||
@ -1377,7 +1522,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
|
|||||||
|
|
||||||
grub_ia64_dl_get_tramp_got_size (e, &tramp, &got);
|
grub_ia64_dl_get_tramp_got_size (e, &tramp, &got);
|
||||||
|
|
||||||
ia64_toff = *kernel_sz;
|
tramp_off = *kernel_sz;
|
||||||
*kernel_sz += ALIGN_UP (tramp, 16);
|
*kernel_sz += ALIGN_UP (tramp, 16);
|
||||||
|
|
||||||
ia64jmp_off = *kernel_sz;
|
ia64jmp_off = *kernel_sz;
|
||||||
@ -1419,7 +1564,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
|
|||||||
SUFFIX (relocate_addresses) (e, sections, section_addresses,
|
SUFFIX (relocate_addresses) (e, sections, section_addresses,
|
||||||
section_entsize,
|
section_entsize,
|
||||||
num_sections, strtab,
|
num_sections, strtab,
|
||||||
out_img, ia64_toff, ia64_got_off,
|
out_img, tramp_off, ia64_got_off,
|
||||||
image_target);
|
image_target);
|
||||||
|
|
||||||
*reloc_size = SUFFIX (make_reloc_section) (e, reloc_section,
|
*reloc_size = SUFFIX (make_reloc_section) (e, reloc_section,
|
||||||
@ -1427,7 +1572,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
|
|||||||
section_entsize, num_sections,
|
section_entsize, num_sections,
|
||||||
strtab, ia64jmp_off
|
strtab, ia64jmp_off
|
||||||
+ image_target->vaddr_offset,
|
+ image_target->vaddr_offset,
|
||||||
2 * ia64jmpnum + got,
|
2 * ia64jmpnum + (got / 8),
|
||||||
image_target);
|
image_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +149,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform)
|
|||||||
output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext);
|
output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext);
|
||||||
grub_install_make_image_wrap (input_dir, prefix, output,
|
grub_install_make_image_wrap (input_dir, prefix, output,
|
||||||
0, load_cfg,
|
0, load_cfg,
|
||||||
targets[platform].mkimage_target, 0,
|
targets[platform].mkimage_target, 0);
|
||||||
GRUB_COMPRESSION_AUTO);
|
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
|
|
||||||
/* TRANSLATORS: First %s is replaced by platform name. Second one by filename. */
|
/* TRANSLATORS: First %s is replaced by platform name. Second one by filename. */
|
||||||
|
@ -241,8 +241,7 @@ write_part (FILE *f, const char *srcdir)
|
|||||||
static void
|
static void
|
||||||
make_image_abs (enum grub_install_plat plat,
|
make_image_abs (enum grub_install_plat plat,
|
||||||
const char *mkimage_target,
|
const char *mkimage_target,
|
||||||
const char *output,
|
const char *output)
|
||||||
grub_compression_t compress)
|
|
||||||
{
|
{
|
||||||
char *load_cfg;
|
char *load_cfg;
|
||||||
FILE *load_cfg_f;
|
FILE *load_cfg_f;
|
||||||
@ -266,8 +265,7 @@ make_image_abs (enum grub_install_plat plat,
|
|||||||
grub_install_push_module ("iso9660");
|
grub_install_push_module ("iso9660");
|
||||||
grub_install_make_image_wrap (source_dirs[plat], "/boot/grub", output,
|
grub_install_make_image_wrap (source_dirs[plat], "/boot/grub", output,
|
||||||
0, load_cfg,
|
0, load_cfg,
|
||||||
mkimage_target, 0,
|
mkimage_target, 0);
|
||||||
compress);
|
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
grub_util_unlink (load_cfg);
|
grub_util_unlink (load_cfg);
|
||||||
@ -276,12 +274,10 @@ make_image_abs (enum grub_install_plat plat,
|
|||||||
static void
|
static void
|
||||||
make_image (enum grub_install_plat plat,
|
make_image (enum grub_install_plat plat,
|
||||||
const char *mkimage_target,
|
const char *mkimage_target,
|
||||||
const char *output_sub,
|
const char *output_sub)
|
||||||
grub_compression_t compress)
|
|
||||||
{
|
{
|
||||||
char *out = grub_util_path_concat (2, boot_grub, output_sub);
|
char *out = grub_util_path_concat (2, boot_grub, output_sub);
|
||||||
make_image_abs (plat, mkimage_target,
|
make_image_abs (plat, mkimage_target, out);
|
||||||
out, GRUB_COMPRESSION_AUTO);
|
|
||||||
free (out);
|
free (out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,8 +303,7 @@ make_image_fwdisk_abs (enum grub_install_plat plat,
|
|||||||
|
|
||||||
grub_install_push_module ("iso9660");
|
grub_install_push_module ("iso9660");
|
||||||
grub_install_make_image_wrap (source_dirs[plat], "()/boot/grub", output,
|
grub_install_make_image_wrap (source_dirs[plat], "()/boot/grub", output,
|
||||||
0, load_cfg, mkimage_target, 0,
|
0, load_cfg, mkimage_target, 0);
|
||||||
GRUB_COMPRESSION_AUTO);
|
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,8 +478,7 @@ main (int argc, char *argv[])
|
|||||||
grub_install_make_image_wrap (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC],
|
grub_install_make_image_wrap (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC],
|
||||||
"/boot/grub", output,
|
"/boot/grub", output,
|
||||||
0, load_cfg,
|
0, load_cfg,
|
||||||
"i386-pc-eltorito", 0,
|
"i386-pc-eltorito", 0);
|
||||||
GRUB_COMPRESSION_AUTO);
|
|
||||||
|
|
||||||
xorriso_push ("-b");
|
xorriso_push ("-b");
|
||||||
xorriso_push ("boot/grub/i386-pc/eltorito.img");
|
xorriso_push ("boot/grub/i386-pc/eltorito.img");
|
||||||
@ -528,8 +522,7 @@ main (int argc, char *argv[])
|
|||||||
grub_install_make_image_wrap (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC],
|
grub_install_make_image_wrap (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC],
|
||||||
"/boot/grub", output,
|
"/boot/grub", output,
|
||||||
0, load_cfg,
|
0, load_cfg,
|
||||||
"i386-pc", 0,
|
"i386-pc", 0);
|
||||||
GRUB_COMPRESSION_AUTO);
|
|
||||||
sz = ftello (sa);
|
sz = ftello (sa);
|
||||||
fflush (sa);
|
fflush (sa);
|
||||||
grub_util_fd_sync (fileno (sa));
|
grub_util_fd_sync (fileno (sa));
|
||||||
@ -554,7 +547,7 @@ main (int argc, char *argv[])
|
|||||||
grub_install_push_module ("pata");
|
grub_install_push_module ("pata");
|
||||||
grub_install_push_module ("ahci");
|
grub_install_push_module ("ahci");
|
||||||
grub_install_push_module ("at_keyboard");
|
grub_install_push_module ("at_keyboard");
|
||||||
make_image (GRUB_INSTALL_PLATFORM_I386_MULTIBOOT, "i386-multiboot", "i386-multiboot/core.elf", GRUB_COMPRESSION_AUTO);
|
make_image (GRUB_INSTALL_PLATFORM_I386_MULTIBOOT, "i386-multiboot", "i386-multiboot/core.elf");
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
@ -781,22 +774,22 @@ main (int argc, char *argv[])
|
|||||||
make_image_fwdisk (GRUB_INSTALL_PLATFORM_MIPSEL_ARC, "mipsel-arc", "arc.exe");
|
make_image_fwdisk (GRUB_INSTALL_PLATFORM_MIPSEL_ARC, "mipsel-arc", "arc.exe");
|
||||||
|
|
||||||
grub_install_push_module ("pata");
|
grub_install_push_module ("pata");
|
||||||
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS, "mipsel-qemu_mips-elf", "roms/mipsel-qemu_mips.elf", GRUB_COMPRESSION_AUTO);
|
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS, "mipsel-qemu_mips-elf", "roms/mipsel-qemu_mips.elf");
|
||||||
|
|
||||||
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-loongson-elf", "loongson.elf", GRUB_COMPRESSION_XZ);
|
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-loongson-elf", "loongson.elf");
|
||||||
|
|
||||||
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-yeeloong-flash", "mipsel-yeeloong.bin", GRUB_COMPRESSION_XZ);
|
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-yeeloong-flash", "mipsel-yeeloong.bin");
|
||||||
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-fuloong2f-flash", "mipsel-fuloong2f.bin", GRUB_COMPRESSION_XZ);
|
make_image (GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON, "mipsel-fuloong2f-flash", "mipsel-fuloong2f.bin");
|
||||||
|
|
||||||
make_image (GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS, "mips-qemu_mips-elf", "roms/mips-qemu_mips.elf", GRUB_COMPRESSION_AUTO);
|
make_image (GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS, "mips-qemu_mips-elf", "roms/mips-qemu_mips.elf");
|
||||||
|
|
||||||
grub_install_push_module ("at_keyboard");
|
grub_install_push_module ("at_keyboard");
|
||||||
|
|
||||||
make_image (GRUB_INSTALL_PLATFORM_I386_QEMU, "i386-qemu", "roms/qemu.img", GRUB_COMPRESSION_AUTO);
|
make_image (GRUB_INSTALL_PLATFORM_I386_QEMU, "i386-qemu", "roms/qemu.img");
|
||||||
|
|
||||||
grub_install_push_module ("ahci");
|
grub_install_push_module ("ahci");
|
||||||
|
|
||||||
make_image (GRUB_INSTALL_PLATFORM_I386_COREBOOT, "i386-coreboot", "roms/coreboot.elf", GRUB_COMPRESSION_AUTO);
|
make_image (GRUB_INSTALL_PLATFORM_I386_COREBOOT, "i386-coreboot", "roms/coreboot.elf");
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static grub_compression_t compression;
|
|
||||||
static char *output_image;
|
static char *output_image;
|
||||||
static char **files;
|
static char **files;
|
||||||
static int nfiles;
|
static int nfiles;
|
||||||
@ -35,8 +34,7 @@ static FILE *memdisk;
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
OPTION_OUTPUT = 'o',
|
OPTION_OUTPUT = 'o',
|
||||||
OPTION_FORMAT = 'C',
|
OPTION_FORMAT = 'O'
|
||||||
OPTION_COMPRESION = 'C'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
@ -44,8 +42,7 @@ static struct argp_option options[] = {
|
|||||||
{"output", 'o', N_("FILE"),
|
{"output", 'o', N_("FILE"),
|
||||||
0, N_("save output in FILE [required]"), 2},
|
0, N_("save output in FILE [required]"), 2},
|
||||||
{"format", 'O', N_("FILE"), 0, 0, 2},
|
{"format", 'O', N_("FILE"), 0, 0, 2},
|
||||||
{"compression", 'C', N_("xz|none|auto"),
|
{"compression", 'C', N_("xz|none|auto"), OPTION_HIDDEN, 0, 2},
|
||||||
0, N_("choose the compression to use for core image"), 2},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,6 +67,9 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
|
|||||||
static error_t
|
static error_t
|
||||||
argp_parser (int key, char *arg, struct argp_state *state)
|
argp_parser (int key, char *arg, struct argp_state *state)
|
||||||
{
|
{
|
||||||
|
if (key == 'C')
|
||||||
|
key = GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS;
|
||||||
|
|
||||||
if (grub_install_parse (key, arg))
|
if (grub_install_parse (key, arg))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -95,23 +95,6 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'C':
|
|
||||||
if (grub_strcmp (arg, "xz") == 0)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_LIBLZMA
|
|
||||||
compression = GRUB_COMPRESSION_XZ;
|
|
||||||
#else
|
|
||||||
grub_util_error ("%s",
|
|
||||||
_("grub-mkimage is compiled without XZ support"));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (grub_strcmp (arg, "none") == 0)
|
|
||||||
compression = GRUB_COMPRESSION_NONE;
|
|
||||||
else if (grub_strcmp (arg, "auto") == 0)
|
|
||||||
compression = GRUB_COMPRESSION_AUTO;
|
|
||||||
else
|
|
||||||
grub_util_error (_("Unknown compression format %s"), arg);
|
|
||||||
break;
|
|
||||||
case ARGP_KEY_ARG:
|
case ARGP_KEY_ARG:
|
||||||
files[nfiles++] = xstrdup (arg);
|
files[nfiles++] = xstrdup (arg);
|
||||||
break;
|
break;
|
||||||
@ -365,8 +348,7 @@ main (int argc, char *argv[])
|
|||||||
grub_install_make_image_wrap (grub_install_source_directory,
|
grub_install_make_image_wrap (grub_install_source_directory,
|
||||||
"(memdisk)/boot/grub", output_image,
|
"(memdisk)/boot/grub", output_image,
|
||||||
memdisk_img, NULL,
|
memdisk_img, NULL,
|
||||||
grub_util_get_target_name (format), 0,
|
grub_util_get_target_name (format), 0);
|
||||||
compression);
|
|
||||||
|
|
||||||
grub_util_unlink (memdisk_img);
|
grub_util_unlink (memdisk_img);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -209,9 +209,23 @@ DEVICE must be an OS device (e.g. /dev/sda)."),
|
|||||||
NULL, help_filter, NULL
|
NULL, help_filter, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char *
|
||||||
|
get_device_name (char *dev)
|
||||||
|
{
|
||||||
|
size_t len = strlen (dev);
|
||||||
|
|
||||||
|
if (dev[0] != '(' || dev[len - 1] != ')')
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
dev[len - 1] = '\0';
|
||||||
|
return dev + 1;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
char *root_dev = NULL;
|
||||||
|
char *dest_dev = NULL;
|
||||||
struct arguments arguments;
|
struct arguments arguments;
|
||||||
|
|
||||||
grub_util_host_init (&argc, &argv);
|
grub_util_host_init (&argc, &argv);
|
||||||
@ -250,11 +264,34 @@ main (int argc, char *argv[])
|
|||||||
grub_mdraid1x_init ();
|
grub_mdraid1x_init ();
|
||||||
grub_lvm_init ();
|
grub_lvm_init ();
|
||||||
|
|
||||||
|
dest_dev = get_device_name (arguments.device);
|
||||||
|
if (! dest_dev)
|
||||||
|
{
|
||||||
|
/* Possibly, the user specified an OS device file. */
|
||||||
|
dest_dev = grub_util_get_grub_dev (arguments.device);
|
||||||
|
if (! dest_dev)
|
||||||
|
{
|
||||||
|
char *program = xstrdup(program_name);
|
||||||
|
fprintf (stderr, _("Invalid device `%s'.\n"), arguments.device);
|
||||||
|
argp_help (&argp, stderr, ARGP_HELP_STD_USAGE, program);
|
||||||
|
free(program);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
grub_util_info ("transformed OS device `%s' into GRUB device `%s'",
|
||||||
|
arguments.device, dest_dev);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* For simplicity. */
|
||||||
|
dest_dev = xstrdup (dest_dev);
|
||||||
|
grub_util_info ("Using `%s' as GRUB device", dest_dev);
|
||||||
|
}
|
||||||
|
|
||||||
/* Do the real work. */
|
/* Do the real work. */
|
||||||
GRUB_SETUP_FUNC (arguments.dir ? : DEFAULT_DIRECTORY,
|
GRUB_SETUP_FUNC (arguments.dir ? : DEFAULT_DIRECTORY,
|
||||||
arguments.boot_file ? : DEFAULT_BOOT_FILE,
|
arguments.boot_file ? : DEFAULT_BOOT_FILE,
|
||||||
arguments.core_file ? : DEFAULT_CORE_FILE,
|
arguments.core_file ? : DEFAULT_CORE_FILE,
|
||||||
arguments.device, arguments.force,
|
dest_dev, arguments.force,
|
||||||
arguments.fs_probe, arguments.allow_floppy);
|
arguments.fs_probe, arguments.allow_floppy);
|
||||||
|
|
||||||
/* Free resources. */
|
/* Free resources. */
|
||||||
@ -266,6 +303,8 @@ main (int argc, char *argv[])
|
|||||||
free (arguments.dir);
|
free (arguments.dir);
|
||||||
free (arguments.dev_map);
|
free (arguments.dev_map);
|
||||||
free (arguments.device);
|
free (arguments.device);
|
||||||
|
free (root_dev);
|
||||||
|
free (dest_dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -68,13 +68,7 @@ else
|
|||||||
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"
|
case x"$GRUB_FS" in
|
||||||
|
|
||||||
if [ x"$GRUBFS" = x ]; then
|
|
||||||
GRUBFS="$(stat -f --printf=%T / || true)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case x"$GRUBFS" in
|
|
||||||
xbtrfs)
|
xbtrfs)
|
||||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
rootsubvol="`make_system_path_relative_to_its_root /`"
|
||||||
rootsubvol="${rootsubvol#/}"
|
rootsubvol="${rootsubvol#/}"
|
||||||
|
@ -64,13 +64,7 @@ if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
|
|||||||
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
|
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"
|
case x"$GRUB_FS" in
|
||||||
|
|
||||||
if [ x"$GRUBFS" = x ]; then
|
|
||||||
GRUBFS="$(stat -f --printf=%T /)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case x"$GRUBFS" in
|
|
||||||
xbtrfs)
|
xbtrfs)
|
||||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
rootsubvol="`make_system_path_relative_to_its_root /`"
|
||||||
rootsubvol="${rootsubvol#/}"
|
rootsubvol="${rootsubvol#/}"
|
||||||
|
@ -129,7 +129,7 @@ for OS in ${OSPROBED} ; do
|
|||||||
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
|
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
|
||||||
LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
|
LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
|
||||||
BOOT="`echo ${OS} | cut -d ':' -f 4`"
|
BOOT="`echo ${OS} | cut -d ':' -f 4`"
|
||||||
UUID="`grub-probe --target=fs_uuid --device ${DEVICE%@*}`"
|
UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"
|
||||||
EXPUUID="$UUID"
|
EXPUUID="$UUID"
|
||||||
|
|
||||||
if [ x"${DEVICE#*@}" != x ] ; then
|
if [ x"${DEVICE#*@}" != x ] ; then
|
||||||
|
@ -256,3 +256,11 @@ void
|
|||||||
grub_register_exported_symbols (void)
|
grub_register_exported_symbols (void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used in comparison of arrays of strings with qsort */
|
||||||
|
int
|
||||||
|
grub_qsort_strcmp (const void *p1, const void *p2)
|
||||||
|
{
|
||||||
|
return strcmp(*(char **)p1, *(char **)p2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,8 @@ static const struct grub_install_image_target_desc image_targets[] =
|
|||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR,
|
||||||
|
.mod_align = GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.dirname = "sparc64-ieee1275",
|
.dirname = "sparc64-ieee1275",
|
||||||
@ -398,7 +399,8 @@ static const struct grub_install_image_target_desc image_targets[] =
|
|||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR,
|
||||||
|
.mod_align = GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.dirname = "sparc64-ieee1275",
|
.dirname = "sparc64-ieee1275",
|
||||||
@ -413,7 +415,8 @@ static const struct grub_install_image_target_desc image_targets[] =
|
|||||||
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
.decompressor_uncompressed_addr = TARGET_NO_FIELD,
|
||||||
.section_align = 1,
|
.section_align = 1,
|
||||||
.vaddr_offset = 0,
|
.vaddr_offset = 0,
|
||||||
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
|
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR,
|
||||||
|
.mod_align = GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.dirname = "ia64-efi",
|
.dirname = "ia64-efi",
|
||||||
@ -831,6 +834,94 @@ struct fixup_block_list
|
|||||||
struct grub_pe32_fixup_block b;
|
struct grub_pe32_fixup_block b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* R_ARM_THM_CALL/THM_JUMP24
|
||||||
|
*
|
||||||
|
* Relocate Thumb (T32) instruction set relative branches:
|
||||||
|
* B.W, BL and BLX
|
||||||
|
*/
|
||||||
|
static grub_err_t
|
||||||
|
grub_arm_reloc_thm_call (grub_uint16_t *target, Elf32_Addr sym_addr)
|
||||||
|
{
|
||||||
|
grub_int32_t offset;
|
||||||
|
|
||||||
|
offset = grub_arm_thm_call_get_offset (target);
|
||||||
|
|
||||||
|
grub_dprintf ("dl", " sym_addr = 0x%08x", sym_addr);
|
||||||
|
|
||||||
|
offset += sym_addr;
|
||||||
|
|
||||||
|
grub_dprintf("dl", " BL*: target=%p, sym_addr=0x%08x, offset=%d\n",
|
||||||
|
target, sym_addr, offset);
|
||||||
|
|
||||||
|
/* Keep traditional (pre-Thumb2) limits on blx. In any case if the kernel
|
||||||
|
is bigger than 2M (currently under 150K) then we probably have a problem
|
||||||
|
somewhere else. */
|
||||||
|
if (offset < -0x200000 || offset >= 0x200000)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
N_("THM_CALL Relocation out of range."));
|
||||||
|
|
||||||
|
grub_dprintf ("dl", " relative destination = %p",
|
||||||
|
(char *) target + offset);
|
||||||
|
|
||||||
|
return grub_arm_thm_call_set_offset (target, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* R_ARM_THM_JUMP19
|
||||||
|
*
|
||||||
|
* Relocate conditional Thumb (T32) B<c>.W
|
||||||
|
*/
|
||||||
|
static grub_err_t
|
||||||
|
grub_arm_reloc_thm_jump19 (grub_uint16_t *target, Elf32_Addr sym_addr)
|
||||||
|
{
|
||||||
|
grub_int32_t offset;
|
||||||
|
|
||||||
|
if (!(sym_addr & 1))
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
N_("Relocation targeting wrong execution state"));
|
||||||
|
|
||||||
|
offset = grub_arm_thm_jump19_get_offset (target);
|
||||||
|
|
||||||
|
/* Adjust and re-truncate offset */
|
||||||
|
offset += sym_addr;
|
||||||
|
|
||||||
|
if (!grub_arm_thm_jump19_check_offset (offset))
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
N_("THM_JUMP19 Relocation out of range."));
|
||||||
|
|
||||||
|
grub_arm_thm_jump19_set_offset (target, offset);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* R_ARM_JUMP24
|
||||||
|
*
|
||||||
|
* Relocate ARM (A32) B
|
||||||
|
*/
|
||||||
|
static grub_err_t
|
||||||
|
grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr sym_addr)
|
||||||
|
{
|
||||||
|
grub_int32_t offset;
|
||||||
|
|
||||||
|
if (sym_addr & 1)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
N_("Relocation targeting wrong execution state"));
|
||||||
|
|
||||||
|
offset = grub_arm_jump24_get_offset (target);
|
||||||
|
offset += sym_addr;
|
||||||
|
|
||||||
|
if (!grub_arm_jump24_check_offset (offset))
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
N_("JUMP24 Relocation out of range."));
|
||||||
|
|
||||||
|
|
||||||
|
grub_arm_jump24_set_offset (target, offset);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
|
|
||||||
#define MKIMAGE_ELF32 1
|
#define MKIMAGE_ELF32 1
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user