mirror of
https://git.proxmox.com/git/grub2
synced 2025-10-04 07:50:49 +00:00
Switch away from git-dpm
This commit is contained in:
parent
e2dc71dd03
commit
2c1a132e34
5
INSTALL
5
INSTALL
@ -23,11 +23,6 @@ configuring the GRUB.
|
|||||||
* Other standard GNU/Unix tools
|
* Other standard GNU/Unix tools
|
||||||
* a libc with large file support (e.g. glibc 2.1 or later)
|
* a libc with large file support (e.g. glibc 2.1 or later)
|
||||||
|
|
||||||
On Unix-based systems, you also need:
|
|
||||||
|
|
||||||
* libefivar (recommended)
|
|
||||||
* libefiboot (recommended; your OS may ship this together with libefivar)
|
|
||||||
|
|
||||||
On GNU/Linux, you also need:
|
On GNU/Linux, you also need:
|
||||||
|
|
||||||
* libdevmapper 1.02.34 or later (recommended)
|
* libdevmapper 1.02.34 or later (recommended)
|
||||||
|
@ -336,23 +336,6 @@ program = {
|
|||||||
condition = COND_GRUB_MKFONT;
|
condition = COND_GRUB_MKFONT;
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
|
||||||
name = grub-mkdevicemap;
|
|
||||||
installdir = sbin;
|
|
||||||
mansection = 8;
|
|
||||||
|
|
||||||
common = util/grub-mkdevicemap.c;
|
|
||||||
common = util/deviceiter.c;
|
|
||||||
common = util/devicemap.c;
|
|
||||||
common = grub-core/osdep/init.c;
|
|
||||||
|
|
||||||
ldadd = libgrubmods.a;
|
|
||||||
ldadd = libgrubgcry.a;
|
|
||||||
ldadd = libgrubkern.a;
|
|
||||||
ldadd = grub-core/lib/gnulib/libgnu.a;
|
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
|
||||||
};
|
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
name = grub-probe;
|
name = grub-probe;
|
||||||
installdir = sbin;
|
installdir = sbin;
|
||||||
@ -570,8 +553,6 @@ program = {
|
|||||||
common = grub-core/osdep/compress.c;
|
common = grub-core/osdep/compress.c;
|
||||||
extra_dist = grub-core/osdep/unix/compress.c;
|
extra_dist = grub-core/osdep/unix/compress.c;
|
||||||
extra_dist = grub-core/osdep/basic/compress.c;
|
extra_dist = grub-core/osdep/basic/compress.c;
|
||||||
common = grub-core/osdep/efivar.c;
|
|
||||||
extra_dist = grub-core/osdep/unix/efivar.c;
|
|
||||||
common = util/editenv.c;
|
common = util/editenv.c;
|
||||||
common = grub-core/osdep/blocklist.c;
|
common = grub-core/osdep/blocklist.c;
|
||||||
common = grub-core/osdep/config.c;
|
common = grub-core/osdep/config.c;
|
||||||
@ -585,15 +566,12 @@ program = {
|
|||||||
common = grub-core/kern/emu/argp_common.c;
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
common = grub-core/osdep/init.c;
|
common = grub-core/osdep/init.c;
|
||||||
|
|
||||||
cflags = '$(EFIVAR_CFLAGS)';
|
|
||||||
|
|
||||||
ldadd = '$(LIBLZMA)';
|
ldadd = '$(LIBLZMA)';
|
||||||
ldadd = libgrubmods.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = libgrubgcry.a;
|
ldadd = libgrubgcry.a;
|
||||||
ldadd = libgrubkern.a;
|
ldadd = libgrubkern.a;
|
||||||
ldadd = grub-core/lib/gnulib/libgnu.a;
|
ldadd = grub-core/lib/gnulib/libgnu.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
ldadd = '$(EFIVAR_LIBS)';
|
|
||||||
|
|
||||||
condition = COND_HAVE_EXEC;
|
condition = COND_HAVE_EXEC;
|
||||||
};
|
};
|
||||||
@ -622,8 +600,6 @@ program = {
|
|||||||
extra_dist = grub-core/osdep/basic/no_platform.c;
|
extra_dist = grub-core/osdep/basic/no_platform.c;
|
||||||
extra_dist = grub-core/osdep/unix/platform.c;
|
extra_dist = grub-core/osdep/unix/platform.c;
|
||||||
common = grub-core/osdep/compress.c;
|
common = grub-core/osdep/compress.c;
|
||||||
common = grub-core/osdep/efivar.c;
|
|
||||||
extra_dist = grub-core/osdep/unix/efivar.c;
|
|
||||||
common = util/editenv.c;
|
common = util/editenv.c;
|
||||||
common = grub-core/osdep/blocklist.c;
|
common = grub-core/osdep/blocklist.c;
|
||||||
common = grub-core/osdep/config.c;
|
common = grub-core/osdep/config.c;
|
||||||
@ -637,15 +613,12 @@ program = {
|
|||||||
common = grub-core/kern/emu/argp_common.c;
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
common = grub-core/osdep/init.c;
|
common = grub-core/osdep/init.c;
|
||||||
|
|
||||||
cflags = '$(EFIVAR_CFLAGS)';
|
|
||||||
|
|
||||||
ldadd = '$(LIBLZMA)';
|
ldadd = '$(LIBLZMA)';
|
||||||
ldadd = libgrubmods.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = libgrubgcry.a;
|
ldadd = libgrubgcry.a;
|
||||||
ldadd = libgrubkern.a;
|
ldadd = libgrubkern.a;
|
||||||
ldadd = grub-core/lib/gnulib/libgnu.a;
|
ldadd = grub-core/lib/gnulib/libgnu.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
ldadd = '$(EFIVAR_LIBS)';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
@ -667,8 +640,6 @@ program = {
|
|||||||
common = grub-core/osdep/platform.c;
|
common = grub-core/osdep/platform.c;
|
||||||
common = grub-core/osdep/platform_unix.c;
|
common = grub-core/osdep/platform_unix.c;
|
||||||
common = grub-core/osdep/compress.c;
|
common = grub-core/osdep/compress.c;
|
||||||
common = grub-core/osdep/efivar.c;
|
|
||||||
extra_dist = grub-core/osdep/unix/efivar.c;
|
|
||||||
common = util/editenv.c;
|
common = util/editenv.c;
|
||||||
common = grub-core/osdep/blocklist.c;
|
common = grub-core/osdep/blocklist.c;
|
||||||
common = grub-core/osdep/config.c;
|
common = grub-core/osdep/config.c;
|
||||||
@ -681,15 +652,12 @@ program = {
|
|||||||
common = grub-core/kern/emu/argp_common.c;
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
common = grub-core/osdep/init.c;
|
common = grub-core/osdep/init.c;
|
||||||
|
|
||||||
cflags = '$(EFIVAR_CFLAGS)';
|
|
||||||
|
|
||||||
ldadd = '$(LIBLZMA)';
|
ldadd = '$(LIBLZMA)';
|
||||||
ldadd = libgrubmods.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = libgrubgcry.a;
|
ldadd = libgrubgcry.a;
|
||||||
ldadd = libgrubkern.a;
|
ldadd = libgrubkern.a;
|
||||||
ldadd = grub-core/lib/gnulib/libgnu.a;
|
ldadd = grub-core/lib/gnulib/libgnu.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
ldadd = '$(EFIVAR_LIBS)';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
@ -711,8 +679,6 @@ program = {
|
|||||||
common = grub-core/osdep/platform.c;
|
common = grub-core/osdep/platform.c;
|
||||||
common = grub-core/osdep/platform_unix.c;
|
common = grub-core/osdep/platform_unix.c;
|
||||||
common = grub-core/osdep/compress.c;
|
common = grub-core/osdep/compress.c;
|
||||||
common = grub-core/osdep/efivar.c;
|
|
||||||
extra_dist = grub-core/osdep/unix/efivar.c;
|
|
||||||
common = util/editenv.c;
|
common = util/editenv.c;
|
||||||
common = grub-core/osdep/blocklist.c;
|
common = grub-core/osdep/blocklist.c;
|
||||||
common = grub-core/osdep/config.c;
|
common = grub-core/osdep/config.c;
|
||||||
@ -722,15 +688,12 @@ program = {
|
|||||||
common = grub-core/kern/emu/argp_common.c;
|
common = grub-core/kern/emu/argp_common.c;
|
||||||
common = grub-core/osdep/init.c;
|
common = grub-core/osdep/init.c;
|
||||||
|
|
||||||
cflags = '$(EFIVAR_CFLAGS)';
|
|
||||||
|
|
||||||
ldadd = '$(LIBLZMA)';
|
ldadd = '$(LIBLZMA)';
|
||||||
ldadd = libgrubmods.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = libgrubgcry.a;
|
ldadd = libgrubgcry.a;
|
||||||
ldadd = libgrubkern.a;
|
ldadd = libgrubkern.a;
|
||||||
ldadd = grub-core/lib/gnulib/libgnu.a;
|
ldadd = grub-core/lib/gnulib/libgnu.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
ldadd = '$(EFIVAR_LIBS)';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
script = {
|
script = {
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
/* Define to 1 to enable disk cache statistics. */
|
/* Define to 1 to enable disk cache statistics. */
|
||||||
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
||||||
#define BOOT_TIME_STATS @BOOT_TIME_STATS@
|
#define BOOT_TIME_STATS @BOOT_TIME_STATS@
|
||||||
/* Define to 1 to make GRUB quieter at boot time. */
|
|
||||||
#define QUIET_BOOT @QUIET_BOOT@
|
|
||||||
|
|
||||||
/* We don't need those. */
|
/* We don't need those. */
|
||||||
#define MINILZO_CFG_SKIP_LZO_PTR 1
|
#define MINILZO_CFG_SKIP_LZO_PTR 1
|
||||||
|
74
configure.ac
74
configure.ac
@ -452,18 +452,6 @@ AC_CHECK_HEADER([util.h], [
|
|||||||
])
|
])
|
||||||
AC_SUBST([LIBUTIL])
|
AC_SUBST([LIBUTIL])
|
||||||
|
|
||||||
case "$host_os" in
|
|
||||||
cygwin | windows* | mingw32* | aros*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# For setting EFI variables in grub-install.
|
|
||||||
PKG_CHECK_MODULES([EFIVAR], [efivar efiboot], [
|
|
||||||
AC_DEFINE([HAVE_EFIVAR], [1],
|
|
||||||
[Define to 1 if you have the efivar and efiboot libraries.])
|
|
||||||
], [:])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
|
AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
|
||||||
SAVED_CFLAGS="$CFLAGS"
|
SAVED_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
|
CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
|
||||||
@ -1719,7 +1707,7 @@ fi
|
|||||||
|
|
||||||
if test x"$starfield_excuse" = x; then
|
if test x"$starfield_excuse" = x; then
|
||||||
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/truetype/dejavu /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
|
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
|
||||||
if test -f "$dir/DejaVuSans.$ext"; then
|
if test -f "$dir/DejaVuSans.$ext"; then
|
||||||
DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
|
DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
|
||||||
break 2
|
break 2
|
||||||
@ -1916,61 +1904,6 @@ fi
|
|||||||
AC_SUBST([LIBZFS])
|
AC_SUBST([LIBZFS])
|
||||||
AC_SUBST([LIBNVPAIR])
|
AC_SUBST([LIBNVPAIR])
|
||||||
|
|
||||||
AC_ARG_ENABLE([ubuntu-recovery],
|
|
||||||
[AS_HELP_STRING([--enable-ubuntu-recovery],
|
|
||||||
[adjust boot options for the Ubuntu recovery mode (default=no)])],
|
|
||||||
[], [enable_ubuntu_recovery=no])
|
|
||||||
if test x"$enable_ubuntu_recovery" = xyes ; then
|
|
||||||
UBUNTU_RECOVERY=1
|
|
||||||
else
|
|
||||||
UBUNTU_RECOVERY=0
|
|
||||||
fi
|
|
||||||
AC_SUBST([UBUNTU_RECOVERY])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([quiet-boot],
|
|
||||||
[AS_HELP_STRING([--enable-quiet-boot],
|
|
||||||
[emit fewer messages at boot time (default=no)])],
|
|
||||||
[], [enable_quiet_boot=no])
|
|
||||||
if test x"$enable_quiet_boot" = xyes ; then
|
|
||||||
QUIET_BOOT=1
|
|
||||||
else
|
|
||||||
QUIET_BOOT=0
|
|
||||||
fi
|
|
||||||
AC_SUBST([QUIET_BOOT])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([quick-boot],
|
|
||||||
[AS_HELP_STRING([--enable-quick-boot],
|
|
||||||
[bypass boot menu if possible (default=no)])],
|
|
||||||
[], [enable_quick_boot=no])
|
|
||||||
if test x"$enable_quick_boot" = xyes ; then
|
|
||||||
QUICK_BOOT=1
|
|
||||||
else
|
|
||||||
QUICK_BOOT=0
|
|
||||||
fi
|
|
||||||
AC_SUBST([QUICK_BOOT])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([gfxpayload-dynamic],
|
|
||||||
[AS_HELP_STRING([--enable-gfxpayload-dynamic],
|
|
||||||
[use GRUB_GFXPAYLOAD_LINUX=keep unless explicitly unsupported on current hardware (default=no)])],
|
|
||||||
[], [enable_gfxpayload_dynamic=no])
|
|
||||||
if test x"$enable_gfxpayload_dynamic" = xyes ; then
|
|
||||||
GFXPAYLOAD_DYNAMIC=1
|
|
||||||
else
|
|
||||||
GFXPAYLOAD_DYNAMIC=0
|
|
||||||
fi
|
|
||||||
AC_SUBST([GFXPAYLOAD_DYNAMIC])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([vt-handoff],
|
|
||||||
[AS_HELP_STRING([--enable-vt-handoff],
|
|
||||||
[use Linux vt.handoff option for flicker-free booting (default=no)])],
|
|
||||||
[], [enable_vt_handoff=no])
|
|
||||||
if test x"$enable_vt_handoff" = xyes ; then
|
|
||||||
VT_HANDOFF=1
|
|
||||||
else
|
|
||||||
VT_HANDOFF=0
|
|
||||||
fi
|
|
||||||
AC_SUBST([VT_HANDOFF])
|
|
||||||
|
|
||||||
LIBS=""
|
LIBS=""
|
||||||
|
|
||||||
AC_SUBST([FONT_SOURCE])
|
AC_SUBST([FONT_SOURCE])
|
||||||
@ -2233,10 +2166,5 @@ echo "With stack smashing protector: Yes"
|
|||||||
else
|
else
|
||||||
echo "With stack smashing protector: No"
|
echo "With stack smashing protector: No"
|
||||||
fi
|
fi
|
||||||
if [ x"$enable_quiet_boot" = xyes ]; then
|
|
||||||
echo With quiet boot: Yes
|
|
||||||
else
|
|
||||||
echo With quiet boot: No
|
|
||||||
fi
|
|
||||||
echo "*******************************************************"
|
echo "*******************************************************"
|
||||||
]
|
]
|
||||||
|
9
debian/.git-dpm
vendored
9
debian/.git-dpm
vendored
@ -1,9 +0,0 @@
|
|||||||
# see git-dpm(1) from git-dpm package
|
|
||||||
589500ad3777d1335c8e5cb139f7c0c6089112a8
|
|
||||||
589500ad3777d1335c8e5cb139f7c0c6089112a8
|
|
||||||
21f954425ffe2a934b6b26c0c948d340c91a16bb
|
|
||||||
21f954425ffe2a934b6b26c0c948d340c91a16bb
|
|
||||||
grub2_2.06.orig.tar.xz
|
|
||||||
c9f93f1e195ec7a5a21d36a13b469788c0b29f0f
|
|
||||||
6581924
|
|
||||||
signature:910db38472f2d654a4816a0c3b7b83415502850f:833:grub2_2.06.orig.tar.xz.asc
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
@ -7,8 +7,9 @@ grub2 (2.06-6) UNRELEASED; urgency=high
|
|||||||
- Due to a mistake in the buster upload (2.06-3~deb10u2) that left
|
- Due to a mistake in the buster upload (2.06-3~deb10u2) that left
|
||||||
the CVE-2022-2601 bugs in place, we need to bump SBAT for all of
|
the CVE-2022-2601 bugs in place, we need to bump SBAT for all of
|
||||||
the Debian GRUB binaries. :-(
|
the Debian GRUB binaries. :-(
|
||||||
|
* Switch away from git-dpm
|
||||||
|
|
||||||
-- Steve McIntyre <93sam@debian.org> Sun, 13 Nov 2022 00:33:35 +0000
|
-- Steve McIntyre <93sam@debian.org> Sun, 04 Dec 2022 18:13:10 +0000
|
||||||
|
|
||||||
grub2 (2.06-5) unstable; urgency=high
|
grub2 (2.06-5) unstable; urgency=high
|
||||||
|
|
||||||
|
@ -575,12 +575,12 @@ To upgrade to a new version of the miniLZO library, download the release
|
|||||||
tarball and copy the files into the target directory:
|
tarball and copy the files into the target directory:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
curl -L -O http://www.oberhumer.com/opensource/lzo/download/minilzo-2.10.tar.gz
|
curl -L -O http://www.oberhumer.com/opensource/lzo/download/minilzo-2.08.tar.gz
|
||||||
tar -zxf minilzo-2.10.tar.gz
|
tar -zxf minilzo-2.08.tar.gz
|
||||||
rm minilzo-2.10/testmini.c
|
rm minilzo-2.08/testmini.c
|
||||||
rm -r grub-core/lib/minilzo/*
|
rm -r grub-core/lib/minilzo/*
|
||||||
cp minilzo-2.10/*.[hc] grub-core/lib/minilzo
|
cp minilzo-2.08/*.[hc] grub-core/lib/minilzo
|
||||||
rm -r minilzo-2.10*
|
rm -r minilzo-2.08*
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@node Porting
|
@node Porting
|
||||||
|
@ -1500,8 +1500,7 @@ resolution. @xref{gfxmode}.
|
|||||||
Set a background image for use with the @samp{gfxterm} graphical terminal.
|
Set a background image for use with the @samp{gfxterm} graphical terminal.
|
||||||
The value of this option must be a file readable by GRUB at boot time, and
|
The value of this option must be a file readable by GRUB at boot time, and
|
||||||
it must end with @file{.png}, @file{.tga}, @file{.jpg}, or @file{.jpeg}.
|
it must end with @file{.png}, @file{.tga}, @file{.jpg}, or @file{.jpeg}.
|
||||||
The image will be scaled if necessary to fit the screen. Image height and
|
The image will be scaled if necessary to fit the screen.
|
||||||
width will be restricted by an artificial limit of 16384.
|
|
||||||
|
|
||||||
@item GRUB_THEME
|
@item GRUB_THEME
|
||||||
Set a theme for use with the @samp{gfxterm} graphical terminal.
|
Set a theme for use with the @samp{gfxterm} graphical terminal.
|
||||||
@ -1564,25 +1563,6 @@ This option may be set to a list of GRUB module names separated by spaces.
|
|||||||
Each module will be loaded as early as possible, at the start of
|
Each module will be loaded as early as possible, at the start of
|
||||||
@file{grub.cfg}.
|
@file{grub.cfg}.
|
||||||
|
|
||||||
@item GRUB_RECORDFAIL_TIMEOUT
|
|
||||||
If this option is set, it overrides the default recordfail setting. A
|
|
||||||
setting of -1 causes GRUB to wait for user input indefinitely. However, a
|
|
||||||
false positive in the recordfail mechanism may occur if power is lost during
|
|
||||||
boot before boot success is recorded in userspace. The default setting is
|
|
||||||
30, which causes GRUB to wait for user input for thirty seconds before
|
|
||||||
continuing. This default allows interactive users the opportunity to switch
|
|
||||||
to a different, working kernel, while avoiding a false positive causing the
|
|
||||||
boot to block indefinitely on headless and appliance systems where access to
|
|
||||||
a console is restricted or limited.
|
|
||||||
|
|
||||||
This option is only effective when GRUB was configured with the
|
|
||||||
@option{--enable-quick-boot} option.
|
|
||||||
|
|
||||||
@item GRUB_RECOVERY_TITLE
|
|
||||||
This option sets the English text of the string that will be displayed in
|
|
||||||
parentheses to indicate that a boot option is provided to help users recover
|
|
||||||
a broken system. The default is "recovery mode".
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
The following options are still accepted for compatibility with existing
|
The following options are still accepted for compatibility with existing
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
[NAME]
|
|
||||||
grub-mkdevicemap \- make a device map file automatically
|
|
||||||
[SEE ALSO]
|
|
||||||
.BR grub-probe (8)
|
|
@ -93,9 +93,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
|
|||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/stack_protector.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/stack_protector.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
|
||||||
if !COND_i386_pc
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/verify.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/verify.h
|
||||||
endif
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
|
||||||
|
@ -141,7 +141,7 @@ kernel = {
|
|||||||
common = kern/rescue_parser.c;
|
common = kern/rescue_parser.c;
|
||||||
common = kern/rescue_reader.c;
|
common = kern/rescue_reader.c;
|
||||||
common = kern/term.c;
|
common = kern/term.c;
|
||||||
nopc = kern/verifiers.c;
|
common = kern/verifiers.c;
|
||||||
|
|
||||||
noemu = kern/compiler-rt.c;
|
noemu = kern/compiler-rt.c;
|
||||||
noemu = kern/mm.c;
|
noemu = kern/mm.c;
|
||||||
@ -946,12 +946,6 @@ module = {
|
|||||||
cppflags = '-I$(srcdir)/lib/posix_wrap';
|
cppflags = '-I$(srcdir)/lib/posix_wrap';
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
|
||||||
name = verifiers;
|
|
||||||
common = kern/verifiers.c;
|
|
||||||
enable = i386_pc;
|
|
||||||
};
|
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = hdparm;
|
name = hdparm;
|
||||||
common = commands/hdparm.c;
|
common = commands/hdparm.c;
|
||||||
@ -970,14 +964,6 @@ module = {
|
|||||||
common = lib/hexdump.c;
|
common = lib/hexdump.c;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
|
||||||
name = hwmatch;
|
|
||||||
i386_pc = commands/i386/pc/hwmatch.c;
|
|
||||||
enable = i386_pc;
|
|
||||||
cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
|
|
||||||
cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
|
|
||||||
};
|
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = keystatus;
|
name = keystatus;
|
||||||
common = commands/keystatus.c;
|
common = commands/keystatus.c;
|
||||||
@ -1888,13 +1874,6 @@ module = {
|
|||||||
enable = x86_64_efi;
|
enable = x86_64_efi;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = {
|
|
||||||
name = linuxefi;
|
|
||||||
efi = loader/i386/efi/linux.c;
|
|
||||||
enable = i386_efi;
|
|
||||||
enable = x86_64_efi;
|
|
||||||
};
|
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = chain;
|
name = chain;
|
||||||
efi = loader/efi/chainloader.c;
|
efi = loader/efi/chainloader.c;
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#if QUIET_BOOT && !defined(HYBRID_BOOT)
|
|
||||||
#include <grub/machine/memory.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* defines for the code go here
|
* defines for the code go here
|
||||||
@ -252,17 +249,9 @@ real_start:
|
|||||||
/* save drive reference first thing! */
|
/* save drive reference first thing! */
|
||||||
pushw %dx
|
pushw %dx
|
||||||
|
|
||||||
#if QUIET_BOOT && !defined(HYBRID_BOOT)
|
|
||||||
/* is either shift key held down? */
|
|
||||||
movw $(GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR + 0x17), %bx
|
|
||||||
testb $3, (%bx)
|
|
||||||
jz 2f
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* print a notification message on the screen */
|
/* print a notification message on the screen */
|
||||||
MSG(notification_string)
|
MSG(notification_string)
|
||||||
|
|
||||||
2:
|
|
||||||
/* set %si to the disk address packet */
|
/* set %si to the disk address packet */
|
||||||
movw $disk_address_packet, %si
|
movw $disk_address_packet, %si
|
||||||
|
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#if QUIET_BOOT
|
|
||||||
#include <grub/machine/memory.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* defines for the code go here
|
* defines for the code go here
|
||||||
@ -28,12 +25,6 @@
|
|||||||
|
|
||||||
#define MSG(x) movw $x, %si; call LOCAL(message)
|
#define MSG(x) movw $x, %si; call LOCAL(message)
|
||||||
|
|
||||||
#if QUIET_BOOT
|
|
||||||
#define SILENT(x) call LOCAL(check_silent); jz LOCAL(x)
|
|
||||||
#else
|
|
||||||
#define SILENT(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.file "diskboot.S"
|
.file "diskboot.S"
|
||||||
|
|
||||||
.text
|
.text
|
||||||
@ -59,14 +50,11 @@ _start:
|
|||||||
/* save drive reference first thing! */
|
/* save drive reference first thing! */
|
||||||
pushw %dx
|
pushw %dx
|
||||||
|
|
||||||
SILENT(after_notification_string)
|
|
||||||
|
|
||||||
/* print a notification message on the screen */
|
/* print a notification message on the screen */
|
||||||
pushw %si
|
pushw %si
|
||||||
MSG(notification_string)
|
MSG(notification_string)
|
||||||
popw %si
|
popw %si
|
||||||
|
|
||||||
LOCAL(after_notification_string):
|
|
||||||
/* this sets up for the first run through "bootloop" */
|
/* this sets up for the first run through "bootloop" */
|
||||||
movw $LOCAL(firstlist), %di
|
movw $LOCAL(firstlist), %di
|
||||||
|
|
||||||
@ -291,10 +279,7 @@ LOCAL(copy_buffer):
|
|||||||
/* restore addressing regs and print a dot with correct DS
|
/* restore addressing regs and print a dot with correct DS
|
||||||
(MSG modifies SI, which is saved, and unused AX and BX) */
|
(MSG modifies SI, which is saved, and unused AX and BX) */
|
||||||
popw %ds
|
popw %ds
|
||||||
SILENT(after_notification_step)
|
|
||||||
MSG(notification_step)
|
MSG(notification_step)
|
||||||
|
|
||||||
LOCAL(after_notification_step):
|
|
||||||
popa
|
popa
|
||||||
|
|
||||||
/* check if finished with this dataset */
|
/* check if finished with this dataset */
|
||||||
@ -310,11 +295,8 @@ LOCAL(after_notification_step):
|
|||||||
/* END OF MAIN LOOP */
|
/* END OF MAIN LOOP */
|
||||||
|
|
||||||
LOCAL(bootit):
|
LOCAL(bootit):
|
||||||
SILENT(after_notification_done)
|
|
||||||
/* print a newline */
|
/* print a newline */
|
||||||
MSG(notification_done)
|
MSG(notification_done)
|
||||||
|
|
||||||
LOCAL(after_notification_done):
|
|
||||||
popw %dx /* this makes sure %dl is our "boot" drive */
|
popw %dx /* this makes sure %dl is our "boot" drive */
|
||||||
ljmp $0, $(GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
ljmp $0, $(GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
||||||
|
|
||||||
@ -338,14 +320,6 @@ LOCAL(general_error):
|
|||||||
/* go here when you need to stop the machine hard after an error condition */
|
/* go here when you need to stop the machine hard after an error condition */
|
||||||
LOCAL(stop): jmp LOCAL(stop)
|
LOCAL(stop): jmp LOCAL(stop)
|
||||||
|
|
||||||
#if QUIET_BOOT
|
|
||||||
LOCAL(check_silent):
|
|
||||||
/* is either shift key held down? */
|
|
||||||
movw $(GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR + 0x17), %bx
|
|
||||||
testb $3, (%bx)
|
|
||||||
ret
|
|
||||||
#endif
|
|
||||||
|
|
||||||
notification_string: .asciz "loading"
|
notification_string: .asciz "loading"
|
||||||
|
|
||||||
notification_step: .asciz "."
|
notification_step: .asciz "."
|
||||||
|
@ -27,20 +27,10 @@
|
|||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_err_t (*grub_loader_boot_func) (void *);
|
static grub_err_t (*grub_loader_boot_func) (void);
|
||||||
static grub_err_t (*grub_loader_unload_func) (void *);
|
static grub_err_t (*grub_loader_unload_func) (void);
|
||||||
static void *grub_loader_context;
|
|
||||||
static int grub_loader_flags;
|
static int grub_loader_flags;
|
||||||
|
|
||||||
struct grub_simple_loader_hooks
|
|
||||||
{
|
|
||||||
grub_err_t (*boot) (void);
|
|
||||||
grub_err_t (*unload) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Don't heap allocate this to avoid making grub_loader_set fallible. */
|
|
||||||
static struct grub_simple_loader_hooks simple_loader_hooks;
|
|
||||||
|
|
||||||
struct grub_preboot
|
struct grub_preboot
|
||||||
{
|
{
|
||||||
grub_err_t (*preboot_func) (int);
|
grub_err_t (*preboot_func) (int);
|
||||||
@ -54,29 +44,6 @@ static int grub_loader_loaded;
|
|||||||
static struct grub_preboot *preboots_head = 0,
|
static struct grub_preboot *preboots_head = 0,
|
||||||
*preboots_tail = 0;
|
*preboots_tail = 0;
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_simple_boot_hook (void *context)
|
|
||||||
{
|
|
||||||
struct grub_simple_loader_hooks *hooks;
|
|
||||||
|
|
||||||
hooks = (struct grub_simple_loader_hooks *) context;
|
|
||||||
return hooks->boot ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_simple_unload_hook (void *context)
|
|
||||||
{
|
|
||||||
struct grub_simple_loader_hooks *hooks;
|
|
||||||
grub_err_t ret;
|
|
||||||
|
|
||||||
hooks = (struct grub_simple_loader_hooks *) context;
|
|
||||||
|
|
||||||
ret = hooks->unload ();
|
|
||||||
grub_memset (hooks, 0, sizeof (*hooks));
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_loader_is_loaded (void)
|
grub_loader_is_loaded (void)
|
||||||
{
|
{
|
||||||
@ -143,45 +110,28 @@ grub_loader_unregister_preboot_hook (struct grub_preboot *hnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_loader_set_ex (grub_err_t (*boot) (void *),
|
grub_loader_set (grub_err_t (*boot) (void),
|
||||||
grub_err_t (*unload) (void *),
|
grub_err_t (*unload) (void),
|
||||||
void *context,
|
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
if (grub_loader_loaded && grub_loader_unload_func)
|
if (grub_loader_loaded && grub_loader_unload_func)
|
||||||
grub_loader_unload_func (grub_loader_context);
|
grub_loader_unload_func ();
|
||||||
|
|
||||||
grub_loader_boot_func = boot;
|
grub_loader_boot_func = boot;
|
||||||
grub_loader_unload_func = unload;
|
grub_loader_unload_func = unload;
|
||||||
grub_loader_context = context;
|
|
||||||
grub_loader_flags = flags;
|
grub_loader_flags = flags;
|
||||||
|
|
||||||
grub_loader_loaded = 1;
|
grub_loader_loaded = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
grub_loader_set (grub_err_t (*boot) (void),
|
|
||||||
grub_err_t (*unload) (void),
|
|
||||||
int flags)
|
|
||||||
{
|
|
||||||
grub_loader_set_ex (grub_simple_boot_hook,
|
|
||||||
grub_simple_unload_hook,
|
|
||||||
&simple_loader_hooks,
|
|
||||||
flags);
|
|
||||||
|
|
||||||
simple_loader_hooks.boot = boot;
|
|
||||||
simple_loader_hooks.unload = unload;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_loader_unset(void)
|
grub_loader_unset(void)
|
||||||
{
|
{
|
||||||
if (grub_loader_loaded && grub_loader_unload_func)
|
if (grub_loader_loaded && grub_loader_unload_func)
|
||||||
grub_loader_unload_func (grub_loader_context);
|
grub_loader_unload_func ();
|
||||||
|
|
||||||
grub_loader_boot_func = 0;
|
grub_loader_boot_func = 0;
|
||||||
grub_loader_unload_func = 0;
|
grub_loader_unload_func = 0;
|
||||||
grub_loader_context = 0;
|
|
||||||
|
|
||||||
grub_loader_loaded = 0;
|
grub_loader_loaded = 0;
|
||||||
}
|
}
|
||||||
@ -208,7 +158,7 @@ grub_loader_boot (void)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = (grub_loader_boot_func) (grub_loader_context);
|
err = (grub_loader_boot_func) ();
|
||||||
|
|
||||||
for (cur = preboots_tail; cur; cur = cur->prev)
|
for (cur = preboots_tail; cur; cur = cur->prev)
|
||||||
if (! err)
|
if (! err)
|
||||||
|
@ -145,8 +145,7 @@ grub_efi_log_event_status (grub_efi_status_t status)
|
|||||||
case GRUB_EFI_NOT_FOUND:
|
case GRUB_EFI_NOT_FOUND:
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
|
||||||
default:
|
default:
|
||||||
grub_dprintf ("tpm", "Unknown TPM error: %" PRIdGRUB_SSIZE, status);
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,146 +0,0 @@
|
|||||||
/* hwmatch.c - Match hardware against a whitelist/blacklist. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/pci.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
#include <regex.h>
|
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
|
||||||
|
|
||||||
/* Context for grub_cmd_hwmatch. */
|
|
||||||
struct hwmatch_ctx
|
|
||||||
{
|
|
||||||
grub_file_t matches_file;
|
|
||||||
int class_match;
|
|
||||||
int match;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Helper for grub_cmd_hwmatch. */
|
|
||||||
static int
|
|
||||||
hwmatch_iter (grub_pci_device_t dev, grub_pci_id_t pciid, void *data)
|
|
||||||
{
|
|
||||||
struct hwmatch_ctx *ctx = data;
|
|
||||||
grub_pci_address_t addr;
|
|
||||||
grub_uint32_t class, baseclass, vendor, device;
|
|
||||||
grub_pci_id_t subpciid;
|
|
||||||
grub_uint32_t subvendor, subdevice, subclass;
|
|
||||||
char *id, *line;
|
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
|
||||||
class = grub_pci_read (addr);
|
|
||||||
baseclass = class >> 24;
|
|
||||||
|
|
||||||
if (ctx->class_match != baseclass)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
vendor = pciid & 0xffff;
|
|
||||||
device = pciid >> 16;
|
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_SUBVENDOR);
|
|
||||||
subpciid = grub_pci_read (addr);
|
|
||||||
|
|
||||||
subclass = (class >> 16) & 0xff;
|
|
||||||
subvendor = subpciid & 0xffff;
|
|
||||||
subdevice = subpciid >> 16;
|
|
||||||
|
|
||||||
id = grub_xasprintf ("v%04xd%04xsv%04xsd%04xbc%02xsc%02x",
|
|
||||||
vendor, device, subvendor, subdevice,
|
|
||||||
baseclass, subclass);
|
|
||||||
|
|
||||||
grub_file_seek (ctx->matches_file, 0);
|
|
||||||
while ((line = grub_file_getline (ctx->matches_file)) != NULL)
|
|
||||||
{
|
|
||||||
char *anchored_line;
|
|
||||||
regex_t regex;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (! *line || *line == '#')
|
|
||||||
{
|
|
||||||
grub_free (line);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
anchored_line = grub_xasprintf ("^%s$", line);
|
|
||||||
ret = regcomp (®ex, anchored_line, REG_EXTENDED | REG_NOSUB);
|
|
||||||
grub_free (anchored_line);
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
grub_free (line);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = regexec (®ex, id, 0, NULL, 0);
|
|
||||||
regfree (®ex);
|
|
||||||
grub_free (line);
|
|
||||||
if (! ret)
|
|
||||||
{
|
|
||||||
ctx->match = 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_hwmatch (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
struct hwmatch_ctx ctx = { .match = 0 };
|
|
||||||
char *match_str;
|
|
||||||
|
|
||||||
if (argc < 2)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "list file and class required");
|
|
||||||
|
|
||||||
ctx.matches_file = grub_file_open (args[0], GRUB_FILE_TYPE_HWMATCH);
|
|
||||||
if (! ctx.matches_file)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
ctx.class_match = grub_strtol (args[1], 0, 10);
|
|
||||||
|
|
||||||
grub_pci_iterate (hwmatch_iter, &ctx);
|
|
||||||
|
|
||||||
match_str = grub_xasprintf ("%d", ctx.match);
|
|
||||||
grub_env_set ("match", match_str);
|
|
||||||
grub_free (match_str);
|
|
||||||
|
|
||||||
grub_file_close (ctx.matches_file);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(hwmatch)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("hwmatch", grub_cmd_hwmatch,
|
|
||||||
N_("MATCHES-FILE CLASS"),
|
|
||||||
N_("Match PCI devices."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(hwmatch)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
@ -137,7 +137,7 @@ ascii_glyph_lookup (grub_uint32_t code)
|
|||||||
ascii_font_glyph[current]->offset_x = 0;
|
ascii_font_glyph[current]->offset_x = 0;
|
||||||
ascii_font_glyph[current]->offset_y = -2;
|
ascii_font_glyph[current]->offset_y = -2;
|
||||||
ascii_font_glyph[current]->device_width = 8;
|
ascii_font_glyph[current]->device_width = 8;
|
||||||
ascii_font_glyph[current]->font = &null_font;
|
ascii_font_glyph[current]->font = NULL;
|
||||||
|
|
||||||
grub_memcpy (ascii_font_glyph[current]->bitmap,
|
grub_memcpy (ascii_font_glyph[current]->bitmap,
|
||||||
&ascii_bitmaps[current * ASCII_BITMAP_SIZE],
|
&ascii_bitmaps[current * ASCII_BITMAP_SIZE],
|
||||||
@ -300,8 +300,6 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||||||
font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t));
|
font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t));
|
||||||
if (!font->bmp_idx)
|
if (!font->bmp_idx)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Init the BMP index array to 0xffff. */
|
|
||||||
grub_memset (font->bmp_idx, 0xff, 0x10000 * sizeof (grub_uint16_t));
|
grub_memset (font->bmp_idx, 0xff, 0x10000 * sizeof (grub_uint16_t));
|
||||||
|
|
||||||
|
|
||||||
@ -330,7 +328,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->code < 0x10000 && i < 0xffff)
|
if (entry->code < 0x10000)
|
||||||
font->bmp_idx[entry->code] = i;
|
font->bmp_idx[entry->code] = i;
|
||||||
|
|
||||||
last_code = entry->code;
|
last_code = entry->code;
|
||||||
@ -409,27 +407,6 @@ read_section_as_short (struct font_file_section *section,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_file_t
|
|
||||||
try_open_from_prefix (const char *prefix, const char *filename)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
char *fullname, *ptr;
|
|
||||||
|
|
||||||
fullname = grub_malloc (grub_strlen (prefix) + grub_strlen (filename) + 1
|
|
||||||
+ sizeof ("/fonts/") + sizeof (".pf2"));
|
|
||||||
if (!fullname)
|
|
||||||
return 0;
|
|
||||||
ptr = grub_stpcpy (fullname, prefix);
|
|
||||||
ptr = grub_stpcpy (ptr, "/fonts/");
|
|
||||||
ptr = grub_stpcpy (ptr, filename);
|
|
||||||
ptr = grub_stpcpy (ptr, ".pf2");
|
|
||||||
*ptr = 0;
|
|
||||||
|
|
||||||
file = grub_buffile_open (fullname, GRUB_FILE_TYPE_FONT, 1024);
|
|
||||||
grub_free (fullname);
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Load a font and add it to the beginning of the global font list.
|
/* Load a font and add it to the beginning of the global font list.
|
||||||
Returns 0 upon success, nonzero upon failure. */
|
Returns 0 upon success, nonzero upon failure. */
|
||||||
grub_font_t
|
grub_font_t
|
||||||
@ -447,19 +424,26 @@ grub_font_load (const char *filename)
|
|||||||
if (filename[0] == '(' || filename[0] == '/' || filename[0] == '+')
|
if (filename[0] == '(' || filename[0] == '/' || filename[0] == '+')
|
||||||
file = grub_buffile_open (filename, GRUB_FILE_TYPE_FONT, 1024);
|
file = grub_buffile_open (filename, GRUB_FILE_TYPE_FONT, 1024);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
file = try_open_from_prefix ("(memdisk)", filename);
|
|
||||||
if (!file)
|
|
||||||
{
|
{
|
||||||
const char *prefix = grub_env_get ("prefix");
|
const char *prefix = grub_env_get ("prefix");
|
||||||
|
char *fullname, *ptr;
|
||||||
if (!prefix)
|
if (!prefix)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
|
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
|
||||||
"prefix");
|
"prefix");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
file = try_open_from_prefix (prefix, filename);
|
fullname = grub_malloc (grub_strlen (prefix) + grub_strlen (filename) + 1
|
||||||
}
|
+ sizeof ("/fonts/") + sizeof (".pf2"));
|
||||||
|
if (!fullname)
|
||||||
|
goto fail;
|
||||||
|
ptr = grub_stpcpy (fullname, prefix);
|
||||||
|
ptr = grub_stpcpy (ptr, "/fonts/");
|
||||||
|
ptr = grub_stpcpy (ptr, filename);
|
||||||
|
ptr = grub_stpcpy (ptr, ".pf2");
|
||||||
|
*ptr = 0;
|
||||||
|
file = grub_buffile_open (fullname, GRUB_FILE_TYPE_FONT, 1024);
|
||||||
|
grub_free (fullname);
|
||||||
}
|
}
|
||||||
if (!file)
|
if (!file)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -702,47 +686,40 @@ read_be_int16 (grub_file_t file, grub_int16_t * value)
|
|||||||
static inline struct char_index_entry *
|
static inline struct char_index_entry *
|
||||||
find_glyph (const grub_font_t font, grub_uint32_t code)
|
find_glyph (const grub_font_t font, grub_uint32_t code)
|
||||||
{
|
{
|
||||||
struct char_index_entry *table, *first, *end;
|
struct char_index_entry *table;
|
||||||
grub_size_t len;
|
grub_size_t lo;
|
||||||
|
grub_size_t hi;
|
||||||
|
grub_size_t mid;
|
||||||
|
|
||||||
table = font->char_index;
|
table = font->char_index;
|
||||||
if (table == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Use BMP index if possible. */
|
/* Use BMP index if possible. */
|
||||||
if (code < 0x10000 && font->bmp_idx)
|
if (code < 0x10000 && font->bmp_idx)
|
||||||
{
|
{
|
||||||
if (font->bmp_idx[code] < 0xffff)
|
if (font->bmp_idx[code] == 0xffff)
|
||||||
|
return 0;
|
||||||
return &table[font->bmp_idx[code]];
|
return &table[font->bmp_idx[code]];
|
||||||
/*
|
|
||||||
* When we are here then lookup in BMP index result in miss,
|
|
||||||
* fallthough to binary-search.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Do a binary search in `char_index', which is ordered by code point. */
|
||||||
* Do a binary search in char_index which is ordered by code point.
|
lo = 0;
|
||||||
* The code below is the same as libstdc++'s std::lower_bound().
|
hi = font->num_chars - 1;
|
||||||
*/
|
|
||||||
first = table;
|
|
||||||
len = font->num_chars;
|
|
||||||
end = first + len;
|
|
||||||
|
|
||||||
while (len > 0)
|
if (!table)
|
||||||
{
|
return 0;
|
||||||
grub_size_t half = len >> 1;
|
|
||||||
struct char_index_entry *middle = first + half;
|
|
||||||
|
|
||||||
if (middle->code < code)
|
while (lo <= hi)
|
||||||
{
|
{
|
||||||
first = middle + 1;
|
mid = lo + (hi - lo) / 2;
|
||||||
len = len - half - 1;
|
if (code < table[mid].code)
|
||||||
}
|
hi = mid - 1;
|
||||||
|
else if (code > table[mid].code)
|
||||||
|
lo = mid + 1;
|
||||||
else
|
else
|
||||||
len = half;
|
return &table[mid];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (first < end && first->code == code) ? first : NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a glyph for the Unicode character CODE in FONT. The glyph is loaded
|
/* Get a glyph for the Unicode character CODE in FONT. The glyph is loaded
|
||||||
@ -762,8 +739,7 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code)
|
|||||||
grub_int16_t xoff;
|
grub_int16_t xoff;
|
||||||
grub_int16_t yoff;
|
grub_int16_t yoff;
|
||||||
grub_int16_t dwidth;
|
grub_int16_t dwidth;
|
||||||
grub_ssize_t len;
|
int len;
|
||||||
grub_size_t sz;
|
|
||||||
|
|
||||||
if (index_entry->glyph)
|
if (index_entry->glyph)
|
||||||
/* Return cached glyph. */
|
/* Return cached glyph. */
|
||||||
@ -784,25 +760,15 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code)
|
|||||||
|| read_be_uint16 (font->file, &height) != 0
|
|| read_be_uint16 (font->file, &height) != 0
|
||||||
|| read_be_int16 (font->file, &xoff) != 0
|
|| read_be_int16 (font->file, &xoff) != 0
|
||||||
|| read_be_int16 (font->file, &yoff) != 0
|
|| read_be_int16 (font->file, &yoff) != 0
|
||||||
|| read_be_int16 (font->file, &dwidth) != 0
|
|| read_be_int16 (font->file, &dwidth) != 0)
|
||||||
|| width > font->max_char_width
|
|
||||||
|| height > font->max_char_height)
|
|
||||||
{
|
{
|
||||||
remove_font (font);
|
remove_font (font);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate real struct size of current glyph. */
|
len = (width * height + 7) / 8;
|
||||||
if (grub_video_bitmap_calc_1bpp_bufsz (width, height, &len) ||
|
glyph = grub_malloc (sizeof (struct grub_font_glyph) + len);
|
||||||
grub_add (sizeof (struct grub_font_glyph), len, &sz))
|
if (!glyph)
|
||||||
{
|
|
||||||
remove_font (font);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate and initialize the glyph struct. */
|
|
||||||
glyph = grub_malloc (sz);
|
|
||||||
if (glyph == NULL)
|
|
||||||
{
|
{
|
||||||
remove_font (font);
|
remove_font (font);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1078,20 +1044,27 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code)
|
|||||||
return best_glyph;
|
return best_glyph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static struct grub_font_glyph *
|
||||||
|
grub_font_dup_glyph (struct grub_font_glyph *glyph)
|
||||||
|
{
|
||||||
|
static struct grub_font_glyph *ret;
|
||||||
|
ret = grub_malloc (sizeof (*ret) + (glyph->width * glyph->height + 7) / 8);
|
||||||
|
if (!ret)
|
||||||
|
return NULL;
|
||||||
|
grub_memcpy (ret, glyph, sizeof (*ret)
|
||||||
|
+ (glyph->width * glyph->height + 7) / 8);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FIXME: suboptimal. */
|
/* FIXME: suboptimal. */
|
||||||
static void
|
static void
|
||||||
grub_font_blit_glyph (struct grub_font_glyph *target,
|
grub_font_blit_glyph (struct grub_font_glyph *target,
|
||||||
struct grub_font_glyph *src, unsigned dx, unsigned dy)
|
struct grub_font_glyph *src, unsigned dx, unsigned dy)
|
||||||
{
|
{
|
||||||
grub_uint16_t max_x, max_y;
|
|
||||||
unsigned src_bit, tgt_bit, src_byte, tgt_byte;
|
unsigned src_bit, tgt_bit, src_byte, tgt_byte;
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
|
|
||||||
/* Harden against out-of-bound writes. */
|
|
||||||
if ((grub_add (dx, src->width, &max_x) || max_x > target->width) ||
|
|
||||||
(grub_add (dy, src->height, &max_y) || max_y > target->height))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < src->height; i++)
|
for (i = 0; i < src->height; i++)
|
||||||
{
|
{
|
||||||
src_bit = (src->width * i) % 8;
|
src_bit = (src->width * i) % 8;
|
||||||
@ -1123,16 +1096,9 @@ grub_font_blit_glyph_mirror (struct grub_font_glyph *target,
|
|||||||
struct grub_font_glyph *src,
|
struct grub_font_glyph *src,
|
||||||
unsigned dx, unsigned dy)
|
unsigned dx, unsigned dy)
|
||||||
{
|
{
|
||||||
grub_uint16_t max_x, max_y;
|
|
||||||
unsigned tgt_bit, src_byte, tgt_byte;
|
unsigned tgt_bit, src_byte, tgt_byte;
|
||||||
signed src_bit;
|
signed src_bit;
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
|
|
||||||
/* Harden against out-of-bound writes. */
|
|
||||||
if ((grub_add (dx, src->width, &max_x) || max_x > target->width) ||
|
|
||||||
(grub_add (dy, src->height, &max_y) || max_y > target->height))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < src->height; i++)
|
for (i = 0; i < src->height; i++)
|
||||||
{
|
{
|
||||||
src_bit = (src->width * i + src->width - 1) % 8;
|
src_bit = (src->width * i + src->width - 1) % 8;
|
||||||
@ -1231,12 +1197,12 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|||||||
ctx.bounds.height = main_glyph->height;
|
ctx.bounds.height = main_glyph->height;
|
||||||
|
|
||||||
above_rightx = main_glyph->offset_x + main_glyph->width;
|
above_rightx = main_glyph->offset_x + main_glyph->width;
|
||||||
above_righty = ctx.bounds.y + (int) ctx.bounds.height;
|
above_righty = ctx.bounds.y + ctx.bounds.height;
|
||||||
|
|
||||||
above_leftx = main_glyph->offset_x;
|
above_leftx = main_glyph->offset_x;
|
||||||
above_lefty = ctx.bounds.y + (int) ctx.bounds.height;
|
above_lefty = ctx.bounds.y + ctx.bounds.height;
|
||||||
|
|
||||||
below_rightx = ctx.bounds.x + (int) ctx.bounds.width;
|
below_rightx = ctx.bounds.x + ctx.bounds.width;
|
||||||
below_righty = ctx.bounds.y;
|
below_righty = ctx.bounds.y;
|
||||||
|
|
||||||
comb = grub_unicode_get_comb (glyph_id);
|
comb = grub_unicode_get_comb (glyph_id);
|
||||||
@ -1249,7 +1215,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|||||||
|
|
||||||
if (!combining_glyphs[i])
|
if (!combining_glyphs[i])
|
||||||
continue;
|
continue;
|
||||||
targetx = ((int) ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x;
|
targetx = (ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x;
|
||||||
/* CGJ is to avoid diacritics reordering. */
|
/* CGJ is to avoid diacritics reordering. */
|
||||||
if (comb[i].code
|
if (comb[i].code
|
||||||
== GRUB_UNICODE_COMBINING_GRAPHEME_JOINER)
|
== GRUB_UNICODE_COMBINING_GRAPHEME_JOINER)
|
||||||
@ -1259,8 +1225,8 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|||||||
case GRUB_UNICODE_COMB_OVERLAY:
|
case GRUB_UNICODE_COMB_OVERLAY:
|
||||||
do_blit (combining_glyphs[i],
|
do_blit (combining_glyphs[i],
|
||||||
targetx,
|
targetx,
|
||||||
((int) ctx.bounds.height - combining_glyphs[i]->height) / 2
|
(ctx.bounds.height - combining_glyphs[i]->height) / 2
|
||||||
- ((int) ctx.bounds.height + ctx.bounds.y), &ctx);
|
- (ctx.bounds.height + ctx.bounds.y), &ctx);
|
||||||
if (min_devwidth < combining_glyphs[i]->width)
|
if (min_devwidth < combining_glyphs[i]->width)
|
||||||
min_devwidth = combining_glyphs[i]->width;
|
min_devwidth = combining_glyphs[i]->width;
|
||||||
break;
|
break;
|
||||||
@ -1333,7 +1299,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|||||||
/* Fallthrough. */
|
/* Fallthrough. */
|
||||||
case GRUB_UNICODE_STACK_ATTACHED_ABOVE:
|
case GRUB_UNICODE_STACK_ATTACHED_ABOVE:
|
||||||
do_blit (combining_glyphs[i], targetx,
|
do_blit (combining_glyphs[i], targetx,
|
||||||
-((int) ctx.bounds.height + ctx.bounds.y + space
|
-(ctx.bounds.height + ctx.bounds.y + space
|
||||||
+ combining_glyphs[i]->height), &ctx);
|
+ combining_glyphs[i]->height), &ctx);
|
||||||
if (min_devwidth < combining_glyphs[i]->width)
|
if (min_devwidth < combining_glyphs[i]->width)
|
||||||
min_devwidth = combining_glyphs[i]->width;
|
min_devwidth = combining_glyphs[i]->width;
|
||||||
@ -1341,7 +1307,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|||||||
|
|
||||||
case GRUB_UNICODE_COMB_HEBREW_DAGESH:
|
case GRUB_UNICODE_COMB_HEBREW_DAGESH:
|
||||||
do_blit (combining_glyphs[i], targetx,
|
do_blit (combining_glyphs[i], targetx,
|
||||||
-((int) ctx.bounds.height / 2 + ctx.bounds.y
|
-(ctx.bounds.height / 2 + ctx.bounds.y
|
||||||
+ combining_glyphs[i]->height / 2), &ctx);
|
+ combining_glyphs[i]->height / 2), &ctx);
|
||||||
if (min_devwidth < combining_glyphs[i]->width)
|
if (min_devwidth < combining_glyphs[i]->width)
|
||||||
min_devwidth = combining_glyphs[i]->width;
|
min_devwidth = combining_glyphs[i]->width;
|
||||||
@ -1505,18 +1471,14 @@ ensure_comb_space (const struct grub_unicode_glyph *glyph_id)
|
|||||||
if (glyph_id->ncomb <= render_max_comb_glyphs)
|
if (glyph_id->ncomb <= render_max_comb_glyphs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (grub_mul (glyph_id->ncomb, 2, &render_max_comb_glyphs))
|
render_max_comb_glyphs = 2 * glyph_id->ncomb;
|
||||||
render_max_comb_glyphs = 0;
|
if (render_max_comb_glyphs < 8)
|
||||||
if (render_max_comb_glyphs > 0 && render_max_comb_glyphs < 8)
|
|
||||||
render_max_comb_glyphs = 8;
|
render_max_comb_glyphs = 8;
|
||||||
grub_free (render_combining_glyphs);
|
grub_free (render_combining_glyphs);
|
||||||
render_combining_glyphs = (render_max_comb_glyphs > 0) ?
|
render_combining_glyphs = grub_malloc (render_max_comb_glyphs
|
||||||
grub_calloc (render_max_comb_glyphs, sizeof (render_combining_glyphs[0])) : NULL;
|
* sizeof (render_combining_glyphs[0]));
|
||||||
if (!render_combining_glyphs)
|
if (!render_combining_glyphs)
|
||||||
{
|
grub_errno = 0;
|
||||||
render_max_comb_glyphs = 0;
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -1544,7 +1506,6 @@ grub_font_construct_glyph (grub_font_t hinted_font,
|
|||||||
struct grub_video_signed_rect bounds;
|
struct grub_video_signed_rect bounds;
|
||||||
static struct grub_font_glyph *glyph = 0;
|
static struct grub_font_glyph *glyph = 0;
|
||||||
static grub_size_t max_glyph_size = 0;
|
static grub_size_t max_glyph_size = 0;
|
||||||
grub_size_t cur_glyph_size;
|
|
||||||
|
|
||||||
ensure_comb_space (glyph_id);
|
ensure_comb_space (glyph_id);
|
||||||
|
|
||||||
@ -1561,33 +1522,29 @@ grub_font_construct_glyph (grub_font_t hinted_font,
|
|||||||
if (!glyph_id->ncomb && !glyph_id->attributes)
|
if (!glyph_id->ncomb && !glyph_id->attributes)
|
||||||
return main_glyph;
|
return main_glyph;
|
||||||
|
|
||||||
if (grub_video_bitmap_calc_1bpp_bufsz (bounds.width, bounds.height, &cur_glyph_size) ||
|
if (max_glyph_size < sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT)
|
||||||
grub_add (sizeof (*glyph), cur_glyph_size, &cur_glyph_size))
|
|
||||||
return main_glyph;
|
|
||||||
|
|
||||||
if (max_glyph_size < cur_glyph_size)
|
|
||||||
{
|
{
|
||||||
grub_free (glyph);
|
grub_free (glyph);
|
||||||
if (grub_mul (cur_glyph_size, 2, &max_glyph_size))
|
max_glyph_size = (sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) * 2;
|
||||||
max_glyph_size = 0;
|
if (max_glyph_size < 8)
|
||||||
glyph = max_glyph_size > 0 ? grub_malloc (max_glyph_size) : NULL;
|
max_glyph_size = 8;
|
||||||
|
glyph = grub_malloc (max_glyph_size);
|
||||||
}
|
}
|
||||||
if (!glyph)
|
if (!glyph)
|
||||||
{
|
{
|
||||||
max_glyph_size = 0;
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
return main_glyph;
|
return main_glyph;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_memset (glyph, 0, cur_glyph_size);
|
grub_memset (glyph, 0, sizeof (*glyph)
|
||||||
|
+ (bounds.width * bounds.height
|
||||||
|
+ GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT);
|
||||||
|
|
||||||
glyph->font = main_glyph->font;
|
glyph->font = main_glyph->font;
|
||||||
if (bounds.width == 0 || bounds.height == 0 ||
|
glyph->width = bounds.width;
|
||||||
grub_cast (bounds.width, &glyph->width) ||
|
glyph->height = bounds.height;
|
||||||
grub_cast (bounds.height, &glyph->height) ||
|
glyph->offset_x = bounds.x;
|
||||||
grub_cast (bounds.x, &glyph->offset_x) ||
|
glyph->offset_y = bounds.y;
|
||||||
grub_cast (bounds.y, &glyph->offset_y))
|
|
||||||
return main_glyph;
|
|
||||||
|
|
||||||
if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR)
|
if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR)
|
||||||
grub_font_blit_glyph_mirror (glyph, main_glyph,
|
grub_font_blit_glyph_mirror (glyph, main_glyph,
|
||||||
|
@ -912,23 +912,6 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
|||||||
return grub_error (GRUB_ERR_BAD_FS,
|
return grub_error (GRUB_ERR_BAD_FS,
|
||||||
"couldn't find the chunk descriptor");
|
"couldn't find the chunk descriptor");
|
||||||
|
|
||||||
if (!chsize)
|
|
||||||
{
|
|
||||||
grub_dprintf ("btrfs", "zero-size chunk\n");
|
|
||||||
return grub_error (GRUB_ERR_BAD_FS,
|
|
||||||
"got an invalid zero-size chunk");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The space being allocated for a chunk should at least be able to
|
|
||||||
* contain one chunk item.
|
|
||||||
*/
|
|
||||||
if (chsize < sizeof (struct grub_btrfs_chunk_item))
|
|
||||||
{
|
|
||||||
grub_dprintf ("btrfs", "chunk-size too small\n");
|
|
||||||
return grub_error (GRUB_ERR_BAD_FS,
|
|
||||||
"got an invalid chunk size");
|
|
||||||
}
|
|
||||||
chunk = grub_malloc (chsize);
|
chunk = grub_malloc (chsize);
|
||||||
if (!chunk)
|
if (!chunk)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
@ -987,16 +970,6 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
|||||||
stripe_length = grub_divmod64 (grub_le_to_cpu64 (chunk->size),
|
stripe_length = grub_divmod64 (grub_le_to_cpu64 (chunk->size),
|
||||||
nstripes,
|
nstripes,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* For single, there should be exactly 1 stripe. */
|
|
||||||
if (grub_le_to_cpu16 (chunk->nstripes) != 1)
|
|
||||||
{
|
|
||||||
grub_dprintf ("btrfs", "invalid RAID_SINGLE: nstripes != 1 (%u)\n",
|
|
||||||
grub_le_to_cpu16 (chunk->nstripes));
|
|
||||||
return grub_error (GRUB_ERR_BAD_FS,
|
|
||||||
"invalid RAID_SINGLE: nstripes != 1 (%u)",
|
|
||||||
grub_le_to_cpu16 (chunk->nstripes));
|
|
||||||
}
|
|
||||||
if (stripe_length == 0)
|
if (stripe_length == 0)
|
||||||
stripe_length = 512;
|
stripe_length = 512;
|
||||||
stripen = grub_divmod64 (off, stripe_length, &stripe_offset);
|
stripen = grub_divmod64 (off, stripe_length, &stripe_offset);
|
||||||
@ -1016,19 +989,6 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
|||||||
stripen = 0;
|
stripen = 0;
|
||||||
stripe_offset = off;
|
stripe_offset = off;
|
||||||
csize = grub_le_to_cpu64 (chunk->size) - off;
|
csize = grub_le_to_cpu64 (chunk->size) - off;
|
||||||
|
|
||||||
/*
|
|
||||||
* Redundancy, and substripes only apply to RAID10, and there
|
|
||||||
* should be exactly 2 sub-stripes.
|
|
||||||
*/
|
|
||||||
if (grub_le_to_cpu16 (chunk->nstripes) != redundancy)
|
|
||||||
{
|
|
||||||
grub_dprintf ("btrfs", "invalid RAID1: nstripes != %u (%u)\n",
|
|
||||||
redundancy, grub_le_to_cpu16 (chunk->nstripes));
|
|
||||||
return grub_error (GRUB_ERR_BAD_FS,
|
|
||||||
"invalid RAID1: nstripes != %u (%u)",
|
|
||||||
redundancy, grub_le_to_cpu16 (chunk->nstripes));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GRUB_BTRFS_CHUNK_TYPE_RAID0:
|
case GRUB_BTRFS_CHUNK_TYPE_RAID0:
|
||||||
@ -1065,20 +1025,6 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
|||||||
stripe_offset = low + chunk_stripe_length
|
stripe_offset = low + chunk_stripe_length
|
||||||
* high;
|
* high;
|
||||||
csize = chunk_stripe_length - low;
|
csize = chunk_stripe_length - low;
|
||||||
|
|
||||||
/*
|
|
||||||
* Substripes only apply to RAID10, and there
|
|
||||||
* should be exactly 2 sub-stripes.
|
|
||||||
*/
|
|
||||||
if (grub_le_to_cpu16 (chunk->nsubstripes) != 2)
|
|
||||||
{
|
|
||||||
grub_dprintf ("btrfs", "invalid RAID10: nsubstripes != 2 (%u)",
|
|
||||||
grub_le_to_cpu16 (chunk->nsubstripes));
|
|
||||||
return grub_error (GRUB_ERR_BAD_FS,
|
|
||||||
"invalid RAID10: nsubstripes != 2 (%u)",
|
|
||||||
grub_le_to_cpu16 (chunk->nsubstripes));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GRUB_BTRFS_CHUNK_TYPE_RAID5:
|
case GRUB_BTRFS_CHUNK_TYPE_RAID5:
|
||||||
@ -1176,17 +1122,8 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
|||||||
if (csize > (grub_uint64_t) size)
|
if (csize > (grub_uint64_t) size)
|
||||||
csize = size;
|
csize = size;
|
||||||
|
|
||||||
/*
|
|
||||||
* The space for a chunk stripe is limited to the space provide in the super-block's
|
|
||||||
* bootstrap mapping with an initial btrfs key at the start of each chunk.
|
|
||||||
*/
|
|
||||||
grub_size_t avail_stripes = sizeof (data->sblock.bootstrap_mapping) /
|
|
||||||
(sizeof (struct grub_btrfs_key) + sizeof (struct grub_btrfs_chunk_stripe));
|
|
||||||
|
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
grub_size_t est_chunk_alloc = 0;
|
|
||||||
|
|
||||||
grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T
|
grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T
|
||||||
"+0x%" PRIxGRUB_UINT64_T
|
"+0x%" PRIxGRUB_UINT64_T
|
||||||
" (%d stripes (%d substripes) of %"
|
" (%d stripes (%d substripes) of %"
|
||||||
@ -1199,22 +1136,6 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
|
|||||||
grub_dprintf ("btrfs", "reading laddr 0x%" PRIxGRUB_UINT64_T "\n",
|
grub_dprintf ("btrfs", "reading laddr 0x%" PRIxGRUB_UINT64_T "\n",
|
||||||
addr);
|
addr);
|
||||||
|
|
||||||
if (grub_mul (sizeof (struct grub_btrfs_chunk_stripe),
|
|
||||||
grub_le_to_cpu16 (chunk->nstripes), &est_chunk_alloc) ||
|
|
||||||
grub_add (est_chunk_alloc,
|
|
||||||
sizeof (struct grub_btrfs_chunk_item), &est_chunk_alloc) ||
|
|
||||||
est_chunk_alloc > chunk->size)
|
|
||||||
{
|
|
||||||
err = GRUB_ERR_BAD_FS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_le_to_cpu16 (chunk->nstripes) > avail_stripes)
|
|
||||||
{
|
|
||||||
err = GRUB_ERR_BAD_FS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_raid56)
|
if (is_raid56)
|
||||||
{
|
{
|
||||||
err = btrfs_read_from_chunk (data, chunk, stripen,
|
err = btrfs_read_from_chunk (data, chunk, stripen,
|
||||||
@ -2040,7 +1961,6 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
|||||||
int r = 0;
|
int r = 0;
|
||||||
grub_uint64_t tree;
|
grub_uint64_t tree;
|
||||||
grub_uint8_t type;
|
grub_uint8_t type;
|
||||||
grub_size_t est_size = 0;
|
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
@ -2099,18 +2019,6 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (direl == NULL ||
|
|
||||||
grub_add (grub_le_to_cpu16 (direl->n),
|
|
||||||
grub_le_to_cpu16 (direl->m), &est_size) ||
|
|
||||||
grub_add (est_size, sizeof (*direl), &est_size) ||
|
|
||||||
grub_sub (est_size, sizeof (direl->name), &est_size) ||
|
|
||||||
est_size > allocated)
|
|
||||||
{
|
|
||||||
grub_errno = GRUB_ERR_OUT_OF_RANGE;
|
|
||||||
r = -grub_errno;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (cdirel = direl;
|
for (cdirel = direl;
|
||||||
(grub_uint8_t *) cdirel - (grub_uint8_t *) direl
|
(grub_uint8_t *) cdirel - (grub_uint8_t *) direl
|
||||||
< (grub_ssize_t) elemsize;
|
< (grub_ssize_t) elemsize;
|
||||||
@ -2121,19 +2029,6 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
|||||||
char c;
|
char c;
|
||||||
struct grub_btrfs_inode inode;
|
struct grub_btrfs_inode inode;
|
||||||
struct grub_dirhook_info info;
|
struct grub_dirhook_info info;
|
||||||
|
|
||||||
if (cdirel == NULL ||
|
|
||||||
grub_add (grub_le_to_cpu16 (cdirel->n),
|
|
||||||
grub_le_to_cpu16 (cdirel->m), &est_size) ||
|
|
||||||
grub_add (est_size, sizeof (*cdirel), &est_size) ||
|
|
||||||
grub_sub (est_size, sizeof (cdirel->name), &est_size) ||
|
|
||||||
est_size > allocated)
|
|
||||||
{
|
|
||||||
grub_errno = GRUB_ERR_OUT_OF_RANGE;
|
|
||||||
r = -grub_errno;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = grub_btrfs_read_inode (data, &inode, cdirel->key.object_id,
|
err = grub_btrfs_read_inode (data, &inode, cdirel->key.object_id,
|
||||||
tree);
|
tree);
|
||||||
grub_memset (&info, 0, sizeof (info));
|
grub_memset (&info, 0, sizeof (info));
|
||||||
|
@ -122,7 +122,6 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||||||
#define F2FS_INLINE_DOTS 0x10 /* File having implicit dot dentries. */
|
#define F2FS_INLINE_DOTS 0x10 /* File having implicit dot dentries. */
|
||||||
|
|
||||||
#define MAX_VOLUME_NAME 512
|
#define MAX_VOLUME_NAME 512
|
||||||
#define MAX_NAT_BITMAP_SIZE 3900
|
|
||||||
|
|
||||||
enum FILE_TYPE
|
enum FILE_TYPE
|
||||||
{
|
{
|
||||||
@ -184,7 +183,7 @@ struct grub_f2fs_checkpoint
|
|||||||
grub_uint32_t checksum_offset;
|
grub_uint32_t checksum_offset;
|
||||||
grub_uint64_t elapsed_time;
|
grub_uint64_t elapsed_time;
|
||||||
grub_uint8_t alloc_type[MAX_ACTIVE_LOGS];
|
grub_uint8_t alloc_type[MAX_ACTIVE_LOGS];
|
||||||
grub_uint8_t sit_nat_version_bitmap[MAX_NAT_BITMAP_SIZE];
|
grub_uint8_t sit_nat_version_bitmap[3900];
|
||||||
grub_uint32_t checksum;
|
grub_uint32_t checksum;
|
||||||
} GRUB_PACKED;
|
} GRUB_PACKED;
|
||||||
|
|
||||||
@ -303,7 +302,6 @@ struct grub_f2fs_data
|
|||||||
|
|
||||||
struct grub_f2fs_nat_journal nat_j;
|
struct grub_f2fs_nat_journal nat_j;
|
||||||
char *nat_bitmap;
|
char *nat_bitmap;
|
||||||
grub_uint32_t nat_bitmap_size;
|
|
||||||
|
|
||||||
grub_disk_t disk;
|
grub_disk_t disk;
|
||||||
struct grub_f2fs_node *inode;
|
struct grub_f2fs_node *inode;
|
||||||
@ -379,20 +377,15 @@ sum_blk_addr (struct grub_f2fs_data *data, int base, int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
nat_bitmap_ptr (struct grub_f2fs_data *data, grub_uint32_t *nat_bitmap_size)
|
nat_bitmap_ptr (struct grub_f2fs_data *data)
|
||||||
{
|
{
|
||||||
struct grub_f2fs_checkpoint *ckpt = &data->ckpt;
|
struct grub_f2fs_checkpoint *ckpt = &data->ckpt;
|
||||||
grub_uint32_t offset;
|
grub_uint32_t offset;
|
||||||
*nat_bitmap_size = MAX_NAT_BITMAP_SIZE;
|
|
||||||
|
|
||||||
if (grub_le_to_cpu32 (data->sblock.cp_payload) > 0)
|
if (grub_le_to_cpu32 (data->sblock.cp_payload) > 0)
|
||||||
return ckpt->sit_nat_version_bitmap;
|
return ckpt->sit_nat_version_bitmap;
|
||||||
|
|
||||||
offset = grub_le_to_cpu32 (ckpt->sit_ver_bitmap_bytesize);
|
offset = grub_le_to_cpu32 (ckpt->sit_ver_bitmap_bytesize);
|
||||||
if (offset >= MAX_NAT_BITMAP_SIZE)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
*nat_bitmap_size = *nat_bitmap_size - offset;
|
|
||||||
|
|
||||||
return ckpt->sit_nat_version_bitmap + offset;
|
return ckpt->sit_nat_version_bitmap + offset;
|
||||||
}
|
}
|
||||||
@ -445,15 +438,11 @@ grub_f2fs_crc_valid (grub_uint32_t blk_crc, void *buf, const grub_uint32_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
grub_f2fs_test_bit (grub_uint32_t nr, const char *p, grub_uint32_t len)
|
grub_f2fs_test_bit (grub_uint32_t nr, const char *p)
|
||||||
{
|
{
|
||||||
int mask;
|
int mask;
|
||||||
grub_uint32_t shifted_nr = (nr >> 3);
|
|
||||||
|
|
||||||
if (shifted_nr >= len)
|
p += (nr >> 3);
|
||||||
return -1;
|
|
||||||
|
|
||||||
p += shifted_nr;
|
|
||||||
mask = 1 << (7 - (nr & 0x07));
|
mask = 1 << (7 - (nr & 0x07));
|
||||||
|
|
||||||
return mask & *p;
|
return mask & *p;
|
||||||
@ -643,27 +632,23 @@ get_nat_journal (struct grub_f2fs_data *data)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_uint32_t
|
||||||
get_blkaddr_from_nat_journal (struct grub_f2fs_data *data, grub_uint32_t nid,
|
get_blkaddr_from_nat_journal (struct grub_f2fs_data *data, grub_uint32_t nid)
|
||||||
grub_uint32_t *blkaddr)
|
|
||||||
{
|
{
|
||||||
grub_uint16_t n = grub_le_to_cpu16 (data->nat_j.n_nats);
|
grub_uint16_t n = grub_le_to_cpu16 (data->nat_j.n_nats);
|
||||||
|
grub_uint32_t blkaddr = 0;
|
||||||
grub_uint16_t i;
|
grub_uint16_t i;
|
||||||
|
|
||||||
if (n >= NAT_JOURNAL_ENTRIES)
|
|
||||||
return grub_error (GRUB_ERR_BAD_FS,
|
|
||||||
"invalid number of nat journal entries");
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
if (grub_le_to_cpu32 (data->nat_j.entries[i].nid) == nid)
|
if (grub_le_to_cpu32 (data->nat_j.entries[i].nid) == nid)
|
||||||
{
|
{
|
||||||
*blkaddr = grub_le_to_cpu32 (data->nat_j.entries[i].ne.block_addr);
|
blkaddr = grub_le_to_cpu32 (data->nat_j.entries[i].ne.block_addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return blkaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_uint32_t
|
static grub_uint32_t
|
||||||
@ -671,14 +656,10 @@ get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid)
|
|||||||
{
|
{
|
||||||
struct grub_f2fs_nat_block *nat_block;
|
struct grub_f2fs_nat_block *nat_block;
|
||||||
grub_uint32_t seg_off, block_off, entry_off, block_addr;
|
grub_uint32_t seg_off, block_off, entry_off, block_addr;
|
||||||
grub_uint32_t blkaddr = 0;
|
grub_uint32_t blkaddr;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
int result_bit;
|
|
||||||
|
|
||||||
err = get_blkaddr_from_nat_journal (data, nid, &blkaddr);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
blkaddr = get_blkaddr_from_nat_journal (data, nid);
|
||||||
if (blkaddr)
|
if (blkaddr)
|
||||||
return blkaddr;
|
return blkaddr;
|
||||||
|
|
||||||
@ -694,15 +675,8 @@ get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid)
|
|||||||
((seg_off * data->blocks_per_seg) << 1) +
|
((seg_off * data->blocks_per_seg) << 1) +
|
||||||
(block_off & (data->blocks_per_seg - 1));
|
(block_off & (data->blocks_per_seg - 1));
|
||||||
|
|
||||||
result_bit = grub_f2fs_test_bit (block_off, data->nat_bitmap,
|
if (grub_f2fs_test_bit (block_off, data->nat_bitmap))
|
||||||
data->nat_bitmap_size);
|
|
||||||
if (result_bit > 0)
|
|
||||||
block_addr += data->blocks_per_seg;
|
block_addr += data->blocks_per_seg;
|
||||||
else if (result_bit == -1)
|
|
||||||
{
|
|
||||||
grub_free (nat_block);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = grub_f2fs_block_read (data, block_addr, nat_block);
|
err = grub_f2fs_block_read (data, block_addr, nat_block);
|
||||||
if (err)
|
if (err)
|
||||||
@ -852,9 +826,7 @@ grub_f2fs_mount (grub_disk_t disk)
|
|||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
data->nat_bitmap = nat_bitmap_ptr (data, &data->nat_bitmap_size);
|
data->nat_bitmap = nat_bitmap_ptr (data);
|
||||||
if (data->nat_bitmap == NULL)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
err = get_nat_journal (data);
|
err = get_nat_journal (data);
|
||||||
if (err)
|
if (err)
|
||||||
@ -1003,10 +975,6 @@ grub_f2fs_check_dentries (struct grub_f2fs_dir_iter_ctx *ctx)
|
|||||||
|
|
||||||
ftype = ctx->dentry[i].file_type;
|
ftype = ctx->dentry[i].file_type;
|
||||||
name_len = grub_le_to_cpu16 (ctx->dentry[i].name_len);
|
name_len = grub_le_to_cpu16 (ctx->dentry[i].name_len);
|
||||||
|
|
||||||
if (name_len >= F2FS_NAME_LEN)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
filename = grub_malloc (name_len + 1);
|
filename = grub_malloc (name_len + 1);
|
||||||
if (!filename)
|
if (!filename)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -192,11 +192,6 @@ struct grub_xfs_time_legacy
|
|||||||
grub_uint32_t nanosec;
|
grub_uint32_t nanosec;
|
||||||
} GRUB_PACKED;
|
} GRUB_PACKED;
|
||||||
|
|
||||||
/*
|
|
||||||
* The struct grub_xfs_inode layout was taken from the
|
|
||||||
* struct xfs_dinode_core which is described here:
|
|
||||||
* https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf
|
|
||||||
*/
|
|
||||||
struct grub_xfs_inode
|
struct grub_xfs_inode
|
||||||
{
|
{
|
||||||
grub_uint8_t magic[2];
|
grub_uint8_t magic[2];
|
||||||
@ -213,15 +208,14 @@ struct grub_xfs_inode
|
|||||||
grub_uint32_t nextents;
|
grub_uint32_t nextents;
|
||||||
grub_uint16_t unused3;
|
grub_uint16_t unused3;
|
||||||
grub_uint8_t fork_offset;
|
grub_uint8_t fork_offset;
|
||||||
grub_uint8_t unused4[17]; /* Last member of inode v2. */
|
grub_uint8_t unused4[37];
|
||||||
grub_uint8_t unused5[20]; /* First member of inode v3. */
|
|
||||||
grub_uint64_t flags2;
|
grub_uint64_t flags2;
|
||||||
grub_uint8_t unused6[48]; /* Last member of inode v3. */
|
grub_uint8_t unused5[48];
|
||||||
} GRUB_PACKED;
|
} GRUB_PACKED;
|
||||||
|
|
||||||
#define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode)
|
#define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode)
|
||||||
/* Size of struct grub_xfs_inode v2, up to unused4 member included. */
|
/* Size of struct grub_xfs_inode until fork_offset (included). */
|
||||||
#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76)
|
#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 92)
|
||||||
|
|
||||||
struct grub_xfs_dirblock_tail
|
struct grub_xfs_dirblock_tail
|
||||||
{
|
{
|
||||||
|
@ -427,11 +427,6 @@ grub_gettext_init_ext (struct grub_gettext_context *ctx,
|
|||||||
if (locale[0] == 'e' && locale[1] == 'n'
|
if (locale[0] == 'e' && locale[1] == 'n'
|
||||||
&& (locale[2] == '\0' || locale[2] == '_'))
|
&& (locale[2] == '\0' || locale[2] == '_'))
|
||||||
grub_errno = err = GRUB_ERR_NONE;
|
grub_errno = err = GRUB_ERR_NONE;
|
||||||
|
|
||||||
/* If no translations are available, fall back to untranslated text. */
|
|
||||||
if (err == GRUB_ERR_FILE_NOT_FOUND)
|
|
||||||
grub_errno = err = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,38 +113,6 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate pages below a specified address */
|
|
||||||
void *
|
|
||||||
grub_efi_allocate_pages_max (grub_efi_physical_address_t max,
|
|
||||||
grub_efi_uintn_t pages)
|
|
||||||
{
|
|
||||||
grub_efi_status_t status;
|
|
||||||
grub_efi_boot_services_t *b;
|
|
||||||
grub_efi_physical_address_t address = max;
|
|
||||||
|
|
||||||
if (max > 0xffffffff)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
b = grub_efi_system_table->boot_services;
|
|
||||||
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
|
|
||||||
|
|
||||||
if (status != GRUB_EFI_SUCCESS)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (address == 0)
|
|
||||||
{
|
|
||||||
/* Uggh, the address 0 was allocated... This is too annoying,
|
|
||||||
so reallocate another one. */
|
|
||||||
address = max;
|
|
||||||
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address);
|
|
||||||
grub_efi_free_pages (0, pages);
|
|
||||||
if (status != GRUB_EFI_SUCCESS)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (void *) ((grub_addr_t) address);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate pages. Return the pointer to the first of allocated pages. */
|
/* Allocate pages. Return the pointer to the first of allocated pages. */
|
||||||
void *
|
void *
|
||||||
grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
|
grub_efi_allocate_pages_real (grub_efi_physical_address_t address,
|
||||||
|
@ -119,11 +119,10 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)),
|
|||||||
void **context __attribute__ ((unused)),
|
void **context __attribute__ ((unused)),
|
||||||
enum grub_verify_flags *flags)
|
enum grub_verify_flags *flags)
|
||||||
{
|
{
|
||||||
*flags = GRUB_VERIFY_FLAGS_NONE;
|
*flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION;
|
||||||
|
|
||||||
switch (type & GRUB_FILE_TYPE_MASK)
|
switch (type & GRUB_FILE_TYPE_MASK)
|
||||||
{
|
{
|
||||||
/* Files we check. */
|
|
||||||
case GRUB_FILE_TYPE_LINUX_KERNEL:
|
case GRUB_FILE_TYPE_LINUX_KERNEL:
|
||||||
case GRUB_FILE_TYPE_MULTIBOOT_KERNEL:
|
case GRUB_FILE_TYPE_MULTIBOOT_KERNEL:
|
||||||
case GRUB_FILE_TYPE_BSD_KERNEL:
|
case GRUB_FILE_TYPE_BSD_KERNEL:
|
||||||
@ -131,42 +130,11 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)),
|
|||||||
case GRUB_FILE_TYPE_PLAN9_KERNEL:
|
case GRUB_FILE_TYPE_PLAN9_KERNEL:
|
||||||
case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
|
case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
|
||||||
*flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK;
|
*flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK;
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
/* Files that do not affect secureboot state. */
|
/* Fall through. */
|
||||||
case GRUB_FILE_TYPE_NONE:
|
|
||||||
case GRUB_FILE_TYPE_LOOPBACK:
|
|
||||||
case GRUB_FILE_TYPE_LINUX_INITRD:
|
|
||||||
case GRUB_FILE_TYPE_OPENBSD_RAMDISK:
|
|
||||||
case GRUB_FILE_TYPE_XNU_RAMDISK:
|
|
||||||
case GRUB_FILE_TYPE_SIGNATURE:
|
|
||||||
case GRUB_FILE_TYPE_PUBLIC_KEY:
|
|
||||||
case GRUB_FILE_TYPE_PUBLIC_KEY_TRUST:
|
|
||||||
case GRUB_FILE_TYPE_PRINT_BLOCKLIST:
|
|
||||||
case GRUB_FILE_TYPE_TESTLOAD:
|
|
||||||
case GRUB_FILE_TYPE_GET_SIZE:
|
|
||||||
case GRUB_FILE_TYPE_ZFS_ENCRYPTION_KEY:
|
|
||||||
case GRUB_FILE_TYPE_CAT:
|
|
||||||
case GRUB_FILE_TYPE_HEXCAT:
|
|
||||||
case GRUB_FILE_TYPE_CMP:
|
|
||||||
case GRUB_FILE_TYPE_HASHLIST:
|
|
||||||
case GRUB_FILE_TYPE_TO_HASH:
|
|
||||||
case GRUB_FILE_TYPE_KEYBOARD_LAYOUT:
|
|
||||||
case GRUB_FILE_TYPE_PIXMAP:
|
|
||||||
case GRUB_FILE_TYPE_GRUB_MODULE_LIST:
|
|
||||||
case GRUB_FILE_TYPE_CONFIG:
|
|
||||||
case GRUB_FILE_TYPE_THEME:
|
|
||||||
case GRUB_FILE_TYPE_GETTEXT_CATALOG:
|
|
||||||
case GRUB_FILE_TYPE_FS_SEARCH:
|
|
||||||
case GRUB_FILE_TYPE_LOADENV:
|
|
||||||
case GRUB_FILE_TYPE_SAVEENV:
|
|
||||||
case GRUB_FILE_TYPE_VERIFY_SIGNATURE:
|
|
||||||
*flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION;
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
/* Other files. */
|
|
||||||
default:
|
default:
|
||||||
return grub_error (GRUB_ERR_ACCESS_DENIED, N_("prohibited by secure boot policy"));
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,18 +532,6 @@ read_device_map (const char *dev_map)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! strncmp (p, "/dev/fd", sizeof ("/dev/fd") - 1))
|
|
||||||
{
|
|
||||||
char *q = p + sizeof ("/dev/fd") - 1;
|
|
||||||
if (*q >= '0' && *q <= '9')
|
|
||||||
{
|
|
||||||
free (map[drive].drive);
|
|
||||||
map[drive].drive = NULL;
|
|
||||||
grub_util_info ("`%s' looks like a floppy drive, skipping", p);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On Linux, the devfs uses symbolic links horribly, and that
|
/* On Linux, the devfs uses symbolic links horribly, and that
|
||||||
confuses the interface very much, so use realpath to expand
|
confuses the interface very much, so use realpath to expand
|
||||||
symbolic links. */
|
symbolic links. */
|
||||||
|
@ -79,7 +79,6 @@ grub_file_open (const char *name, enum grub_file_type type)
|
|||||||
|
|
||||||
device = grub_device_open (device_name);
|
device = grub_device_open (device_name);
|
||||||
grub_free (device_name);
|
grub_free (device_name);
|
||||||
device_name = NULL;
|
|
||||||
if (! device)
|
if (! device)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@ -132,7 +131,6 @@ grub_file_open (const char *name, enum grub_file_type type)
|
|||||||
return file;
|
return file;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
grub_free (device_name);
|
|
||||||
if (device)
|
if (device)
|
||||||
grub_device_close (device);
|
grub_device_close (device);
|
||||||
|
|
||||||
|
@ -76,7 +76,6 @@ grub_exit (void)
|
|||||||
grub_ieee1275_exit ();
|
grub_ieee1275_exit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __i386__
|
|
||||||
/* Translate an OF filesystem path (separated by backslashes), into a GRUB
|
/* Translate an OF filesystem path (separated by backslashes), into a GRUB
|
||||||
path (separated by forward slashes). */
|
path (separated by forward slashes). */
|
||||||
static void
|
static void
|
||||||
@ -91,18 +90,9 @@ grub_translate_ieee1275_path (char *filepath)
|
|||||||
backslash = grub_strchr (filepath, '\\');
|
backslash = grub_strchr (filepath, '\\');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void (*grub_ieee1275_net_config) (const char *dev, char **device, char **path,
|
void (*grub_ieee1275_net_config) (const char *dev, char **device, char **path,
|
||||||
char *bootpath);
|
char *bootpath);
|
||||||
#ifdef __i386__
|
|
||||||
void
|
|
||||||
grub_machine_get_bootlocation (char **device __attribute__ ((unused)),
|
|
||||||
char **path __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_env_set ("prefix", "(sd,1)/");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void
|
void
|
||||||
grub_machine_get_bootlocation (char **device, char **path)
|
grub_machine_get_bootlocation (char **device, char **path)
|
||||||
{
|
{
|
||||||
@ -156,7 +146,6 @@ grub_machine_get_bootlocation (char **device, char **path)
|
|||||||
}
|
}
|
||||||
grub_free (bootpath);
|
grub_free (bootpath);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Claim some available memory in the first /memory node. */
|
/* Claim some available memory in the first /memory node. */
|
||||||
#ifdef __sparc__
|
#ifdef __sparc__
|
||||||
|
@ -51,7 +51,6 @@ lockdown_verifier_init (grub_file_t io __attribute__ ((unused)),
|
|||||||
case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
|
case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
|
||||||
case GRUB_FILE_TYPE_ACPI_TABLE:
|
case GRUB_FILE_TYPE_ACPI_TABLE:
|
||||||
case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE:
|
case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE:
|
||||||
case GRUB_FILE_TYPE_FONT:
|
|
||||||
*flags = GRUB_VERIFY_FLAGS_DEFER_AUTH;
|
*flags = GRUB_VERIFY_FLAGS_DEFER_AUTH;
|
||||||
|
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
|
@ -29,9 +29,7 @@
|
|||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/reader.h>
|
#include <grub/reader.h>
|
||||||
#include <grub/parser.h>
|
#include <grub/parser.h>
|
||||||
#ifndef GRUB_MACHINE_PCBIOS
|
|
||||||
#include <grub/verify.h>
|
#include <grub/verify.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_PCBIOS
|
#ifdef GRUB_MACHINE_PCBIOS
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
@ -267,30 +265,18 @@ reclaim_module_space (void)
|
|||||||
void __attribute__ ((noreturn))
|
void __attribute__ ((noreturn))
|
||||||
grub_main (void)
|
grub_main (void)
|
||||||
{
|
{
|
||||||
#if QUIET_BOOT
|
|
||||||
struct grub_term_output *term;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* First of all, initialize the machine. */
|
/* First of all, initialize the machine. */
|
||||||
grub_machine_init ();
|
grub_machine_init ();
|
||||||
|
|
||||||
grub_boot_time ("After machine init.");
|
grub_boot_time ("After machine init.");
|
||||||
|
|
||||||
#if QUIET_BOOT
|
|
||||||
/* Disable the cursor until we need it. */
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
grub_term_setcursor (term, 0);
|
|
||||||
#else
|
|
||||||
/* Hello. */
|
/* Hello. */
|
||||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||||
grub_printf ("Welcome to GRUB!\n\n");
|
grub_printf ("Welcome to GRUB!\n\n");
|
||||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GRUB_MACHINE_PCBIOS
|
|
||||||
/* Init verifiers API. */
|
/* Init verifiers API. */
|
||||||
grub_verifiers_init ();
|
grub_verifiers_init ();
|
||||||
#endif
|
|
||||||
|
|
||||||
grub_load_config ();
|
grub_load_config ();
|
||||||
|
|
||||||
@ -326,12 +312,5 @@ grub_main (void)
|
|||||||
grub_boot_time ("After execution of embedded config. Attempt to go to normal mode");
|
grub_boot_time ("After execution of embedded config. Attempt to go to normal mode");
|
||||||
|
|
||||||
grub_load_normal_mode ();
|
grub_load_normal_mode ();
|
||||||
|
|
||||||
#if QUIET_BOOT
|
|
||||||
/* If we have to enter rescue mode, enable the cursor again. */
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
grub_term_setcursor (term, 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
grub_rescue_run ();
|
grub_rescue_run ();
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/offsets.h>
|
#include <grub/offsets.h>
|
||||||
|
|
||||||
#define MSR_VSX 0x80
|
|
||||||
|
|
||||||
.extern __bss_start
|
.extern __bss_start
|
||||||
.extern _end
|
.extern _end
|
||||||
|
|
||||||
@ -30,16 +28,6 @@
|
|||||||
.globl start, _start
|
.globl start, _start
|
||||||
start:
|
start:
|
||||||
_start:
|
_start:
|
||||||
_start:
|
|
||||||
|
|
||||||
/* Disable VSX instruction */
|
|
||||||
mfmsr 0
|
|
||||||
oris 0,0,MSR_VSX
|
|
||||||
/* The "VSX Available" bit is in the lower half of the MSR, so we
|
|
||||||
don't need mtmsrd, which in any case won't work in 32-bit mode. */
|
|
||||||
mtmsr 0
|
|
||||||
isync
|
|
||||||
|
|
||||||
li 2, 0
|
li 2, 0
|
||||||
li 13, 0
|
li 13, 0
|
||||||
|
|
||||||
|
@ -78,9 +78,7 @@ grub_rescue_read_line (char **line, int cont,
|
|||||||
void __attribute__ ((noreturn))
|
void __attribute__ ((noreturn))
|
||||||
grub_rescue_run (void)
|
grub_rescue_run (void)
|
||||||
{
|
{
|
||||||
#if QUIET_BOOT
|
|
||||||
grub_printf ("Entering rescue mode...\n");
|
grub_printf ("Entering rescue mode...\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -100,13 +100,11 @@ grub_verifiers_open (grub_file_t io, enum grub_file_type type)
|
|||||||
FOR_LIST_ELEMENTS(ver, grub_file_verifiers)
|
FOR_LIST_ELEMENTS(ver, grub_file_verifiers)
|
||||||
{
|
{
|
||||||
enum grub_verify_flags flags = 0;
|
enum grub_verify_flags flags = 0;
|
||||||
grub_dprintf ("verify", "trying verifier %s\n", ver->name);
|
|
||||||
err = ver->init (io, type, &context, &flags);
|
err = ver->init (io, type, &context, &flags);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail_noclose;
|
goto fail_noclose;
|
||||||
if (flags & GRUB_VERIFY_FLAGS_DEFER_AUTH)
|
if (flags & GRUB_VERIFY_FLAGS_DEFER_AUTH)
|
||||||
{
|
{
|
||||||
grub_dprintf ("verify", "verifier %s said GRUB_VERIFY_FLAGS_DEFER_AUTH\n", ver->name);
|
|
||||||
defer = 1;
|
defer = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -223,25 +221,8 @@ grub_verify_string (char *str, enum grub_verify_string_type type)
|
|||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* It is intended to build verifiers as module on i386-pc platform to minimize
|
|
||||||
* the impact of growing core image size could blow up the 63 sectors limit of
|
|
||||||
* some MBR gap one day. It is also adequate to do so, given no core function
|
|
||||||
* on i386-pc would require the verifiers API to work.
|
|
||||||
*/
|
|
||||||
#ifdef GRUB_MACHINE_PCBIOS
|
|
||||||
GRUB_MOD_INIT(verifiers)
|
|
||||||
#else
|
|
||||||
void
|
void
|
||||||
grub_verifiers_init (void)
|
grub_verifiers_init (void)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
grub_file_filter_register (GRUB_FILE_FILTER_VERIFY, grub_verifiers_open);
|
grub_file_filter_register (GRUB_FILE_FILTER_VERIFY, grub_verifiers_open);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_PCBIOS
|
|
||||||
GRUB_MOD_FINI(verifiers)
|
|
||||||
{
|
|
||||||
grub_file_filter_unregister (GRUB_FILE_FILTER_VERIFY);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the LZO real-time data compression library.
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
The LZO library is free software; you can redistribute it and/or
|
The LZO library is free software; you can redistribute it and/or
|
||||||
@ -29,9 +29,9 @@
|
|||||||
#ifndef __LZOCONF_H_INCLUDED
|
#ifndef __LZOCONF_H_INCLUDED
|
||||||
#define __LZOCONF_H_INCLUDED 1
|
#define __LZOCONF_H_INCLUDED 1
|
||||||
|
|
||||||
#define LZO_VERSION 0x20a0 /* 2.10 */
|
#define LZO_VERSION 0x2080
|
||||||
#define LZO_VERSION_STRING "2.10"
|
#define LZO_VERSION_STRING "2.08"
|
||||||
#define LZO_VERSION_DATE "Mar 01 2017"
|
#define LZO_VERSION_DATE "Jun 29 2014"
|
||||||
|
|
||||||
/* internal Autoconf configuration file - only used when building LZO */
|
/* internal Autoconf configuration file - only used when building LZO */
|
||||||
#if defined(LZO_HAVE_CONFIG_H)
|
#if defined(LZO_HAVE_CONFIG_H)
|
||||||
@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
/* get OS and architecture defines */
|
/* get OS and architecture defines */
|
||||||
#ifndef __LZODEFS_H_INCLUDED
|
#ifndef __LZODEFS_H_INCLUDED
|
||||||
#include <lzo/lzodefs.h>
|
#include "lzodefs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -94,29 +94,25 @@ extern "C" {
|
|||||||
# if (LZO_OS_WIN64)
|
# if (LZO_OS_WIN64)
|
||||||
typedef unsigned __int64 lzo_uint;
|
typedef unsigned __int64 lzo_uint;
|
||||||
typedef __int64 lzo_int;
|
typedef __int64 lzo_int;
|
||||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF___INT64
|
|
||||||
# else
|
# else
|
||||||
typedef lzo_ullong_t lzo_uint;
|
typedef lzo_ullong_t lzo_uint;
|
||||||
typedef lzo_llong_t lzo_int;
|
typedef lzo_llong_t lzo_int;
|
||||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG_LONG
|
|
||||||
# endif
|
# endif
|
||||||
# define LZO_SIZEOF_LZO_INT 8
|
# define LZO_SIZEOF_LZO_UINT 8
|
||||||
# define LZO_UINT_MAX 0xffffffffffffffffull
|
# define LZO_UINT_MAX 0xffffffffffffffffull
|
||||||
# define LZO_INT_MAX 9223372036854775807LL
|
# define LZO_INT_MAX 9223372036854775807LL
|
||||||
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||||
# elif (LZO_ABI_IP32L64) /* MIPS R5900 */
|
# elif (LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||||
typedef unsigned int lzo_uint;
|
typedef unsigned int lzo_uint;
|
||||||
typedef int lzo_int;
|
typedef int lzo_int;
|
||||||
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT
|
# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_INT
|
||||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT
|
|
||||||
# define LZO_UINT_MAX UINT_MAX
|
# define LZO_UINT_MAX UINT_MAX
|
||||||
# define LZO_INT_MAX INT_MAX
|
# define LZO_INT_MAX INT_MAX
|
||||||
# define LZO_INT_MIN INT_MIN
|
# define LZO_INT_MIN INT_MIN
|
||||||
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||||
typedef unsigned long lzo_uint;
|
typedef unsigned long lzo_uint;
|
||||||
typedef long lzo_int;
|
typedef long lzo_int;
|
||||||
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_LONG
|
# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LONG
|
||||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG
|
|
||||||
# define LZO_UINT_MAX ULONG_MAX
|
# define LZO_UINT_MAX ULONG_MAX
|
||||||
# define LZO_INT_MAX LONG_MAX
|
# define LZO_INT_MAX LONG_MAX
|
||||||
# define LZO_INT_MIN LONG_MIN
|
# define LZO_INT_MIN LONG_MIN
|
||||||
@ -126,7 +122,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The larger type of lzo_uint and lzo_uint32_t. */
|
/* The larger type of lzo_uint and lzo_uint32_t. */
|
||||||
#if (LZO_SIZEOF_LZO_INT >= 4)
|
#if (LZO_SIZEOF_LZO_UINT >= 4)
|
||||||
# define lzo_xint lzo_uint
|
# define lzo_xint lzo_uint
|
||||||
#else
|
#else
|
||||||
# define lzo_xint lzo_uint32_t
|
# define lzo_xint lzo_uint32_t
|
||||||
@ -135,8 +131,7 @@ extern "C" {
|
|||||||
typedef int lzo_bool;
|
typedef int lzo_bool;
|
||||||
|
|
||||||
/* sanity checks */
|
/* sanity checks */
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int) == LZO_SIZEOF_LZO_INT)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_UINT)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_INT)
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint))
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t))
|
||||||
|
|
||||||
@ -168,14 +163,14 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t))
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Older LZO versions used to support ancient systems and memory models
|
/* Older LZO versions used to support ancient systems and memory models
|
||||||
* such as 16-bit MSDOS with __huge pointers or Cray PVP, but these
|
* like 16-bit MSDOS with __huge pointers and Cray PVP, but these
|
||||||
* obsolete configurations are not supported any longer.
|
* obsolete configurations are not supported any longer.
|
||||||
*/
|
*/
|
||||||
#if defined(__LZO_MMODEL_HUGE)
|
#if defined(__LZO_MMODEL_HUGE)
|
||||||
#error "__LZO_MMODEL_HUGE memory model is unsupported"
|
#error "__LZO_MMODEL_HUGE is unsupported"
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_MM_PVP)
|
#if (LZO_MM_PVP)
|
||||||
#error "LZO_MM_PVP memory model is unsupported"
|
#error "LZO_MM_PVP is unsupported"
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_SIZEOF_INT < 4)
|
#if (LZO_SIZEOF_INT < 4)
|
||||||
#error "LZO_SIZEOF_INT < 4 is unsupported"
|
#error "LZO_SIZEOF_INT < 4 is unsupported"
|
||||||
@ -226,13 +221,13 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep))
|
|||||||
|
|
||||||
/* __cdecl calling convention for public C and assembly functions */
|
/* __cdecl calling convention for public C and assembly functions */
|
||||||
#if !defined(LZO_PUBLIC)
|
#if !defined(LZO_PUBLIC)
|
||||||
# define LZO_PUBLIC(r) __LZO_EXPORT1 r __LZO_EXPORT2 __LZO_CDECL
|
# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LZO_EXTERN)
|
#if !defined(LZO_EXTERN)
|
||||||
# define LZO_EXTERN(r) __LZO_EXTERN_C LZO_PUBLIC(r)
|
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LZO_PRIVATE)
|
#if !defined(LZO_PRIVATE)
|
||||||
# define LZO_PRIVATE(r) static r __LZO_CDECL
|
# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* function types */
|
/* function types */
|
||||||
@ -404,10 +399,6 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size);
|
|||||||
/* deprecated types */
|
/* deprecated types */
|
||||||
typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u;
|
typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u;
|
||||||
typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u;
|
typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u;
|
||||||
/* deprecated defines */
|
|
||||||
#if !defined(LZO_SIZEOF_LZO_UINT)
|
|
||||||
# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LZO_INT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(LZO_CFG_COMPAT)
|
#if defined(LZO_CFG_COMPAT)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the LZO real-time data compression library.
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
The LZO library is free software; you can redistribute it and/or
|
The LZO library is free software; you can redistribute it and/or
|
||||||
@ -40,33 +40,6 @@
|
|||||||
# define __LONG_MAX__ 9223372036854775807L
|
# define __LONG_MAX__ 9223372036854775807L
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if 0
|
|
||||||
#elif !defined(__LZO_LANG_OVERRIDE)
|
|
||||||
#if (defined(__clang__) || defined(__GNUC__)) && defined(__ASSEMBLER__)
|
|
||||||
# if (__ASSEMBLER__+0) <= 0
|
|
||||||
# error "__ASSEMBLER__"
|
|
||||||
# else
|
|
||||||
# define LZO_LANG_ASSEMBLER 1
|
|
||||||
# endif
|
|
||||||
#elif defined(__cplusplus)
|
|
||||||
# if (__cplusplus+0) <= 0
|
|
||||||
# error "__cplusplus"
|
|
||||||
# elif (__cplusplus < 199711L)
|
|
||||||
# define LZO_LANG_CXX 1
|
|
||||||
# elif defined(_MSC_VER) && defined(_MSVC_LANG) && (_MSVC_LANG+0 >= 201402L) && 1
|
|
||||||
# define LZO_LANG_CXX _MSVC_LANG
|
|
||||||
# else
|
|
||||||
# define LZO_LANG_CXX __cplusplus
|
|
||||||
# endif
|
|
||||||
# define LZO_LANG_CPLUSPLUS LZO_LANG_CXX
|
|
||||||
#else
|
|
||||||
# if defined(__STDC_VERSION__) && (__STDC_VERSION__+0 >= 199409L)
|
|
||||||
# define LZO_LANG_C __STDC_VERSION__
|
|
||||||
# else
|
|
||||||
# define LZO_LANG_C 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if !defined(LZO_CFG_NO_DISABLE_WUNDEF)
|
#if !defined(LZO_CFG_NO_DISABLE_WUNDEF)
|
||||||
#if defined(__ARMCC_VERSION)
|
#if defined(__ARMCC_VERSION)
|
||||||
# pragma diag_suppress 193
|
# pragma diag_suppress 193
|
||||||
@ -162,12 +135,10 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if (UINT_MAX == LZO_0xffffL)
|
#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL)
|
||||||
#if defined(_MSC_VER) && defined(M_I86HM)
|
|
||||||
# define ptrdiff_t long
|
# define ptrdiff_t long
|
||||||
# define _PTRDIFF_T_DEFINED 1
|
# define _PTRDIFF_T_DEFINED 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if (UINT_MAX == LZO_0xffffL)
|
#if (UINT_MAX == LZO_0xffffL)
|
||||||
# undef __LZO_RENAME_A
|
# undef __LZO_RENAME_A
|
||||||
# undef __LZO_RENAME_B
|
# undef __LZO_RENAME_B
|
||||||
@ -316,7 +287,7 @@
|
|||||||
#define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f)
|
#define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f)
|
||||||
#define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g)
|
#define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g)
|
||||||
#endif
|
#endif
|
||||||
#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-((b)!=0))) - (o)) << 1) + (o)*((b)!=0))
|
#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-!!(b))) - (o)) << 1) + (o)*!!(b))
|
||||||
#if 1 && defined(__cplusplus)
|
#if 1 && defined(__cplusplus)
|
||||||
# if !defined(__STDC_CONSTANT_MACROS)
|
# if !defined(__STDC_CONSTANT_MACROS)
|
||||||
# define __STDC_CONSTANT_MACROS 1
|
# define __STDC_CONSTANT_MACROS 1
|
||||||
@ -427,7 +398,7 @@
|
|||||||
#elif defined(__TOS__) || defined(__atarist__)
|
#elif defined(__TOS__) || defined(__atarist__)
|
||||||
# define LZO_OS_TOS 1
|
# define LZO_OS_TOS 1
|
||||||
# define LZO_INFO_OS "tos"
|
# define LZO_INFO_OS "tos"
|
||||||
#elif defined(macintosh) && !defined(__arm__) && !defined(__i386__) && !defined(__ppc__) && !defined(__x64_64__)
|
#elif defined(macintosh) && !defined(__ppc__)
|
||||||
# define LZO_OS_MACCLASSIC 1
|
# define LZO_OS_MACCLASSIC 1
|
||||||
# define LZO_INFO_OS "macclassic"
|
# define LZO_INFO_OS "macclassic"
|
||||||
#elif defined(__VMS)
|
#elif defined(__VMS)
|
||||||
@ -567,12 +538,6 @@
|
|||||||
# define LZO_CC_ARMCC __ARMCC_VERSION
|
# define LZO_CC_ARMCC __ARMCC_VERSION
|
||||||
# define LZO_INFO_CC "ARM C Compiler"
|
# define LZO_INFO_CC "ARM C Compiler"
|
||||||
# define LZO_INFO_CCVER __VERSION__
|
# define LZO_INFO_CCVER __VERSION__
|
||||||
#elif defined(__clang__) && defined(__c2__) && defined(__c2_version__) && defined(_MSC_VER)
|
|
||||||
# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0))
|
|
||||||
# define LZO_CC_CLANG_C2 _MSC_VER
|
|
||||||
# define LZO_CC_CLANG_VENDOR_MICROSOFT 1
|
|
||||||
# define LZO_INFO_CC "clang/c2"
|
|
||||||
# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__c2_version__)
|
|
||||||
#elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__)
|
#elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__)
|
||||||
# if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__)
|
# if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__)
|
||||||
# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0))
|
# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0))
|
||||||
@ -584,18 +549,8 @@
|
|||||||
# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
|
# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
|
||||||
# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
|
# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
|
||||||
# endif
|
# endif
|
||||||
# if defined(__APPLE_CC__)
|
|
||||||
# define LZO_CC_CLANG_VENDOR_APPLE 1
|
|
||||||
# define LZO_INFO_CC "clang/apple"
|
|
||||||
# else
|
|
||||||
# define LZO_CC_CLANG_VENDOR_LLVM 1
|
|
||||||
# define LZO_INFO_CC "clang"
|
# define LZO_INFO_CC "clang"
|
||||||
# endif
|
|
||||||
# if defined(__clang_version__)
|
|
||||||
# define LZO_INFO_CCVER __clang_version__
|
|
||||||
# else
|
|
||||||
# define LZO_INFO_CCVER __VERSION__
|
# define LZO_INFO_CCVER __VERSION__
|
||||||
# endif
|
|
||||||
#elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
|
#elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
|
||||||
# if defined(__GNUC_PATCHLEVEL__)
|
# if defined(__GNUC_PATCHLEVEL__)
|
||||||
# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
|
# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0))
|
||||||
@ -815,7 +770,7 @@
|
|||||||
#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
|
#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16)
|
||||||
# define LZO_ARCH_I086 1
|
# define LZO_ARCH_I086 1
|
||||||
# define LZO_INFO_ARCH "i086"
|
# define LZO_INFO_ARCH "i086"
|
||||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
#elif defined(__aarch64__)
|
||||||
# define LZO_ARCH_ARM64 1
|
# define LZO_ARCH_ARM64 1
|
||||||
# define LZO_INFO_ARCH "arm64"
|
# define LZO_INFO_ARCH "arm64"
|
||||||
#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA)
|
#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA)
|
||||||
@ -827,11 +782,22 @@
|
|||||||
#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64)
|
#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64)
|
||||||
# define LZO_ARCH_AMD64 1
|
# define LZO_ARCH_AMD64 1
|
||||||
# define LZO_INFO_ARCH "amd64"
|
# define LZO_INFO_ARCH "amd64"
|
||||||
#elif defined(__arm__) || defined(_M_ARM)
|
#elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB))
|
||||||
# define LZO_ARCH_ARM 1
|
# define LZO_ARCH_ARM 1
|
||||||
# define LZO_INFO_ARCH "arm"
|
# define LZO_ARCH_ARM_THUMB 1
|
||||||
|
# define LZO_INFO_ARCH "arm_thumb"
|
||||||
#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__)
|
#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__)
|
||||||
# define LZO_ARCH_ARM 1
|
# define LZO_ARCH_ARM 1
|
||||||
|
# if defined(__CPU_MODE__) && ((__CPU_MODE__-0) == 1)
|
||||||
|
# define LZO_ARCH_ARM_THUMB 1
|
||||||
|
# define LZO_INFO_ARCH "arm_thumb"
|
||||||
|
# elif defined(__CPU_MODE__) && ((__CPU_MODE__-0) == 2)
|
||||||
|
# define LZO_INFO_ARCH "arm"
|
||||||
|
# else
|
||||||
|
# define LZO_INFO_ARCH "arm"
|
||||||
|
# endif
|
||||||
|
#elif defined(__arm__) || defined(_M_ARM)
|
||||||
|
# define LZO_ARCH_ARM 1
|
||||||
# define LZO_INFO_ARCH "arm"
|
# define LZO_INFO_ARCH "arm"
|
||||||
#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__)
|
#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__)
|
||||||
# define LZO_ARCH_AVR 1
|
# define LZO_ARCH_AVR 1
|
||||||
@ -905,15 +871,6 @@
|
|||||||
#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR)
|
#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR)
|
||||||
# define LZO_ARCH_POWERPC 1
|
# define LZO_ARCH_POWERPC 1
|
||||||
# define LZO_INFO_ARCH "powerpc"
|
# define LZO_INFO_ARCH "powerpc"
|
||||||
#elif defined(__powerpc64__) || defined(__powerpc64) || defined(__ppc64__) || defined(__PPC64__)
|
|
||||||
# define LZO_ARCH_POWERPC 1
|
|
||||||
# define LZO_INFO_ARCH "powerpc"
|
|
||||||
#elif defined(__powerpc64le__) || defined(__powerpc64le) || defined(__ppc64le__) || defined(__PPC64LE__)
|
|
||||||
# define LZO_ARCH_POWERPC 1
|
|
||||||
# define LZO_INFO_ARCH "powerpc"
|
|
||||||
#elif defined(__riscv)
|
|
||||||
# define LZO_ARCH_RISCV 1
|
|
||||||
# define LZO_INFO_ARCH "riscv"
|
|
||||||
#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x)
|
#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x)
|
||||||
# define LZO_ARCH_S390 1
|
# define LZO_ARCH_S390 1
|
||||||
# define LZO_INFO_ARCH "s390"
|
# define LZO_INFO_ARCH "s390"
|
||||||
@ -948,23 +905,6 @@
|
|||||||
# define LZO_INFO_ARCH "unknown"
|
# define LZO_INFO_ARCH "unknown"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LZO_ARCH_ARM_THUMB2)
|
|
||||||
#if (LZO_ARCH_ARM)
|
|
||||||
# if defined(__thumb__) || defined(__thumb) || defined(_M_THUMB)
|
|
||||||
# if defined(__thumb2__)
|
|
||||||
# define LZO_ARCH_ARM_THUMB2 1
|
|
||||||
# elif 1 && defined(__TARGET_ARCH_THUMB) && ((__TARGET_ARCH_THUMB)+0 >= 4)
|
|
||||||
# define LZO_ARCH_ARM_THUMB2 1
|
|
||||||
# elif 1 && defined(_MSC_VER) && defined(_M_THUMB) && ((_M_THUMB)+0 >= 7)
|
|
||||||
# define LZO_ARCH_ARM_THUMB2 1
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if (LZO_ARCH_ARM_THUMB2)
|
|
||||||
# undef LZO_INFO_ARCH
|
|
||||||
# define LZO_INFO_ARCH "arm_thumb2"
|
|
||||||
#endif
|
|
||||||
#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2)
|
#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2)
|
||||||
# error "FIXME - missing define for CPU architecture"
|
# error "FIXME - missing define for CPU architecture"
|
||||||
#endif
|
#endif
|
||||||
@ -1007,10 +947,13 @@
|
|||||||
#if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86)
|
#if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86)
|
||||||
# error "unexpected configuration - check your compiler defines"
|
# error "unexpected configuration - check your compiler defines"
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM)
|
#if (LZO_ARCH_ARM_THUMB && !LZO_ARCH_ARM)
|
||||||
# error "unexpected configuration - check your compiler defines"
|
# error "unexpected configuration - check your compiler defines"
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM)
|
#if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM_THUMB)
|
||||||
|
# error "unexpected configuration - check your compiler defines"
|
||||||
|
#endif
|
||||||
|
#if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM_THUMB)
|
||||||
# error "unexpected configuration - check your compiler defines"
|
# error "unexpected configuration - check your compiler defines"
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2)
|
#if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2)
|
||||||
@ -1042,9 +985,7 @@
|
|||||||
# if !defined(LZO_TARGET_FEATURE_SSE2)
|
# if !defined(LZO_TARGET_FEATURE_SSE2)
|
||||||
# if defined(__SSE2__)
|
# if defined(__SSE2__)
|
||||||
# define LZO_TARGET_FEATURE_SSE2 1
|
# define LZO_TARGET_FEATURE_SSE2 1
|
||||||
# elif defined(_MSC_VER) && (defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2))
|
# elif defined(_MSC_VER) && ((defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2)) || defined(_M_AMD64))
|
||||||
# define LZO_TARGET_FEATURE_SSE2 1
|
|
||||||
# elif (LZO_CC_INTELC_MSC || LZO_CC_MSC) && defined(_M_AMD64)
|
|
||||||
# define LZO_TARGET_FEATURE_SSE2 1
|
# define LZO_TARGET_FEATURE_SSE2 1
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -1093,11 +1034,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#if (LZO_ARCH_ARM)
|
#if (LZO_ARCH_ARM)
|
||||||
# if !defined(LZO_TARGET_FEATURE_NEON)
|
# if !defined(LZO_TARGET_FEATURE_NEON)
|
||||||
# if defined(__ARM_NEON) && ((__ARM_NEON)+0)
|
# if defined(__ARM_NEON__)
|
||||||
# define LZO_TARGET_FEATURE_NEON 1
|
|
||||||
# elif 1 && defined(__ARM_NEON__) && ((__ARM_NEON__)+0)
|
|
||||||
# define LZO_TARGET_FEATURE_NEON 1
|
|
||||||
# elif 1 && defined(__TARGET_FEATURE_NEON) && ((__TARGET_FEATURE_NEON)+0)
|
|
||||||
# define LZO_TARGET_FEATURE_NEON 1
|
# define LZO_TARGET_FEATURE_NEON 1
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -1168,7 +1105,7 @@
|
|||||||
# error "unexpected configuration - check your compiler defines"
|
# error "unexpected configuration - check your compiler defines"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(__cplusplus)
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200))
|
#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200))
|
||||||
@ -1191,7 +1128,7 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
# error "FIXME - implement LZO_MM_AHSHIFT"
|
# error "FIXME - implement LZO_MM_AHSHIFT"
|
||||||
#endif
|
#endif
|
||||||
#if defined(__cplusplus)
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -1277,53 +1214,12 @@ extern "C" {
|
|||||||
# define __lzo_gnuc_extension__ __extension__
|
# define __lzo_gnuc_extension__ __extension__
|
||||||
#elif (LZO_CC_IBMC >= 600)
|
#elif (LZO_CC_IBMC >= 600)
|
||||||
# define __lzo_gnuc_extension__ __extension__
|
# define __lzo_gnuc_extension__ __extension__
|
||||||
|
#else
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__lzo_gnuc_extension__)
|
#if !defined(__lzo_gnuc_extension__)
|
||||||
# define __lzo_gnuc_extension__ /*empty*/
|
# define __lzo_gnuc_extension__ /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(lzo_has_builtin)
|
|
||||||
#if (LZO_CC_CLANG) && defined(__has_builtin)
|
|
||||||
# define lzo_has_builtin __has_builtin
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_builtin)
|
|
||||||
# define lzo_has_builtin(x) 0
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_attribute)
|
|
||||||
#if (LZO_CC_CLANG) && defined(__has_attribute)
|
|
||||||
# define lzo_has_attribute __has_attribute
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_attribute)
|
|
||||||
# define lzo_has_attribute(x) 0
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_declspec_attribute)
|
|
||||||
#if (LZO_CC_CLANG) && defined(__has_declspec_attribute)
|
|
||||||
# define lzo_has_declspec_attribute __has_declspec_attribute
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_declspec_attribute)
|
|
||||||
# define lzo_has_declspec_attribute(x) 0
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_feature)
|
|
||||||
#if (LZO_CC_CLANG) && defined(__has_feature)
|
|
||||||
# define lzo_has_feature __has_feature
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_feature)
|
|
||||||
# define lzo_has_feature(x) 0
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_extension)
|
|
||||||
#if (LZO_CC_CLANG) && defined(__has_extension)
|
|
||||||
# define lzo_has_extension __has_extension
|
|
||||||
#elif (LZO_CC_CLANG) && defined(__has_feature)
|
|
||||||
# define lzo_has_extension __has_feature
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if !defined(lzo_has_extension)
|
|
||||||
# define lzo_has_extension(x) 0
|
|
||||||
#endif
|
|
||||||
#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0
|
#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0
|
||||||
# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul))
|
# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul))
|
||||||
# define LZO_CFG_USE_NEW_STYLE_CASTS 0
|
# define LZO_CFG_USE_NEW_STYLE_CASTS 0
|
||||||
@ -1460,7 +1356,7 @@ extern "C" {
|
|||||||
# elif (LZO_CC_MSC && (_MSC_VER < 900))
|
# elif (LZO_CC_MSC && (_MSC_VER < 900))
|
||||||
# define LZO_UNUSED(var) if (&var) ; else
|
# define LZO_UNUSED(var) if (&var) ; else
|
||||||
# elif (LZO_CC_KEILC)
|
# elif (LZO_CC_KEILC)
|
||||||
# define LZO_UNUSED(var) {extern int lzo_unused__[1-2*!(sizeof(var)>0)]; (void)lzo_unused__;}
|
# define LZO_UNUSED(var) {LZO_EXTERN_C int lzo_unused__[1-2*!(sizeof(var)>0)];}
|
||||||
# elif (LZO_CC_PACIFICC)
|
# elif (LZO_CC_PACIFICC)
|
||||||
# define LZO_UNUSED(var) ((void) sizeof(var))
|
# define LZO_UNUSED(var) ((void) sizeof(var))
|
||||||
# elif (LZO_CC_WATCOMC) && defined(__cplusplus)
|
# elif (LZO_CC_WATCOMC) && defined(__cplusplus)
|
||||||
@ -1469,9 +1365,6 @@ extern "C" {
|
|||||||
# define LZO_UNUSED(var) ((void) &var)
|
# define LZO_UNUSED(var) ((void) &var)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LZO_UNUSED_RESULT)
|
|
||||||
# define LZO_UNUSED_RESULT(var) LZO_UNUSED(var)
|
|
||||||
#endif
|
|
||||||
#if !defined(LZO_UNUSED_FUNC)
|
#if !defined(LZO_UNUSED_FUNC)
|
||||||
# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600))
|
# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600))
|
||||||
# define LZO_UNUSED_FUNC(func) ((void) func)
|
# define LZO_UNUSED_FUNC(func) ((void) func)
|
||||||
@ -1484,7 +1377,7 @@ extern "C" {
|
|||||||
# elif (LZO_CC_MSC)
|
# elif (LZO_CC_MSC)
|
||||||
# define LZO_UNUSED_FUNC(func) ((void) &func)
|
# define LZO_UNUSED_FUNC(func) ((void) &func)
|
||||||
# elif (LZO_CC_KEILC || LZO_CC_PELLESC)
|
# elif (LZO_CC_KEILC || LZO_CC_PELLESC)
|
||||||
# define LZO_UNUSED_FUNC(func) {extern int lzo_unused__[1-2*!(sizeof((int)func)>0)]; (void)lzo_unused__;}
|
# define LZO_UNUSED_FUNC(func) {LZO_EXTERN_C int lzo_unused_func__[1-2*!(sizeof((int)func)>0)];}
|
||||||
# else
|
# else
|
||||||
# define LZO_UNUSED_FUNC(func) ((void) func)
|
# define LZO_UNUSED_FUNC(func) ((void) func)
|
||||||
# endif
|
# endif
|
||||||
@ -1890,7 +1783,6 @@ extern "C" {
|
|||||||
#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800))
|
#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800))
|
||||||
# define __lzo_likely(e) (__builtin_expect(!!(e),1))
|
# define __lzo_likely(e) (__builtin_expect(!!(e),1))
|
||||||
# define __lzo_unlikely(e) (__builtin_expect(!!(e),0))
|
# define __lzo_unlikely(e) (__builtin_expect(!!(e),0))
|
||||||
#elif (LZO_CC_CLANG && LZO_CC_CLANG_C2)
|
|
||||||
#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
|
#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE)
|
||||||
# define __lzo_likely(e) (__builtin_expect(!!(e),1))
|
# define __lzo_likely(e) (__builtin_expect(!!(e),1))
|
||||||
# define __lzo_unlikely(e) (__builtin_expect(!!(e),0))
|
# define __lzo_unlikely(e) (__builtin_expect(!!(e),0))
|
||||||
@ -1903,13 +1795,6 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
# define __lzo_likely(e) (e)
|
# define __lzo_likely(e) (e)
|
||||||
#endif
|
#endif
|
||||||
#if defined(__lzo_very_likely)
|
|
||||||
# ifndef __lzo_HAVE_very_likely
|
|
||||||
# define __lzo_HAVE_very_likely 1
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define __lzo_very_likely(e) __lzo_likely(e)
|
|
||||||
#endif
|
|
||||||
#if defined(__lzo_unlikely)
|
#if defined(__lzo_unlikely)
|
||||||
# ifndef __lzo_HAVE_unlikely
|
# ifndef __lzo_HAVE_unlikely
|
||||||
# define __lzo_HAVE_unlikely 1
|
# define __lzo_HAVE_unlikely 1
|
||||||
@ -1917,12 +1802,12 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
# define __lzo_unlikely(e) (e)
|
# define __lzo_unlikely(e) (e)
|
||||||
#endif
|
#endif
|
||||||
#if defined(__lzo_very_unlikely)
|
#if !defined(__lzo_static_unused_void_func)
|
||||||
# ifndef __lzo_HAVE_very_unlikely
|
# if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
|
||||||
# define __lzo_HAVE_very_unlikely 1
|
# define __lzo_static_unused_void_func(f) static void __attribute__((__unused__)) f(void)
|
||||||
|
# else
|
||||||
|
# define __lzo_static_unused_void_func(f) static __lzo_inline void f(void)
|
||||||
# endif
|
# endif
|
||||||
#else
|
|
||||||
# define __lzo_very_unlikely(e) __lzo_unlikely(e)
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__lzo_loop_forever)
|
#if !defined(__lzo_loop_forever)
|
||||||
# if (LZO_CC_IBMC)
|
# if (LZO_CC_IBMC)
|
||||||
@ -1932,7 +1817,7 @@ extern "C" {
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__lzo_unreachable)
|
#if !defined(__lzo_unreachable)
|
||||||
#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul)) && lzo_has_builtin(__builtin_unreachable)
|
#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul))
|
||||||
# define __lzo_unreachable() __builtin_unreachable();
|
# define __lzo_unreachable() __builtin_unreachable();
|
||||||
#elif (LZO_CC_GNUC >= 0x040500ul)
|
#elif (LZO_CC_GNUC >= 0x040500ul)
|
||||||
# define __lzo_unreachable() __builtin_unreachable();
|
# define __lzo_unreachable() __builtin_unreachable();
|
||||||
@ -1951,15 +1836,6 @@ extern "C" {
|
|||||||
# define __lzo_unreachable() __lzo_loop_forever();
|
# define __lzo_unreachable() __lzo_loop_forever();
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(lzo_unused_funcs_impl)
|
|
||||||
# if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI)
|
|
||||||
# define lzo_unused_funcs_impl(r,f) static r __attribute__((__unused__)) f
|
|
||||||
# elif 1 && (LZO_CC_BORLANDC || LZO_CC_GNUC)
|
|
||||||
# define lzo_unused_funcs_impl(r,f) static r f
|
|
||||||
# else
|
|
||||||
# define lzo_unused_funcs_impl(r,f) __lzo_static_forceinline r f
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifndef __LZO_CTA_NAME
|
#ifndef __LZO_CTA_NAME
|
||||||
#if (LZO_CFG_USE_COUNTER)
|
#if (LZO_CFG_USE_COUNTER)
|
||||||
# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__)
|
# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__)
|
||||||
@ -1985,8 +1861,6 @@ extern "C" {
|
|||||||
#if !defined(LZO_COMPILE_TIME_ASSERT)
|
#if !defined(LZO_COMPILE_TIME_ASSERT)
|
||||||
# if (LZO_CC_AZTECC)
|
# if (LZO_CC_AZTECC)
|
||||||
# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];}
|
# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];}
|
||||||
# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030000ul))
|
|
||||||
# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));}
|
|
||||||
# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
|
# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
|
||||||
# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
||||||
# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__)
|
# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__)
|
||||||
@ -2003,16 +1877,11 @@ extern "C" {
|
|||||||
# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];}
|
# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_LANG_ASSEMBLER)
|
|
||||||
# undef LZO_COMPILE_TIME_ASSERT_HEADER
|
|
||||||
# define LZO_COMPILE_TIME_ASSERT_HEADER(e) /*empty*/
|
|
||||||
#else
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1)
|
LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1)
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) }
|
extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) }
|
||||||
#endif
|
#endif
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
|
LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
|
||||||
#endif
|
|
||||||
#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64)
|
#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64)
|
||||||
# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC)
|
# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC)
|
||||||
# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
|
# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC)
|
||||||
@ -2079,7 +1948,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
|
|||||||
#if !defined(LZO_HAVE_WINDOWS_H)
|
#if !defined(LZO_HAVE_WINDOWS_H)
|
||||||
#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64)
|
#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64)
|
||||||
# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000))
|
# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000))
|
||||||
# elif ((LZO_OS_WIN32 && defined(__PW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul)))
|
# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__)
|
||||||
# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul)))
|
# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul)))
|
||||||
# else
|
# else
|
||||||
# define LZO_HAVE_WINDOWS_H 1
|
# define LZO_HAVE_WINDOWS_H 1
|
||||||
@ -2087,7 +1956,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define LZO_SIZEOF_CHAR 1
|
|
||||||
#ifndef LZO_SIZEOF_SHORT
|
#ifndef LZO_SIZEOF_SHORT
|
||||||
#if defined(SIZEOF_SHORT)
|
#if defined(SIZEOF_SHORT)
|
||||||
# define LZO_SIZEOF_SHORT (SIZEOF_SHORT)
|
# define LZO_SIZEOF_SHORT (SIZEOF_SHORT)
|
||||||
@ -2286,12 +2154,12 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long))
|
|||||||
# define LZO_WORDSIZE 8
|
# define LZO_WORDSIZE 8
|
||||||
#elif (LZO_ARCH_AMD64)
|
#elif (LZO_ARCH_AMD64)
|
||||||
# define LZO_WORDSIZE 8
|
# define LZO_WORDSIZE 8
|
||||||
#elif (LZO_ARCH_ARM64)
|
|
||||||
# define LZO_WORDSIZE 8
|
|
||||||
#elif (LZO_ARCH_AVR)
|
#elif (LZO_ARCH_AVR)
|
||||||
# define LZO_WORDSIZE 1
|
# define LZO_WORDSIZE 1
|
||||||
#elif (LZO_ARCH_H8300)
|
#elif (LZO_ARCH_H8300)
|
||||||
# if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
|
# if defined(__NORMAL_MODE__)
|
||||||
|
# define LZO_WORDSIZE 4
|
||||||
|
# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
|
||||||
# define LZO_WORDSIZE 4
|
# define LZO_WORDSIZE 4
|
||||||
# else
|
# else
|
||||||
# define LZO_WORDSIZE 2
|
# define LZO_WORDSIZE 2
|
||||||
@ -2334,15 +2202,11 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8)
|
|||||||
#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430)
|
#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430)
|
||||||
# define LZO_SIZEOF_VOID_P 2
|
# define LZO_SIZEOF_VOID_P 2
|
||||||
#elif (LZO_ARCH_H8300)
|
#elif (LZO_ARCH_H8300)
|
||||||
# if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 4)
|
|
||||||
# if defined(__NORMAL_MODE__)
|
# if defined(__NORMAL_MODE__)
|
||||||
# define LZO_SIZEOF_VOID_P 2
|
# define LZO_SIZEOF_VOID_P 2
|
||||||
# else
|
# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
|
||||||
# define LZO_SIZEOF_VOID_P 4
|
# define LZO_SIZEOF_VOID_P 4
|
||||||
# endif
|
|
||||||
# else
|
# else
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 2)
|
|
||||||
# define LZO_SIZEOF_VOID_P 2
|
# define LZO_SIZEOF_VOID_P 2
|
||||||
# endif
|
# endif
|
||||||
# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4)
|
# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4)
|
||||||
@ -2432,7 +2296,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define LZO_ABI_BIG_ENDIAN 1
|
# define LZO_ABI_BIG_ENDIAN 1
|
||||||
#elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64)
|
#elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64)
|
||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
# define LZO_ABI_LITTLE_ENDIAN 1
|
||||||
#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430 || LZO_ARCH_RISCV)
|
#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430)
|
||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
# define LZO_ABI_LITTLE_ENDIAN 1
|
||||||
#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU)
|
#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU)
|
||||||
# define LZO_ABI_BIG_ENDIAN 1
|
# define LZO_ABI_BIG_ENDIAN 1
|
||||||
@ -2446,14 +2310,10 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define LZO_ABI_BIG_ENDIAN 1
|
# define LZO_ABI_BIG_ENDIAN 1
|
||||||
#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
|
#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
|
||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
# define LZO_ABI_LITTLE_ENDIAN 1
|
||||||
#elif 1 && (LZO_ARCH_ARM) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0)
|
|
||||||
# define LZO_ABI_BIG_ENDIAN 1
|
|
||||||
#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__)
|
#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__)
|
||||||
# define LZO_ABI_BIG_ENDIAN 1
|
# define LZO_ABI_BIG_ENDIAN 1
|
||||||
#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__)
|
#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__)
|
||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
# define LZO_ABI_LITTLE_ENDIAN 1
|
||||||
#elif 1 && (LZO_ARCH_ARM) && defined(_MSC_VER) && defined(_WIN32)
|
|
||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
|
||||||
#elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC)
|
#elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC)
|
||||||
# if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
|
# if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
|
||||||
# error "unexpected configuration - check your compiler defines"
|
# error "unexpected configuration - check your compiler defines"
|
||||||
@ -2463,14 +2323,10 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
# define LZO_ABI_LITTLE_ENDIAN 1
|
||||||
# endif
|
# endif
|
||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
# define LZO_ABI_LITTLE_ENDIAN 1
|
||||||
#elif 1 && (LZO_ARCH_ARM64) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0)
|
|
||||||
# define LZO_ABI_BIG_ENDIAN 1
|
|
||||||
#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__)
|
#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__)
|
||||||
# define LZO_ABI_BIG_ENDIAN 1
|
# define LZO_ABI_BIG_ENDIAN 1
|
||||||
#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__)
|
#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__)
|
||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
# define LZO_ABI_LITTLE_ENDIAN 1
|
||||||
#elif 1 && (LZO_ARCH_ARM64) && defined(_MSC_VER) && defined(_WIN32)
|
|
||||||
# define LZO_ABI_LITTLE_ENDIAN 1
|
|
||||||
#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__)
|
#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__)
|
||||||
# define LZO_ABI_BIG_ENDIAN 1
|
# define LZO_ABI_BIG_ENDIAN 1
|
||||||
#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__)
|
#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__)
|
||||||
@ -2512,12 +2368,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define LZO_ABI_IP32L64 1
|
# define LZO_ABI_IP32L64 1
|
||||||
# define LZO_INFO_ABI_PM "ip32l64"
|
# define LZO_INFO_ABI_PM "ip32l64"
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_VOID_P == 4 && LZO_WORDSIZE == 8)
|
|
||||||
# define LZO_ABI_IP32W64 1
|
|
||||||
# ifndef LZO_INFO_ABI_PM
|
|
||||||
# define LZO_INFO_ABI_PM "ip32w64"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if 0
|
#if 0
|
||||||
#elif !defined(__LZO_LIBC_OVERRIDE)
|
#elif !defined(__LZO_LIBC_OVERRIDE)
|
||||||
#if (LZO_LIBC_NAKED)
|
#if (LZO_LIBC_NAKED)
|
||||||
@ -2605,43 +2455,20 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# endif
|
# endif
|
||||||
#elif (LZO_ARCH_ARM)
|
#elif (LZO_ARCH_ARM)
|
||||||
# if defined(__ARM_FEATURE_UNALIGNED)
|
# if defined(__ARM_FEATURE_UNALIGNED)
|
||||||
# if ((__ARM_FEATURE_UNALIGNED)+0)
|
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
# ifndef LZO_OPT_UNALIGNED16
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
# define LZO_OPT_UNALIGNED16 1
|
||||||
# endif
|
# endif
|
||||||
# ifndef LZO_OPT_UNALIGNED32
|
# ifndef LZO_OPT_UNALIGNED32
|
||||||
# define LZO_OPT_UNALIGNED32 1
|
# define LZO_OPT_UNALIGNED32 1
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# elif defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM+0) >= 7)
|
||||||
# elif 1 && (LZO_ARCH_ARM_THUMB2)
|
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
# ifndef LZO_OPT_UNALIGNED16
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
# define LZO_OPT_UNALIGNED16 1
|
||||||
# endif
|
# endif
|
||||||
# ifndef LZO_OPT_UNALIGNED32
|
# ifndef LZO_OPT_UNALIGNED32
|
||||||
# define LZO_OPT_UNALIGNED32 1
|
# define LZO_OPT_UNALIGNED32 1
|
||||||
# endif
|
# endif
|
||||||
# elif 1 && defined(__ARM_ARCH) && ((__ARM_ARCH)+0 >= 7)
|
# elif defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM+0) >= 6) && !defined(__TARGET_PROFILE_M)
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
|
||||||
# endif
|
|
||||||
# ifndef LZO_OPT_UNALIGNED32
|
|
||||||
# define LZO_OPT_UNALIGNED32 1
|
|
||||||
# endif
|
|
||||||
# elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 7)
|
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
|
||||||
# endif
|
|
||||||
# ifndef LZO_OPT_UNALIGNED32
|
|
||||||
# define LZO_OPT_UNALIGNED32 1
|
|
||||||
# endif
|
|
||||||
# elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 6) && (defined(__TARGET_PROFILE_A) || defined(__TARGET_PROFILE_R))
|
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
|
||||||
# endif
|
|
||||||
# ifndef LZO_OPT_UNALIGNED32
|
|
||||||
# define LZO_OPT_UNALIGNED32 1
|
|
||||||
# endif
|
|
||||||
# elif 1 && defined(_MSC_VER) && defined(_M_ARM) && ((_M_ARM)+0 >= 7)
|
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
# ifndef LZO_OPT_UNALIGNED16
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
# define LZO_OPT_UNALIGNED16 1
|
||||||
# endif
|
# endif
|
||||||
@ -2693,7 +2520,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
#elif (LZO_ARCH_POWERPC)
|
#elif (LZO_ARCH_POWERPC)
|
||||||
# define LZO_OPT_PREFER_PREINC 1
|
# define LZO_OPT_PREFER_PREINC 1
|
||||||
# define LZO_OPT_PREFER_PREDEC 1
|
# define LZO_OPT_PREFER_PREDEC 1
|
||||||
# if (LZO_ABI_BIG_ENDIAN) || (LZO_WORDSIZE == 8)
|
# if (LZO_ABI_BIG_ENDIAN)
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
# ifndef LZO_OPT_UNALIGNED16
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
# define LZO_OPT_UNALIGNED16 1
|
||||||
# endif
|
# endif
|
||||||
@ -2706,19 +2533,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#elif (LZO_ARCH_RISCV)
|
|
||||||
# define LZO_OPT_AVOID_UINT_INDEX 1
|
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
|
||||||
# endif
|
|
||||||
# ifndef LZO_OPT_UNALIGNED32
|
|
||||||
# define LZO_OPT_UNALIGNED32 1
|
|
||||||
# endif
|
|
||||||
# if (LZO_WORDSIZE == 8)
|
|
||||||
# ifndef LZO_OPT_UNALIGNED64
|
|
||||||
# define LZO_OPT_UNALIGNED64 1
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#elif (LZO_ARCH_S390)
|
#elif (LZO_ARCH_S390)
|
||||||
# ifndef LZO_OPT_UNALIGNED16
|
# ifndef LZO_OPT_UNALIGNED16
|
||||||
# define LZO_OPT_UNALIGNED16 1
|
# define LZO_OPT_UNALIGNED16 1
|
||||||
@ -2810,61 +2624,32 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
#if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0))
|
#if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0))
|
||||||
# error "missing defines for sizes"
|
# error "missing defines for sizes"
|
||||||
#endif
|
#endif
|
||||||
#define LZO_TYPEOF_CHAR 1u
|
|
||||||
#define LZO_TYPEOF_SHORT 2u
|
|
||||||
#define LZO_TYPEOF_INT 3u
|
|
||||||
#define LZO_TYPEOF_LONG 4u
|
|
||||||
#define LZO_TYPEOF_LONG_LONG 5u
|
|
||||||
#define LZO_TYPEOF___INT8 17u
|
|
||||||
#define LZO_TYPEOF___INT16 18u
|
|
||||||
#define LZO_TYPEOF___INT32 19u
|
|
||||||
#define LZO_TYPEOF___INT64 20u
|
|
||||||
#define LZO_TYPEOF___INT128 21u
|
|
||||||
#define LZO_TYPEOF___INT256 22u
|
|
||||||
#define LZO_TYPEOF___MODE_QI 33u
|
|
||||||
#define LZO_TYPEOF___MODE_HI 34u
|
|
||||||
#define LZO_TYPEOF___MODE_SI 35u
|
|
||||||
#define LZO_TYPEOF___MODE_DI 36u
|
|
||||||
#define LZO_TYPEOF___MODE_TI 37u
|
|
||||||
#define LZO_TYPEOF_CHAR_P 129u
|
|
||||||
#if !defined(lzo_llong_t)
|
#if !defined(lzo_llong_t)
|
||||||
#if (LZO_SIZEOF_LONG_LONG+0 > 0)
|
#if (LZO_SIZEOF_LONG_LONG+0 > 0)
|
||||||
# if !(LZO_LANG_ASSEMBLER)
|
__lzo_gnuc_extension__ typedef long long lzo_llong_t__;
|
||||||
__lzo_gnuc_extension__ typedef long long lzo_llong_t__;
|
__lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
||||||
__lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__;
|
|
||||||
# endif
|
|
||||||
# define lzo_llong_t lzo_llong_t__
|
# define lzo_llong_t lzo_llong_t__
|
||||||
# define lzo_ullong_t lzo_ullong_t__
|
# define lzo_ullong_t lzo_ullong_t__
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(lzo_int16e_t)
|
#if !defined(lzo_int16e_t)
|
||||||
#if (LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) && (LZO_SIZEOF_SHORT != 2)
|
#if (LZO_SIZEOF_LONG == 2)
|
||||||
# undef LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T
|
|
||||||
#endif
|
|
||||||
#if (LZO_SIZEOF_LONG == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT)
|
|
||||||
# define lzo_int16e_t long
|
# define lzo_int16e_t long
|
||||||
# define lzo_uint16e_t unsigned long
|
# define lzo_uint16e_t unsigned long
|
||||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_LONG
|
#elif (LZO_SIZEOF_INT == 2)
|
||||||
#elif (LZO_SIZEOF_INT == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT)
|
|
||||||
# define lzo_int16e_t int
|
# define lzo_int16e_t int
|
||||||
# define lzo_uint16e_t unsigned int
|
# define lzo_uint16e_t unsigned int
|
||||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_INT
|
|
||||||
#elif (LZO_SIZEOF_SHORT == 2)
|
#elif (LZO_SIZEOF_SHORT == 2)
|
||||||
# define lzo_int16e_t short int
|
# define lzo_int16e_t short int
|
||||||
# define lzo_uint16e_t unsigned short int
|
# define lzo_uint16e_t unsigned short int
|
||||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_SHORT
|
|
||||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM)
|
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM)
|
||||||
# if !(LZO_LANG_ASSEMBLER)
|
|
||||||
typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__)));
|
typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||||
typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
|
typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||||
# endif
|
|
||||||
# define lzo_int16e_t lzo_int16e_hi_t__
|
# define lzo_int16e_t lzo_int16e_hi_t__
|
||||||
# define lzo_uint16e_t lzo_uint16e_hi_t__
|
# define lzo_uint16e_t lzo_uint16e_hi_t__
|
||||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI
|
|
||||||
#elif (LZO_SIZEOF___INT16 == 2)
|
#elif (LZO_SIZEOF___INT16 == 2)
|
||||||
# define lzo_int16e_t __int16
|
# define lzo_int16e_t __int16
|
||||||
# define lzo_uint16e_t unsigned __int16
|
# define lzo_uint16e_t unsigned __int16
|
||||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___INT16
|
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -2874,47 +2659,33 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(lzo_int32e_t)
|
#if !defined(lzo_int32e_t)
|
||||||
#if (LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) && (LZO_SIZEOF_INT != 4)
|
#if (LZO_SIZEOF_LONG == 4)
|
||||||
# undef LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T
|
|
||||||
#endif
|
|
||||||
#if (LZO_SIZEOF_LONG == 4) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT)
|
|
||||||
# define lzo_int32e_t long int
|
# define lzo_int32e_t long int
|
||||||
# define lzo_uint32e_t unsigned long int
|
# define lzo_uint32e_t unsigned long int
|
||||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG
|
|
||||||
#elif (LZO_SIZEOF_INT == 4)
|
#elif (LZO_SIZEOF_INT == 4)
|
||||||
# define lzo_int32e_t int
|
# define lzo_int32e_t int
|
||||||
# define lzo_uint32e_t unsigned int
|
# define lzo_uint32e_t unsigned int
|
||||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_INT
|
|
||||||
#elif (LZO_SIZEOF_SHORT == 4)
|
#elif (LZO_SIZEOF_SHORT == 4)
|
||||||
# define lzo_int32e_t short int
|
# define lzo_int32e_t short int
|
||||||
# define lzo_uint32e_t unsigned short int
|
# define lzo_uint32e_t unsigned short int
|
||||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_SHORT
|
|
||||||
#elif (LZO_SIZEOF_LONG_LONG == 4)
|
#elif (LZO_SIZEOF_LONG_LONG == 4)
|
||||||
# define lzo_int32e_t lzo_llong_t
|
# define lzo_int32e_t lzo_llong_t
|
||||||
# define lzo_uint32e_t lzo_ullong_t
|
# define lzo_uint32e_t lzo_ullong_t
|
||||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG_LONG
|
|
||||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
||||||
# if !(LZO_LANG_ASSEMBLER)
|
|
||||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||||
# endif
|
|
||||||
# define lzo_int32e_t lzo_int32e_si_t__
|
# define lzo_int32e_t lzo_int32e_si_t__
|
||||||
# define lzo_uint32e_t lzo_uint32e_si_t__
|
# define lzo_uint32e_t lzo_uint32e_si_t__
|
||||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI
|
|
||||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L)
|
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L)
|
||||||
# if !(LZO_LANG_ASSEMBLER)
|
|
||||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||||
# endif
|
|
||||||
# define lzo_int32e_t lzo_int32e_si_t__
|
# define lzo_int32e_t lzo_int32e_si_t__
|
||||||
# define lzo_uint32e_t lzo_uint32e_si_t__
|
# define lzo_uint32e_t lzo_uint32e_si_t__
|
||||||
# define LZO_INT32_C(c) (c##LL)
|
# define LZO_INT32_C(c) (c##LL)
|
||||||
# define LZO_UINT32_C(c) (c##ULL)
|
# define LZO_UINT32_C(c) (c##ULL)
|
||||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI
|
|
||||||
#elif (LZO_SIZEOF___INT32 == 4)
|
#elif (LZO_SIZEOF___INT32 == 4)
|
||||||
# define lzo_int32e_t __int32
|
# define lzo_int32e_t __int32
|
||||||
# define lzo_uint32e_t unsigned __int32
|
# define lzo_uint32e_t unsigned __int32
|
||||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___INT32
|
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -2925,28 +2696,21 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
#endif
|
#endif
|
||||||
#if !defined(lzo_int64e_t)
|
#if !defined(lzo_int64e_t)
|
||||||
#if (LZO_SIZEOF___INT64 == 8)
|
#if (LZO_SIZEOF___INT64 == 8)
|
||||||
# if (LZO_CC_BORLANDC) && !defined(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T)
|
# if (LZO_CC_BORLANDC) && !(LZO_CFG_TYPE_PREFER___INT64)
|
||||||
# define LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T LZO_TYPEOF___INT64
|
# define LZO_CFG_TYPE_PREFER___INT64 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && (LZO_SIZEOF_LONG_LONG != 8)
|
|
||||||
# undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T
|
|
||||||
#endif
|
|
||||||
#if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) && (LZO_SIZEOF___INT64 != 8)
|
|
||||||
# undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T
|
|
||||||
#endif
|
|
||||||
#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||||
# define lzo_int64e_t int
|
# define lzo_int64e_t int
|
||||||
# define lzo_uint64e_t unsigned int
|
# define lzo_uint64e_t unsigned int
|
||||||
# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_INT
|
# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_INT
|
||||||
#elif (LZO_SIZEOF_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64)
|
#elif (LZO_SIZEOF_LONG == 8)
|
||||||
# define lzo_int64e_t long int
|
# define lzo_int64e_t long int
|
||||||
# define lzo_uint64e_t unsigned long int
|
# define lzo_uint64e_t unsigned long int
|
||||||
# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG
|
# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_LONG
|
||||||
#elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64)
|
#elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_TYPE_PREFER___INT64)
|
||||||
# define lzo_int64e_t lzo_llong_t
|
# define lzo_int64e_t lzo_llong_t
|
||||||
# define lzo_uint64e_t lzo_ullong_t
|
# define lzo_uint64e_t lzo_ullong_t
|
||||||
# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG_LONG
|
|
||||||
# if (LZO_CC_BORLANDC)
|
# if (LZO_CC_BORLANDC)
|
||||||
# define LZO_INT64_C(c) ((c) + 0ll)
|
# define LZO_INT64_C(c) ((c) + 0ll)
|
||||||
# define LZO_UINT64_C(c) ((c) + 0ull)
|
# define LZO_UINT64_C(c) ((c) + 0ull)
|
||||||
@ -2957,10 +2721,10 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define LZO_INT64_C(c) (c##LL)
|
# define LZO_INT64_C(c) (c##LL)
|
||||||
# define LZO_UINT64_C(c) (c##ULL)
|
# define LZO_UINT64_C(c) (c##ULL)
|
||||||
# endif
|
# endif
|
||||||
|
# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_LONG_LONG
|
||||||
#elif (LZO_SIZEOF___INT64 == 8)
|
#elif (LZO_SIZEOF___INT64 == 8)
|
||||||
# define lzo_int64e_t __int64
|
# define lzo_int64e_t __int64
|
||||||
# define lzo_uint64e_t unsigned __int64
|
# define lzo_uint64e_t unsigned __int64
|
||||||
# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF___INT64
|
|
||||||
# if (LZO_CC_BORLANDC)
|
# if (LZO_CC_BORLANDC)
|
||||||
# define LZO_INT64_C(c) ((c) + 0i64)
|
# define LZO_INT64_C(c) ((c) + 0i64)
|
||||||
# define LZO_UINT64_C(c) ((c) + 0ui64)
|
# define LZO_UINT64_C(c) ((c) + 0ui64)
|
||||||
@ -2968,11 +2732,11 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define LZO_INT64_C(c) (c##i64)
|
# define LZO_INT64_C(c) (c##i64)
|
||||||
# define LZO_UINT64_C(c) (c##ui64)
|
# define LZO_UINT64_C(c) (c##ui64)
|
||||||
# endif
|
# endif
|
||||||
|
# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF___INT64
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(lzo_int64e_t)
|
#if defined(lzo_int64e_t)
|
||||||
# define LZO_SIZEOF_LZO_INT64E_T 8
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T)
|
||||||
#endif
|
#endif
|
||||||
@ -2981,17 +2745,14 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define lzo_int32l_t lzo_int32e_t
|
# define lzo_int32l_t lzo_int32e_t
|
||||||
# define lzo_uint32l_t lzo_uint32e_t
|
# define lzo_uint32l_t lzo_uint32e_t
|
||||||
# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T
|
# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T
|
||||||
# define LZO_TYPEOF_LZO_INT32L_T LZO_TYPEOF_LZO_INT32E_T
|
|
||||||
#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||||
# define lzo_int32l_t int
|
# define lzo_int32l_t int
|
||||||
# define lzo_uint32l_t unsigned int
|
# define lzo_uint32l_t unsigned int
|
||||||
# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT
|
# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT
|
||||||
# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_INT
|
|
||||||
#elif (LZO_SIZEOF_LONG >= 4)
|
#elif (LZO_SIZEOF_LONG >= 4)
|
||||||
# define lzo_int32l_t long int
|
# define lzo_int32l_t long int
|
||||||
# define lzo_uint32l_t unsigned long int
|
# define lzo_uint32l_t unsigned long int
|
||||||
# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG
|
# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG
|
||||||
# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_LONG
|
|
||||||
#else
|
#else
|
||||||
# error "lzo_int32l_t"
|
# error "lzo_int32l_t"
|
||||||
#endif
|
#endif
|
||||||
@ -3005,7 +2766,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define lzo_int64l_t lzo_int64e_t
|
# define lzo_int64l_t lzo_int64e_t
|
||||||
# define lzo_uint64l_t lzo_uint64e_t
|
# define lzo_uint64l_t lzo_uint64e_t
|
||||||
# define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T
|
# define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T
|
||||||
# define LZO_TYPEOF_LZO_INT64L_T LZO_TYPEOF_LZO_INT64E_T
|
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -3018,12 +2778,10 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define lzo_int32f_t lzo_int64l_t
|
# define lzo_int32f_t lzo_int64l_t
|
||||||
# define lzo_uint32f_t lzo_uint64l_t
|
# define lzo_uint32f_t lzo_uint64l_t
|
||||||
# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T
|
# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T
|
||||||
# define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT64L_T
|
|
||||||
#else
|
#else
|
||||||
# define lzo_int32f_t lzo_int32l_t
|
# define lzo_int32f_t lzo_int32l_t
|
||||||
# define lzo_uint32f_t lzo_uint32l_t
|
# define lzo_uint32f_t lzo_uint32l_t
|
||||||
# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T
|
# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T
|
||||||
# define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT32L_T
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
@ -3035,7 +2793,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define lzo_int64f_t lzo_int64l_t
|
# define lzo_int64f_t lzo_int64l_t
|
||||||
# define lzo_uint64f_t lzo_uint64l_t
|
# define lzo_uint64f_t lzo_uint64l_t
|
||||||
# define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T
|
# define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T
|
||||||
# define LZO_TYPEOF_LZO_INT64F_T LZO_TYPEOF_LZO_INT64L_T
|
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -3046,43 +2803,33 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
#if !defined(lzo_intptr_t)
|
#if !defined(lzo_intptr_t)
|
||||||
#if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16))
|
#if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16))
|
||||||
# define __LZO_INTPTR_T_IS_POINTER 1
|
# define __LZO_INTPTR_T_IS_POINTER 1
|
||||||
# if !(LZO_LANG_ASSEMBLER)
|
typedef char* lzo_intptr_t;
|
||||||
typedef char * lzo_intptr_t;
|
typedef char* lzo_uintptr_t;
|
||||||
typedef char * lzo_uintptr_t;
|
|
||||||
# endif
|
|
||||||
# define lzo_intptr_t lzo_intptr_t
|
# define lzo_intptr_t lzo_intptr_t
|
||||||
# define lzo_uintptr_t lzo_uintptr_t
|
# define lzo_uintptr_t lzo_uintptr_t
|
||||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P
|
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P
|
||||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_CHAR_P
|
|
||||||
#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4))
|
#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4))
|
||||||
# if !(LZO_LANG_ASSEMBLER)
|
|
||||||
typedef __w64 int lzo_intptr_t;
|
typedef __w64 int lzo_intptr_t;
|
||||||
typedef __w64 unsigned int lzo_uintptr_t;
|
typedef __w64 unsigned int lzo_uintptr_t;
|
||||||
# endif
|
|
||||||
# define lzo_intptr_t lzo_intptr_t
|
# define lzo_intptr_t lzo_intptr_t
|
||||||
# define lzo_uintptr_t lzo_uintptr_t
|
# define lzo_uintptr_t lzo_uintptr_t
|
||||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
|
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
|
||||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT
|
|
||||||
#elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P)
|
#elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P)
|
||||||
# define lzo_intptr_t short
|
# define lzo_intptr_t short
|
||||||
# define lzo_uintptr_t unsigned short
|
# define lzo_uintptr_t unsigned short
|
||||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT
|
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT
|
||||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_SHORT
|
|
||||||
#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||||
# define lzo_intptr_t int
|
# define lzo_intptr_t int
|
||||||
# define lzo_uintptr_t unsigned int
|
# define lzo_uintptr_t unsigned int
|
||||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
|
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
|
||||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT
|
|
||||||
#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P)
|
#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P)
|
||||||
# define lzo_intptr_t long
|
# define lzo_intptr_t long
|
||||||
# define lzo_uintptr_t unsigned long
|
# define lzo_uintptr_t unsigned long
|
||||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG
|
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG
|
||||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LONG
|
|
||||||
#elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P)
|
#elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P)
|
||||||
# define lzo_intptr_t lzo_int64l_t
|
# define lzo_intptr_t lzo_int64l_t
|
||||||
# define lzo_uintptr_t lzo_uint64l_t
|
# define lzo_uintptr_t lzo_uint64l_t
|
||||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T
|
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T
|
||||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LZO_INT64L_T
|
|
||||||
#else
|
#else
|
||||||
# error "lzo_intptr_t"
|
# error "lzo_intptr_t"
|
||||||
#endif
|
#endif
|
||||||
@ -3097,42 +2844,33 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
# define lzo_word_t lzo_uintptr_t
|
# define lzo_word_t lzo_uintptr_t
|
||||||
# define lzo_sword_t lzo_intptr_t
|
# define lzo_sword_t lzo_intptr_t
|
||||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T
|
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T
|
||||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LZO_INTPTR_T
|
|
||||||
#elif (LZO_WORDSIZE == LZO_SIZEOF_LONG)
|
#elif (LZO_WORDSIZE == LZO_SIZEOF_LONG)
|
||||||
# define lzo_word_t unsigned long
|
# define lzo_word_t unsigned long
|
||||||
# define lzo_sword_t long
|
# define lzo_sword_t long
|
||||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG
|
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG
|
||||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LONG
|
|
||||||
#elif (LZO_WORDSIZE == LZO_SIZEOF_INT)
|
#elif (LZO_WORDSIZE == LZO_SIZEOF_INT)
|
||||||
# define lzo_word_t unsigned int
|
# define lzo_word_t unsigned int
|
||||||
# define lzo_sword_t int
|
# define lzo_sword_t int
|
||||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT
|
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT
|
||||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_INT
|
|
||||||
#elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT)
|
#elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT)
|
||||||
# define lzo_word_t unsigned short
|
# define lzo_word_t unsigned short
|
||||||
# define lzo_sword_t short
|
# define lzo_sword_t short
|
||||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT
|
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT
|
||||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_SHORT
|
|
||||||
#elif (LZO_WORDSIZE == 1)
|
#elif (LZO_WORDSIZE == 1)
|
||||||
# define lzo_word_t unsigned char
|
# define lzo_word_t unsigned char
|
||||||
# define lzo_sword_t signed char
|
# define lzo_sword_t signed char
|
||||||
# define LZO_SIZEOF_LZO_WORD_T 1
|
# define LZO_SIZEOF_LZO_WORD_T 1
|
||||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_CHAR
|
|
||||||
#elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T)
|
#elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T)
|
||||||
# define lzo_word_t lzo_uint64l_t
|
# define lzo_word_t lzo_uint64l_t
|
||||||
# define lzo_sword_t lzo_int64l_t
|
# define lzo_sword_t lzo_int64l_t
|
||||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T
|
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T
|
||||||
# define LZO_TYPEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T
|
|
||||||
#elif (LZO_ARCH_SPU) && (LZO_CC_GNUC)
|
#elif (LZO_ARCH_SPU) && (LZO_CC_GNUC)
|
||||||
#if 0
|
#if 0
|
||||||
# if !(LZO_LANG_ASSEMBLER)
|
|
||||||
typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__)));
|
typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__)));
|
||||||
typedef int lzo_sword_t __attribute__((__mode__(__V16QI__)));
|
typedef int lzo_sword_t __attribute__((__mode__(__V16QI__)));
|
||||||
# endif
|
|
||||||
# define lzo_word_t lzo_word_t
|
# define lzo_word_t lzo_word_t
|
||||||
# define lzo_sword_t lzo_sword_t
|
# define lzo_sword_t lzo_sword_t
|
||||||
# define LZO_SIZEOF_LZO_WORD_T 16
|
# define LZO_SIZEOF_LZO_WORD_T 16
|
||||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF___MODE_V16QI
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
# error "lzo_word_t"
|
# error "lzo_word_t"
|
||||||
@ -3147,7 +2885,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
|||||||
#define lzo_int8_t signed char
|
#define lzo_int8_t signed char
|
||||||
#define lzo_uint8_t unsigned char
|
#define lzo_uint8_t unsigned char
|
||||||
#define LZO_SIZEOF_LZO_INT8_T 1
|
#define LZO_SIZEOF_LZO_INT8_T 1
|
||||||
#define LZO_TYPEOF_LZO_INT8_T LZO_TYPEOF_CHAR
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t))
|
||||||
#endif
|
#endif
|
||||||
@ -3155,7 +2892,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t))
|
|||||||
#define lzo_int16_t lzo_int16e_t
|
#define lzo_int16_t lzo_int16e_t
|
||||||
#define lzo_uint16_t lzo_uint16e_t
|
#define lzo_uint16_t lzo_uint16e_t
|
||||||
#define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T
|
#define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T
|
||||||
#define LZO_TYPEOF_LZO_INT16_T LZO_TYPEOF_LZO_INT16E_T
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t))
|
||||||
#endif
|
#endif
|
||||||
@ -3163,7 +2899,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t))
|
|||||||
#define lzo_int32_t lzo_int32e_t
|
#define lzo_int32_t lzo_int32e_t
|
||||||
#define lzo_uint32_t lzo_uint32e_t
|
#define lzo_uint32_t lzo_uint32e_t
|
||||||
#define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T
|
#define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T
|
||||||
#define LZO_TYPEOF_LZO_INT32_T LZO_TYPEOF_LZO_INT32E_T
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t))
|
||||||
#endif
|
#endif
|
||||||
@ -3171,7 +2906,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t))
|
|||||||
#define lzo_int64_t lzo_int64e_t
|
#define lzo_int64_t lzo_int64e_t
|
||||||
#define lzo_uint64_t lzo_uint64e_t
|
#define lzo_uint64_t lzo_uint64e_t
|
||||||
#define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T
|
#define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T
|
||||||
#define LZO_TYPEOF_LZO_INT64_T LZO_TYPEOF_LZO_INT64E_T
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t))
|
||||||
#endif
|
#endif
|
||||||
@ -3179,7 +2913,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t))
|
|||||||
#define lzo_int_least32_t lzo_int32l_t
|
#define lzo_int_least32_t lzo_int32l_t
|
||||||
#define lzo_uint_least32_t lzo_uint32l_t
|
#define lzo_uint_least32_t lzo_uint32l_t
|
||||||
#define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T
|
#define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T
|
||||||
#define LZO_TYPEOF_LZO_INT_LEAST32_T LZO_TYPEOF_LZO_INT32L_T
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t))
|
||||||
#endif
|
#endif
|
||||||
@ -3187,7 +2920,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_leas
|
|||||||
#define lzo_int_least64_t lzo_int64l_t
|
#define lzo_int_least64_t lzo_int64l_t
|
||||||
#define lzo_uint_least64_t lzo_uint64l_t
|
#define lzo_uint_least64_t lzo_uint64l_t
|
||||||
#define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T
|
#define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T
|
||||||
#define LZO_TYPEOF_LZO_INT_LEAST64_T LZO_TYPEOF_LZO_INT64L_T
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t))
|
||||||
#endif
|
#endif
|
||||||
@ -3195,7 +2927,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_leas
|
|||||||
#define lzo_int_fast32_t lzo_int32f_t
|
#define lzo_int_fast32_t lzo_int32f_t
|
||||||
#define lzo_uint_fast32_t lzo_uint32f_t
|
#define lzo_uint_fast32_t lzo_uint32f_t
|
||||||
#define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T
|
#define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T
|
||||||
#define LZO_TYPEOF_LZO_INT_FAST32_T LZO_TYPEOF_LZO_INT32F_T
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t))
|
||||||
#endif
|
#endif
|
||||||
@ -3203,7 +2934,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast3
|
|||||||
#define lzo_int_fast64_t lzo_int64f_t
|
#define lzo_int_fast64_t lzo_int64f_t
|
||||||
#define lzo_uint_fast64_t lzo_uint64f_t
|
#define lzo_uint_fast64_t lzo_uint64f_t
|
||||||
#define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T
|
#define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T
|
||||||
#define LZO_TYPEOF_LZO_INT_FAST64_T LZO_TYPEOF_LZO_INT64F_T
|
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8)
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8)
|
||||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t))
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t))
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the LZO real-time data compression library.
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
The LZO library is free software; you can redistribute it and/or
|
The LZO library is free software; you can redistribute it and/or
|
||||||
@ -32,25 +32,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __MINILZO_H_INCLUDED
|
#ifndef __MINILZO_H
|
||||||
#define __MINILZO_H_INCLUDED 1
|
#define __MINILZO_H 1
|
||||||
|
|
||||||
#define MINILZO_VERSION 0x20a0 /* 2.10 */
|
#define MINILZO_VERSION 0x2080
|
||||||
|
|
||||||
#if defined(__LZOCONF_H_INCLUDED)
|
#ifdef __LZOCONF_H
|
||||||
# error "you cannot use both LZO and miniLZO"
|
# error "you cannot use both LZO and miniLZO"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* internal Autoconf configuration file - only used when building miniLZO */
|
|
||||||
#ifdef MINILZO_HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#ifndef __LZODEFS_H_INCLUDED
|
|
||||||
#include "lzodefs.h"
|
|
||||||
#endif
|
|
||||||
#undef LZO_HAVE_CONFIG_H
|
#undef LZO_HAVE_CONFIG_H
|
||||||
#include "lzoconf.h"
|
#include "lzoconf.h"
|
||||||
|
|
||||||
@ -102,5 +92,3 @@ lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
|
||||||
/* vim:set ts=4 sw=4 et: */
|
|
||||||
|
@ -44,28 +44,33 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||||||
|
|
||||||
static grub_dl_t my_mod;
|
static grub_dl_t my_mod;
|
||||||
|
|
||||||
static grub_err_t
|
static grub_efi_physical_address_t address;
|
||||||
grub_chainloader_unload (void *context)
|
static grub_efi_uintn_t pages;
|
||||||
{
|
static grub_efi_device_path_t *file_path;
|
||||||
grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
|
static grub_efi_handle_t image_handle;
|
||||||
grub_efi_loaded_image_t *loaded_image;
|
static grub_efi_char16_t *cmdline;
|
||||||
grub_efi_boot_services_t *b;
|
|
||||||
|
|
||||||
loaded_image = grub_efi_get_loaded_image (image_handle);
|
static grub_err_t
|
||||||
if (loaded_image != NULL)
|
grub_chainloader_unload (void)
|
||||||
grub_free (loaded_image->load_options);
|
{
|
||||||
|
grub_efi_boot_services_t *b;
|
||||||
|
|
||||||
b = grub_efi_system_table->boot_services;
|
b = grub_efi_system_table->boot_services;
|
||||||
efi_call_1 (b->unload_image, image_handle);
|
efi_call_1 (b->unload_image, image_handle);
|
||||||
|
efi_call_2 (b->free_pages, address, pages);
|
||||||
|
|
||||||
|
grub_free (file_path);
|
||||||
|
grub_free (cmdline);
|
||||||
|
cmdline = 0;
|
||||||
|
file_path = 0;
|
||||||
|
|
||||||
grub_dl_unref (my_mod);
|
grub_dl_unref (my_mod);
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_chainloader_boot (void *context)
|
grub_chainloader_boot (void)
|
||||||
{
|
{
|
||||||
grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
|
|
||||||
grub_efi_boot_services_t *b;
|
grub_efi_boot_services_t *b;
|
||||||
grub_efi_status_t status;
|
grub_efi_status_t status;
|
||||||
grub_efi_uintn_t exit_data_size;
|
grub_efi_uintn_t exit_data_size;
|
||||||
@ -135,7 +140,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
|||||||
char *dir_start;
|
char *dir_start;
|
||||||
char *dir_end;
|
char *dir_end;
|
||||||
grub_size_t size;
|
grub_size_t size;
|
||||||
grub_efi_device_path_t *d, *file_path;
|
grub_efi_device_path_t *d;
|
||||||
|
|
||||||
dir_start = grub_strchr (filename, ')');
|
dir_start = grub_strchr (filename, ')');
|
||||||
if (! dir_start)
|
if (! dir_start)
|
||||||
@ -217,15 +222,11 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
grub_efi_status_t status;
|
grub_efi_status_t status;
|
||||||
grub_efi_boot_services_t *b;
|
grub_efi_boot_services_t *b;
|
||||||
grub_device_t dev = 0;
|
grub_device_t dev = 0;
|
||||||
grub_efi_device_path_t *dp = NULL, *file_path = NULL;
|
grub_efi_device_path_t *dp = 0;
|
||||||
grub_efi_loaded_image_t *loaded_image;
|
grub_efi_loaded_image_t *loaded_image;
|
||||||
char *filename;
|
char *filename;
|
||||||
void *boot_image = 0;
|
void *boot_image = 0;
|
||||||
grub_efi_handle_t dev_handle = 0;
|
grub_efi_handle_t dev_handle = 0;
|
||||||
grub_efi_physical_address_t address = 0;
|
|
||||||
grub_efi_uintn_t pages = 0;
|
|
||||||
grub_efi_char16_t *cmdline = NULL;
|
|
||||||
grub_efi_handle_t image_handle = NULL;
|
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||||
@ -233,6 +234,11 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
|
|
||||||
grub_dl_ref (my_mod);
|
grub_dl_ref (my_mod);
|
||||||
|
|
||||||
|
/* Initialize some global variables. */
|
||||||
|
address = 0;
|
||||||
|
image_handle = 0;
|
||||||
|
file_path = 0;
|
||||||
|
|
||||||
b = grub_efi_system_table->boot_services;
|
b = grub_efi_system_table->boot_services;
|
||||||
|
|
||||||
file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE);
|
file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE);
|
||||||
@ -402,11 +408,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
grub_device_close (dev);
|
grub_device_close (dev);
|
||||||
|
|
||||||
/* We're finished with the source image buffer and file path now. */
|
grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
|
||||||
efi_call_2 (b->free_pages, address, pages);
|
|
||||||
grub_free (file_path);
|
|
||||||
|
|
||||||
grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
@ -417,15 +419,11 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
if (file)
|
if (file)
|
||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
|
|
||||||
grub_free (cmdline);
|
|
||||||
grub_free (file_path);
|
grub_free (file_path);
|
||||||
|
|
||||||
if (address)
|
if (address)
|
||||||
efi_call_2 (b->free_pages, address, pages);
|
efi_call_2 (b->free_pages, address, pages);
|
||||||
|
|
||||||
if (image_handle != NULL)
|
|
||||||
efi_call_1 (b->unload_image, image_handle);
|
|
||||||
|
|
||||||
grub_dl_unref (my_mod);
|
grub_dl_unref (my_mod);
|
||||||
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
@ -1,386 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2012 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/loader.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/types.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/cpu/linux.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
#include <grub/lib/cmdline.h>
|
|
||||||
#include <grub/linux.h>
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#include <grub/efi/sb.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
|
||||||
|
|
||||||
static grub_dl_t my_mod;
|
|
||||||
static int loaded;
|
|
||||||
static void *kernel_mem;
|
|
||||||
static grub_uint64_t kernel_size;
|
|
||||||
static grub_uint8_t *initrd_mem;
|
|
||||||
static grub_uint32_t handover_offset;
|
|
||||||
struct linux_kernel_params *params;
|
|
||||||
static char *linux_cmdline;
|
|
||||||
|
|
||||||
#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12)
|
|
||||||
|
|
||||||
#define SHIM_LOCK_GUID \
|
|
||||||
{ 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }
|
|
||||||
|
|
||||||
struct grub_efi_shim_lock
|
|
||||||
{
|
|
||||||
grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size);
|
|
||||||
};
|
|
||||||
typedef struct grub_efi_shim_lock grub_efi_shim_lock_t;
|
|
||||||
|
|
||||||
static grub_efi_boolean_t
|
|
||||||
grub_linuxefi_secure_validate (void *data, grub_uint32_t size)
|
|
||||||
{
|
|
||||||
grub_efi_guid_t guid = SHIM_LOCK_GUID;
|
|
||||||
grub_efi_shim_lock_t *shim_lock;
|
|
||||||
grub_efi_status_t status;
|
|
||||||
|
|
||||||
if (grub_efi_get_secureboot () != GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
|
||||||
{
|
|
||||||
grub_dprintf ("linuxefi", "secure boot not enabled, not validating");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("linuxefi", "Locating shim protocol\n");
|
|
||||||
shim_lock = grub_efi_locate_protocol(&guid, NULL);
|
|
||||||
|
|
||||||
if (!shim_lock)
|
|
||||||
{
|
|
||||||
grub_dprintf ("linuxefi", "shim not available\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("linuxefi", "Asking shim to verify kernel signature\n");
|
|
||||||
status = shim_lock->verify(data, size);
|
|
||||||
if (status == GRUB_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
grub_dprintf ("linuxefi", "Kernel signature verification passed\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("linuxefi", "Kernel signature verification failed (0x%lx)\n",
|
|
||||||
(unsigned long) status);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef void(*handover_func)(void *, grub_efi_system_table_t *, struct linux_kernel_params *);
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_linuxefi_boot (void)
|
|
||||||
{
|
|
||||||
handover_func hf;
|
|
||||||
int offset = 0;
|
|
||||||
|
|
||||||
#ifdef __x86_64__
|
|
||||||
offset = 512;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hf = (handover_func)((char *)kernel_mem + handover_offset + offset);
|
|
||||||
|
|
||||||
asm volatile ("cli");
|
|
||||||
|
|
||||||
hf (grub_efi_image_handle, grub_efi_system_table, params);
|
|
||||||
|
|
||||||
/* Not reached */
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_linuxefi_unload (void)
|
|
||||||
{
|
|
||||||
grub_dl_unref (my_mod);
|
|
||||||
loaded = 0;
|
|
||||||
if (initrd_mem)
|
|
||||||
grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, BYTES_TO_PAGES(params->ramdisk_size));
|
|
||||||
if (linux_cmdline)
|
|
||||||
grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)linux_cmdline, BYTES_TO_PAGES(params->cmdline_size + 1));
|
|
||||||
if (kernel_mem)
|
|
||||||
grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
|
|
||||||
if (params)
|
|
||||||
grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)params, BYTES_TO_PAGES(16384));
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
|
||||||
grub_size_t size = 0;
|
|
||||||
struct grub_linux_initrd_context initrd_ctx;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!loaded)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_initrd_init (argc, argv, &initrd_ctx))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
size = grub_get_initrd_size (&initrd_ctx);
|
|
||||||
|
|
||||||
initrd_mem = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(size));
|
|
||||||
|
|
||||||
if (!initrd_mem)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("linuxefi", "initrd_mem = %lx\n", (unsigned long) initrd_mem);
|
|
||||||
|
|
||||||
params->ramdisk_size = size;
|
|
||||||
params->ramdisk_image = (grub_uint32_t)(grub_addr_t) initrd_mem;
|
|
||||||
|
|
||||||
if (grub_initrd_load (&initrd_ctx, argv, initrd_mem))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
params->ramdisk_size = size;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_initrd_close (&initrd_ctx);
|
|
||||||
|
|
||||||
if (initrd_mem && grub_errno)
|
|
||||||
grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, BYTES_TO_PAGES(size));
|
|
||||||
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char *argv[])
|
|
||||||
{
|
|
||||||
grub_file_t file = 0;
|
|
||||||
struct linux_i386_kernel_header lh;
|
|
||||||
grub_ssize_t len, start, filelen;
|
|
||||||
void *kernel;
|
|
||||||
|
|
||||||
grub_dl_ref (my_mod);
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
|
|
||||||
if (! file)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
filelen = grub_file_size (file);
|
|
||||||
|
|
||||||
kernel = grub_malloc(filelen);
|
|
||||||
|
|
||||||
if (!kernel)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_file_read (file, kernel, filelen) != filelen)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! grub_linuxefi_secure_validate (kernel, filelen))
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_ACCESS_DENIED, N_("%s has invalid signature"), argv[0]);
|
|
||||||
grub_free (kernel);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_file_seek (file, 0);
|
|
||||||
|
|
||||||
grub_free(kernel);
|
|
||||||
|
|
||||||
params = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(16384));
|
|
||||||
|
|
||||||
if (! params)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("linuxefi", "params = %lx\n", (unsigned long) params);
|
|
||||||
|
|
||||||
grub_memset (params, 0, 16384);
|
|
||||||
|
|
||||||
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
|
|
||||||
{
|
|
||||||
if (!grub_errno)
|
|
||||||
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
|
||||||
argv[0]);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lh.boot_flag != grub_cpu_to_le16 (0xaa55))
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_OS, N_("invalid magic number"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_OS, N_("too many setup sectors"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lh.version < grub_cpu_to_le16 (0x020b))
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_OS, N_("kernel too old"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lh.handover_offset)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_OS, N_("kernel doesn't support EFI handover"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff,
|
|
||||||
BYTES_TO_PAGES(lh.cmdline_size + 1));
|
|
||||||
|
|
||||||
if (!linux_cmdline)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("linuxefi", "linux_cmdline = %lx\n",
|
|
||||||
(unsigned long) linux_cmdline);
|
|
||||||
|
|
||||||
grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
|
|
||||||
{
|
|
||||||
grub_err_t err;
|
|
||||||
err = grub_create_loader_cmdline (argc, argv,
|
|
||||||
linux_cmdline
|
|
||||||
+ sizeof (LINUX_IMAGE) - 1,
|
|
||||||
lh.cmdline_size
|
|
||||||
- (sizeof (LINUX_IMAGE) - 1),
|
|
||||||
GRUB_VERIFY_KERNEL_CMDLINE);
|
|
||||||
if (err)
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline;
|
|
||||||
|
|
||||||
handover_offset = lh.handover_offset;
|
|
||||||
|
|
||||||
start = (lh.setup_sects + 1) * 512;
|
|
||||||
len = grub_file_size(file) - start;
|
|
||||||
|
|
||||||
kernel_mem = grub_efi_allocate_fixed(lh.pref_address,
|
|
||||||
BYTES_TO_PAGES(lh.init_size));
|
|
||||||
|
|
||||||
if (!kernel_mem)
|
|
||||||
kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
|
|
||||||
BYTES_TO_PAGES(lh.init_size));
|
|
||||||
|
|
||||||
if (!kernel_mem)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel"));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
grub_dprintf ("linuxefi", "kernel_mem = %lx\n", (unsigned long) kernel_mem);
|
|
||||||
|
|
||||||
if (grub_file_seek (file, start) == (grub_off_t) -1)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
|
||||||
argv[0]);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_file_read (file, kernel_mem, len) != len && !grub_errno)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
|
||||||
argv[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_NONE)
|
|
||||||
{
|
|
||||||
grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0);
|
|
||||||
loaded = 1;
|
|
||||||
lh.code32_start = (grub_uint32_t)(grub_addr_t) kernel_mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* do not overwrite below boot_params->hdr to avoid setting the sentinel byte */
|
|
||||||
start = offsetof (struct linux_kernel_params, setup_sects);
|
|
||||||
grub_memcpy ((grub_uint8_t *)params + start, (grub_uint8_t *)&lh + start, 2 * 512 - start);
|
|
||||||
|
|
||||||
params->type_of_loader = 0x21;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
|
|
||||||
if (file)
|
|
||||||
grub_file_close (file);
|
|
||||||
|
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
{
|
|
||||||
grub_dl_unref (my_mod);
|
|
||||||
loaded = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (linux_cmdline && !loaded)
|
|
||||||
grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)linux_cmdline, BYTES_TO_PAGES(lh.cmdline_size + 1));
|
|
||||||
|
|
||||||
if (kernel_mem && !loaded)
|
|
||||||
grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, BYTES_TO_PAGES(kernel_size));
|
|
||||||
|
|
||||||
if (params && !loaded)
|
|
||||||
grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)params, BYTES_TO_PAGES(16384));
|
|
||||||
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_linux, cmd_initrd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(linuxefi)
|
|
||||||
{
|
|
||||||
cmd_linux =
|
|
||||||
grub_register_command ("linuxefi", grub_cmd_linux,
|
|
||||||
0, N_("Load Linux."));
|
|
||||||
cmd_initrd =
|
|
||||||
grub_register_command ("initrdefi", grub_cmd_initrd,
|
|
||||||
0, N_("Load initrd."));
|
|
||||||
my_mod = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(linuxefi)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_linux);
|
|
||||||
grub_unregister_command (cmd_initrd);
|
|
||||||
}
|
|
@ -78,8 +78,6 @@ static grub_size_t maximal_cmdline_size;
|
|||||||
static struct linux_kernel_params linux_params;
|
static struct linux_kernel_params linux_params;
|
||||||
static char *linux_cmdline;
|
static char *linux_cmdline;
|
||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
static int using_linuxefi;
|
|
||||||
static grub_command_t initrdefi_cmd;
|
|
||||||
static grub_efi_uintn_t efi_mmap_size;
|
static grub_efi_uintn_t efi_mmap_size;
|
||||||
#else
|
#else
|
||||||
static const grub_size_t efi_mmap_size = 0;
|
static const grub_size_t efi_mmap_size = 0;
|
||||||
@ -661,39 +659,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
|
|
||||||
grub_dl_ref (my_mod);
|
grub_dl_ref (my_mod);
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EFI
|
|
||||||
using_linuxefi = 0;
|
|
||||||
if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
|
|
||||||
{
|
|
||||||
/* linuxefi requires a successful signature check and then hand over
|
|
||||||
to the kernel without calling ExitBootServices. */
|
|
||||||
grub_dl_t mod;
|
|
||||||
grub_command_t linuxefi_cmd;
|
|
||||||
|
|
||||||
grub_dprintf ("linux", "Secure Boot enabled: trying linuxefi\n");
|
|
||||||
|
|
||||||
mod = grub_dl_load ("linuxefi");
|
|
||||||
if (mod)
|
|
||||||
{
|
|
||||||
grub_dl_ref (mod);
|
|
||||||
linuxefi_cmd = grub_command_find ("linuxefi");
|
|
||||||
initrdefi_cmd = grub_command_find ("initrdefi");
|
|
||||||
if (linuxefi_cmd && initrdefi_cmd)
|
|
||||||
{
|
|
||||||
(linuxefi_cmd->func) (linuxefi_cmd, argc, argv);
|
|
||||||
if (grub_errno == GRUB_ERR_NONE)
|
|
||||||
{
|
|
||||||
grub_dprintf ("linux", "Handing off to linuxefi\n");
|
|
||||||
using_linuxefi = 1;
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
grub_dprintf ("linux", "linuxefi failed (%d)\n", grub_errno);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||||
@ -1077,12 +1042,6 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 };
|
struct grub_linux_initrd_context initrd_ctx = { 0, 0, 0 };
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EFI
|
|
||||||
/* If we're using linuxefi, just forward to initrdefi. */
|
|
||||||
if (using_linuxefi && initrdefi_cmd)
|
|
||||||
return (initrdefi_cmd->func) (initrdefi_cmd, argc, argv);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -146,18 +146,11 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head,
|
|||||||
int *length, char *set)
|
int *length, char *set)
|
||||||
{
|
{
|
||||||
const char *readable_ptr = check_with;
|
const char *readable_ptr = check_with;
|
||||||
int readable_len;
|
|
||||||
const grub_uint8_t *ptr;
|
const grub_uint8_t *ptr;
|
||||||
char *optr = set;
|
char *optr = set;
|
||||||
int bytes_processed = 0;
|
int bytes_processed = 0;
|
||||||
if (length)
|
if (length)
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
|
||||||
if (readable_ptr != NULL)
|
|
||||||
readable_len = grub_strlen (readable_ptr);
|
|
||||||
else
|
|
||||||
readable_len = 0;
|
|
||||||
|
|
||||||
for (ptr = name_at; ptr < tail && bytes_processed < tail - head + 2; )
|
for (ptr = name_at; ptr < tail && bytes_processed < tail - head + 2; )
|
||||||
{
|
{
|
||||||
/* End marker. */
|
/* End marker. */
|
||||||
@ -179,16 +172,13 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head,
|
|||||||
ptr = head + (((ptr[0] & 0x3f) << 8) | ptr[1]);
|
ptr = head + (((ptr[0] & 0x3f) << 8) | ptr[1]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (readable_ptr != NULL && (*ptr > readable_len || grub_memcmp (ptr + 1, readable_ptr, *ptr) != 0))
|
if (readable_ptr && grub_memcmp (ptr + 1, readable_ptr, *ptr) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (grub_memchr (ptr + 1, 0, *ptr)
|
if (grub_memchr (ptr + 1, 0, *ptr)
|
||||||
|| grub_memchr (ptr + 1, '.', *ptr))
|
|| grub_memchr (ptr + 1, '.', *ptr))
|
||||||
return 0;
|
return 0;
|
||||||
if (readable_ptr)
|
if (readable_ptr)
|
||||||
{
|
|
||||||
readable_ptr += *ptr;
|
readable_ptr += *ptr;
|
||||||
readable_len -= *ptr;
|
|
||||||
}
|
|
||||||
if (readable_ptr && *readable_ptr != '.' && *readable_ptr != 0)
|
if (readable_ptr && *readable_ptr != '.' && *readable_ptr != 0)
|
||||||
return 0;
|
return 0;
|
||||||
bytes_processed += *ptr + 1;
|
bytes_processed += *ptr + 1;
|
||||||
@ -202,10 +192,7 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head,
|
|||||||
if (optr)
|
if (optr)
|
||||||
*optr++ = '.';
|
*optr++ = '.';
|
||||||
if (readable_ptr && *readable_ptr)
|
if (readable_ptr && *readable_ptr)
|
||||||
{
|
|
||||||
readable_ptr++;
|
readable_ptr++;
|
||||||
readable_len--;
|
|
||||||
}
|
|
||||||
ptr += *ptr + 1;
|
ptr += *ptr + 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -680,11 +667,9 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)),
|
|||||||
grub_net_addr_to_str (&addresses[i], buf);
|
grub_net_addr_to_str (&addresses[i], buf);
|
||||||
grub_printf ("%s\n", buf);
|
grub_printf ("%s\n", buf);
|
||||||
}
|
}
|
||||||
if (naddresses)
|
|
||||||
{
|
|
||||||
grub_free (addresses);
|
grub_free (addresses);
|
||||||
|
if (naddresses)
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
|
||||||
return grub_error (GRUB_ERR_NET_NO_DOMAIN, N_("no DNS record found"));
|
return grub_error (GRUB_ERR_NET_NO_DOMAIN, N_("no DNS record found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,15 +23,12 @@
|
|||||||
#include <grub/efi/api.h>
|
#include <grub/efi/api.h>
|
||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/net/netbuff.h>
|
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
/* GUID. */
|
/* GUID. */
|
||||||
static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
|
static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
|
||||||
static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
|
static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
|
||||||
static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
|
|
||||||
static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
send_card_buffer (struct grub_net_card *dev,
|
send_card_buffer (struct grub_net_card *dev,
|
||||||
@ -327,382 +324,6 @@ grub_efinet_findcards (void)
|
|||||||
grub_free (handles);
|
grub_free (handles);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_efi_handle_t
|
|
||||||
grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path,
|
|
||||||
grub_efi_device_path_t **r_device_path)
|
|
||||||
{
|
|
||||||
grub_efi_handle_t handle;
|
|
||||||
grub_efi_status_t status;
|
|
||||||
|
|
||||||
status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path,
|
|
||||||
protocol, &device_path, &handle);
|
|
||||||
|
|
||||||
if (status != GRUB_EFI_SUCCESS)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (r_device_path)
|
|
||||||
*r_device_path = device_path;
|
|
||||||
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_efi_ipv4_address_t *
|
|
||||||
grub_dns_server_ip4_address (grub_efi_device_path_t *dp, grub_efi_uintn_t *num_dns)
|
|
||||||
{
|
|
||||||
grub_efi_handle_t hnd;
|
|
||||||
grub_efi_status_t status;
|
|
||||||
grub_efi_ip4_config2_protocol_t *conf;
|
|
||||||
grub_efi_ipv4_address_t *addrs;
|
|
||||||
grub_efi_uintn_t data_size = 1 * sizeof (grub_efi_ipv4_address_t);
|
|
||||||
|
|
||||||
hnd = grub_efi_locate_device_path (&ip4_config_guid, dp, NULL);
|
|
||||||
|
|
||||||
if (!hnd)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
conf = grub_efi_open_protocol (hnd, &ip4_config_guid,
|
|
||||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
|
||||||
|
|
||||||
if (!conf)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
addrs = grub_malloc (data_size);
|
|
||||||
if (!addrs)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
status = efi_call_4 (conf->get_data, conf,
|
|
||||||
GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
|
||||||
&data_size, addrs);
|
|
||||||
|
|
||||||
if (status == GRUB_EFI_BUFFER_TOO_SMALL)
|
|
||||||
{
|
|
||||||
grub_free (addrs);
|
|
||||||
addrs = grub_malloc (data_size);
|
|
||||||
if (!addrs)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
status = efi_call_4 (conf->get_data, conf,
|
|
||||||
GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
|
||||||
&data_size, addrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status != GRUB_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
grub_free (addrs);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*num_dns = data_size / sizeof (grub_efi_ipv4_address_t);
|
|
||||||
return addrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_efi_ipv6_address_t *
|
|
||||||
grub_dns_server_ip6_address (grub_efi_device_path_t *dp, grub_efi_uintn_t *num_dns)
|
|
||||||
{
|
|
||||||
grub_efi_handle_t hnd;
|
|
||||||
grub_efi_status_t status;
|
|
||||||
grub_efi_ip6_config_protocol_t *conf;
|
|
||||||
grub_efi_ipv6_address_t *addrs;
|
|
||||||
grub_efi_uintn_t data_size = 1 * sizeof (grub_efi_ipv6_address_t);
|
|
||||||
|
|
||||||
hnd = grub_efi_locate_device_path (&ip6_config_guid, dp, NULL);
|
|
||||||
|
|
||||||
if (!hnd)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
conf = grub_efi_open_protocol (hnd, &ip6_config_guid,
|
|
||||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
|
||||||
|
|
||||||
if (!conf)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
addrs = grub_malloc (data_size);
|
|
||||||
if (!addrs)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
status = efi_call_4 (conf->get_data, conf,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
|
||||||
&data_size, addrs);
|
|
||||||
|
|
||||||
if (status == GRUB_EFI_BUFFER_TOO_SMALL)
|
|
||||||
{
|
|
||||||
grub_free (addrs);
|
|
||||||
addrs = grub_malloc (data_size);
|
|
||||||
if (!addrs)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
status = efi_call_4 (conf->get_data, conf,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
|
||||||
&data_size, addrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status != GRUB_EFI_SUCCESS)
|
|
||||||
{
|
|
||||||
grub_free (addrs);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*num_dns = data_size / sizeof (grub_efi_ipv6_address_t);
|
|
||||||
return addrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct grub_net_buff *
|
|
||||||
grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6)
|
|
||||||
{
|
|
||||||
grub_efi_uint16_t uri_len;
|
|
||||||
grub_efi_device_path_t *ldp, *ddp;
|
|
||||||
grub_efi_uri_device_path_t *uri_dp;
|
|
||||||
struct grub_net_buff *nb;
|
|
||||||
grub_err_t err;
|
|
||||||
|
|
||||||
ddp = grub_efi_duplicate_device_path (dp);
|
|
||||||
ldp = grub_efi_find_last_device_path (ddp);
|
|
||||||
|
|
||||||
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
|
||||||
|| GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
uri_len = GRUB_EFI_DEVICE_PATH_LENGTH (ldp) > 4 ? GRUB_EFI_DEVICE_PATH_LENGTH (ldp) - 4 : 0;
|
|
||||||
|
|
||||||
if (!uri_len)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
uri_dp = (grub_efi_uri_device_path_t *) ldp;
|
|
||||||
|
|
||||||
ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
|
||||||
ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
|
||||||
ldp->length = sizeof (*ldp);
|
|
||||||
|
|
||||||
ldp = grub_efi_find_last_device_path (ddp);
|
|
||||||
|
|
||||||
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
|
||||||
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
|
||||||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
nb = grub_netbuff_alloc (512);
|
|
||||||
if (!nb)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE)
|
|
||||||
{
|
|
||||||
grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp;
|
|
||||||
struct grub_net_bootp_packet *bp;
|
|
||||||
grub_uint8_t *ptr;
|
|
||||||
grub_efi_ipv4_address_t *dns;
|
|
||||||
grub_efi_uintn_t num_dns;
|
|
||||||
|
|
||||||
bp = (struct grub_net_bootp_packet *) nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof (*bp) + 4);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof(bp->boot_file) < uri_len)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
grub_memcpy (bp->boot_file, uri_dp->uri, uri_len);
|
|
||||||
grub_memcpy (&bp->your_ip, ipv4->local_ip_address, sizeof (bp->your_ip));
|
|
||||||
grub_memcpy (&bp->server_ip, ipv4->remote_ip_address, sizeof (bp->server_ip));
|
|
||||||
|
|
||||||
bp->vendor[0] = GRUB_NET_BOOTP_RFC1048_MAGIC_0;
|
|
||||||
bp->vendor[1] = GRUB_NET_BOOTP_RFC1048_MAGIC_1;
|
|
||||||
bp->vendor[2] = GRUB_NET_BOOTP_RFC1048_MAGIC_2;
|
|
||||||
bp->vendor[3] = GRUB_NET_BOOTP_RFC1048_MAGIC_3;
|
|
||||||
|
|
||||||
ptr = nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof (ipv4->subnet_mask) + 2);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*ptr++ = GRUB_NET_BOOTP_NETMASK;
|
|
||||||
*ptr++ = sizeof (ipv4->subnet_mask);
|
|
||||||
grub_memcpy (ptr, ipv4->subnet_mask, sizeof (ipv4->subnet_mask));
|
|
||||||
|
|
||||||
ptr = nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof (ipv4->gateway_ip_address) + 2);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*ptr++ = GRUB_NET_BOOTP_ROUTER;
|
|
||||||
*ptr++ = sizeof (ipv4->gateway_ip_address);
|
|
||||||
grub_memcpy (ptr, ipv4->gateway_ip_address, sizeof (ipv4->gateway_ip_address));
|
|
||||||
|
|
||||||
ptr = nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof ("HTTPClient") + 1);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*ptr++ = GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER;
|
|
||||||
*ptr++ = sizeof ("HTTPClient") - 1;
|
|
||||||
grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1);
|
|
||||||
|
|
||||||
dns = grub_dns_server_ip4_address (dp, &num_dns);
|
|
||||||
if (dns)
|
|
||||||
{
|
|
||||||
grub_efi_uintn_t size_dns = sizeof (*dns) * num_dns;
|
|
||||||
|
|
||||||
ptr = nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, size_dns + 2);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*ptr++ = GRUB_NET_BOOTP_DNS;
|
|
||||||
*ptr++ = size_dns;
|
|
||||||
grub_memcpy (ptr, dns, size_dns);
|
|
||||||
grub_free (dns);
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr = nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, 1);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*ptr = GRUB_NET_BOOTP_END;
|
|
||||||
*use_ipv6 = 0;
|
|
||||||
|
|
||||||
ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
|
||||||
ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
|
||||||
ldp->length = sizeof (*ldp);
|
|
||||||
ldp = grub_efi_find_last_device_path (ddp);
|
|
||||||
|
|
||||||
if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE)
|
|
||||||
{
|
|
||||||
grub_efi_mac_address_device_path_t *mac = (grub_efi_mac_address_device_path_t *) ldp;
|
|
||||||
bp->hw_type = mac->if_type;
|
|
||||||
bp->hw_len = sizeof (bp->mac_addr);
|
|
||||||
grub_memcpy (bp->mac_addr, mac->mac_address, bp->hw_len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_efi_ipv6_device_path_t *ipv6 = (grub_efi_ipv6_device_path_t *) ldp;
|
|
||||||
|
|
||||||
struct grub_net_dhcp6_packet *d6p;
|
|
||||||
struct grub_net_dhcp6_option *opt;
|
|
||||||
struct grub_net_dhcp6_option_iana *iana;
|
|
||||||
struct grub_net_dhcp6_option_iaaddr *iaaddr;
|
|
||||||
grub_efi_ipv6_address_t *dns;
|
|
||||||
grub_efi_uintn_t num_dns;
|
|
||||||
|
|
||||||
d6p = (struct grub_net_dhcp6_packet *)nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof(*d6p));
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
d6p->message_type = GRUB_NET_DHCP6_REPLY;
|
|
||||||
|
|
||||||
opt = (struct grub_net_dhcp6_option *)nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof(*opt));
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA);
|
|
||||||
opt->len = grub_cpu_to_be16_compile_time (sizeof(*iana) + sizeof(*opt) + sizeof(*iaaddr));
|
|
||||||
|
|
||||||
err = grub_netbuff_put (nb, sizeof(*iana));
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
opt = (struct grub_net_dhcp6_option *)nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof(*opt));
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IAADDR);
|
|
||||||
opt->len = grub_cpu_to_be16_compile_time (sizeof (*iaaddr));
|
|
||||||
|
|
||||||
iaaddr = (struct grub_net_dhcp6_option_iaaddr *)nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof(*iaaddr));
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
grub_memcpy (iaaddr->addr, ipv6->local_ip_address, sizeof(ipv6->local_ip_address));
|
|
||||||
|
|
||||||
opt = (struct grub_net_dhcp6_option *)nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof(*opt) + uri_len);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_BOOTFILE_URL);
|
|
||||||
opt->len = grub_cpu_to_be16 (uri_len);
|
|
||||||
grub_memcpy (opt->data, uri_dp->uri, uri_len);
|
|
||||||
|
|
||||||
dns = grub_dns_server_ip6_address (dp, &num_dns);
|
|
||||||
if (dns)
|
|
||||||
{
|
|
||||||
grub_efi_uintn_t size_dns = sizeof (*dns) * num_dns;
|
|
||||||
|
|
||||||
opt = (struct grub_net_dhcp6_option *)nb->tail;
|
|
||||||
err = grub_netbuff_put (nb, sizeof(*opt) + size_dns);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_free (ddp);
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_DNS_SERVERS);
|
|
||||||
opt->len = grub_cpu_to_be16 (size_dns);
|
|
||||||
grub_memcpy (opt->data, dns, size_dns);
|
|
||||||
grub_free (dns);
|
|
||||||
}
|
|
||||||
|
|
||||||
*use_ipv6 = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_free (ddp);
|
|
||||||
return nb;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
||||||
char **path)
|
char **path)
|
||||||
@ -719,11 +340,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|||||||
grub_efi_device_path_t *cdp;
|
grub_efi_device_path_t *cdp;
|
||||||
struct grub_efi_pxe *pxe;
|
struct grub_efi_pxe *pxe;
|
||||||
struct grub_efi_pxe_mode *pxe_mode;
|
struct grub_efi_pxe_mode *pxe_mode;
|
||||||
grub_uint8_t *packet_buf;
|
|
||||||
grub_size_t packet_bufsz ;
|
|
||||||
int ipv6;
|
|
||||||
struct grub_net_buff *nb = NULL;
|
|
||||||
|
|
||||||
if (card->driver != &efidriver)
|
if (card->driver != &efidriver)
|
||||||
continue;
|
continue;
|
||||||
cdp = grub_efi_get_device_path (card->efi_handle);
|
cdp = grub_efi_get_device_path (card->efi_handle);
|
||||||
@ -743,21 +359,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|||||||
ldp = grub_efi_find_last_device_path (dp);
|
ldp = grub_efi_find_last_device_path (dp);
|
||||||
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|
||||||
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
|
||||||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE
|
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
|
||||||
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE))
|
|
||||||
continue;
|
continue;
|
||||||
dup_dp = grub_efi_duplicate_device_path (dp);
|
dup_dp = grub_efi_duplicate_device_path (dp);
|
||||||
if (!dup_dp)
|
if (!dup_dp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)
|
|
||||||
{
|
|
||||||
dup_ldp = grub_efi_find_last_device_path (dup_dp);
|
|
||||||
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
|
||||||
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
|
||||||
dup_ldp->length = sizeof (*dup_ldp);
|
|
||||||
}
|
|
||||||
|
|
||||||
dup_ldp = grub_efi_find_last_device_path (dup_dp);
|
dup_ldp = grub_efi_find_last_device_path (dup_dp);
|
||||||
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
|
||||||
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
|
||||||
@ -769,47 +375,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|||||||
}
|
}
|
||||||
pxe = grub_efi_open_protocol (hnd, &pxe_io_guid,
|
pxe = grub_efi_open_protocol (hnd, &pxe_io_guid,
|
||||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
if (!pxe)
|
if (! pxe)
|
||||||
{
|
|
||||||
nb = grub_efinet_create_dhcp_ack_from_device_path (dp, &ipv6);
|
|
||||||
if (!nb)
|
|
||||||
{
|
|
||||||
grub_print_error ();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
packet_buf = nb->head;
|
|
||||||
packet_bufsz = nb->tail - nb->head;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pxe_mode = pxe->mode;
|
pxe_mode = pxe->mode;
|
||||||
packet_buf = (grub_uint8_t *) &pxe_mode->dhcp_ack;
|
|
||||||
packet_bufsz = sizeof (pxe_mode->dhcp_ack);
|
|
||||||
ipv6 = pxe_mode->using_ipv6;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ipv6)
|
|
||||||
{
|
|
||||||
grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
|
|
||||||
(struct grub_net_dhcp6_packet *)
|
|
||||||
packet_buf,
|
|
||||||
packet_bufsz,
|
|
||||||
1, device, path);
|
|
||||||
if (grub_errno)
|
|
||||||
grub_print_error ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_net_configure_by_dhcp_ack (card->name, card, 0,
|
grub_net_configure_by_dhcp_ack (card->name, card, 0,
|
||||||
(struct grub_net_bootp_packet *)
|
(struct grub_net_bootp_packet *)
|
||||||
packet_buf,
|
&pxe_mode->dhcp_ack,
|
||||||
packet_bufsz,
|
sizeof (pxe_mode->dhcp_ack),
|
||||||
1, device, path);
|
1, device, path);
|
||||||
}
|
|
||||||
|
|
||||||
if (nb)
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,15 +68,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)
|
|||||||
char *end = ptr + len;
|
char *end = ptr + len;
|
||||||
while (end > ptr && *(end - 1) == '\r')
|
while (end > ptr && *(end - 1) == '\r')
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
/* LF without CR. */
|
|
||||||
if (end == ptr + len)
|
|
||||||
{
|
|
||||||
data->errmsg = grub_strdup (_("invalid HTTP header - LF without CR"));
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
*end = 0;
|
*end = 0;
|
||||||
|
|
||||||
/* Trailing CRLF. */
|
/* Trailing CRLF. */
|
||||||
if (data->in_chunk_len == 1)
|
if (data->in_chunk_len == 1)
|
||||||
{
|
{
|
||||||
@ -198,7 +190,9 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)),
|
|||||||
int have_line = 1;
|
int have_line = 1;
|
||||||
char *t;
|
char *t;
|
||||||
ptr = grub_memchr (nb->data, '\n', nb->tail - nb->data);
|
ptr = grub_memchr (nb->data, '\n', nb->tail - nb->data);
|
||||||
if (ptr == NULL)
|
if (ptr)
|
||||||
|
ptr++;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
have_line = 0;
|
have_line = 0;
|
||||||
ptr = (char *) nb->tail;
|
ptr = (char *) nb->tail;
|
||||||
@ -318,14 +312,12 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
|||||||
int i;
|
int i;
|
||||||
struct grub_net_buff *nb;
|
struct grub_net_buff *nb;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
char* server = file->device->net->server;
|
|
||||||
int port = file->device->net->port;
|
|
||||||
|
|
||||||
nb = grub_netbuff_alloc (GRUB_NET_TCP_RESERVE_SIZE
|
nb = grub_netbuff_alloc (GRUB_NET_TCP_RESERVE_SIZE
|
||||||
+ sizeof ("GET ") - 1
|
+ sizeof ("GET ") - 1
|
||||||
+ grub_strlen (data->filename)
|
+ grub_strlen (data->filename)
|
||||||
+ sizeof (" HTTP/1.1\r\nHost: ") - 1
|
+ sizeof (" HTTP/1.1\r\nHost: ") - 1
|
||||||
+ grub_strlen (server) + sizeof (":XXXXXXXXXX")
|
+ grub_strlen (file->device->net->server)
|
||||||
+ sizeof ("\r\nUser-Agent: " PACKAGE_STRING
|
+ sizeof ("\r\nUser-Agent: " PACKAGE_STRING
|
||||||
"\r\n") - 1
|
"\r\n") - 1
|
||||||
+ sizeof ("Range: bytes=XXXXXXXXXXXXXXXXXXXX"
|
+ sizeof ("Range: bytes=XXXXXXXXXXXXXXXXXXXX"
|
||||||
@ -364,7 +356,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
|||||||
sizeof (" HTTP/1.1\r\nHost: ") - 1);
|
sizeof (" HTTP/1.1\r\nHost: ") - 1);
|
||||||
|
|
||||||
ptr = nb->tail;
|
ptr = nb->tail;
|
||||||
err = grub_netbuff_put (nb, grub_strlen (server));
|
err = grub_netbuff_put (nb, grub_strlen (file->device->net->server));
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
grub_netbuff_free (nb);
|
grub_netbuff_free (nb);
|
||||||
@ -373,15 +365,6 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
|||||||
grub_memcpy (ptr, file->device->net->server,
|
grub_memcpy (ptr, file->device->net->server,
|
||||||
grub_strlen (file->device->net->server));
|
grub_strlen (file->device->net->server));
|
||||||
|
|
||||||
if (port)
|
|
||||||
{
|
|
||||||
ptr = nb->tail;
|
|
||||||
grub_snprintf ((char *) ptr,
|
|
||||||
sizeof (":XXXXXXXXXX"),
|
|
||||||
":%d",
|
|
||||||
port);
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr = nb->tail;
|
ptr = nb->tail;
|
||||||
err = grub_netbuff_put (nb,
|
err = grub_netbuff_put (nb,
|
||||||
sizeof ("\r\nUser-Agent: " PACKAGE_STRING "\r\n")
|
sizeof ("\r\nUser-Agent: " PACKAGE_STRING "\r\n")
|
||||||
@ -407,10 +390,8 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
|||||||
grub_netbuff_put (nb, 2);
|
grub_netbuff_put (nb, 2);
|
||||||
grub_memcpy (ptr, "\r\n", 2);
|
grub_memcpy (ptr, "\r\n", 2);
|
||||||
|
|
||||||
grub_dprintf ("http", "opening path %s on host %s TCP port %d\n",
|
data->sock = grub_net_tcp_open (file->device->net->server,
|
||||||
data->filename, server, port ? port : HTTP_PORT);
|
HTTP_PORT, http_receive,
|
||||||
data->sock = grub_net_tcp_open (server,
|
|
||||||
port ? port : HTTP_PORT, http_receive,
|
|
||||||
http_err, NULL,
|
http_err, NULL,
|
||||||
file);
|
file);
|
||||||
if (!data->sock)
|
if (!data->sock)
|
||||||
@ -428,7 +409,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; data->sock && !data->headers_recv && i < 100; i++)
|
for (i = 0; !data->headers_recv && i < 100; i++)
|
||||||
{
|
{
|
||||||
grub_net_tcp_retransmit ();
|
grub_net_tcp_retransmit ();
|
||||||
grub_net_poll_cards (300, &data->headers_recv);
|
grub_net_poll_cards (300, &data->headers_recv);
|
||||||
@ -436,7 +417,6 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
|
|||||||
|
|
||||||
if (!data->headers_recv)
|
if (!data->headers_recv)
|
||||||
{
|
{
|
||||||
if (data->sock)
|
|
||||||
grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT);
|
grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT);
|
||||||
if (data->err)
|
if (data->err)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <grub/net/netbuff.h>
|
#include <grub/net/netbuff.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/priority_queue.h>
|
#include <grub/priority_queue.h>
|
||||||
#include <grub/safemath.h>
|
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
|
|
||||||
struct iphdr {
|
struct iphdr {
|
||||||
@ -240,45 +239,6 @@ handle_dgram (struct grub_net_buff *nb,
|
|||||||
{
|
{
|
||||||
struct udphdr *udph;
|
struct udphdr *udph;
|
||||||
udph = (struct udphdr *) nb->data;
|
udph = (struct udphdr *) nb->data;
|
||||||
|
|
||||||
if (proto == GRUB_NET_IP_UDP && udph->dst == grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT))
|
|
||||||
{
|
|
||||||
if (udph->chksum)
|
|
||||||
{
|
|
||||||
grub_uint16_t chk, expected;
|
|
||||||
chk = udph->chksum;
|
|
||||||
udph->chksum = 0;
|
|
||||||
expected = grub_net_ip_transport_checksum (nb,
|
|
||||||
GRUB_NET_IP_UDP,
|
|
||||||
source,
|
|
||||||
dest);
|
|
||||||
if (expected != chk)
|
|
||||||
{
|
|
||||||
grub_dprintf ("net", "Invalid UDP checksum. "
|
|
||||||
"Expected %x, got %x\n",
|
|
||||||
grub_be_to_cpu16 (expected),
|
|
||||||
grub_be_to_cpu16 (chk));
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
udph->chksum = chk;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = grub_netbuff_pull (nb, sizeof (*udph));
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = grub_net_process_dhcp6 (nb, card);
|
|
||||||
if (err)
|
|
||||||
grub_print_error ();
|
|
||||||
|
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (proto == GRUB_NET_IP_UDP && grub_be_to_cpu16 (udph->dst) == 68)
|
if (proto == GRUB_NET_IP_UDP && grub_be_to_cpu16 (udph->dst) == 68)
|
||||||
{
|
{
|
||||||
const struct grub_net_bootp_packet *bootp;
|
const struct grub_net_bootp_packet *bootp;
|
||||||
@ -552,14 +512,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb,
|
|||||||
{
|
{
|
||||||
rsm->total_len = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK)
|
rsm->total_len = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK)
|
||||||
+ (nb->tail - nb->data));
|
+ (nb->tail - nb->data));
|
||||||
|
rsm->total_len -= ((iph->verhdrlen & 0xf) * sizeof (grub_uint32_t));
|
||||||
if (grub_sub (rsm->total_len, (iph->verhdrlen & 0xf) * sizeof (grub_uint32_t),
|
|
||||||
&rsm->total_len))
|
|
||||||
{
|
|
||||||
grub_dprintf ("net", "IP reassembly size underflow\n");
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
rsm->asm_netbuff = grub_netbuff_alloc (rsm->total_len);
|
rsm->asm_netbuff = grub_netbuff_alloc (rsm->total_len);
|
||||||
if (!rsm->asm_netbuff)
|
if (!rsm->asm_netbuff)
|
||||||
{
|
{
|
||||||
|
@ -442,12 +442,6 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
|
|||||||
grub_uint16_t newip[8];
|
grub_uint16_t newip[8];
|
||||||
const char *ptr = val;
|
const char *ptr = val;
|
||||||
int word, quaddot = -1;
|
int word, quaddot = -1;
|
||||||
int bracketed = 0;
|
|
||||||
|
|
||||||
if (ptr[0] == '[') {
|
|
||||||
bracketed = 1;
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ptr[0] == ':' && ptr[1] != ':')
|
if (ptr[0] == ':' && ptr[1] != ':')
|
||||||
return 0;
|
return 0;
|
||||||
@ -486,9 +480,6 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
|
|||||||
grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0]));
|
grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0]));
|
||||||
}
|
}
|
||||||
grub_memcpy (ip, newip, 16);
|
grub_memcpy (ip, newip, 16);
|
||||||
if (bracketed && *ptr == ']') {
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
if (rest)
|
if (rest)
|
||||||
*rest = ptr;
|
*rest = ptr;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1274,10 +1265,8 @@ grub_net_open_real (const char *name)
|
|||||||
{
|
{
|
||||||
grub_net_app_level_t proto;
|
grub_net_app_level_t proto;
|
||||||
const char *protname, *server;
|
const char *protname, *server;
|
||||||
char *host;
|
|
||||||
grub_size_t protnamelen;
|
grub_size_t protnamelen;
|
||||||
int try;
|
int try;
|
||||||
int port = 0;
|
|
||||||
|
|
||||||
if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0)
|
if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0)
|
||||||
{
|
{
|
||||||
@ -1315,72 +1304,6 @@ grub_net_open_real (const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* port_start;
|
|
||||||
/* ipv6 or port specified? */
|
|
||||||
if ((port_start = grub_strchr (server, ':')))
|
|
||||||
{
|
|
||||||
char* ipv6_begin;
|
|
||||||
if((ipv6_begin = grub_strchr (server, '[')))
|
|
||||||
{
|
|
||||||
char* ipv6_end = grub_strchr (server, ']');
|
|
||||||
if(!ipv6_end)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_NET_BAD_ADDRESS,
|
|
||||||
N_("mismatched [ in address"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
/* port number after bracketed ipv6 addr */
|
|
||||||
if(ipv6_end[1] == ':')
|
|
||||||
{
|
|
||||||
port = grub_strtoul (ipv6_end + 2, NULL, 10);
|
|
||||||
if(port > 65535)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_NET_BAD_ADDRESS,
|
|
||||||
N_("bad port number"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
host = grub_strndup (ipv6_begin, (ipv6_end - ipv6_begin) + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (grub_strchr (port_start + 1, ':'))
|
|
||||||
{
|
|
||||||
int iplen = grub_strlen (server);
|
|
||||||
/* bracket bare ipv6 addrs */
|
|
||||||
host = grub_malloc (iplen + 3);
|
|
||||||
if(!host)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
host[0] = '[';
|
|
||||||
grub_memcpy (host + 1, server, iplen);
|
|
||||||
host[iplen + 1] = ']';
|
|
||||||
host[iplen + 2] = '\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* hostname:port or ipv4:port */
|
|
||||||
port = grub_strtol (port_start + 1, NULL, 10);
|
|
||||||
if(port > 65535)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_NET_BAD_ADDRESS,
|
|
||||||
N_("bad port number"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
host = grub_strndup (server, port_start - server);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
host = grub_strdup (server);
|
|
||||||
}
|
|
||||||
if (!host)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (try = 0; try < 2; try++)
|
for (try = 0; try < 2; try++)
|
||||||
{
|
{
|
||||||
FOR_NET_APP_LEVEL (proto)
|
FOR_NET_APP_LEVEL (proto)
|
||||||
@ -1390,19 +1313,15 @@ grub_net_open_real (const char *name)
|
|||||||
{
|
{
|
||||||
grub_net_t ret = grub_zalloc (sizeof (*ret));
|
grub_net_t ret = grub_zalloc (sizeof (*ret));
|
||||||
if (!ret)
|
if (!ret)
|
||||||
grub_free (host);
|
return NULL;
|
||||||
if (host)
|
ret->protocol = proto;
|
||||||
{
|
ret->server = grub_strdup (server);
|
||||||
ret->server = grub_strdup (host);
|
|
||||||
if (!ret->server)
|
if (!ret->server)
|
||||||
{
|
{
|
||||||
grub_free (ret);
|
grub_free (ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ret->fs = &grub_net_fs;
|
ret->fs = &grub_net_fs;
|
||||||
ret->protocol = proto;
|
|
||||||
ret->port = port;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1548,7 +1467,6 @@ grub_net_fs_close (grub_file_t file)
|
|||||||
grub_netbuff_free (file->device->net->packs.first->nb);
|
grub_netbuff_free (file->device->net->packs.first->nb);
|
||||||
grub_net_remove_packet (file->device->net->packs.first);
|
grub_net_remove_packet (file->device->net->packs.first);
|
||||||
}
|
}
|
||||||
if (!file->device->net->broken)
|
|
||||||
file->device->net->protocol->close (file);
|
file->device->net->protocol->close (file);
|
||||||
grub_free (file->device->net->name);
|
grub_free (file->device->net->name);
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
@ -1771,10 +1689,7 @@ grub_net_seek_real (struct grub_file *file, grub_off_t offset)
|
|||||||
file->device->net->stall = 0;
|
file->device->net->stall = 0;
|
||||||
err = file->device->net->protocol->open (file, file->device->net->name);
|
err = file->device->net->protocol->open (file, file->device->net->name);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
|
||||||
file->device->net->broken = 1;
|
|
||||||
return err;
|
return err;
|
||||||
}
|
|
||||||
grub_net_fs_read_real (file, NULL, offset);
|
grub_net_fs_read_real (file, NULL, offset);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
@ -1783,9 +1698,6 @@ grub_net_seek_real (struct grub_file *file, grub_off_t offset)
|
|||||||
static grub_ssize_t
|
static grub_ssize_t
|
||||||
grub_net_fs_read (grub_file_t file, char *buf, grub_size_t len)
|
grub_net_fs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||||
{
|
{
|
||||||
if (file->device->net->broken)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (file->offset != file->device->net->offset)
|
if (file->offset != file->device->net->offset)
|
||||||
{
|
{
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
@ -79,23 +79,10 @@ grub_netbuff_alloc (grub_size_t len)
|
|||||||
|
|
||||||
COMPILE_TIME_ASSERT (NETBUFF_ALIGN % sizeof (grub_properly_aligned_t) == 0);
|
COMPILE_TIME_ASSERT (NETBUFF_ALIGN % sizeof (grub_properly_aligned_t) == 0);
|
||||||
|
|
||||||
/*
|
|
||||||
* The largest size of a TCP packet is 64 KiB, and everything else
|
|
||||||
* should be a lot smaller - most MTUs are 1500 or less. Cap data
|
|
||||||
* size at 64 KiB + a buffer.
|
|
||||||
*/
|
|
||||||
if (len > 0xffffUL + 0x1000UL)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BUG,
|
|
||||||
"attempted to allocate a packet that is too big");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len < NETBUFFMINLEN)
|
if (len < NETBUFFMINLEN)
|
||||||
len = NETBUFFMINLEN;
|
len = NETBUFFMINLEN;
|
||||||
|
|
||||||
len = ALIGN_UP (len, NETBUFF_ALIGN);
|
len = ALIGN_UP (len, NETBUFF_ALIGN);
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EMU
|
#ifdef GRUB_MACHINE_EMU
|
||||||
data = grub_malloc (len + sizeof (*nb));
|
data = grub_malloc (len + sizeof (*nb));
|
||||||
#else
|
#else
|
||||||
|
@ -251,9 +251,9 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
|
|||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
case TFTP_ERROR:
|
case TFTP_ERROR:
|
||||||
data->have_oack = 1;
|
data->have_oack = 1;
|
||||||
|
grub_netbuff_free (nb);
|
||||||
grub_error (GRUB_ERR_IO, "%s", tftph->u.err.errmsg);
|
grub_error (GRUB_ERR_IO, "%s", tftph->u.err.errmsg);
|
||||||
grub_error_save (&data->save_err);
|
grub_error_save (&data->save_err);
|
||||||
grub_netbuff_free (nb);
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
default:
|
default:
|
||||||
grub_netbuff_free (nb);
|
grub_netbuff_free (nb);
|
||||||
@ -295,7 +295,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
|||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
grub_uint8_t *nbd;
|
grub_uint8_t *nbd;
|
||||||
grub_net_network_level_address_t addr;
|
grub_net_network_level_address_t addr;
|
||||||
int port = file->device->net->port;
|
|
||||||
|
|
||||||
data = grub_zalloc (sizeof (*data));
|
data = grub_zalloc (sizeof (*data));
|
||||||
if (!data)
|
if (!data)
|
||||||
@ -362,15 +361,12 @@ tftp_open (struct grub_file *file, const char *filename)
|
|||||||
err = grub_net_resolve_address (file->device->net->server, &addr);
|
err = grub_net_resolve_address (file->device->net->server, &addr);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n",
|
|
||||||
(unsigned long long)data->file_size,
|
|
||||||
(unsigned long long)data->block_size);
|
|
||||||
grub_free (data);
|
grub_free (data);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->sock = grub_net_udp_open (addr,
|
data->sock = grub_net_udp_open (addr,
|
||||||
port ? port : TFTP_SERVER_PORT, tftp_receive,
|
TFTP_SERVER_PORT, tftp_receive,
|
||||||
file);
|
file);
|
||||||
if (!data->sock)
|
if (!data->sock)
|
||||||
{
|
{
|
||||||
@ -404,7 +400,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
|||||||
{
|
{
|
||||||
grub_net_udp_close (data->sock);
|
grub_net_udp_close (data->sock);
|
||||||
grub_free (data);
|
grub_free (data);
|
||||||
file->data = NULL;
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,8 +395,6 @@ grub_unicode_estimate_width (const struct grub_unicode_glyph *c)
|
|||||||
{
|
{
|
||||||
if (grub_unicode_get_comb_type (c->base))
|
if (grub_unicode_get_comb_type (c->base))
|
||||||
return 0;
|
return 0;
|
||||||
if (((unsigned long) (c->base >> 3)) >= ARRAY_SIZE (widthspec))
|
|
||||||
return 1;
|
|
||||||
if (widthspec[c->base >> 3] & (1 << (c->base & 7)))
|
if (widthspec[c->base >> 3] & (1 << (c->base & 7)))
|
||||||
return 2;
|
return 2;
|
||||||
else
|
else
|
||||||
@ -472,9 +470,6 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen,
|
|||||||
if (!haveout)
|
if (!haveout)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (out->ncomb == GRUB_UNICODE_NCOMB_MAX)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (comb_type == GRUB_UNICODE_COMB_MC
|
if (comb_type == GRUB_UNICODE_COMB_MC
|
||||||
|| comb_type == GRUB_UNICODE_COMB_ME
|
|| comb_type == GRUB_UNICODE_COMB_ME
|
||||||
|| comb_type == GRUB_UNICODE_COMB_MN)
|
|| comb_type == GRUB_UNICODE_COMB_MN)
|
||||||
|
@ -407,15 +407,6 @@ static grub_err_t
|
|||||||
grub_normal_read_line_real (char **line, int cont, int nested)
|
grub_normal_read_line_real (char **line, int cont, int nested)
|
||||||
{
|
{
|
||||||
const char *prompt;
|
const char *prompt;
|
||||||
#if QUIET_BOOT
|
|
||||||
static int displayed_intro;
|
|
||||||
|
|
||||||
if (! displayed_intro)
|
|
||||||
{
|
|
||||||
grub_normal_reader_init (nested);
|
|
||||||
displayed_intro = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (cont)
|
if (cont)
|
||||||
/* TRANSLATORS: it's command line prompt. */
|
/* TRANSLATORS: it's command line prompt. */
|
||||||
@ -468,9 +459,7 @@ grub_cmdline_run (int nested, int force_auth)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !QUIET_BOOT
|
|
||||||
grub_normal_reader_init (nested);
|
grub_normal_reader_init (nested);
|
||||||
#endif
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -603,30 +603,6 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
|||||||
static struct grub_term_coordinate *pos;
|
static struct grub_term_coordinate *pos;
|
||||||
int entry = -1;
|
int entry = -1;
|
||||||
|
|
||||||
if (timeout == 0)
|
|
||||||
{
|
|
||||||
/* If modifier key statuses can't be detected without a delay,
|
|
||||||
then a hidden timeout of zero cannot be interrupted in any way,
|
|
||||||
which is not very helpful. Bump it to three seconds in this
|
|
||||||
case to give the user a fighting chance. */
|
|
||||||
grub_term_input_t term;
|
|
||||||
int nterms = 0;
|
|
||||||
int mods_detectable = 1;
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
|
||||||
{
|
|
||||||
if (!term->getkeystatus)
|
|
||||||
{
|
|
||||||
mods_detectable = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nterms++;
|
|
||||||
}
|
|
||||||
if (!mods_detectable || !nterms)
|
|
||||||
timeout = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (timeout_style == TIMEOUT_STYLE_COUNTDOWN && timeout)
|
if (timeout_style == TIMEOUT_STYLE_COUNTDOWN && timeout)
|
||||||
{
|
{
|
||||||
pos = grub_term_save_pos ();
|
pos = grub_term_save_pos ();
|
||||||
@ -831,18 +807,12 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
|||||||
|
|
||||||
/* Callback invoked immediately before a menu entry is executed. */
|
/* Callback invoked immediately before a menu entry is executed. */
|
||||||
static void
|
static void
|
||||||
notify_booting (grub_menu_entry_t entry
|
notify_booting (grub_menu_entry_t entry,
|
||||||
#if QUIET_BOOT
|
|
||||||
__attribute__((unused))
|
|
||||||
#endif
|
|
||||||
,
|
|
||||||
void *userdata __attribute__((unused)))
|
void *userdata __attribute__((unused)))
|
||||||
{
|
{
|
||||||
#if !QUIET_BOOT
|
|
||||||
grub_printf (" ");
|
grub_printf (" ");
|
||||||
grub_printf_ (N_("Booting `%s'"), entry->title);
|
grub_printf_ (N_("Booting `%s'"), entry->title);
|
||||||
grub_printf ("\n\n");
|
grub_printf ("\n\n");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback invoked when a default menu entry executed because of a timeout
|
/* Callback invoked when a default menu entry executed because of a timeout
|
||||||
@ -890,9 +860,6 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
|
|||||||
int boot_entry;
|
int boot_entry;
|
||||||
grub_menu_entry_t e;
|
grub_menu_entry_t e;
|
||||||
int auto_boot;
|
int auto_boot;
|
||||||
#if QUIET_BOOT
|
|
||||||
int initial_timeout = grub_menu_get_timeout ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
boot_entry = run_menu (menu, nested, &auto_boot);
|
boot_entry = run_menu (menu, nested, &auto_boot);
|
||||||
if (boot_entry < 0)
|
if (boot_entry < 0)
|
||||||
@ -902,10 +869,6 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
|
|||||||
if (! e)
|
if (! e)
|
||||||
continue; /* Menu is empty. */
|
continue; /* Menu is empty. */
|
||||||
|
|
||||||
#if QUIET_BOOT
|
|
||||||
/* Only clear the screen if we drew the menu in the first place. */
|
|
||||||
if (initial_timeout != 0)
|
|
||||||
#endif
|
|
||||||
grub_cls ();
|
grub_cls ();
|
||||||
|
|
||||||
if (auto_boot)
|
if (auto_boot)
|
||||||
|
@ -30,8 +30,3 @@ grub_install_get_default_x86_platform (void)
|
|||||||
return "i386-pc";
|
return "i386-pc";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
grub_install_get_default_powerpc_machtype (void)
|
|
||||||
{
|
|
||||||
return "generic";
|
|
||||||
}
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#if !defined (__MINGW32__) && !defined (__CYGWIN__) && !defined (__AROS__)
|
|
||||||
#include "unix/efivar.c"
|
|
||||||
#endif
|
|
@ -963,19 +963,6 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
|
|||||||
*pp = '\0';
|
*pp = '\0';
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is a FusionIO disk. */
|
|
||||||
if ((strncmp ("fio", p, 3) == 0) && p[3] >= 'a' && p[3] <= 'z')
|
|
||||||
{
|
|
||||||
char *pp = p + 3;
|
|
||||||
while (*pp >= 'a' && *pp <= 'z')
|
|
||||||
pp++;
|
|
||||||
if (*pp)
|
|
||||||
*is_part = 1;
|
|
||||||
/* /dev/fio[a-z]+[0-9]* */
|
|
||||||
*pp = '\0';
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
@ -19,13 +19,10 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <grub/util/install.h>
|
#include <grub/util/install.h>
|
||||||
#include <grub/emu/config.h>
|
|
||||||
#include <grub/emu/exec.h>
|
#include <grub/emu/exec.h>
|
||||||
#include <grub/emu/misc.h>
|
#include <grub/emu/misc.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
@ -131,23 +128,8 @@ const char *
|
|||||||
grub_install_get_default_arm_platform (void)
|
grub_install_get_default_arm_platform (void)
|
||||||
{
|
{
|
||||||
if (is_efi_system())
|
if (is_efi_system())
|
||||||
{
|
return "arm-efi";
|
||||||
const char *pkglibdir = grub_util_get_pkglibdir ();
|
|
||||||
const char *platform;
|
|
||||||
char *pd;
|
|
||||||
int found;
|
|
||||||
|
|
||||||
platform = "arm-efi";
|
|
||||||
|
|
||||||
pd = grub_util_path_concat (2, pkglibdir, platform);
|
|
||||||
found = grub_util_is_directory (pd);
|
|
||||||
free (pd);
|
|
||||||
if (found)
|
|
||||||
return platform;
|
|
||||||
else
|
else
|
||||||
grub_util_info ("... but %s platform not available", platform);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "arm-uboot";
|
return "arm-uboot";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,23 +138,10 @@ grub_install_get_default_x86_platform (void)
|
|||||||
{
|
{
|
||||||
if (is_efi_system())
|
if (is_efi_system())
|
||||||
{
|
{
|
||||||
const char *pkglibdir = grub_util_get_pkglibdir ();
|
|
||||||
const char *platform;
|
|
||||||
char *pd;
|
|
||||||
int found;
|
|
||||||
|
|
||||||
if (read_platform_size() == 64)
|
if (read_platform_size() == 64)
|
||||||
platform = "x86_64-efi";
|
return "x86_64-efi";
|
||||||
else
|
else
|
||||||
platform = "i386-efi";
|
return "i386-efi";
|
||||||
|
|
||||||
pd = grub_util_path_concat (2, pkglibdir, platform);
|
|
||||||
found = grub_util_is_directory (pd);
|
|
||||||
free (pd);
|
|
||||||
if (found)
|
|
||||||
return platform;
|
|
||||||
else
|
|
||||||
grub_util_info ("... but %s platform not available", platform);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_util_info ("Looking for /proc/device-tree ..");
|
grub_util_info ("Looking for /proc/device-tree ..");
|
||||||
@ -185,74 +154,3 @@ grub_install_get_default_x86_platform (void)
|
|||||||
grub_util_info ("... not found");
|
grub_util_info ("... not found");
|
||||||
return "i386-pc";
|
return "i386-pc";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
grub_install_get_default_powerpc_machtype (void)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
char *buf = NULL;
|
|
||||||
size_t len = 0;
|
|
||||||
const char *machtype = "generic";
|
|
||||||
|
|
||||||
fp = grub_util_fopen ("/proc/cpuinfo", "r");
|
|
||||||
if (! fp)
|
|
||||||
return machtype;
|
|
||||||
|
|
||||||
while (getline (&buf, &len, fp) > 0)
|
|
||||||
{
|
|
||||||
if (strncmp (buf, "pmac-generation",
|
|
||||||
sizeof ("pmac-generation") - 1) == 0)
|
|
||||||
{
|
|
||||||
if (strstr (buf, "NewWorld"))
|
|
||||||
{
|
|
||||||
machtype = "pmac_newworld";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (strstr (buf, "OldWorld"))
|
|
||||||
{
|
|
||||||
machtype = "pmac_oldworld";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp (buf, "motherboard", sizeof ("motherboard") - 1) == 0 &&
|
|
||||||
strstr (buf, "AAPL"))
|
|
||||||
{
|
|
||||||
machtype = "pmac_oldworld";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp (buf, "machine", sizeof ("machine") - 1) == 0 &&
|
|
||||||
strstr (buf, "CHRP IBM"))
|
|
||||||
{
|
|
||||||
if (strstr (buf, "qemu"))
|
|
||||||
{
|
|
||||||
machtype = "chrp_ibm_qemu";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
machtype = "chrp_ibm";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp (buf, "platform", sizeof ("platform") - 1) == 0)
|
|
||||||
{
|
|
||||||
if (strstr (buf, "Maple"))
|
|
||||||
{
|
|
||||||
machtype = "maple";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (strstr (buf, "Cell"))
|
|
||||||
{
|
|
||||||
machtype = "cell";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free (buf);
|
|
||||||
fclose (fp);
|
|
||||||
return machtype;
|
|
||||||
}
|
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include <grub/emu/config.h>
|
#include <grub/emu/config.h>
|
||||||
#include <grub/util/install.h>
|
#include <grub/util/install.h>
|
||||||
#include <grub/util/misc.h>
|
#include <grub/util/misc.h>
|
||||||
#include <grub/list.h>
|
|
||||||
#include <grub/safemath.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
@ -64,27 +61,13 @@ grub_util_get_localedir (void)
|
|||||||
return LOCALEDIR;
|
return LOCALEDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cfglist
|
|
||||||
{
|
|
||||||
struct cfglist *next;
|
|
||||||
struct cfglist *prev;
|
|
||||||
char *path;
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_util_load_config (struct grub_util_config *cfg)
|
grub_util_load_config (struct grub_util_config *cfg)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
const char *argv[4];
|
const char *argv[4];
|
||||||
char *script = NULL, *ptr;
|
char *script, *ptr;
|
||||||
const char *cfgfile, *iptr;
|
const char *cfgfile, *iptr;
|
||||||
char *cfgdir;
|
|
||||||
grub_util_fd_dir_t d;
|
|
||||||
struct cfglist *cfgpaths = NULL, *cfgpath, *next_cfgpath;
|
|
||||||
int num_cfgpaths = 0;
|
|
||||||
size_t len_cfgpaths = 0;
|
|
||||||
char **sorted_cfgpaths = NULL;
|
|
||||||
int i;
|
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
const char *v;
|
const char *v;
|
||||||
@ -100,74 +83,18 @@ grub_util_load_config (struct grub_util_config *cfg)
|
|||||||
cfg->grub_distributor = xstrdup (v);
|
cfg->grub_distributor = xstrdup (v);
|
||||||
|
|
||||||
cfgfile = grub_util_get_config_filename ();
|
cfgfile = grub_util_get_config_filename ();
|
||||||
if (grub_util_is_regular (cfgfile))
|
if (!grub_util_is_regular (cfgfile))
|
||||||
{
|
return;
|
||||||
size_t sz;
|
|
||||||
|
|
||||||
++num_cfgpaths;
|
|
||||||
sz = strlen (cfgfile);
|
|
||||||
if (grub_mul (sz, 4, &sz) ||
|
|
||||||
grub_add (sz, sizeof (". ''; ") - 1, &sz) ||
|
|
||||||
grub_add (len_cfgpaths, sz, &len_cfgpaths))
|
|
||||||
grub_util_error ("%s", _("overflow is detected"));
|
|
||||||
}
|
|
||||||
|
|
||||||
cfgdir = xasprintf ("%s.d", cfgfile);
|
|
||||||
d = grub_util_fd_opendir (cfgdir);
|
|
||||||
if (d)
|
|
||||||
{
|
|
||||||
grub_util_fd_dirent_t de;
|
|
||||||
|
|
||||||
while ((de = grub_util_fd_readdir (d)))
|
|
||||||
{
|
|
||||||
const char *ext = strrchr (de->d_name, '.');
|
|
||||||
size_t sz;
|
|
||||||
|
|
||||||
if (!ext || strcmp (ext, ".cfg") != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
cfgpath = xmalloc (sizeof (*cfgpath));
|
|
||||||
cfgpath->path = grub_util_path_concat (2, cfgdir, de->d_name);
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&cfgpaths), GRUB_AS_LIST (cfgpath));
|
|
||||||
++num_cfgpaths;
|
|
||||||
sz = strlen (cfgpath->path);
|
|
||||||
if (grub_mul (sz, 4, &sz) ||
|
|
||||||
grub_add (sz, sizeof (". ''; ") - 1, &sz) ||
|
|
||||||
grub_add (len_cfgpaths, sz, &len_cfgpaths))
|
|
||||||
grub_util_error ("%s", _("overflow is detected"));
|
|
||||||
}
|
|
||||||
grub_util_fd_closedir (d);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_cfgpaths == 0)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
sorted_cfgpaths = xcalloc (num_cfgpaths, sizeof (*sorted_cfgpaths));
|
|
||||||
i = 0;
|
|
||||||
if (grub_util_is_regular (cfgfile))
|
|
||||||
sorted_cfgpaths[i++] = xstrdup (cfgfile);
|
|
||||||
FOR_LIST_ELEMENTS_SAFE (cfgpath, next_cfgpath, cfgpaths)
|
|
||||||
{
|
|
||||||
sorted_cfgpaths[i++] = cfgpath->path;
|
|
||||||
free (cfgpath);
|
|
||||||
}
|
|
||||||
assert (i == num_cfgpaths);
|
|
||||||
qsort (sorted_cfgpaths + 1, num_cfgpaths - 1, sizeof (*sorted_cfgpaths),
|
|
||||||
(int (*) (const void *, const void *)) strcmp);
|
|
||||||
|
|
||||||
argv[0] = "sh";
|
argv[0] = "sh";
|
||||||
argv[1] = "-c";
|
argv[1] = "-c";
|
||||||
|
|
||||||
if (grub_add (len_cfgpaths, 300, &len_cfgpaths))
|
script = xcalloc (4, strlen (cfgfile) + 300);
|
||||||
grub_util_error ("%s", _("overflow is detected"));
|
|
||||||
script = xmalloc (len_cfgpaths);
|
|
||||||
|
|
||||||
ptr = script;
|
ptr = script;
|
||||||
for (i = 0; i < num_cfgpaths; i++)
|
|
||||||
{
|
|
||||||
memcpy (ptr, ". '", 3);
|
memcpy (ptr, ". '", 3);
|
||||||
ptr += 3;
|
ptr += 3;
|
||||||
for (iptr = sorted_cfgpaths[i]; *iptr; iptr++)
|
for (iptr = cfgfile; *iptr; iptr++)
|
||||||
{
|
{
|
||||||
if (*iptr == '\\')
|
if (*iptr == '\\')
|
||||||
{
|
{
|
||||||
@ -177,11 +104,8 @@ grub_util_load_config (struct grub_util_config *cfg)
|
|||||||
}
|
}
|
||||||
*ptr++ = *iptr;
|
*ptr++ = *iptr;
|
||||||
}
|
}
|
||||||
memcpy (ptr, "'; ", 3);
|
|
||||||
ptr += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy (ptr, "printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\n\" "
|
strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\n\" "
|
||||||
"\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\"");
|
"\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\"");
|
||||||
|
|
||||||
argv[2] = script;
|
argv[2] = script;
|
||||||
@ -201,11 +125,9 @@ grub_util_load_config (struct grub_util_config *cfg)
|
|||||||
waitpid (pid, NULL, 0);
|
waitpid (pid, NULL, 0);
|
||||||
}
|
}
|
||||||
if (f)
|
if (f)
|
||||||
goto out;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_cfgpaths; i++)
|
f = grub_util_fopen (cfgfile, "r");
|
||||||
{
|
|
||||||
f = grub_util_fopen (sorted_cfgpaths[i], "r");
|
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
grub_util_parse_config (f, cfg, 0);
|
grub_util_parse_config (f, cfg, 0);
|
||||||
@ -214,12 +136,4 @@ grub_util_load_config (struct grub_util_config *cfg)
|
|||||||
else
|
else
|
||||||
grub_util_warn (_("cannot open configuration file `%s': %s"),
|
grub_util_warn (_("cannot open configuration file `%s': %s"),
|
||||||
cfgfile, strerror (errno));
|
cfgfile, strerror (errno));
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
free (script);
|
|
||||||
for (i = 0; i < num_cfgpaths; i++)
|
|
||||||
free (sorted_cfgpaths[i]);
|
|
||||||
free (sorted_cfgpaths);
|
|
||||||
free (cfgdir);
|
|
||||||
}
|
}
|
||||||
|
@ -1,508 +0,0 @@
|
|||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2013,2019 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Contains portions derived from efibootmgr, licensed as follows:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2001-2004 Dell, Inc. <Matt_Domsch@dell.com>
|
|
||||||
* Copyright 2015-2016 Red Hat, Inc. <pjones@redhat.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_EFIVAR
|
|
||||||
|
|
||||||
#include <grub/util/install.h>
|
|
||||||
#include <grub/emu/hostdisk.h>
|
|
||||||
#include <grub/util/misc.h>
|
|
||||||
#include <grub/list.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/emu/exec.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <efiboot.h>
|
|
||||||
#include <efivar.h>
|
|
||||||
|
|
||||||
struct efi_variable {
|
|
||||||
struct efi_variable *next;
|
|
||||||
struct efi_variable **prev;
|
|
||||||
char *name;
|
|
||||||
efi_guid_t guid;
|
|
||||||
uint8_t *data;
|
|
||||||
size_t data_size;
|
|
||||||
uint32_t attributes;
|
|
||||||
int num;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Boot option attributes. */
|
|
||||||
#define LOAD_OPTION_ACTIVE 0x00000001
|
|
||||||
|
|
||||||
/* GUIDs. */
|
|
||||||
#define BLKX_UNKNOWN_GUID \
|
|
||||||
EFI_GUID (0x47c7b225, 0xc42a, 0x11d2, 0x8e57, 0x00, 0xa0, 0xc9, 0x69, \
|
|
||||||
0x72, 0x3b)
|
|
||||||
|
|
||||||
/* Log all errors recorded by libefivar/libefiboot. */
|
|
||||||
static void
|
|
||||||
show_efi_errors (void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int saved_errno = errno;
|
|
||||||
|
|
||||||
for (i = 0; ; ++i)
|
|
||||||
{
|
|
||||||
char *filename, *function, *message = NULL;
|
|
||||||
int line, error = 0, rc;
|
|
||||||
|
|
||||||
rc = efi_error_get (i, &filename, &function, &line, &message, &error);
|
|
||||||
if (rc < 0)
|
|
||||||
/* Give up. The caller is going to log an error anyway. */
|
|
||||||
break;
|
|
||||||
if (rc == 0)
|
|
||||||
/* No more errors. */
|
|
||||||
break;
|
|
||||||
grub_util_warn ("%s: %s: %s", function, message, strerror (error));
|
|
||||||
}
|
|
||||||
|
|
||||||
efi_error_clear ();
|
|
||||||
errno = saved_errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct efi_variable *
|
|
||||||
new_efi_variable (void)
|
|
||||||
{
|
|
||||||
struct efi_variable *new = xmalloc (sizeof (*new));
|
|
||||||
memset (new, 0, sizeof (*new));
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct efi_variable *
|
|
||||||
new_boot_variable (void)
|
|
||||||
{
|
|
||||||
struct efi_variable *new = new_efi_variable ();
|
|
||||||
new->guid = EFI_GLOBAL_GUID;
|
|
||||||
new->attributes = EFI_VARIABLE_NON_VOLATILE |
|
|
||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
|
||||||
EFI_VARIABLE_RUNTIME_ACCESS;
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
free_efi_variable (struct efi_variable *entry)
|
|
||||||
{
|
|
||||||
if (entry)
|
|
||||||
{
|
|
||||||
free (entry->name);
|
|
||||||
free (entry->data);
|
|
||||||
free (entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
read_efi_variable (const char *name, struct efi_variable **entry)
|
|
||||||
{
|
|
||||||
struct efi_variable *new = new_efi_variable ();
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = efi_get_variable (EFI_GLOBAL_GUID, name,
|
|
||||||
&new->data, &new->data_size, &new->attributes);
|
|
||||||
if (rc < 0)
|
|
||||||
{
|
|
||||||
free_efi_variable (new);
|
|
||||||
new = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new)
|
|
||||||
{
|
|
||||||
/* Latest Apple firmware sets the high bit which appears invalid
|
|
||||||
to the Linux kernel if we write it back, so let's zero it out if it
|
|
||||||
is set since it would be invalid to set it anyway. */
|
|
||||||
new->attributes = new->attributes & ~(1 << 31);
|
|
||||||
|
|
||||||
new->name = xstrdup (name);
|
|
||||||
new->guid = EFI_GLOBAL_GUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
*entry = new;
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set an EFI variable, but only if it differs from the current value.
|
|
||||||
Some firmware implementations are liable to fill up flash space if we set
|
|
||||||
variables unnecessarily, so try to keep write activity to a minimum. */
|
|
||||||
static int
|
|
||||||
set_efi_variable (const char *name, struct efi_variable *entry)
|
|
||||||
{
|
|
||||||
struct efi_variable *old = NULL;
|
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
read_efi_variable (name, &old);
|
|
||||||
efi_error_clear ();
|
|
||||||
if (old && old->attributes == entry->attributes &&
|
|
||||||
old->data_size == entry->data_size &&
|
|
||||||
memcmp (old->data, entry->data, entry->data_size) == 0)
|
|
||||||
grub_util_info ("skipping unnecessary update of EFI variable %s", name);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rc = efi_set_variable (EFI_GLOBAL_GUID, name,
|
|
||||||
entry->data, entry->data_size, entry->attributes,
|
|
||||||
0644);
|
|
||||||
if (rc < 0)
|
|
||||||
grub_util_warn (_("Cannot set EFI variable %s"), name);
|
|
||||||
}
|
|
||||||
free_efi_variable (old);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
cmpvarbyname (const void *p1, const void *p2)
|
|
||||||
{
|
|
||||||
const struct efi_variable *var1 = *(const struct efi_variable **)p1;
|
|
||||||
const struct efi_variable *var2 = *(const struct efi_variable **)p2;
|
|
||||||
return strcmp (var1->name, var2->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
read_boot_variables (struct efi_variable **varlist)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
efi_guid_t *guid = NULL;
|
|
||||||
char *name = NULL;
|
|
||||||
struct efi_variable **newlist = NULL;
|
|
||||||
int nentries = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
while ((rc = efi_get_next_variable_name (&guid, &name)) > 0)
|
|
||||||
{
|
|
||||||
const char *snum = name + sizeof ("Boot") - 1;
|
|
||||||
struct efi_variable *var = NULL;
|
|
||||||
unsigned int num;
|
|
||||||
|
|
||||||
if (memcmp (guid, &efi_guid_global, sizeof (efi_guid_global)) != 0 ||
|
|
||||||
strncmp (name, "Boot", sizeof ("Boot") - 1) != 0 ||
|
|
||||||
!grub_isxdigit (snum[0]) || !grub_isxdigit (snum[1]) ||
|
|
||||||
!grub_isxdigit (snum[2]) || !grub_isxdigit (snum[3]))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
rc = read_efi_variable (name, &var);
|
|
||||||
if (rc < 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (sscanf (var->name, "Boot%04X-%*s", &num) == 1 && num < 65536)
|
|
||||||
var->num = num;
|
|
||||||
|
|
||||||
newlist = xrealloc (newlist, (++nentries) * sizeof (*newlist));
|
|
||||||
newlist[nentries - 1] = var;
|
|
||||||
}
|
|
||||||
if (rc == 0 && newlist)
|
|
||||||
{
|
|
||||||
qsort (newlist, nentries, sizeof (*newlist), cmpvarbyname);
|
|
||||||
for (i = nentries - 1; i >= 0; --i)
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (varlist), GRUB_AS_LIST (newlist[i]));
|
|
||||||
}
|
|
||||||
else if (newlist)
|
|
||||||
{
|
|
||||||
for (i = 0; i < nentries; ++i)
|
|
||||||
free_efi_variable (newlist[i]);
|
|
||||||
free (newlist);
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GET_ORDER(data, i) \
|
|
||||||
((uint16_t) ((data)[(i) * 2]) + ((data)[(i) * 2 + 1] << 8))
|
|
||||||
#define SET_ORDER(data, i, num) \
|
|
||||||
do { \
|
|
||||||
(data)[(i) * 2] = (num) & 0xFF; \
|
|
||||||
(data)[(i) * 2 + 1] = ((num) >> 8) & 0xFF; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
static void
|
|
||||||
remove_from_boot_order (struct efi_variable *order, uint16_t num)
|
|
||||||
{
|
|
||||||
unsigned int old_i, new_i;
|
|
||||||
|
|
||||||
/* We've got an array (in order->data) of the order. Squeeze out any
|
|
||||||
instance of the entry we're deleting by shifting the remainder down. */
|
|
||||||
for (old_i = 0, new_i = 0;
|
|
||||||
old_i < order->data_size / sizeof (uint16_t);
|
|
||||||
++old_i)
|
|
||||||
{
|
|
||||||
uint16_t old_num = GET_ORDER (order->data, old_i);
|
|
||||||
if (old_num != num)
|
|
||||||
{
|
|
||||||
if (new_i != old_i)
|
|
||||||
SET_ORDER (order->data, new_i, old_num);
|
|
||||||
++new_i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
order->data_size = new_i * sizeof (uint16_t);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
add_to_boot_order (struct efi_variable *order, uint16_t num)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
size_t new_data_size;
|
|
||||||
uint8_t *new_data;
|
|
||||||
|
|
||||||
/* Check whether this entry is already in the boot order. If it is, leave
|
|
||||||
it alone. */
|
|
||||||
for (i = 0; i < order->data_size / sizeof (uint16_t); ++i)
|
|
||||||
if (GET_ORDER (order->data, i) == num)
|
|
||||||
return;
|
|
||||||
|
|
||||||
new_data_size = order->data_size + sizeof (uint16_t);
|
|
||||||
new_data = xmalloc (new_data_size);
|
|
||||||
SET_ORDER (new_data, 0, num);
|
|
||||||
memcpy (new_data + sizeof (uint16_t), order->data, order->data_size);
|
|
||||||
free (order->data);
|
|
||||||
order->data = new_data;
|
|
||||||
order->data_size = new_data_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
find_free_boot_num (struct efi_variable *entries)
|
|
||||||
{
|
|
||||||
int num_vars = 0, i;
|
|
||||||
struct efi_variable *entry;
|
|
||||||
|
|
||||||
FOR_LIST_ELEMENTS (entry, entries)
|
|
||||||
++num_vars;
|
|
||||||
|
|
||||||
if (num_vars == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* O(n^2), but n is small and this is easy. */
|
|
||||||
for (i = 0; i < num_vars; ++i)
|
|
||||||
{
|
|
||||||
int found = 0;
|
|
||||||
FOR_LIST_ELEMENTS (entry, entries)
|
|
||||||
{
|
|
||||||
if (entry->num == i)
|
|
||||||
{
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
get_edd_version (void)
|
|
||||||
{
|
|
||||||
efi_guid_t blkx_guid = BLKX_UNKNOWN_GUID;
|
|
||||||
uint8_t *data = NULL;
|
|
||||||
size_t data_size = 0;
|
|
||||||
uint32_t attributes;
|
|
||||||
efidp_header *path;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = efi_get_variable (blkx_guid, "blk0", &data, &data_size, &attributes);
|
|
||||||
if (rc < 0)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
path = (efidp_header *) data;
|
|
||||||
if (path->type == 2 && path->subtype == 1)
|
|
||||||
return 3;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct efi_variable *
|
|
||||||
make_boot_variable (int num, const char *disk, int part, const char *loader,
|
|
||||||
const char *label)
|
|
||||||
{
|
|
||||||
struct efi_variable *entry = new_boot_variable ();
|
|
||||||
uint32_t options;
|
|
||||||
uint32_t edd10_devicenum;
|
|
||||||
ssize_t dp_needed, loadopt_needed;
|
|
||||||
efidp dp = NULL;
|
|
||||||
|
|
||||||
options = EFIBOOT_ABBREV_HD;
|
|
||||||
switch (get_edd_version ()) {
|
|
||||||
case 1:
|
|
||||||
options = EFIBOOT_ABBREV_EDD10;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
options = EFIBOOT_ABBREV_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This may not be the right disk; but it's probably only an issue on very
|
|
||||||
old hardware anyway. */
|
|
||||||
edd10_devicenum = 0x80;
|
|
||||||
|
|
||||||
dp_needed = efi_generate_file_device_path_from_esp (NULL, 0, disk, part,
|
|
||||||
loader, options,
|
|
||||||
edd10_devicenum);
|
|
||||||
if (dp_needed < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
dp = xmalloc (dp_needed);
|
|
||||||
dp_needed = efi_generate_file_device_path_from_esp ((uint8_t *) dp,
|
|
||||||
dp_needed, disk, part,
|
|
||||||
loader, options,
|
|
||||||
edd10_devicenum);
|
|
||||||
if (dp_needed < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
loadopt_needed = efi_loadopt_create (NULL, 0, LOAD_OPTION_ACTIVE,
|
|
||||||
dp, dp_needed, (unsigned char *) label,
|
|
||||||
NULL, 0);
|
|
||||||
if (loadopt_needed < 0)
|
|
||||||
goto err;
|
|
||||||
entry->data_size = loadopt_needed;
|
|
||||||
entry->data = xmalloc (entry->data_size);
|
|
||||||
loadopt_needed = efi_loadopt_create (entry->data, entry->data_size,
|
|
||||||
LOAD_OPTION_ACTIVE, dp, dp_needed,
|
|
||||||
(unsigned char *) label, NULL, 0);
|
|
||||||
if (loadopt_needed < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
entry->name = xasprintf ("Boot%04X", num);
|
|
||||||
entry->num = num;
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
|
|
||||||
err:
|
|
||||||
free_efi_variable (entry);
|
|
||||||
free (dp);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_install_efivar_register_efi (grub_device_t efidir_grub_dev,
|
|
||||||
const char *efifile_path,
|
|
||||||
const char *efi_distributor)
|
|
||||||
{
|
|
||||||
const char *efidir_disk;
|
|
||||||
int efidir_part;
|
|
||||||
struct efi_variable *entries = NULL, *entry;
|
|
||||||
struct efi_variable *order;
|
|
||||||
int entry_num = -1;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
efidir_disk = grub_util_biosdisk_get_osdev (efidir_grub_dev->disk);
|
|
||||||
efidir_part = efidir_grub_dev->disk->partition ? efidir_grub_dev->disk->partition->number + 1 : 1;
|
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
/*
|
|
||||||
* Linux uses efivarfs (mounted on /sys/firmware/efi/efivars) to access the
|
|
||||||
* EFI variable store. Some legacy systems may still use the deprecated
|
|
||||||
* efivars interface (accessed through /sys/firmware/efi/vars). Where both
|
|
||||||
* are present, libefivar will use the former in preference, so attempting
|
|
||||||
* to load efivars will not interfere with later operations.
|
|
||||||
*/
|
|
||||||
grub_util_exec_redirect_all ((const char * []){ "modprobe", "efivars", NULL },
|
|
||||||
NULL, NULL, "/dev/null");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!efi_variables_supported ())
|
|
||||||
{
|
|
||||||
grub_util_warn ("%s",
|
|
||||||
_("EFI variables are not supported on this system."));
|
|
||||||
/* Let the user continue. Perhaps they can still arrange to boot GRUB
|
|
||||||
manually. */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = read_boot_variables (&entries);
|
|
||||||
if (rc < 0)
|
|
||||||
{
|
|
||||||
grub_util_warn ("%s", _("Cannot read EFI Boot* variables"));
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
rc = read_efi_variable ("BootOrder", &order);
|
|
||||||
if (rc < 0)
|
|
||||||
{
|
|
||||||
order = new_boot_variable ();
|
|
||||||
order->name = xstrdup ("BootOrder");
|
|
||||||
efi_error_clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Delete old entries from the same distributor. */
|
|
||||||
FOR_LIST_ELEMENTS (entry, entries)
|
|
||||||
{
|
|
||||||
efi_load_option *load_option = (efi_load_option *) entry->data;
|
|
||||||
const char *label;
|
|
||||||
|
|
||||||
if (entry->num < 0)
|
|
||||||
continue;
|
|
||||||
label = (const char *) efi_loadopt_desc (load_option, entry->data_size);
|
|
||||||
if (strcasecmp (label, efi_distributor) != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* To avoid problems with some firmware implementations, reuse the first
|
|
||||||
matching variable we find rather than deleting and recreating it. */
|
|
||||||
if (entry_num == -1)
|
|
||||||
entry_num = entry->num;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_util_info ("deleting superfluous EFI variable %s (%s)",
|
|
||||||
entry->name, label);
|
|
||||||
rc = efi_del_variable (EFI_GLOBAL_GUID, entry->name);
|
|
||||||
if (rc < 0)
|
|
||||||
{
|
|
||||||
grub_util_warn (_("Cannot delete EFI variable %s"), entry->name);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_from_boot_order (order, (uint16_t) entry->num);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry_num == -1)
|
|
||||||
entry_num = find_free_boot_num (entries);
|
|
||||||
entry = make_boot_variable (entry_num, efidir_disk, efidir_part,
|
|
||||||
efifile_path, efi_distributor);
|
|
||||||
if (!entry)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
grub_util_info ("setting EFI variable %s", entry->name);
|
|
||||||
rc = set_efi_variable (entry->name, entry);
|
|
||||||
if (rc < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
add_to_boot_order (order, (uint16_t) entry_num);
|
|
||||||
|
|
||||||
grub_util_info ("setting EFI variable BootOrder");
|
|
||||||
rc = set_efi_variable ("BootOrder", order);
|
|
||||||
if (rc < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
err:
|
|
||||||
show_efi_errors ();
|
|
||||||
return errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* HAVE_EFIVAR */
|
|
@ -243,7 +243,6 @@ grub_util_find_root_devices_from_poolname (char *poolname)
|
|||||||
argv[2] = poolname;
|
argv[2] = poolname;
|
||||||
argv[3] = NULL;
|
argv[3] = NULL;
|
||||||
|
|
||||||
setenv ("ZPOOL_VDEV_NAME_PATH", "YES", 1);
|
|
||||||
pid = grub_util_exec_pipe (argv, &fd);
|
pid = grub_util_exec_pipe (argv, &fd);
|
||||||
if (!pid)
|
if (!pid)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -19,12 +19,15 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <grub/util/install.h>
|
#include <grub/util/install.h>
|
||||||
|
#include <grub/emu/hostdisk.h>
|
||||||
#include <grub/util/misc.h>
|
#include <grub/util/misc.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/emu/exec.h>
|
#include <grub/emu/exec.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <dirent.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
get_ofpathname (const char *dev)
|
get_ofpathname (const char *dev)
|
||||||
@ -75,19 +78,102 @@ get_ofpathname (const char *dev)
|
|||||||
dev);
|
dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
grub_install_remove_efi_entries_by_distributor (const char *efi_distributor)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
pid_t pid = grub_util_exec_pipe ((const char * []){ "efibootmgr", NULL }, &fd);
|
||||||
|
char *line = NULL;
|
||||||
|
size_t len = 0;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
if (!pid)
|
||||||
|
{
|
||||||
|
grub_util_warn (_("Unable to open stream from %s: %s"),
|
||||||
|
"efibootmgr", strerror (errno));
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *fp = fdopen (fd, "r");
|
||||||
|
if (!fp)
|
||||||
|
{
|
||||||
|
grub_util_warn (_("Unable to open stream from %s: %s"),
|
||||||
|
"efibootmgr", strerror (errno));
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
line = xmalloc (80);
|
||||||
|
len = 80;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char *bootnum;
|
||||||
|
ret = getline (&line, &len, fp);
|
||||||
|
if (ret == -1)
|
||||||
|
break;
|
||||||
|
if (grub_memcmp (line, "Boot", sizeof ("Boot") - 1) != 0
|
||||||
|
|| line[sizeof ("Boot") - 1] < '0'
|
||||||
|
|| line[sizeof ("Boot") - 1] > '9')
|
||||||
|
continue;
|
||||||
|
if (!strcasestr (line, efi_distributor))
|
||||||
|
continue;
|
||||||
|
bootnum = line + sizeof ("Boot") - 1;
|
||||||
|
bootnum[4] = '\0';
|
||||||
|
if (!verbosity)
|
||||||
|
rc = grub_util_exec ((const char * []){ "efibootmgr", "-q",
|
||||||
|
"-b", bootnum, "-B", NULL });
|
||||||
|
else
|
||||||
|
rc = grub_util_exec ((const char * []){ "efibootmgr",
|
||||||
|
"-b", bootnum, "-B", NULL });
|
||||||
|
}
|
||||||
|
|
||||||
|
free (line);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_install_register_efi (grub_device_t efidir_grub_dev,
|
grub_install_register_efi (grub_device_t efidir_grub_dev,
|
||||||
const char *efifile_path,
|
const char *efifile_path,
|
||||||
const char *efi_distributor)
|
const char *efi_distributor)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EFIVAR
|
const char * efidir_disk;
|
||||||
return grub_install_efivar_register_efi (efidir_grub_dev, efifile_path,
|
int efidir_part;
|
||||||
efi_distributor);
|
int ret;
|
||||||
#else
|
efidir_disk = grub_util_biosdisk_get_osdev (efidir_grub_dev->disk);
|
||||||
grub_util_error ("%s",
|
efidir_part = efidir_grub_dev->disk->partition ? efidir_grub_dev->disk->partition->number + 1 : 1;
|
||||||
_("GRUB was not built with efivar support; "
|
|
||||||
"cannot register EFI boot entry"));
|
if (grub_util_exec_redirect_null ((const char * []){ "efibootmgr", "--version", NULL }))
|
||||||
|
{
|
||||||
|
/* TRANSLATORS: This message is shown when required executable `%s'
|
||||||
|
isn't found. */
|
||||||
|
grub_util_error (_("%s: not found"), "efibootmgr");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* On Linux, we need the efivars kernel modules. */
|
||||||
|
#ifdef __linux__
|
||||||
|
grub_util_exec ((const char * []){ "modprobe", "-q", "efivars", NULL });
|
||||||
#endif
|
#endif
|
||||||
|
/* Delete old entries from the same distributor. */
|
||||||
|
ret = grub_install_remove_efi_entries_by_distributor (efi_distributor);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
char *efidir_part_str = xasprintf ("%d", efidir_part);
|
||||||
|
|
||||||
|
if (!verbosity)
|
||||||
|
ret = grub_util_exec ((const char * []){ "efibootmgr", "-q",
|
||||||
|
"-c", "-d", efidir_disk,
|
||||||
|
"-p", efidir_part_str, "-w",
|
||||||
|
"-L", efi_distributor, "-l",
|
||||||
|
efifile_path, NULL });
|
||||||
|
else
|
||||||
|
ret = grub_util_exec ((const char * []){ "efibootmgr",
|
||||||
|
"-c", "-d", efidir_disk,
|
||||||
|
"-p", efidir_part_str, "-w",
|
||||||
|
"-L", efi_distributor, "-l",
|
||||||
|
efifile_path, NULL });
|
||||||
|
free (efidir_part_str);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -132,21 +218,6 @@ grub_install_register_ieee1275 (int is_prep, const char *install_device,
|
|||||||
else
|
else
|
||||||
boot_device = get_ofpathname (install_device);
|
boot_device = get_ofpathname (install_device);
|
||||||
|
|
||||||
if (strcmp (grub_install_get_default_powerpc_machtype (), "chrp_ibm") == 0)
|
|
||||||
{
|
|
||||||
char *arg = xasprintf ("boot-device=%s", boot_device);
|
|
||||||
if (grub_util_exec ((const char * []){ "nvram",
|
|
||||||
"--update-config", arg, NULL }))
|
|
||||||
{
|
|
||||||
char *cmd = xasprintf ("setenv boot-device %s", boot_device);
|
|
||||||
grub_util_error (_("`nvram' failed. \nYou will have to set `boot-device' variable manually. At the IEEE1275 prompt, type:\n %s\n"),
|
|
||||||
cmd);
|
|
||||||
free (cmd);
|
|
||||||
}
|
|
||||||
free (arg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device",
|
if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device",
|
||||||
boot_device, NULL }))
|
boot_device, NULL }))
|
||||||
{
|
{
|
||||||
@ -155,7 +226,6 @@ grub_install_register_ieee1275 (int is_prep, const char *install_device,
|
|||||||
cmd);
|
cmd);
|
||||||
free (cmd);
|
free (cmd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
free (boot_device);
|
free (boot_device);
|
||||||
}
|
}
|
||||||
|
@ -128,12 +128,6 @@ grub_install_get_default_x86_platform (void)
|
|||||||
return "i386-efi";
|
return "i386-efi";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
grub_install_get_default_powerpc_machtype (void)
|
|
||||||
{
|
|
||||||
return "generic";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
get_efi_variable (const wchar_t *varname, ssize_t *len)
|
get_efi_variable (const wchar_t *varname, ssize_t *len)
|
||||||
{
|
{
|
||||||
|
@ -244,14 +244,6 @@ grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused)))
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_keyboard_controller_mod_init (struct grub_term_input *term __attribute__ ((unused))) {
|
|
||||||
if (KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
|
|
||||||
grub_keyboard_controller_init ();
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
grub_keyboard_controller_init (void)
|
grub_keyboard_controller_init (void)
|
||||||
{
|
{
|
||||||
@ -322,7 +314,6 @@ grub_at_restore_hw (void)
|
|||||||
static struct grub_term_input grub_at_keyboard_term =
|
static struct grub_term_input grub_at_keyboard_term =
|
||||||
{
|
{
|
||||||
.name = "at_keyboard",
|
.name = "at_keyboard",
|
||||||
.init = grub_keyboard_controller_mod_init,
|
|
||||||
.fini = grub_keyboard_controller_fini,
|
.fini = grub_keyboard_controller_fini,
|
||||||
.getkey = grub_at_keyboard_getkey
|
.getkey = grub_at_keyboard_getkey
|
||||||
};
|
};
|
||||||
|
@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,
|
|||||||
/* Clear the screen. Using serial console, screen(1) only recognizes the
|
/* Clear the screen. Using serial console, screen(1) only recognizes the
|
||||||
* ANSI escape sequence. Using video console, Apple Open Firmware
|
* ANSI escape sequence. Using video console, Apple Open Firmware
|
||||||
* (version 3.1.1) only recognizes the literal ^L. So use both. */
|
* (version 3.1.1) only recognizes the literal ^L. So use both. */
|
||||||
data->cls = grub_strdup ("\e[2J\e[m");
|
data->cls = grub_strdup ("\e[2J");
|
||||||
data->reverse_video_on = grub_strdup ("\e[7m");
|
data->reverse_video_on = grub_strdup ("\e[7m");
|
||||||
data->reverse_video_off = grub_strdup ("\e[m");
|
data->reverse_video_off = grub_strdup ("\e[m");
|
||||||
if (grub_strcmp ("ieee1275", str) == 0)
|
if (grub_strcmp ("ieee1275", str) == 0)
|
||||||
|
@ -67,7 +67,7 @@ get_pixel (struct grub_video_fbblit_info *source,
|
|||||||
case 1:
|
case 1:
|
||||||
if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED)
|
if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED)
|
||||||
{
|
{
|
||||||
grub_uint64_t bit_index = (grub_uint64_t) y * source->mode_info->width + x;
|
int bit_index = y * source->mode_info->width + x;
|
||||||
grub_uint8_t *ptr = source->data + bit_index / 8;
|
grub_uint8_t *ptr = source->data + bit_index / 8;
|
||||||
int bit_pos = 7 - bit_index % 8;
|
int bit_pos = 7 - bit_index % 8;
|
||||||
color = (*ptr >> bit_pos) & 0x01;
|
color = (*ptr >> bit_pos) & 0x01;
|
||||||
@ -138,7 +138,7 @@ set_pixel (struct grub_video_fbblit_info *source,
|
|||||||
case 1:
|
case 1:
|
||||||
if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED)
|
if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED)
|
||||||
{
|
{
|
||||||
grub_uint64_t bit_index = (grub_uint64_t) y * source->mode_info->width + x;
|
int bit_index = y * source->mode_info->width + x;
|
||||||
grub_uint8_t *ptr = source->data + bit_index / 8;
|
grub_uint8_t *ptr = source->data + bit_index / 8;
|
||||||
int bit_pos = 7 - bit_index % 8;
|
int bit_pos = 7 - bit_index % 8;
|
||||||
*ptr = (*ptr & ~(1 << bit_pos)) | ((color & 0x01) << bit_pos);
|
*ptr = (*ptr & ~(1 << bit_pos)) | ((color & 0x01) << bit_pos);
|
||||||
|
@ -1054,15 +1054,6 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
|
|||||||
|| vbe_mode_info.y_resolution > height)
|
|| vbe_mode_info.y_resolution > height)
|
||||||
/* Resolution exceeds that of preferred mode. */
|
/* Resolution exceeds that of preferred mode. */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Blacklist 1440x900x32 from preferred mode handling until a
|
|
||||||
better solution is available. This mode causes problems on
|
|
||||||
many Thinkpads. See:
|
|
||||||
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/701111 */
|
|
||||||
if (vbe_mode_info.x_resolution == 1440 &&
|
|
||||||
vbe_mode_info.y_resolution == 900 &&
|
|
||||||
vbe_mode_info.bits_per_pixel == 32)
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/bufio.h>
|
#include <grub/bufio.h>
|
||||||
#include <grub/safemath.h>
|
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
@ -110,17 +109,9 @@ static grub_uint8_t
|
|||||||
grub_jpeg_get_byte (struct grub_jpeg_data *data)
|
grub_jpeg_get_byte (struct grub_jpeg_data *data)
|
||||||
{
|
{
|
||||||
grub_uint8_t r;
|
grub_uint8_t r;
|
||||||
grub_ssize_t bytes_read;
|
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
bytes_read = grub_file_read (data->file, &r, 1);
|
grub_file_read (data->file, &r, 1);
|
||||||
|
|
||||||
if (bytes_read != 1)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"jpeg: unexpected end of data");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -129,17 +120,9 @@ static grub_uint16_t
|
|||||||
grub_jpeg_get_word (struct grub_jpeg_data *data)
|
grub_jpeg_get_word (struct grub_jpeg_data *data)
|
||||||
{
|
{
|
||||||
grub_uint16_t r;
|
grub_uint16_t r;
|
||||||
grub_ssize_t bytes_read;
|
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
bytes_read = grub_file_read (data->file, &r, sizeof (grub_uint16_t));
|
grub_file_read (data->file, &r, sizeof (grub_uint16_t));
|
||||||
|
|
||||||
if (bytes_read != sizeof (grub_uint16_t))
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"jpeg: unexpected end of data");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return grub_be_to_cpu16 (r);
|
return grub_be_to_cpu16 (r);
|
||||||
}
|
}
|
||||||
@ -152,11 +135,6 @@ grub_jpeg_get_bit (struct grub_jpeg_data *data)
|
|||||||
if (data->bit_mask == 0)
|
if (data->bit_mask == 0)
|
||||||
{
|
{
|
||||||
data->bit_save = grub_jpeg_get_byte (data);
|
data->bit_save = grub_jpeg_get_byte (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE) {
|
|
||||||
grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"jpeg: file read error");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (data->bit_save == JPEG_ESC_CHAR)
|
if (data->bit_save == JPEG_ESC_CHAR)
|
||||||
{
|
{
|
||||||
if (grub_jpeg_get_byte (data) != 0)
|
if (grub_jpeg_get_byte (data) != 0)
|
||||||
@ -165,11 +143,6 @@ grub_jpeg_get_bit (struct grub_jpeg_data *data)
|
|||||||
"jpeg: invalid 0xFF in data stream");
|
"jpeg: invalid 0xFF in data stream");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: file read error");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
data->bit_mask = 0x80;
|
data->bit_mask = 0x80;
|
||||||
}
|
}
|
||||||
@ -188,7 +161,7 @@ grub_jpeg_get_number (struct grub_jpeg_data *data, int num)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
msb = value = grub_jpeg_get_bit (data);
|
msb = value = grub_jpeg_get_bit (data);
|
||||||
for (i = 1; i < num && grub_errno == GRUB_ERR_NONE; i++)
|
for (i = 1; i < num; i++)
|
||||||
value = (value << 1) + (grub_jpeg_get_bit (data) != 0);
|
value = (value << 1) + (grub_jpeg_get_bit (data) != 0);
|
||||||
if (!msb)
|
if (!msb)
|
||||||
value += 1 - (1 << num);
|
value += 1 - (1 << num);
|
||||||
@ -229,8 +202,6 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data)
|
|||||||
while (data->file->offset + sizeof (count) + 1 <= next_marker)
|
while (data->file->offset + sizeof (count) + 1 <= next_marker)
|
||||||
{
|
{
|
||||||
id = grub_jpeg_get_byte (data);
|
id = grub_jpeg_get_byte (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
ac = (id >> 4) & 1;
|
ac = (id >> 4) & 1;
|
||||||
id &= 0xF;
|
id &= 0xF;
|
||||||
if (id > 1)
|
if (id > 1)
|
||||||
@ -246,9 +217,6 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data)
|
|||||||
n += count[i];
|
n += count[i];
|
||||||
|
|
||||||
id += ac * 2;
|
id += ac * 2;
|
||||||
if (data->huff_value[id] != NULL)
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"jpeg: attempt to reallocate huffman table");
|
|
||||||
data->huff_value[id] = grub_malloc (n);
|
data->huff_value[id] = grub_malloc (n);
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
@ -284,8 +252,6 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data)
|
|||||||
|
|
||||||
next_marker = data->file->offset;
|
next_marker = data->file->offset;
|
||||||
next_marker += grub_jpeg_get_word (data);
|
next_marker += grub_jpeg_get_word (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (next_marker > data->file->size)
|
if (next_marker > data->file->size)
|
||||||
{
|
{
|
||||||
@ -297,8 +263,6 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data)
|
|||||||
<= next_marker)
|
<= next_marker)
|
||||||
{
|
{
|
||||||
id = grub_jpeg_get_byte (data);
|
id = grub_jpeg_get_byte (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
if (id >= 0x10) /* Upper 4-bit is precision. */
|
if (id >= 0x10) /* Upper 4-bit is precision. */
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"jpeg: only 8-bit precision is supported");
|
"jpeg: only 8-bit precision is supported");
|
||||||
@ -330,9 +294,6 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data)
|
|||||||
next_marker = data->file->offset;
|
next_marker = data->file->offset;
|
||||||
next_marker += grub_jpeg_get_word (data);
|
next_marker += grub_jpeg_get_word (data);
|
||||||
|
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (grub_jpeg_get_byte (data) != 8)
|
if (grub_jpeg_get_byte (data) != 8)
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"jpeg: only 8-bit precision is supported");
|
"jpeg: only 8-bit precision is supported");
|
||||||
@ -340,11 +301,7 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data)
|
|||||||
data->image_height = grub_jpeg_get_word (data);
|
data->image_height = grub_jpeg_get_word (data);
|
||||||
data->image_width = grub_jpeg_get_word (data);
|
data->image_width = grub_jpeg_get_word (data);
|
||||||
|
|
||||||
grub_dprintf ("jpeg", "image height: %d\n", data->image_height);
|
if ((!data->image_height) || (!data->image_width))
|
||||||
grub_dprintf ("jpeg", "image width: %d\n", data->image_width);
|
|
||||||
|
|
||||||
if ((!data->image_height) || (!data->image_width) ||
|
|
||||||
(data->image_height > IMAGE_HW_MAX_PX) || (data->image_width > IMAGE_HW_MAX_PX))
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid image size");
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid image size");
|
||||||
|
|
||||||
cc = grub_jpeg_get_byte (data);
|
cc = grub_jpeg_get_byte (data);
|
||||||
@ -362,8 +319,6 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data)
|
|||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid index");
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid index");
|
||||||
|
|
||||||
ss = grub_jpeg_get_byte (data); /* Sampling factor. */
|
ss = grub_jpeg_get_byte (data); /* Sampling factor. */
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
if (!id)
|
if (!id)
|
||||||
{
|
{
|
||||||
grub_uint8_t vs, hs;
|
grub_uint8_t vs, hs;
|
||||||
@ -543,7 +498,7 @@ grub_jpeg_idct_transform (jpeg_data_unit_t du)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static void
|
||||||
grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du)
|
grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du)
|
||||||
{
|
{
|
||||||
int h1, h2, qt;
|
int h1, h2, qt;
|
||||||
@ -558,9 +513,6 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du)
|
|||||||
data->dc_value[id] +=
|
data->dc_value[id] +=
|
||||||
grub_jpeg_get_number (data, grub_jpeg_get_huff_code (data, h1));
|
grub_jpeg_get_number (data, grub_jpeg_get_huff_code (data, h1));
|
||||||
|
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
du[0] = data->dc_value[id] * (int) data->quan_table[qt][0];
|
du[0] = data->dc_value[id] * (int) data->quan_table[qt][0];
|
||||||
pos = 1;
|
pos = 1;
|
||||||
while (pos < ARRAY_SIZE (data->quan_table[qt]))
|
while (pos < ARRAY_SIZE (data->quan_table[qt]))
|
||||||
@ -575,13 +527,11 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du)
|
|||||||
num >>= 4;
|
num >>= 4;
|
||||||
pos += num;
|
pos += num;
|
||||||
|
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (pos >= ARRAY_SIZE (jpeg_zigzag_order))
|
if (pos >= ARRAY_SIZE (jpeg_zigzag_order))
|
||||||
{
|
{
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"jpeg: invalid position in zigzag order!?");
|
"jpeg: invalid position in zigzag order!?");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
du[jpeg_zigzag_order[pos]] = val * (int) data->quan_table[qt][pos];
|
du[jpeg_zigzag_order[pos]] = val * (int) data->quan_table[qt][pos];
|
||||||
@ -589,7 +539,6 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du)
|
|||||||
}
|
}
|
||||||
|
|
||||||
grub_jpeg_idct_transform (du);
|
grub_jpeg_idct_transform (du);
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -648,8 +597,7 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data)
|
|||||||
data_offset += grub_jpeg_get_word (data);
|
data_offset += grub_jpeg_get_word (data);
|
||||||
|
|
||||||
cc = grub_jpeg_get_byte (data);
|
cc = grub_jpeg_get_byte (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
if (cc != 3 && cc != 1)
|
if (cc != 3 && cc != 1)
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"jpeg: component count must be 1 or 3");
|
"jpeg: component count must be 1 or 3");
|
||||||
@ -662,8 +610,7 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data)
|
|||||||
id = grub_jpeg_get_byte (data) - 1;
|
id = grub_jpeg_get_byte (data) - 1;
|
||||||
if ((id < 0) || (id >= 3))
|
if ((id < 0) || (id >= 3))
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid index");
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid index");
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
ht = grub_jpeg_get_byte (data);
|
ht = grub_jpeg_get_byte (data);
|
||||||
data->comp_index[id][1] = (ht >> 4);
|
data->comp_index[id][1] = (ht >> 4);
|
||||||
data->comp_index[id][2] = (ht & 0xF) + 2;
|
data->comp_index[id][2] = (ht & 0xF) + 2;
|
||||||
@ -671,20 +618,14 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data)
|
|||||||
if ((data->comp_index[id][1] < 0) || (data->comp_index[id][1] > 3) ||
|
if ((data->comp_index[id][1] < 0) || (data->comp_index[id][1] > 3) ||
|
||||||
(data->comp_index[id][2] < 0) || (data->comp_index[id][2] > 3))
|
(data->comp_index[id][2] < 0) || (data->comp_index[id][2] > 3))
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid hufftable index");
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid hufftable index");
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_jpeg_get_byte (data); /* Skip 3 unused bytes. */
|
grub_jpeg_get_byte (data); /* Skip 3 unused bytes. */
|
||||||
grub_jpeg_get_word (data);
|
grub_jpeg_get_word (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
if (data->file->offset != data_offset)
|
if (data->file->offset != data_offset)
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: extra byte in sos");
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: extra byte in sos");
|
||||||
|
|
||||||
if (*data->bitmap)
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: too many start of scan blocks");
|
|
||||||
|
|
||||||
if (grub_video_bitmap_create (data->bitmap, data->image_width,
|
if (grub_video_bitmap_create (data->bitmap, data->image_width,
|
||||||
data->image_height,
|
data->image_height,
|
||||||
GRUB_VIDEO_BLIT_FORMAT_RGB_888))
|
GRUB_VIDEO_BLIT_FORMAT_RGB_888))
|
||||||
@ -698,9 +639,7 @@ static grub_err_t
|
|||||||
grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
||||||
{
|
{
|
||||||
unsigned c1, vb, hb, nr1, nc1;
|
unsigned c1, vb, hb, nr1, nc1;
|
||||||
unsigned stride_a, stride_b, stride;
|
|
||||||
int rst = data->dri;
|
int rst = data->dri;
|
||||||
grub_err_t err = GRUB_ERR_NONE;
|
|
||||||
|
|
||||||
vb = 8 << data->log_vs;
|
vb = 8 << data->log_vs;
|
||||||
hb = 8 << data->log_hs;
|
hb = 8 << data->log_hs;
|
||||||
@ -708,17 +647,11 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
|||||||
nc1 = (data->image_width + hb - 1) >> (3 + data->log_hs);
|
nc1 = (data->image_width + hb - 1) >> (3 + data->log_hs);
|
||||||
|
|
||||||
if (data->bitmap_ptr == NULL)
|
if (data->bitmap_ptr == NULL)
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error(GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"jpeg: attempted to decode data before start of stream");
|
"jpeg: attempted to decode data before start of stream");
|
||||||
|
|
||||||
if (grub_mul(vb, data->image_width, &stride_a) ||
|
|
||||||
grub_mul(hb, nc1, &stride_b) ||
|
|
||||||
grub_sub(stride_a, stride_b, &stride))
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"jpeg: cannot decode image with these dimensions");
|
|
||||||
|
|
||||||
for (; data->r1 < nr1 && (!data->dri || rst);
|
for (; data->r1 < nr1 && (!data->dri || rst);
|
||||||
data->r1++, data->bitmap_ptr += stride * 3)
|
data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3)
|
||||||
for (c1 = 0; c1 < nc1 && (!data->dri || rst);
|
for (c1 = 0; c1 < nc1 && (!data->dri || rst);
|
||||||
c1++, rst--, data->bitmap_ptr += hb * 3)
|
c1++, rst--, data->bitmap_ptr += hb * 3)
|
||||||
{
|
{
|
||||||
@ -727,22 +660,17 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
|||||||
|
|
||||||
for (r2 = 0; r2 < (1U << data->log_vs); r2++)
|
for (r2 = 0; r2 < (1U << data->log_vs); r2++)
|
||||||
for (c2 = 0; c2 < (1U << data->log_hs); c2++)
|
for (c2 = 0; c2 < (1U << data->log_hs); c2++)
|
||||||
{
|
grub_jpeg_decode_du (data, 0, data->ydu[r2 * 2 + c2]);
|
||||||
err = grub_jpeg_decode_du (data, 0, data->ydu[r2 * 2 + c2]);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data->color_components >= 3)
|
if (data->color_components >= 3)
|
||||||
{
|
{
|
||||||
err = grub_jpeg_decode_du (data, 1, data->cbdu);
|
grub_jpeg_decode_du (data, 1, data->cbdu);
|
||||||
if (err != GRUB_ERR_NONE)
|
grub_jpeg_decode_du (data, 2, data->crdu);
|
||||||
return err;
|
|
||||||
err = grub_jpeg_decode_du (data, 2, data->crdu);
|
|
||||||
if (err != GRUB_ERR_NONE)
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
nr2 = (data->r1 == nr1 - 1) ? (data->image_height - data->r1 * vb) : vb;
|
nr2 = (data->r1 == nr1 - 1) ? (data->image_height - data->r1 * vb) : vb;
|
||||||
nc2 = (c1 == nc1 - 1) ? (data->image_width - c1 * hb) : hb;
|
nc2 = (c1 == nc1 - 1) ? (data->image_width - c1 * hb) : hb;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ struct grub_png_data
|
|||||||
|
|
||||||
unsigned image_width, image_height;
|
unsigned image_width, image_height;
|
||||||
int bpp, is_16bit;
|
int bpp, is_16bit;
|
||||||
int raw_bytes, is_alpha, is_palette;
|
int raw_bytes, is_gray, is_alpha, is_palette;
|
||||||
int row_bytes, color_bits;
|
int row_bytes, color_bits;
|
||||||
grub_uint8_t *image_data;
|
grub_uint8_t *image_data;
|
||||||
|
|
||||||
@ -142,7 +142,6 @@ static grub_uint8_t
|
|||||||
grub_png_get_byte (struct grub_png_data *data)
|
grub_png_get_byte (struct grub_png_data *data)
|
||||||
{
|
{
|
||||||
grub_uint8_t r;
|
grub_uint8_t r;
|
||||||
grub_ssize_t bytes_read = 0;
|
|
||||||
|
|
||||||
if ((data->inside_idat) && (data->idat_remain == 0))
|
if ((data->inside_idat) && (data->idat_remain == 0))
|
||||||
{
|
{
|
||||||
@ -176,14 +175,7 @@ grub_png_get_byte (struct grub_png_data *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
bytes_read = grub_file_read (data->file, &r, 1);
|
grub_file_read (data->file, &r, 1);
|
||||||
|
|
||||||
if (bytes_read != 1)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"png: unexpected end of data");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data->inside_idat)
|
if (data->inside_idat)
|
||||||
data->idat_remain--;
|
data->idat_remain--;
|
||||||
@ -239,16 +231,15 @@ grub_png_decode_image_palette (struct grub_png_data *data,
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
for (i = 0; 3 * i < len && i < 256; i++)
|
||||||
for (i = 0; 3 * i < len && i < 256 && grub_errno == GRUB_ERR_NONE; i++)
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
data->palette[i][j] = grub_png_get_byte (data);
|
data->palette[i][j] = grub_png_get_byte (data);
|
||||||
for (i *= 3; i < len && grub_errno == GRUB_ERR_NONE; i++)
|
for (i *= 3; i < len; i++)
|
||||||
grub_png_get_byte (data);
|
grub_png_get_byte (data);
|
||||||
|
|
||||||
grub_png_get_dword (data);
|
grub_png_get_dword (data);
|
||||||
|
|
||||||
return grub_errno;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@ -258,27 +249,16 @@ grub_png_decode_image_header (struct grub_png_data *data)
|
|||||||
int color_bits;
|
int color_bits;
|
||||||
enum grub_video_blit_format blt;
|
enum grub_video_blit_format blt;
|
||||||
|
|
||||||
if (data->image_width || data->image_height)
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: two image headers found");
|
|
||||||
|
|
||||||
data->image_width = grub_png_get_dword (data);
|
data->image_width = grub_png_get_dword (data);
|
||||||
data->image_height = grub_png_get_dword (data);
|
data->image_height = grub_png_get_dword (data);
|
||||||
|
|
||||||
grub_dprintf ("png", "image height: %d\n", data->image_height);
|
if ((!data->image_height) || (!data->image_width))
|
||||||
grub_dprintf ("png", "image width: %d\n", data->image_width);
|
|
||||||
|
|
||||||
if ((!data->image_height) || (!data->image_width) ||
|
|
||||||
(data->image_height > IMAGE_HW_MAX_PX) || (data->image_width > IMAGE_HW_MAX_PX))
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: invalid image size");
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: invalid image size");
|
||||||
|
|
||||||
color_bits = grub_png_get_byte (data);
|
color_bits = grub_png_get_byte (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
data->is_16bit = (color_bits == 16);
|
data->is_16bit = (color_bits == 16);
|
||||||
|
|
||||||
color_type = grub_png_get_byte (data);
|
color_type = grub_png_get_byte (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
/* According to PNG spec, no other types are valid. */
|
/* According to PNG spec, no other types are valid. */
|
||||||
if ((color_type & ~(PNG_COLOR_MASK_ALPHA | PNG_COLOR_MASK_COLOR))
|
if ((color_type & ~(PNG_COLOR_MASK_ALPHA | PNG_COLOR_MASK_COLOR))
|
||||||
@ -300,13 +280,13 @@ grub_png_decode_image_header (struct grub_png_data *data)
|
|||||||
data->bpp = 3;
|
data->bpp = 3;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
data->is_gray = 1;
|
||||||
"png: color type not supported");
|
data->bpp = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((color_bits != 8) && (color_bits != 16)
|
if ((color_bits != 8) && (color_bits != 16)
|
||||||
&& (color_bits != 4
|
&& (color_bits != 4
|
||||||
|| !data->is_palette))
|
|| !(data->is_gray || data->is_palette)))
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"png: bit depth must be 8 or 16");
|
"png: bit depth must be 8 or 16");
|
||||||
|
|
||||||
@ -335,7 +315,7 @@ grub_png_decode_image_header (struct grub_png_data *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
if (data->is_16bit || data->is_palette)
|
if (data->is_16bit || data->is_gray || data->is_palette)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
data->image_data = grub_calloc (data->image_height, data->row_bytes);
|
data->image_data = grub_calloc (data->image_height, data->row_bytes);
|
||||||
@ -360,20 +340,14 @@ grub_png_decode_image_header (struct grub_png_data *data)
|
|||||||
if (grub_png_get_byte (data) != PNG_COMPRESSION_BASE)
|
if (grub_png_get_byte (data) != PNG_COMPRESSION_BASE)
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"png: compression method not supported");
|
"png: compression method not supported");
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (grub_png_get_byte (data) != PNG_FILTER_TYPE_BASE)
|
if (grub_png_get_byte (data) != PNG_FILTER_TYPE_BASE)
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"png: filter method not supported");
|
"png: filter method not supported");
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (grub_png_get_byte (data) != PNG_INTERLACE_NONE)
|
if (grub_png_get_byte (data) != PNG_INTERLACE_NONE)
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
"png: interlace method not supported");
|
"png: interlace method not supported");
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
/* Skip crc checksum. */
|
/* Skip crc checksum. */
|
||||||
grub_png_get_dword (data);
|
grub_png_get_dword (data);
|
||||||
@ -442,13 +416,6 @@ grub_png_insert_huff_item (struct huff_table *ht, int code, int len)
|
|||||||
for (i = len; i < ht->max_length; i++)
|
for (i = len; i < ht->max_length; i++)
|
||||||
n += ht->maxval[i];
|
n += ht->maxval[i];
|
||||||
|
|
||||||
if (n > ht->num_values)
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"png: out of range inserting huffman table item");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
ht->values[ht->num_values - i] = ht->values[ht->num_values - i - 1];
|
ht->values[ht->num_values - i] = ht->values[ht->num_values - i - 1];
|
||||||
|
|
||||||
@ -482,7 +449,7 @@ grub_png_get_huff_code (struct grub_png_data *data, struct huff_table *ht)
|
|||||||
int code, i;
|
int code, i;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
for (i = 0; i < ht->max_length && grub_errno == GRUB_ERR_NONE; i++)
|
for (i = 0; i < ht->max_length; i++)
|
||||||
{
|
{
|
||||||
code = (code << 1) + grub_png_get_bits (data, 1);
|
code = (code << 1) + grub_png_get_bits (data, 1);
|
||||||
if (code < ht->maxval[i])
|
if (code < ht->maxval[i])
|
||||||
@ -537,14 +504,8 @@ grub_png_init_dynamic_block (struct grub_png_data *data)
|
|||||||
grub_uint8_t lens[DEFLATE_HCLEN_MAX];
|
grub_uint8_t lens[DEFLATE_HCLEN_MAX];
|
||||||
|
|
||||||
nl = DEFLATE_HLIT_BASE + grub_png_get_bits (data, 5);
|
nl = DEFLATE_HLIT_BASE + grub_png_get_bits (data, 5);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
nd = DEFLATE_HDIST_BASE + grub_png_get_bits (data, 5);
|
nd = DEFLATE_HDIST_BASE + grub_png_get_bits (data, 5);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
nb = DEFLATE_HCLEN_BASE + grub_png_get_bits (data, 4);
|
nb = DEFLATE_HCLEN_BASE + grub_png_get_bits (data, 4);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if ((nl > DEFLATE_HLIT_MAX) || (nd > DEFLATE_HDIST_MAX) ||
|
if ((nl > DEFLATE_HLIT_MAX) || (nd > DEFLATE_HDIST_MAX) ||
|
||||||
(nb > DEFLATE_HCLEN_MAX))
|
(nb > DEFLATE_HCLEN_MAX))
|
||||||
@ -572,7 +533,7 @@ grub_png_init_dynamic_block (struct grub_png_data *data)
|
|||||||
data->dist_offset);
|
data->dist_offset);
|
||||||
|
|
||||||
prev = 0;
|
prev = 0;
|
||||||
for (i = 0; i < nl + nd && grub_errno == GRUB_ERR_NONE; i++)
|
for (i = 0; i < nl + nd; i++)
|
||||||
{
|
{
|
||||||
int n, code;
|
int n, code;
|
||||||
struct huff_table *ht;
|
struct huff_table *ht;
|
||||||
@ -757,30 +718,20 @@ grub_png_read_dynamic_block (struct grub_png_data *data)
|
|||||||
int len, dist, pos;
|
int len, dist, pos;
|
||||||
|
|
||||||
n -= 257;
|
n -= 257;
|
||||||
if (((unsigned int) n) >= ARRAY_SIZE (cplens))
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"png: invalid huff code");
|
|
||||||
len = cplens[n];
|
len = cplens[n];
|
||||||
if (cplext[n])
|
if (cplext[n])
|
||||||
len += grub_png_get_bits (data, cplext[n]);
|
len += grub_png_get_bits (data, cplext[n]);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
n = grub_png_get_huff_code (data, &data->dist_table);
|
n = grub_png_get_huff_code (data, &data->dist_table);
|
||||||
if (((unsigned int) n) >= ARRAY_SIZE (cpdist))
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
||||||
"png: invalid huff code");
|
|
||||||
dist = cpdist[n];
|
dist = cpdist[n];
|
||||||
if (cpdext[n])
|
if (cpdext[n])
|
||||||
dist += grub_png_get_bits (data, cpdext[n]);
|
dist += grub_png_get_bits (data, cpdext[n]);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
pos = data->wp - dist;
|
pos = data->wp - dist;
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
pos += WSIZE;
|
pos += WSIZE;
|
||||||
|
|
||||||
while (len > 0 && grub_errno == GRUB_ERR_NONE)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
data->slide[data->wp] = data->slide[pos];
|
data->slide[data->wp] = data->slide[pos];
|
||||||
grub_png_output_byte (data, data->slide[data->wp]);
|
grub_png_output_byte (data, data->slide[data->wp]);
|
||||||
@ -808,11 +759,7 @@ grub_png_decode_image_data (struct grub_png_data *data)
|
|||||||
int final;
|
int final;
|
||||||
|
|
||||||
cmf = grub_png_get_byte (data);
|
cmf = grub_png_get_byte (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
flg = grub_png_get_byte (data);
|
flg = grub_png_get_byte (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if ((cmf & 0xF) != Z_DEFLATED)
|
if ((cmf & 0xF) != Z_DEFLATED)
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||||
@ -827,11 +774,7 @@ grub_png_decode_image_data (struct grub_png_data *data)
|
|||||||
int block_type;
|
int block_type;
|
||||||
|
|
||||||
final = grub_png_get_bits (data, 1);
|
final = grub_png_get_bits (data, 1);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
block_type = grub_png_get_bits (data, 2);
|
block_type = grub_png_get_bits (data, 2);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
switch (block_type)
|
switch (block_type)
|
||||||
{
|
{
|
||||||
@ -847,7 +790,7 @@ grub_png_decode_image_data (struct grub_png_data *data)
|
|||||||
grub_png_get_byte (data);
|
grub_png_get_byte (data);
|
||||||
grub_png_get_byte (data);
|
grub_png_get_byte (data);
|
||||||
|
|
||||||
for (i = 0; i < len && grub_errno == GRUB_ERR_NONE; i++)
|
for (i = 0; i < len; i++)
|
||||||
grub_png_output_byte (data, grub_png_get_byte (data));
|
grub_png_output_byte (data, grub_png_get_byte (data));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -916,7 +859,26 @@ grub_png_convert_image (struct grub_png_data *data)
|
|||||||
int shift;
|
int shift;
|
||||||
int mask = (1 << data->color_bits) - 1;
|
int mask = (1 << data->color_bits) - 1;
|
||||||
unsigned j;
|
unsigned j;
|
||||||
|
if (data->is_gray)
|
||||||
|
{
|
||||||
|
/* Generic formula is
|
||||||
|
(0xff * i) / ((1U << data->color_bits) - 1)
|
||||||
|
but for allowed bit depth of 1, 2 and for it's
|
||||||
|
equivalent to
|
||||||
|
(0xff / ((1U << data->color_bits) - 1)) * i
|
||||||
|
Precompute the multipliers to avoid division.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const grub_uint8_t multipliers[5] = { 0xff, 0xff, 0x55, 0x24, 0x11 };
|
||||||
|
for (i = 0; i < (1U << data->color_bits); i++)
|
||||||
|
{
|
||||||
|
grub_uint8_t col = multipliers[data->color_bits] * i;
|
||||||
|
palette[i][0] = col;
|
||||||
|
palette[i][1] = col;
|
||||||
|
palette[i][2] = col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
grub_memcpy (palette, data->palette, 3 << data->color_bits);
|
grub_memcpy (palette, data->palette, 3 << data->color_bits);
|
||||||
d1c = d1;
|
d1c = d1;
|
||||||
d2c = d2;
|
d2c = d2;
|
||||||
@ -955,6 +917,60 @@ grub_png_convert_image (struct grub_png_data *data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->is_gray)
|
||||||
|
{
|
||||||
|
switch (data->bpp)
|
||||||
|
{
|
||||||
|
case 4:
|
||||||
|
/* 16-bit gray with alpha. */
|
||||||
|
for (i = 0; i < (data->image_width * data->image_height);
|
||||||
|
i++, d1 += 4, d2 += 4)
|
||||||
|
{
|
||||||
|
d1[R4] = d2[3];
|
||||||
|
d1[G4] = d2[3];
|
||||||
|
d1[B4] = d2[3];
|
||||||
|
d1[A4] = d2[1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (data->is_16bit)
|
||||||
|
/* 16-bit gray without alpha. */
|
||||||
|
{
|
||||||
|
for (i = 0; i < (data->image_width * data->image_height);
|
||||||
|
i++, d1 += 4, d2 += 2)
|
||||||
|
{
|
||||||
|
d1[R3] = d2[1];
|
||||||
|
d1[G3] = d2[1];
|
||||||
|
d1[B3] = d2[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* 8-bit gray with alpha. */
|
||||||
|
{
|
||||||
|
for (i = 0; i < (data->image_width * data->image_height);
|
||||||
|
i++, d1 += 4, d2 += 2)
|
||||||
|
{
|
||||||
|
d1[R4] = d2[1];
|
||||||
|
d1[G4] = d2[1];
|
||||||
|
d1[B4] = d2[1];
|
||||||
|
d1[A4] = d2[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
/* 8-bit gray without alpha. */
|
||||||
|
case 1:
|
||||||
|
for (i = 0; i < (data->image_width * data->image_height);
|
||||||
|
i++, d1 += 3, d2++)
|
||||||
|
{
|
||||||
|
d1[R3] = d2[0];
|
||||||
|
d1[G3] = d2[0];
|
||||||
|
d1[B3] = d2[0];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
/* Only copy the upper 8 bit. */
|
/* Only copy the upper 8 bit. */
|
||||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
@ -1029,8 +1045,6 @@ grub_png_decode_png (struct grub_png_data *data)
|
|||||||
|
|
||||||
len = grub_png_get_dword (data);
|
len = grub_png_get_dword (data);
|
||||||
type = grub_png_get_dword (data);
|
type = grub_png_get_dword (data);
|
||||||
if (grub_errno != GRUB_ERR_NONE)
|
|
||||||
break;
|
|
||||||
data->next_offset = data->file->offset + len + 4;
|
data->next_offset = data->file->offset + len + 4;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -340,13 +340,6 @@ grub_video_reader_tga (struct grub_video_bitmap **bitmap,
|
|||||||
data.image_width = grub_le_to_cpu16 (data.hdr.image_width);
|
data.image_width = grub_le_to_cpu16 (data.hdr.image_width);
|
||||||
data.image_height = grub_le_to_cpu16 (data.hdr.image_height);
|
data.image_height = grub_le_to_cpu16 (data.hdr.image_height);
|
||||||
|
|
||||||
grub_dprintf ("tga", "image height: %d\n", data.image_height);
|
|
||||||
grub_dprintf ("tga", "image width: %d\n", data.image_width);
|
|
||||||
|
|
||||||
/* Check image height and width are within restrictions. */
|
|
||||||
if ((data.image_height > IMAGE_HW_MAX_PX) || (data.image_width > IMAGE_HW_MAX_PX))
|
|
||||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "tga: invalid image size");
|
|
||||||
|
|
||||||
/* Check that bitmap encoding is supported. */
|
/* Check that bitmap encoding is supported. */
|
||||||
switch (data.hdr.image_type)
|
switch (data.hdr.image_type)
|
||||||
{
|
{
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/video.h>
|
#include <grub/video.h>
|
||||||
#include <grub/safemath.h>
|
|
||||||
|
|
||||||
#define IMAGE_HW_MAX_PX 16384
|
|
||||||
|
|
||||||
struct grub_video_bitmap
|
struct grub_video_bitmap
|
||||||
{
|
{
|
||||||
@ -82,23 +79,6 @@ grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap)
|
|||||||
return bitmap->mode_info.height;
|
return bitmap->mode_info.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Calculate and store the size of data buffer of 1bit bitmap in result.
|
|
||||||
* Equivalent to "*result = (width * height + 7) / 8" if no overflow occurs.
|
|
||||||
* Return true when overflow occurs or false if there is no overflow.
|
|
||||||
* This function is intentionally implemented as a macro instead of
|
|
||||||
* an inline function. Although a bit awkward, it preserves data types for
|
|
||||||
* safemath macros and reduces macro side effects as much as possible.
|
|
||||||
*
|
|
||||||
* XXX: Will report false overflow if width * height > UINT64_MAX.
|
|
||||||
*/
|
|
||||||
#define grub_video_bitmap_calc_1bpp_bufsz(width, height, result) \
|
|
||||||
({ \
|
|
||||||
grub_uint64_t _bitmap_pixels; \
|
|
||||||
grub_mul ((width), (height), &_bitmap_pixels) ? 1 : \
|
|
||||||
grub_cast (_bitmap_pixels / GRUB_CHAR_BIT + !!(_bitmap_pixels % GRUB_CHAR_BIT), (result)); \
|
|
||||||
})
|
|
||||||
|
|
||||||
void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap,
|
void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap,
|
||||||
struct grub_video_mode_info *mode_info);
|
struct grub_video_mode_info *mode_info);
|
||||||
|
|
||||||
|
@ -354,16 +354,6 @@
|
|||||||
{ 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \
|
{ 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \
|
|
||||||
{ 0x5b446ed1, 0xe30b, 0x4faa, \
|
|
||||||
{ 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \
|
|
||||||
{ 0x937fe521, 0x95ae, 0x4d1a, \
|
|
||||||
{ 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \
|
|
||||||
}
|
|
||||||
|
|
||||||
struct grub_efi_sal_system_table
|
struct grub_efi_sal_system_table
|
||||||
{
|
{
|
||||||
grub_uint32_t signature;
|
grub_uint32_t signature;
|
||||||
@ -859,8 +849,6 @@ struct grub_efi_ipv4_device_path
|
|||||||
grub_efi_uint16_t remote_port;
|
grub_efi_uint16_t remote_port;
|
||||||
grub_efi_uint16_t protocol;
|
grub_efi_uint16_t protocol;
|
||||||
grub_efi_uint8_t static_ip_address;
|
grub_efi_uint8_t static_ip_address;
|
||||||
grub_efi_ipv4_address_t gateway_ip_address;
|
|
||||||
grub_efi_ipv4_address_t subnet_mask;
|
|
||||||
} GRUB_PACKED;
|
} GRUB_PACKED;
|
||||||
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
|
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
|
||||||
|
|
||||||
@ -915,15 +903,6 @@ struct grub_efi_sata_device_path
|
|||||||
} GRUB_PACKED;
|
} GRUB_PACKED;
|
||||||
typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t;
|
typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t;
|
||||||
|
|
||||||
#define GRUB_EFI_URI_DEVICE_PATH_SUBTYPE 24
|
|
||||||
|
|
||||||
struct grub_efi_uri_device_path
|
|
||||||
{
|
|
||||||
grub_efi_device_path_t header;
|
|
||||||
grub_efi_uint8_t uri[0];
|
|
||||||
} GRUB_PACKED;
|
|
||||||
typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t;
|
|
||||||
|
|
||||||
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
|
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
|
||||||
|
|
||||||
/* Media Device Path. */
|
/* Media Device Path. */
|
||||||
@ -1497,67 +1476,14 @@ typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output
|
|||||||
|
|
||||||
typedef grub_uint8_t grub_efi_pxe_packet_t[1472];
|
typedef grub_uint8_t grub_efi_pxe_packet_t[1472];
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
grub_uint8_t addr[4];
|
|
||||||
} grub_efi_pxe_ipv4_address_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
grub_uint8_t addr[16];
|
|
||||||
} grub_efi_pxe_ipv6_address_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
grub_uint8_t addr[32];
|
|
||||||
} grub_efi_pxe_mac_address_t;
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
grub_uint32_t addr[4];
|
|
||||||
grub_efi_pxe_ipv4_address_t v4;
|
|
||||||
grub_efi_pxe_ipv6_address_t v6;
|
|
||||||
} grub_efi_pxe_ip_address_t;
|
|
||||||
|
|
||||||
#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
|
|
||||||
typedef struct {
|
|
||||||
grub_uint8_t filters;
|
|
||||||
grub_uint8_t ip_cnt;
|
|
||||||
grub_uint16_t reserved;
|
|
||||||
grub_efi_pxe_ip_address_t ip_list[GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT];
|
|
||||||
} grub_efi_pxe_ip_filter_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
grub_efi_pxe_ip_address_t ip_addr;
|
|
||||||
grub_efi_pxe_mac_address_t mac_addr;
|
|
||||||
} grub_efi_pxe_arp_entry_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
grub_efi_pxe_ip_address_t ip_addr;
|
|
||||||
grub_efi_pxe_ip_address_t subnet_mask;
|
|
||||||
grub_efi_pxe_ip_address_t gw_addr;
|
|
||||||
} grub_efi_pxe_route_entry_t;
|
|
||||||
|
|
||||||
|
|
||||||
#define GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8
|
|
||||||
#define GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
|
|
||||||
|
|
||||||
typedef struct grub_efi_pxe_mode
|
typedef struct grub_efi_pxe_mode
|
||||||
{
|
{
|
||||||
grub_uint8_t started;
|
grub_uint8_t unused[52];
|
||||||
grub_uint8_t ipv6_available;
|
|
||||||
grub_uint8_t ipv6_supported;
|
|
||||||
grub_uint8_t using_ipv6;
|
|
||||||
grub_uint8_t unused[16];
|
|
||||||
grub_efi_pxe_ip_address_t station_ip;
|
|
||||||
grub_efi_pxe_ip_address_t subnet_mask;
|
|
||||||
grub_efi_pxe_packet_t dhcp_discover;
|
grub_efi_pxe_packet_t dhcp_discover;
|
||||||
grub_efi_pxe_packet_t dhcp_ack;
|
grub_efi_pxe_packet_t dhcp_ack;
|
||||||
grub_efi_pxe_packet_t proxy_offer;
|
grub_efi_pxe_packet_t proxy_offer;
|
||||||
grub_efi_pxe_packet_t pxe_discover;
|
grub_efi_pxe_packet_t pxe_discover;
|
||||||
grub_efi_pxe_packet_t pxe_reply;
|
grub_efi_pxe_packet_t pxe_reply;
|
||||||
grub_efi_pxe_packet_t pxe_bis_reply;
|
|
||||||
grub_efi_pxe_ip_filter_t ip_filter;
|
|
||||||
grub_uint32_t arp_cache_entries;
|
|
||||||
grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
|
|
||||||
grub_uint32_t route_table_entries;
|
|
||||||
grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
|
|
||||||
} grub_efi_pxe_mode_t;
|
} grub_efi_pxe_mode_t;
|
||||||
|
|
||||||
typedef struct grub_efi_pxe
|
typedef struct grub_efi_pxe
|
||||||
@ -1803,72 +1729,6 @@ struct grub_efi_rng_protocol
|
|||||||
};
|
};
|
||||||
typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t;
|
typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t;
|
||||||
|
|
||||||
enum grub_efi_ip4_config2_data_type {
|
|
||||||
GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
|
|
||||||
GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY,
|
|
||||||
GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
|
|
||||||
GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
|
|
||||||
GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
|
|
||||||
GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MAXIMUM
|
|
||||||
};
|
|
||||||
typedef enum grub_efi_ip4_config2_data_type grub_efi_ip4_config2_data_type_t;
|
|
||||||
|
|
||||||
struct grub_efi_ip4_config2_protocol
|
|
||||||
{
|
|
||||||
grub_efi_status_t (*set_data) (struct grub_efi_ip4_config2_protocol *this,
|
|
||||||
grub_efi_ip4_config2_data_type_t data_type,
|
|
||||||
grub_efi_uintn_t data_size,
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
grub_efi_status_t (*get_data) (struct grub_efi_ip4_config2_protocol *this,
|
|
||||||
grub_efi_ip4_config2_data_type_t data_type,
|
|
||||||
grub_efi_uintn_t *data_size,
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
grub_efi_status_t (*register_data_notify) (struct grub_efi_ip4_config2_protocol *this,
|
|
||||||
grub_efi_ip4_config2_data_type_t data_type,
|
|
||||||
grub_efi_event_t event);
|
|
||||||
|
|
||||||
grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip4_config2_protocol *this,
|
|
||||||
grub_efi_ip4_config2_data_type_t data_type,
|
|
||||||
grub_efi_event_t event);
|
|
||||||
};
|
|
||||||
typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t;
|
|
||||||
|
|
||||||
enum grub_efi_ip6_config_data_type {
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_DUP_ADDR_DETECT_TRANSMITS,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
|
|
||||||
GRUB_EFI_IP6_CONFIG_DATA_TYPE_MAXIMUM
|
|
||||||
};
|
|
||||||
typedef enum grub_efi_ip6_config_data_type grub_efi_ip6_config_data_type_t;
|
|
||||||
|
|
||||||
struct grub_efi_ip6_config_protocol
|
|
||||||
{
|
|
||||||
grub_efi_status_t (*set_data) (struct grub_efi_ip6_config_protocol *this,
|
|
||||||
grub_efi_ip6_config_data_type_t data_type,
|
|
||||||
grub_efi_uintn_t data_size,
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
grub_efi_status_t (*get_data) (struct grub_efi_ip6_config_protocol *this,
|
|
||||||
grub_efi_ip6_config_data_type_t data_type,
|
|
||||||
grub_efi_uintn_t *data_size,
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
grub_efi_status_t (*register_data_notify) (struct grub_efi_ip6_config_protocol *this,
|
|
||||||
grub_efi_ip6_config_data_type_t data_type,
|
|
||||||
grub_efi_event_t event);
|
|
||||||
|
|
||||||
grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip6_config_protocol *this,
|
|
||||||
grub_efi_ip6_config_data_type_t data_type,
|
|
||||||
grub_efi_event_t event);
|
|
||||||
};
|
|
||||||
typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
|
|
||||||
|
|
||||||
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|
||||||
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|
||||||
|| defined(__riscv)
|
|| defined(__riscv)
|
||||||
|
@ -47,9 +47,6 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address,
|
|||||||
grub_efi_uintn_t pages);
|
grub_efi_uintn_t pages);
|
||||||
void *
|
void *
|
||||||
EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages);
|
EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages);
|
||||||
void *
|
|
||||||
EXPORT_FUNC(grub_efi_allocate_pages_max) (grub_efi_physical_address_t max,
|
|
||||||
grub_efi_uintn_t pages);
|
|
||||||
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
|
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
|
||||||
grub_efi_uintn_t pages);
|
grub_efi_uintn_t pages);
|
||||||
grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void);
|
grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void);
|
||||||
|
@ -31,19 +31,14 @@ struct grub_video_fbblit_info
|
|||||||
grub_uint8_t *data;
|
grub_uint8_t *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/* Don't use for 1-bit bitmaps, addressing needs to be done at the bit level
|
||||||
* Don't use for 1-bit bitmaps, addressing needs to be done at the bit level
|
and it doesn't make sense, in general, to ask for a pointer
|
||||||
* and it doesn't make sense, in general, to ask for a pointer
|
to a particular pixel's data. */
|
||||||
* to a particular pixel's data.
|
|
||||||
*
|
|
||||||
* This function assumes that bounds checking has been done in previous phase
|
|
||||||
* and they are opted out in here.
|
|
||||||
*/
|
|
||||||
static inline void *
|
static inline void *
|
||||||
grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||||
unsigned int x, unsigned int y)
|
unsigned int x, unsigned int y)
|
||||||
{
|
{
|
||||||
return source->data + (grub_addr_t) y * source->mode_info->pitch + (grub_addr_t) x * source->mode_info->bytes_per_pixel;
|
return source->data + y * source->mode_info->pitch + x * source->mode_info->bytes_per_pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Advance pointer by VAL bytes. If there is no unaligned access available,
|
/* Advance pointer by VAL bytes. If there is no unaligned access available,
|
||||||
|
@ -122,7 +122,6 @@ enum grub_file_type
|
|||||||
GRUB_FILE_TYPE_FS_SEARCH,
|
GRUB_FILE_TYPE_FS_SEARCH,
|
||||||
GRUB_FILE_TYPE_AUDIO,
|
GRUB_FILE_TYPE_AUDIO,
|
||||||
GRUB_FILE_TYPE_VBE_DUMP,
|
GRUB_FILE_TYPE_VBE_DUMP,
|
||||||
GRUB_FILE_TYPE_HWMATCH,
|
|
||||||
|
|
||||||
GRUB_FILE_TYPE_LOADENV,
|
GRUB_FILE_TYPE_LOADENV,
|
||||||
GRUB_FILE_TYPE_SAVEENV,
|
GRUB_FILE_TYPE_SAVEENV,
|
||||||
|
@ -40,11 +40,6 @@ void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void),
|
|||||||
grub_err_t (*unload) (void),
|
grub_err_t (*unload) (void),
|
||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
void EXPORT_FUNC (grub_loader_set_ex) (grub_err_t (*boot) (void *),
|
|
||||||
grub_err_t (*unload) (void *),
|
|
||||||
void *context,
|
|
||||||
int flags);
|
|
||||||
|
|
||||||
/* Unset current loader, if any. */
|
/* Unset current loader, if any. */
|
||||||
void EXPORT_FUNC (grub_loader_unset) (void);
|
void EXPORT_FUNC (grub_loader_unset) (void);
|
||||||
|
|
||||||
|
@ -270,14 +270,12 @@ typedef struct grub_net
|
|||||||
{
|
{
|
||||||
char *server;
|
char *server;
|
||||||
char *name;
|
char *name;
|
||||||
int port;
|
|
||||||
grub_net_app_level_t protocol;
|
grub_net_app_level_t protocol;
|
||||||
grub_net_packets_t packs;
|
grub_net_packets_t packs;
|
||||||
grub_off_t offset;
|
grub_off_t offset;
|
||||||
grub_fs_t fs;
|
grub_fs_t fs;
|
||||||
int eof;
|
int eof;
|
||||||
int stall;
|
int stall;
|
||||||
int broken;
|
|
||||||
} *grub_net_t;
|
} *grub_net_t;
|
||||||
|
|
||||||
extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name);
|
extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name);
|
||||||
@ -449,66 +447,6 @@ struct grub_net_bootp_packet
|
|||||||
grub_uint8_t vendor[0];
|
grub_uint8_t vendor[0];
|
||||||
} GRUB_PACKED;
|
} GRUB_PACKED;
|
||||||
|
|
||||||
struct grub_net_dhcp6_packet
|
|
||||||
{
|
|
||||||
grub_uint32_t message_type:8;
|
|
||||||
grub_uint32_t transaction_id:24;
|
|
||||||
grub_uint8_t dhcp_options[0];
|
|
||||||
} GRUB_PACKED;
|
|
||||||
|
|
||||||
struct grub_net_dhcp6_option {
|
|
||||||
grub_uint16_t code;
|
|
||||||
grub_uint16_t len;
|
|
||||||
grub_uint8_t data[0];
|
|
||||||
} GRUB_PACKED;
|
|
||||||
|
|
||||||
struct grub_net_dhcp6_option_iana {
|
|
||||||
grub_uint32_t iaid;
|
|
||||||
grub_uint32_t t1;
|
|
||||||
grub_uint32_t t2;
|
|
||||||
grub_uint8_t data[0];
|
|
||||||
} GRUB_PACKED;
|
|
||||||
|
|
||||||
struct grub_net_dhcp6_option_iaaddr {
|
|
||||||
grub_uint8_t addr[16];
|
|
||||||
grub_uint32_t preferred_lifetime;
|
|
||||||
grub_uint32_t valid_lifetime;
|
|
||||||
grub_uint8_t data[0];
|
|
||||||
} GRUB_PACKED;
|
|
||||||
|
|
||||||
struct grub_net_dhcp6_option_duid_ll
|
|
||||||
{
|
|
||||||
grub_uint16_t type;
|
|
||||||
grub_uint16_t hw_type;
|
|
||||||
grub_uint8_t hwaddr[6];
|
|
||||||
} GRUB_PACKED;
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
GRUB_NET_DHCP6_SOLICIT = 1,
|
|
||||||
GRUB_NET_DHCP6_ADVERTISE = 2,
|
|
||||||
GRUB_NET_DHCP6_REQUEST = 3,
|
|
||||||
GRUB_NET_DHCP6_REPLY = 7
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
DHCP6_CLIENT_PORT = 546,
|
|
||||||
DHCP6_SERVER_PORT = 547
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
GRUB_NET_DHCP6_OPTION_CLIENTID = 1,
|
|
||||||
GRUB_NET_DHCP6_OPTION_SERVERID = 2,
|
|
||||||
GRUB_NET_DHCP6_OPTION_IA_NA = 3,
|
|
||||||
GRUB_NET_DHCP6_OPTION_IAADDR = 5,
|
|
||||||
GRUB_NET_DHCP6_OPTION_ORO = 6,
|
|
||||||
GRUB_NET_DHCP6_OPTION_ELAPSED_TIME = 8,
|
|
||||||
GRUB_NET_DHCP6_OPTION_DNS_SERVERS = 23,
|
|
||||||
GRUB_NET_DHCP6_OPTION_BOOTFILE_URL = 59
|
|
||||||
};
|
|
||||||
|
|
||||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
|
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
|
||||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
|
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
|
||||||
#define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53
|
#define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53
|
||||||
@ -529,7 +467,6 @@ enum
|
|||||||
GRUB_NET_DHCP_MESSAGE_TYPE = 53,
|
GRUB_NET_DHCP_MESSAGE_TYPE = 53,
|
||||||
GRUB_NET_DHCP_SERVER_IDENTIFIER = 54,
|
GRUB_NET_DHCP_SERVER_IDENTIFIER = 54,
|
||||||
GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55,
|
GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55,
|
||||||
GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 60,
|
|
||||||
GRUB_NET_BOOTP_CLIENT_ID = 61,
|
GRUB_NET_BOOTP_CLIENT_ID = 61,
|
||||||
GRUB_NET_DHCP_TFTP_SERVER_NAME = 66,
|
GRUB_NET_DHCP_TFTP_SERVER_NAME = 66,
|
||||||
GRUB_NET_DHCP_BOOTFILE_NAME = 67,
|
GRUB_NET_DHCP_BOOTFILE_NAME = 67,
|
||||||
@ -545,14 +482,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
|
|||||||
grub_size_t size,
|
grub_size_t size,
|
||||||
int is_def, char **device, char **path);
|
int is_def, char **device, char **path);
|
||||||
|
|
||||||
struct grub_net_network_level_interface *
|
|
||||||
grub_net_configure_by_dhcpv6_reply (const char *name,
|
|
||||||
struct grub_net_card *card,
|
|
||||||
grub_net_interface_flags_t flags,
|
|
||||||
const struct grub_net_dhcp6_packet *v6,
|
|
||||||
grub_size_t size,
|
|
||||||
int is_def, char **device, char **path);
|
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_net_add_ipv4_local (struct grub_net_network_level_interface *inf,
|
grub_net_add_ipv4_local (struct grub_net_network_level_interface *inf,
|
||||||
int mask);
|
int mask);
|
||||||
@ -561,10 +490,6 @@ void
|
|||||||
grub_net_process_dhcp (struct grub_net_buff *nb,
|
grub_net_process_dhcp (struct grub_net_buff *nb,
|
||||||
struct grub_net_network_level_interface *iface);
|
struct grub_net_network_level_interface *iface);
|
||||||
|
|
||||||
grub_err_t
|
|
||||||
grub_net_process_dhcp6 (struct grub_net_buff *nb,
|
|
||||||
struct grub_net_card *card);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
|
grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
|
||||||
const grub_net_link_level_address_t *b);
|
const grub_net_link_level_address_t *b);
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
#define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res)
|
#define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res)
|
||||||
#define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res)
|
#define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res)
|
||||||
|
|
||||||
#define grub_cast(a, res) grub_add ((a), 0, (res))
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error gcc 5.1 or newer or clang 3.8 or newer is required
|
#error gcc 5.1 or newer or clang 3.8 or newer is required
|
||||||
#endif
|
#endif
|
||||||
|
@ -147,9 +147,7 @@ struct grub_unicode_glyph
|
|||||||
grub_uint8_t bidi_level:6; /* minimum: 6 */
|
grub_uint8_t bidi_level:6; /* minimum: 6 */
|
||||||
enum grub_bidi_type bidi_type:5; /* minimum: :5 */
|
enum grub_bidi_type bidi_type:5; /* minimum: :5 */
|
||||||
|
|
||||||
#define GRUB_UNICODE_NCOMB_MAX ((1 << 8) - 1)
|
|
||||||
unsigned ncomb:8;
|
unsigned ncomb:8;
|
||||||
|
|
||||||
/* Hint by unicode subsystem how wide this character usually is.
|
/* Hint by unicode subsystem how wide this character usually is.
|
||||||
Real width is determined by font. Set only in UTF-8 stream. */
|
Real width is determined by font. Set only in UTF-8 stream. */
|
||||||
int estimated_width:8;
|
int estimated_width:8;
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
#ifndef GRUB_DEVICEITER_MACHINE_UTIL_HEADER
|
|
||||||
#define GRUB_DEVICEITER_MACHINE_UTIL_HEADER 1
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
typedef int (*grub_util_iterate_devices_hook_t) (const char *name,
|
|
||||||
int is_floppy, void *data);
|
|
||||||
|
|
||||||
void grub_util_iterate_devices (grub_util_iterate_devices_hook_t hook,
|
|
||||||
void *hook_data, int floppy_disks);
|
|
||||||
void grub_util_emit_devicemap_entry (FILE *fp, char *name, int is_floppy,
|
|
||||||
int *num_fd, int *num_hd);
|
|
||||||
|
|
||||||
#endif /* ! GRUB_DEVICEITER_MACHINE_UTIL_HEADER */
|
|
@ -223,14 +223,6 @@ grub_install_get_default_arm_platform (void);
|
|||||||
const char *
|
const char *
|
||||||
grub_install_get_default_x86_platform (void);
|
grub_install_get_default_x86_platform (void);
|
||||||
|
|
||||||
const char *
|
|
||||||
grub_install_get_default_powerpc_machtype (void);
|
|
||||||
|
|
||||||
int
|
|
||||||
grub_install_efivar_register_efi (grub_device_t efidir_grub_dev,
|
|
||||||
const char *efifile_path,
|
|
||||||
const char *efi_distributor);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_install_register_efi (grub_device_t efidir_grub_dev,
|
grub_install_register_efi (grub_device_t efidir_grub_dev,
|
||||||
const char *efifile_path,
|
const char *efifile_path,
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
enum grub_verify_flags
|
enum grub_verify_flags
|
||||||
{
|
{
|
||||||
GRUB_VERIFY_FLAGS_NONE = 0,
|
|
||||||
GRUB_VERIFY_FLAGS_SKIP_VERIFICATION = 1,
|
GRUB_VERIFY_FLAGS_SKIP_VERIFICATION = 1,
|
||||||
GRUB_VERIFY_FLAGS_SINGLE_CHUNK = 2,
|
GRUB_VERIFY_FLAGS_SINGLE_CHUNK = 2,
|
||||||
/* Defer verification to another authority. */
|
/* Defer verification to another authority. */
|
||||||
@ -65,14 +64,10 @@ struct grub_file_verifier
|
|||||||
grub_err_t (*verify_string) (char *str, enum grub_verify_string_type type);
|
grub_err_t (*verify_string) (char *str, enum grub_verify_string_type type);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_PCBIOS
|
|
||||||
extern struct grub_file_verifier *grub_file_verifiers;
|
|
||||||
#else
|
|
||||||
extern struct grub_file_verifier *EXPORT_VAR (grub_file_verifiers);
|
extern struct grub_file_verifier *EXPORT_VAR (grub_file_verifiers);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
grub_verifiers_init (void);
|
grub_verifiers_init (void);
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_verifier_register (struct grub_file_verifier *ver)
|
grub_verifier_register (struct grub_file_verifier *ver)
|
||||||
@ -86,12 +81,7 @@ grub_verifier_unregister (struct grub_file_verifier *ver)
|
|||||||
grub_list_remove (GRUB_AS_LIST (ver));
|
grub_list_remove (GRUB_AS_LIST (ver));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_PCBIOS
|
|
||||||
grub_err_t
|
|
||||||
grub_verify_string (char *str, enum grub_verify_string_type type);
|
|
||||||
#else
|
|
||||||
extern grub_err_t
|
extern grub_err_t
|
||||||
EXPORT_FUNC (grub_verify_string) (char *str, enum grub_verify_string_type type);
|
EXPORT_FUNC (grub_verify_string) (char *str, enum grub_verify_string_type type);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ! GRUB_VERIFY_HEADER */
|
#endif /* ! GRUB_VERIFY_HEADER */
|
||||||
|
@ -41,7 +41,7 @@ echo "hello" > "$outfile"
|
|||||||
|
|
||||||
tar cf "$imgfile" "$outfile"
|
tar cf "$imgfile" "$outfile"
|
||||||
|
|
||||||
if [ "$(echo "nativedisk; source '(ahci0)/$outfile';" | "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 " | tail -n 1)" != "Hello World" ]; then
|
if [ "$(echo "nativedisk; source '(ahci0)/$outfile';" | "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 " | tail -n 1)" != "Hello World" ]; then
|
||||||
rm "$imgfile"
|
rm "$imgfile"
|
||||||
rm "$outfile"
|
rm "$outfile"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#! @BUILD_SHEBANG@
|
#! @BUILD_SHEBANG@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "Skipping flaky test."
|
|
||||||
exit 77
|
|
||||||
|
|
||||||
. "@builddir@/grub-core/modinfo.sh"
|
. "@builddir@/grub-core/modinfo.sh"
|
||||||
|
|
||||||
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
||||||
|
@ -16,8 +16,6 @@ out=`echo all_functional_test | @builddir@/grub-shell --timeout=3600 --files="/b
|
|||||||
|
|
||||||
if [ "$(echo "$out" | tail -n 1)" != "ALL TESTS PASSED" ]; then
|
if [ "$(echo "$out" | tail -n 1)" != "ALL TESTS PASSED" ]; then
|
||||||
echo "Functional test failure: $out"
|
echo "Functional test failure: $out"
|
||||||
# Disabled temporarily due to unrecognised video checksum failures.
|
exit 1
|
||||||
#exit 1
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -4,9 +4,6 @@ set -e
|
|||||||
|
|
||||||
fs="$1"
|
fs="$1"
|
||||||
|
|
||||||
# We can't have this set, or filesystem tests will fail
|
|
||||||
unset SOURCE_DATE_EPOCH
|
|
||||||
|
|
||||||
GRUBFSTEST="@builddir@/grub-fstest"
|
GRUBFSTEST="@builddir@/grub-fstest"
|
||||||
|
|
||||||
tempdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
tempdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||||
|
@ -166,11 +166,13 @@ _grub_set_entry () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
__grub_set_default_program="@grub_set_default@"
|
__grub_set_default_program="@grub_set_default@"
|
||||||
complete -F _grub_set_entry -o filenames ${__grub_set_default_program}
|
have ${__grub_set_default_program} && \
|
||||||
|
complete -F _grub_set_entry -o filenames ${__grub_set_default_program}
|
||||||
unset __grub_set_default_program
|
unset __grub_set_default_program
|
||||||
|
|
||||||
__grub_reboot_program="@grub_reboot@"
|
__grub_reboot_program="@grub_reboot@"
|
||||||
complete -F _grub_set_entry -o filenames ${__grub_reboot_program}
|
have ${__grub_reboot_program} && \
|
||||||
|
complete -F _grub_set_entry -o filenames ${__grub_reboot_program}
|
||||||
unset __grub_reboot_program
|
unset __grub_reboot_program
|
||||||
|
|
||||||
|
|
||||||
@ -196,7 +198,8 @@ _grub_editenv () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
__grub_editenv_program="@grub_editenv@"
|
__grub_editenv_program="@grub_editenv@"
|
||||||
complete -F _grub_editenv -o filenames ${__grub_editenv_program}
|
have ${__grub_editenv_program} && \
|
||||||
|
complete -F _grub_editenv -o filenames ${__grub_editenv_program}
|
||||||
unset __grub_editenv_program
|
unset __grub_editenv_program
|
||||||
|
|
||||||
|
|
||||||
@ -216,7 +219,8 @@ _grub_mkconfig () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
__grub_mkconfig_program="@grub_mkconfig@"
|
__grub_mkconfig_program="@grub_mkconfig@"
|
||||||
complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program}
|
have ${__grub_mkconfig_program} && \
|
||||||
|
complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program}
|
||||||
unset __grub_mkconfig_program
|
unset __grub_mkconfig_program
|
||||||
|
|
||||||
|
|
||||||
@ -250,11 +254,13 @@ _grub_setup () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
__grub_bios_setup_program="@grub_bios_setup@"
|
__grub_bios_setup_program="@grub_bios_setup@"
|
||||||
complete -F _grub_setup -o filenames ${__grub_bios_setup_program}
|
have ${__grub_bios_setup_program} && \
|
||||||
|
complete -F _grub_setup -o filenames ${__grub_bios_setup_program}
|
||||||
unset __grub_bios_setup_program
|
unset __grub_bios_setup_program
|
||||||
|
|
||||||
__grub_sparc64_setup_program="@grub_sparc64_setup@"
|
__grub_sparc64_setup_program="@grub_sparc64_setup@"
|
||||||
complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program}
|
have ${__grub_sparc64_setup_program} && \
|
||||||
|
complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program}
|
||||||
unset __grub_sparc64_setup_program
|
unset __grub_sparc64_setup_program
|
||||||
|
|
||||||
|
|
||||||
@ -299,7 +305,8 @@ _grub_install () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
__grub_install_program="@grub_install@"
|
__grub_install_program="@grub_install@"
|
||||||
complete -F _grub_install -o filenames ${__grub_install_program}
|
have ${__grub_install_program} && \
|
||||||
|
complete -F _grub_install -o filenames ${__grub_install_program}
|
||||||
unset __grub_install_program
|
unset __grub_install_program
|
||||||
|
|
||||||
|
|
||||||
@ -320,7 +327,8 @@ _grub_mkfont () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
__grub_mkfont_program="@grub_mkfont@"
|
__grub_mkfont_program="@grub_mkfont@"
|
||||||
complete -F _grub_mkfont -o filenames ${__grub_mkfont_program}
|
have ${__grub_mkfont_program} && \
|
||||||
|
complete -F _grub_mkfont -o filenames ${__grub_mkfont_program}
|
||||||
unset __grub_mkfont_program
|
unset __grub_mkfont_program
|
||||||
|
|
||||||
|
|
||||||
@ -350,7 +358,8 @@ _grub_mkrescue () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
__grub_mkrescue_program="@grub_mkrescue@"
|
__grub_mkrescue_program="@grub_mkrescue@"
|
||||||
complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program}
|
have ${__grub_mkrescue_program} && \
|
||||||
|
complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program}
|
||||||
unset __grub_mkrescue_program
|
unset __grub_mkrescue_program
|
||||||
|
|
||||||
|
|
||||||
@ -391,7 +400,8 @@ _grub_mkimage () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
__grub_mkimage_program="@grub_mkimage@"
|
__grub_mkimage_program="@grub_mkimage@"
|
||||||
complete -F _grub_mkimage -o filenames ${__grub_mkimage_program}
|
have ${__grub_mkimage_program} && \
|
||||||
|
complete -F _grub_mkimage -o filenames ${__grub_mkimage_program}
|
||||||
unset __grub_mkimage_program
|
unset __grub_mkimage_program
|
||||||
|
|
||||||
|
|
||||||
@ -412,7 +422,8 @@ _grub_mkpasswd_pbkdf2 () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
__grub_mkpasswd_pbkdf2_program="@grub_mkpasswd_pbkdf2@"
|
__grub_mkpasswd_pbkdf2_program="@grub_mkpasswd_pbkdf2@"
|
||||||
complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
|
have ${__grub_mkpasswd_pbkdf2_program} && \
|
||||||
|
complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
|
||||||
unset __grub_mkpasswd_pbkdf2_program
|
unset __grub_mkpasswd_pbkdf2_program
|
||||||
|
|
||||||
|
|
||||||
@ -449,7 +460,8 @@ _grub_probe () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
__grub_probe_program="@grub_probe@"
|
__grub_probe_program="@grub_probe@"
|
||||||
complete -F _grub_probe -o filenames ${__grub_probe_program}
|
have ${__grub_probe_program} && \
|
||||||
|
complete -F _grub_probe -o filenames ${__grub_probe_program}
|
||||||
unset __grub_probe_program
|
unset __grub_probe_program
|
||||||
|
|
||||||
|
|
||||||
@ -470,7 +482,8 @@ _grub_script_check () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
__grub_script_check_program="@grub_script_check@"
|
__grub_script_check_program="@grub_script_check@"
|
||||||
complete -F _grub_script_check -o filenames ${__grub_script_check_program}
|
have ${__grub_script_check_program} && \
|
||||||
|
complete -F _grub_script_check -o filenames ${__grub_script_check_program}
|
||||||
|
|
||||||
|
|
||||||
# Local variables:
|
# Local variables:
|
||||||
|
1046
util/deviceiter.c
1046
util/deviceiter.c
File diff suppressed because it is too large
Load Diff
@ -1,13 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <grub/util/deviceiter.h>
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_util_emit_devicemap_entry (FILE *fp, char *name, int is_floppy,
|
|
||||||
int *num_fd, int *num_hd)
|
|
||||||
{
|
|
||||||
if (is_floppy)
|
|
||||||
fprintf (fp, "(fd%d)\t%s\n", (*num_fd)++, name);
|
|
||||||
else
|
|
||||||
fprintf (fp, "(hd%d)\t%s\n", (*num_hd)++, name);
|
|
||||||
}
|
|
@ -245,20 +245,6 @@ find_partition (grub_disk_t dsk __attribute__ ((unused)),
|
|||||||
|
|
||||||
if (ctx->start == part_start)
|
if (ctx->start == part_start)
|
||||||
{
|
{
|
||||||
/* This is dreadfully hardcoded, but there's a limit to what GRUB
|
|
||||||
Legacy was able to deal with anyway. */
|
|
||||||
if (getenv ("GRUB_LEGACY_0_BASED_PARTITIONS"))
|
|
||||||
{
|
|
||||||
if (partition->parent)
|
|
||||||
/* Probably a BSD slice. */
|
|
||||||
ctx->partname = xasprintf ("%d,%d", partition->parent->number,
|
|
||||||
partition->number + 1);
|
|
||||||
else
|
|
||||||
ctx->partname = xasprintf ("%d", partition->number);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx->partname = grub_partition_get_name (partition);
|
ctx->partname = grub_partition_get_name (partition);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -774,25 +774,17 @@ get_localedir (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
copy_locales (const char *dstd, int langpack)
|
copy_locales (const char *dstd)
|
||||||
{
|
{
|
||||||
grub_util_fd_dir_t d;
|
grub_util_fd_dir_t d;
|
||||||
grub_util_fd_dirent_t de;
|
grub_util_fd_dirent_t de;
|
||||||
const char *locale_dir = get_localedir ();
|
const char *locale_dir = get_localedir ();
|
||||||
char *dir;
|
|
||||||
|
|
||||||
if (langpack)
|
d = grub_util_fd_opendir (locale_dir);
|
||||||
dir = xasprintf ("%s-langpack", locale_dir);
|
|
||||||
else
|
|
||||||
dir = xstrdup (locale_dir);
|
|
||||||
|
|
||||||
d = grub_util_fd_opendir (dir);
|
|
||||||
if (!d)
|
if (!d)
|
||||||
{
|
{
|
||||||
if (!langpack)
|
|
||||||
grub_util_warn (_("cannot open directory `%s': %s"),
|
grub_util_warn (_("cannot open directory `%s': %s"),
|
||||||
dir, grub_util_fd_strerror ());
|
locale_dir, grub_util_fd_strerror ());
|
||||||
free (dir);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,14 +801,14 @@ copy_locales (const char *dstd, int langpack)
|
|||||||
if (ext && (grub_strcmp (ext, ".mo") == 0
|
if (ext && (grub_strcmp (ext, ".mo") == 0
|
||||||
|| grub_strcmp (ext, ".gmo") == 0))
|
|| grub_strcmp (ext, ".gmo") == 0))
|
||||||
{
|
{
|
||||||
srcf = grub_util_path_concat (2, dir, de->d_name);
|
srcf = grub_util_path_concat (2, locale_dir, de->d_name);
|
||||||
dstf = grub_util_path_concat (2, dstd, de->d_name);
|
dstf = grub_util_path_concat (2, dstd, de->d_name);
|
||||||
ext = grub_strrchr (dstf, '.');
|
ext = grub_strrchr (dstf, '.');
|
||||||
grub_strcpy (ext, ".mo");
|
grub_strcpy (ext, ".mo");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
srcf = grub_util_path_concat_ext (4, dir, de->d_name,
|
srcf = grub_util_path_concat_ext (4, locale_dir, de->d_name,
|
||||||
"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");
|
||||||
}
|
}
|
||||||
@ -825,7 +817,6 @@ copy_locales (const char *dstd, int langpack)
|
|||||||
free (dstf);
|
free (dstf);
|
||||||
}
|
}
|
||||||
grub_util_fd_closedir (d);
|
grub_util_fd_closedir (d);
|
||||||
free (dir);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -844,15 +835,13 @@ grub_install_copy_nls(const char *src __attribute__ ((unused)),
|
|||||||
{
|
{
|
||||||
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);
|
||||||
copy_locales (dst_locale, 0);
|
copy_locales (dst_locale);
|
||||||
copy_locales (dst_locale, 1);
|
|
||||||
free (srcd);
|
free (srcd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
const char *locale_dir = get_localedir ();
|
const char *locale_dir = get_localedir ();
|
||||||
char *locale_langpack_dir = xasprintf ("%s-langpack", locale_dir);
|
|
||||||
|
|
||||||
for (i = 0; i < install_locales.n_entries; i++)
|
for (i = 0; i < install_locales.n_entries; i++)
|
||||||
{
|
{
|
||||||
@ -869,16 +858,6 @@ grub_install_copy_nls(const char *src __attribute__ ((unused)),
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
free (srcf);
|
free (srcf);
|
||||||
srcf = grub_util_path_concat_ext (4, locale_langpack_dir,
|
|
||||||
install_locales.entries[i],
|
|
||||||
"LC_MESSAGES", PACKAGE, ".mo");
|
|
||||||
if (grub_install_compress_file (srcf, dstf, 0))
|
|
||||||
{
|
|
||||||
free (srcf);
|
|
||||||
free (dstf);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
free (srcf);
|
|
||||||
srcf = grub_util_path_concat_ext (4, locale_dir,
|
srcf = grub_util_path_concat_ext (4, locale_dir,
|
||||||
install_locales.entries[i],
|
install_locales.entries[i],
|
||||||
"LC_MESSAGES", PACKAGE, ".mo");
|
"LC_MESSAGES", PACKAGE, ".mo");
|
||||||
@ -888,8 +867,6 @@ grub_install_copy_nls(const char *src __attribute__ ((unused)),
|
|||||||
free (srcf);
|
free (srcf);
|
||||||
free (dstf);
|
free (dstf);
|
||||||
}
|
}
|
||||||
|
|
||||||
free (locale_langpack_dir);
|
|
||||||
}
|
}
|
||||||
free (dst_locale);
|
free (dst_locale);
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
#include <grub/emu/config.h>
|
#include <grub/emu/config.h>
|
||||||
#include <grub/util/ofpath.h>
|
#include <grub/util/ofpath.h>
|
||||||
#include <grub/hfsplus.h>
|
#include <grub/hfsplus.h>
|
||||||
#include <grub/emu/hostfile.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -56,7 +55,6 @@
|
|||||||
|
|
||||||
static char *target;
|
static char *target;
|
||||||
static int removable = 0;
|
static int removable = 0;
|
||||||
static int force_extra_removable = 0;
|
|
||||||
static int recheck = 0;
|
static int recheck = 0;
|
||||||
static int update_nvram = 1;
|
static int update_nvram = 1;
|
||||||
static char *install_device = NULL;
|
static char *install_device = NULL;
|
||||||
@ -81,7 +79,6 @@ static char *label_color;
|
|||||||
static char *label_bgcolor;
|
static char *label_bgcolor;
|
||||||
static char *product_version;
|
static char *product_version;
|
||||||
static int add_rs_codes = 1;
|
static int add_rs_codes = 1;
|
||||||
static int uefi_secure_boot = 1;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -112,10 +109,7 @@ enum
|
|||||||
OPTION_LABEL_FONT,
|
OPTION_LABEL_FONT,
|
||||||
OPTION_LABEL_COLOR,
|
OPTION_LABEL_COLOR,
|
||||||
OPTION_LABEL_BGCOLOR,
|
OPTION_LABEL_BGCOLOR,
|
||||||
OPTION_PRODUCT_VERSION,
|
OPTION_PRODUCT_VERSION
|
||||||
OPTION_UEFI_SECURE_BOOT,
|
|
||||||
OPTION_NO_UEFI_SECURE_BOOT,
|
|
||||||
OPTION_FORCE_EXTRA_REMOVABLE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int fs_probe = 1;
|
static int fs_probe = 1;
|
||||||
@ -218,10 +212,6 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
|||||||
removable = 1;
|
removable = 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case OPTION_FORCE_EXTRA_REMOVABLE:
|
|
||||||
force_extra_removable = 1;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case OPTION_ALLOW_FLOPPY:
|
case OPTION_ALLOW_FLOPPY:
|
||||||
allow_floppy = 1;
|
allow_floppy = 1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -243,14 +233,6 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
|||||||
bootloader_id = xstrdup (arg);
|
bootloader_id = xstrdup (arg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case OPTION_UEFI_SECURE_BOOT:
|
|
||||||
uefi_secure_boot = 1;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case OPTION_NO_UEFI_SECURE_BOOT:
|
|
||||||
uefi_secure_boot = 0;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case ARGP_KEY_ARG:
|
case ARGP_KEY_ARG:
|
||||||
if (install_device)
|
if (install_device)
|
||||||
grub_util_error ("%s", _("More than one install device?"));
|
grub_util_error ("%s", _("More than one install device?"));
|
||||||
@ -320,17 +302,6 @@ static struct argp_option options[] = {
|
|||||||
{"label-color", OPTION_LABEL_COLOR, N_("COLOR"), 0, N_("use COLOR for label"), 2},
|
{"label-color", OPTION_LABEL_COLOR, N_("COLOR"), 0, N_("use COLOR for label"), 2},
|
||||||
{"label-bgcolor", OPTION_LABEL_BGCOLOR, N_("COLOR"), 0, N_("use COLOR for label background"), 2},
|
{"label-bgcolor", OPTION_LABEL_BGCOLOR, N_("COLOR"), 0, N_("use COLOR for label background"), 2},
|
||||||
{"product-version", OPTION_PRODUCT_VERSION, N_("STRING"), 0, N_("use STRING as product version"), 2},
|
{"product-version", OPTION_PRODUCT_VERSION, N_("STRING"), 0, N_("use STRING as product version"), 2},
|
||||||
{"uefi-secure-boot", OPTION_UEFI_SECURE_BOOT, 0, 0,
|
|
||||||
N_("install an image usable with UEFI Secure Boot. "
|
|
||||||
"This option is only available on EFI and if the grub-efi-amd64-signed "
|
|
||||||
"package is installed."), 2},
|
|
||||||
{"no-uefi-secure-boot", OPTION_NO_UEFI_SECURE_BOOT, 0, 0,
|
|
||||||
N_("do not install an image usable with UEFI Secure Boot, even if the "
|
|
||||||
"system was currently started using it. "
|
|
||||||
"This option is only available on EFI."), 2},
|
|
||||||
{"force-extra-removable", OPTION_FORCE_EXTRA_REMOVABLE, 0, 0,
|
|
||||||
N_("force installation to the removable media path also. "
|
|
||||||
"This option is only available on EFI."), 2},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -856,93 +827,12 @@ fill_core_services (const char *core_services)
|
|||||||
free (sysv_plist);
|
free (sysv_plist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper routine for also_install_removable() below. Walk through the
|
|
||||||
specified dir, looking to see if there is a file/dir that matches
|
|
||||||
the search string exactly, but in a case-insensitive manner. If so,
|
|
||||||
return a copy of the exact file/dir that *does* exist. If not,
|
|
||||||
return NULL */
|
|
||||||
static char *
|
|
||||||
check_component_exists(const char *dir,
|
|
||||||
const char *search)
|
|
||||||
{
|
|
||||||
grub_util_fd_dir_t d;
|
|
||||||
grub_util_fd_dirent_t de;
|
|
||||||
char *found = NULL;
|
|
||||||
|
|
||||||
d = grub_util_fd_opendir (dir);
|
|
||||||
if (!d)
|
|
||||||
grub_util_error (_("cannot open directory `%s': %s"),
|
|
||||||
dir, grub_util_fd_strerror ());
|
|
||||||
|
|
||||||
while ((de = grub_util_fd_readdir (d)))
|
|
||||||
{
|
|
||||||
if (strcasecmp (de->d_name, search) == 0)
|
|
||||||
{
|
|
||||||
found = xstrdup (de->d_name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
grub_util_fd_closedir (d);
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Some complex directory-handling stuff in here, to cope with
|
|
||||||
* case-insensitive FAT/VFAT filesystem semantics. Ugh. */
|
|
||||||
static void
|
|
||||||
also_install_removable(const char *src,
|
|
||||||
const char *base_efidir,
|
|
||||||
const char *efi_file,
|
|
||||||
int is_needed)
|
|
||||||
{
|
|
||||||
char *dst = NULL;
|
|
||||||
char *cur = NULL;
|
|
||||||
char *found = NULL;
|
|
||||||
|
|
||||||
/* We need to install in $base_efidir/EFI/BOOT/$efi_file, but we
|
|
||||||
* need to cope with case-insensitive stuff here. Build the path one
|
|
||||||
* component at a time, checking for existing matches each time. */
|
|
||||||
|
|
||||||
/* Look for "EFI" in base_efidir. Make it if it does not exist in
|
|
||||||
* some form. */
|
|
||||||
found = check_component_exists(base_efidir, "EFI");
|
|
||||||
if (found == NULL)
|
|
||||||
found = xstrdup("EFI");
|
|
||||||
dst = grub_util_path_concat (2, base_efidir, found);
|
|
||||||
cur = xstrdup (dst);
|
|
||||||
free (dst);
|
|
||||||
free (found);
|
|
||||||
grub_install_mkdir_p (cur);
|
|
||||||
|
|
||||||
/* Now BOOT */
|
|
||||||
found = check_component_exists(cur, "BOOT");
|
|
||||||
if (found == NULL)
|
|
||||||
found = xstrdup("BOOT");
|
|
||||||
dst = grub_util_path_concat (2, cur, found);
|
|
||||||
cur = xstrdup (dst);
|
|
||||||
free (dst);
|
|
||||||
free (found);
|
|
||||||
grub_install_mkdir_p (cur);
|
|
||||||
|
|
||||||
/* Now $efi_file */
|
|
||||||
found = check_component_exists(cur, efi_file);
|
|
||||||
if (found == NULL)
|
|
||||||
found = xstrdup(efi_file);
|
|
||||||
dst = grub_util_path_concat (2, cur, found);
|
|
||||||
cur = xstrdup (dst);
|
|
||||||
free (dst);
|
|
||||||
free (found);
|
|
||||||
grub_install_copy_file (src, cur, is_needed);
|
|
||||||
|
|
||||||
free (cur);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int is_efi = 0;
|
int is_efi = 0;
|
||||||
const char *efi_distributor = NULL;
|
const char *efi_distributor = NULL;
|
||||||
const char *efi_suffix = NULL, *efi_suffix_upper = NULL;
|
const char *efi_file = NULL;
|
||||||
char *efi_file = NULL;
|
|
||||||
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;
|
||||||
@ -953,7 +843,6 @@ main (int argc, char *argv[])
|
|||||||
char *relative_grubdir;
|
char *relative_grubdir;
|
||||||
char **efidir_device_names = NULL;
|
char **efidir_device_names = NULL;
|
||||||
grub_device_t efidir_grub_dev = NULL;
|
grub_device_t efidir_grub_dev = NULL;
|
||||||
char *base_efidir = NULL;
|
|
||||||
char *efidir_grub_devname;
|
char *efidir_grub_devname;
|
||||||
int efidir_is_mac = 0;
|
int efidir_is_mac = 0;
|
||||||
int is_prep = 0;
|
int is_prep = 0;
|
||||||
@ -986,9 +875,6 @@ main (int argc, char *argv[])
|
|||||||
bootloader_id = xstrdup ("grub");
|
bootloader_id = xstrdup ("grub");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removable && force_extra_removable)
|
|
||||||
grub_util_error (_("Invalid to use both --removable and --force_extra_removable"));
|
|
||||||
|
|
||||||
if (!grub_install_source_directory)
|
if (!grub_install_source_directory)
|
||||||
{
|
{
|
||||||
if (!target)
|
if (!target)
|
||||||
@ -1208,8 +1094,6 @@ main (int argc, char *argv[])
|
|||||||
if (!efidir_is_mac && grub_strcmp (fs->name, "fat") != 0)
|
if (!efidir_is_mac && grub_strcmp (fs->name, "fat") != 0)
|
||||||
grub_util_error (_("%s doesn't look like an EFI partition"), efidir);
|
grub_util_error (_("%s doesn't look like an EFI partition"), efidir);
|
||||||
|
|
||||||
base_efidir = xstrdup(efidir);
|
|
||||||
|
|
||||||
/* The EFI specification requires that an EFI System Partition must
|
/* The EFI specification requires that an EFI System Partition must
|
||||||
contain an "EFI" subdirectory, and that OS loaders are stored in
|
contain an "EFI" subdirectory, and that OS loaders are stored in
|
||||||
subdirectories below EFI. Vendors are expected to pick names that do
|
subdirectories below EFI. Vendors are expected to pick names that do
|
||||||
@ -1218,43 +1102,6 @@ main (int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
char *t;
|
char *t;
|
||||||
efi_distributor = bootloader_id;
|
efi_distributor = bootloader_id;
|
||||||
if (strcmp (efi_distributor, "kubuntu") == 0)
|
|
||||||
efi_distributor = "ubuntu";
|
|
||||||
else if (strcmp (efi_distributor, "devuan") == 0)
|
|
||||||
efi_distributor = "debian";
|
|
||||||
switch (platform)
|
|
||||||
{
|
|
||||||
case GRUB_INSTALL_PLATFORM_I386_EFI:
|
|
||||||
efi_suffix = "ia32";
|
|
||||||
efi_suffix_upper = "IA32";
|
|
||||||
break;
|
|
||||||
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
|
|
||||||
efi_suffix = "x64";
|
|
||||||
efi_suffix_upper = "X64";
|
|
||||||
break;
|
|
||||||
case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
|
||||||
efi_suffix = "ia64";
|
|
||||||
efi_suffix_upper = "IA64";
|
|
||||||
break;
|
|
||||||
case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
|
||||||
efi_suffix = "arm";
|
|
||||||
efi_suffix_upper = "ARM";
|
|
||||||
break;
|
|
||||||
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
|
||||||
efi_suffix = "aa64";
|
|
||||||
efi_suffix_upper = "AA64";
|
|
||||||
break;
|
|
||||||
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
|
|
||||||
efi_suffix = "riscv32";
|
|
||||||
efi_suffix_upper = "RISCV32";
|
|
||||||
break;
|
|
||||||
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
|
|
||||||
efi_suffix = "riscv64";
|
|
||||||
efi_suffix_upper = "RISCV64";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (removable)
|
if (removable)
|
||||||
{
|
{
|
||||||
/* The specification makes stricter requirements of removable
|
/* The specification makes stricter requirements of removable
|
||||||
@ -1263,16 +1110,66 @@ main (int argc, char *argv[])
|
|||||||
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";
|
||||||
if (!efi_suffix)
|
switch (platform)
|
||||||
|
{
|
||||||
|
case GRUB_INSTALL_PLATFORM_I386_EFI:
|
||||||
|
efi_file = "BOOTIA32.EFI";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
|
||||||
|
efi_file = "BOOTX64.EFI";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
||||||
|
efi_file = "BOOTIA64.EFI";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
||||||
|
efi_file = "BOOTARM.EFI";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
||||||
|
efi_file = "BOOTAA64.EFI";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
|
||||||
|
efi_file = "BOOTRISCV32.EFI";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
|
||||||
|
efi_file = "BOOTRISCV64.EFI";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
grub_util_error ("%s", _("You've found a bug"));
|
grub_util_error ("%s", _("You've found a bug"));
|
||||||
efi_file = xasprintf ("BOOT%s.EFI", efi_suffix_upper);
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* It is convenient for each architecture to have a different
|
/* It is convenient for each architecture to have a different
|
||||||
efi_file, so that different versions can be installed in parallel.
|
efi_file, so that different versions can be installed in parallel.
|
||||||
*/
|
*/
|
||||||
efi_file = xasprintf ("grub%s.efi", efi_suffix);
|
switch (platform)
|
||||||
|
{
|
||||||
|
case GRUB_INSTALL_PLATFORM_I386_EFI:
|
||||||
|
efi_file = "grubia32.efi";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
|
||||||
|
efi_file = "grubx64.efi";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
||||||
|
efi_file = "grubia64.efi";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
||||||
|
efi_file = "grubarm.efi";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
||||||
|
efi_file = "grubaa64.efi";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
|
||||||
|
efi_file = "grubriscv32.efi";
|
||||||
|
break;
|
||||||
|
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
|
||||||
|
efi_file = "grubriscv64.efi";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
efi_file = "grub.efi";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
t = grub_util_path_concat (3, efidir, "EFI", efi_distributor);
|
t = grub_util_path_concat (3, efidir, "EFI", efi_distributor);
|
||||||
free (efidir);
|
free (efidir);
|
||||||
@ -1282,18 +1179,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
if (platform == GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275)
|
if (platform == GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275)
|
||||||
{
|
{
|
||||||
const char *machtype = grub_install_get_default_powerpc_machtype ();
|
|
||||||
int is_guess = 0;
|
int is_guess = 0;
|
||||||
|
|
||||||
if (strcmp (machtype, "pmac_oldworld") == 0)
|
|
||||||
update_nvram = 0;
|
|
||||||
else if (strcmp (machtype, "cell") == 0)
|
|
||||||
update_nvram = 0;
|
|
||||||
else if (strcmp (machtype, "generic") == 0)
|
|
||||||
update_nvram = 0;
|
|
||||||
else if (strcmp (machtype, "chrp_ibm_qemu") == 0)
|
|
||||||
update_nvram = 0;
|
|
||||||
|
|
||||||
if (!macppcdir)
|
if (!macppcdir)
|
||||||
{
|
{
|
||||||
char *d;
|
char *d;
|
||||||
@ -1489,60 +1375,16 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *efi_signed = NULL;
|
if (!have_abstractions)
|
||||||
switch (platform)
|
|
||||||
{
|
|
||||||
case GRUB_INSTALL_PLATFORM_I386_EFI:
|
|
||||||
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
|
|
||||||
case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
|
||||||
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
|
||||||
case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
|
||||||
{
|
|
||||||
char *dir = xasprintf ("%s-signed", grub_install_source_directory);
|
|
||||||
char *signed_image;
|
|
||||||
if (removable)
|
|
||||||
signed_image = xasprintf ("gcd%s.efi.signed", efi_suffix);
|
|
||||||
else
|
|
||||||
signed_image = xasprintf ("grub%s.efi.signed", efi_suffix);
|
|
||||||
efi_signed = grub_util_path_concat (2, dir, signed_image);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!efi_signed || !grub_util_is_regular (efi_signed))
|
|
||||||
uefi_secure_boot = 0;
|
|
||||||
|
|
||||||
if (!have_abstractions || uefi_secure_boot)
|
|
||||||
{
|
{
|
||||||
if ((disk_module && grub_strcmp (disk_module, "biosdisk") != 0)
|
if ((disk_module && grub_strcmp (disk_module, "biosdisk") != 0)
|
||||||
|| grub_drives[1]
|
|| grub_drives[1]
|
||||||
|| (!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))
|
||||||
|| !have_bootdev (platform)
|
|| !have_bootdev (platform))
|
||||||
|| uefi_secure_boot)
|
|
||||||
{
|
{
|
||||||
char *uuid = NULL;
|
char *uuid = NULL;
|
||||||
|
|
||||||
if (uefi_secure_boot && config.is_cryptodisk_enabled)
|
|
||||||
{
|
|
||||||
if (grub_dev->disk)
|
|
||||||
probe_cryptodisk_uuid (grub_dev->disk);
|
|
||||||
|
|
||||||
for (curdrive = grub_drives + 1; *curdrive; curdrive++)
|
|
||||||
{
|
|
||||||
grub_device_t dev = grub_device_open (*curdrive);
|
|
||||||
if (!dev)
|
|
||||||
continue;
|
|
||||||
if (dev->disk)
|
|
||||||
probe_cryptodisk_uuid (dev->disk);
|
|
||||||
grub_device_close (dev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* generic method (used on coreboot and ata mod). */
|
/* generic method (used on coreboot and ata mod). */
|
||||||
if (!force_file_id
|
if (!force_file_id
|
||||||
&& grub_fs->fs_uuid && grub_fs->fs_uuid (grub_dev, &uuid))
|
&& grub_fs->fs_uuid && grub_fs->fs_uuid (grub_dev, &uuid))
|
||||||
@ -1885,19 +1727,6 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
grub_set_install_backup_ponr ();
|
grub_set_install_backup_ponr ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If vestiges of GRUB Legacy still exist, tell the Debian packaging
|
|
||||||
that they can ignore them. */
|
|
||||||
if (!rootdir && grub_util_is_regular ("/boot/grub/stage2") &&
|
|
||||||
grub_util_is_regular ("/boot/grub/menu.lst"))
|
|
||||||
{
|
|
||||||
grub_util_fd_t fd;
|
|
||||||
|
|
||||||
fd = grub_util_fd_open ("/boot/grub/grub2-installed",
|
|
||||||
GRUB_UTIL_FD_O_WRONLY);
|
|
||||||
grub_util_fd_close (fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275:
|
case GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275:
|
||||||
@ -2081,7 +1910,7 @@ main (int argc, char *argv[])
|
|||||||
"\\System\\Library\\CoreServices",
|
"\\System\\Library\\CoreServices",
|
||||||
efi_distributor);
|
efi_distributor);
|
||||||
if (ret)
|
if (ret)
|
||||||
grub_util_error (_("failed to register the EFI boot entry: %s"),
|
grub_util_error (_("efibootmgr failed to register the boot entry: %s"),
|
||||||
strerror (ret));
|
strerror (ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2098,134 +1927,10 @@ main (int argc, char *argv[])
|
|||||||
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);
|
||||||
char *removable_file = xasprintf ("BOOT%s.EFI", efi_suffix_upper);
|
|
||||||
|
|
||||||
if (uefi_secure_boot)
|
|
||||||
{
|
|
||||||
char *shim_signed = NULL;
|
|
||||||
char *mok_signed = NULL, *mok_file = NULL;
|
|
||||||
char *fb_signed = NULL, *fb_file = NULL;
|
|
||||||
char *csv_file = NULL;
|
|
||||||
char *config_dst;
|
|
||||||
FILE *config_dst_f;
|
|
||||||
|
|
||||||
shim_signed = xasprintf ("/usr/lib/shim/shim%s.efi.signed", efi_suffix);
|
|
||||||
mok_signed = xasprintf ("mm%s.efi.signed", efi_suffix);
|
|
||||||
mok_file = xasprintf ("mm%s.efi", efi_suffix);
|
|
||||||
fb_signed = xasprintf ("fb%s.efi.signed", efi_suffix);
|
|
||||||
fb_file = xasprintf ("fb%s.efi", efi_suffix);
|
|
||||||
csv_file = xasprintf ("BOOT%s.CSV", efi_suffix_upper);
|
|
||||||
|
|
||||||
/* If we have a signed shim binary, install that and all
|
|
||||||
its helpers in the normal vendor path */
|
|
||||||
|
|
||||||
if (grub_util_is_regular (shim_signed))
|
|
||||||
{
|
|
||||||
char *chained_base, *chained_dst;
|
|
||||||
char *mok_src, *mok_dst, *fb_src, *fb_dst, *csv_src, *csv_dst;
|
|
||||||
if (!removable)
|
|
||||||
{
|
|
||||||
free (efi_file);
|
|
||||||
efi_file = xasprintf ("shim%s.efi", efi_suffix);
|
|
||||||
free (dst);
|
|
||||||
dst = grub_util_path_concat (2, efidir, efi_file);
|
|
||||||
}
|
|
||||||
grub_install_copy_file (shim_signed, dst, 1);
|
|
||||||
chained_base = xasprintf ("grub%s.efi", efi_suffix);
|
|
||||||
chained_dst = grub_util_path_concat (2, efidir, chained_base);
|
|
||||||
grub_install_copy_file (efi_signed, chained_dst, 1);
|
|
||||||
|
|
||||||
/* Not critical, so not an error if they are not present (as it
|
|
||||||
won't be for older releases); but if we have them, make
|
|
||||||
sure they are installed. */
|
|
||||||
mok_src = grub_util_path_concat (2, "/usr/lib/shim/",
|
|
||||||
mok_signed);
|
|
||||||
mok_dst = grub_util_path_concat (2, efidir,
|
|
||||||
mok_file);
|
|
||||||
grub_install_copy_file (mok_src,
|
|
||||||
mok_dst, 0);
|
|
||||||
|
|
||||||
fb_src = grub_util_path_concat (2, "/usr/lib/shim/",
|
|
||||||
fb_signed);
|
|
||||||
fb_dst = grub_util_path_concat (2, efidir,
|
|
||||||
fb_file);
|
|
||||||
grub_install_copy_file (fb_src,
|
|
||||||
fb_dst, 0);
|
|
||||||
|
|
||||||
csv_src = grub_util_path_concat (2, "/usr/lib/shim/",
|
|
||||||
csv_file);
|
|
||||||
csv_dst = grub_util_path_concat (2, efidir,
|
|
||||||
csv_file);
|
|
||||||
grub_install_copy_file (csv_src,
|
|
||||||
csv_dst, 0);
|
|
||||||
|
|
||||||
/* Install binaries into .../EFI/BOOT too:
|
|
||||||
the shim binary
|
|
||||||
the grub binary
|
|
||||||
the shim fallback binary (not fatal on failure) */
|
|
||||||
if (force_extra_removable)
|
|
||||||
{
|
|
||||||
grub_util_info ("Secure boot: installing shim and image into rm path");
|
|
||||||
also_install_removable (shim_signed, base_efidir, removable_file, 1);
|
|
||||||
|
|
||||||
also_install_removable (efi_signed, base_efidir, chained_base, 1);
|
|
||||||
|
|
||||||
/* If we're updating the NVRAM, add fallback too - it
|
|
||||||
will re-update the NVRAM later if things break */
|
|
||||||
if (update_nvram)
|
|
||||||
also_install_removable (fb_src, base_efidir, fb_file, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
free (chained_dst);
|
|
||||||
free (chained_base);
|
|
||||||
free (mok_src);
|
|
||||||
free (mok_dst);
|
|
||||||
free (fb_src);
|
|
||||||
free (fb_dst);
|
|
||||||
free (csv_src);
|
|
||||||
free (csv_dst);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Tried to install for secure boot, but no signed
|
|
||||||
shim found. Fall back to just installing the signed
|
|
||||||
grub binary */
|
|
||||||
grub_util_info ("Secure boot (no shim): installing signed grub binary");
|
|
||||||
grub_install_copy_file (efi_signed, dst, 1);
|
|
||||||
if (force_extra_removable)
|
|
||||||
{
|
|
||||||
grub_util_info ("Secure boot (no shim): installing signed grub binary into rm path");
|
|
||||||
also_install_removable (efi_signed, base_efidir, removable_file, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* In either case, install our grub.cfg */
|
|
||||||
config_dst = grub_util_path_concat (2, efidir, "grub.cfg");
|
|
||||||
grub_install_copy_file (load_cfg, config_dst, 1);
|
|
||||||
config_dst_f = grub_util_fopen (config_dst, "ab");
|
|
||||||
fprintf (config_dst_f, "configfile $prefix/grub.cfg\n");
|
|
||||||
fclose (config_dst_f);
|
|
||||||
free (config_dst);
|
|
||||||
|
|
||||||
free (csv_file);
|
|
||||||
free (fb_file);
|
|
||||||
free (fb_signed);
|
|
||||||
free (mok_file);
|
|
||||||
free (mok_signed);
|
|
||||||
free (shim_signed);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* No secure boot - just install our newly-generated image */
|
|
||||||
grub_util_info ("No Secure Boot: installing core image");
|
|
||||||
grub_install_copy_file (imgfile, dst, 1);
|
grub_install_copy_file (imgfile, dst, 1);
|
||||||
if (force_extra_removable)
|
|
||||||
also_install_removable (imgfile, base_efidir, removable_file, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_set_install_backup_ponr ();
|
grub_set_install_backup_ponr ();
|
||||||
|
|
||||||
free (removable_file);
|
|
||||||
free (dst);
|
free (dst);
|
||||||
}
|
}
|
||||||
if (!removable && update_nvram)
|
if (!removable && update_nvram)
|
||||||
@ -2252,33 +1957,11 @@ main (int argc, char *argv[])
|
|||||||
ret = grub_install_register_efi (efidir_grub_dev,
|
ret = grub_install_register_efi (efidir_grub_dev,
|
||||||
efifile_path, efi_distributor);
|
efifile_path, efi_distributor);
|
||||||
if (ret)
|
if (ret)
|
||||||
grub_util_error (_("failed to register the EFI boot entry: %s"),
|
grub_util_error (_("efibootmgr failed to register the boot entry: %s"),
|
||||||
strerror (ret));
|
strerror (ret));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRUB_INSTALL_PLATFORM_I386_XEN:
|
|
||||||
{
|
|
||||||
char *path = grub_util_path_concat (2, bootdir, "xen");
|
|
||||||
char *dst = grub_util_path_concat (2, path, "pvboot-i386.elf");
|
|
||||||
grub_install_mkdir_p (path);
|
|
||||||
grub_install_copy_file (imgfile, dst, 1);
|
|
||||||
free (dst);
|
|
||||||
free (path);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
|
|
||||||
{
|
|
||||||
char *path = grub_util_path_concat (2, bootdir, "xen");
|
|
||||||
char *dst = grub_util_path_concat (2, path, "pvboot-x86_64.elf");
|
|
||||||
grub_install_mkdir_p (path);
|
|
||||||
grub_install_copy_file (imgfile, dst, 1);
|
|
||||||
free (dst);
|
|
||||||
free (path);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
|
case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
|
||||||
case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
|
case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
|
||||||
case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:
|
case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:
|
||||||
@ -2288,6 +1971,8 @@ main (int argc, char *argv[])
|
|||||||
case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
|
case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
|
||||||
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
|
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
|
||||||
case GRUB_INSTALL_PLATFORM_I386_QEMU:
|
case GRUB_INSTALL_PLATFORM_I386_QEMU:
|
||||||
|
case GRUB_INSTALL_PLATFORM_I386_XEN:
|
||||||
|
case GRUB_INSTALL_PLATFORM_X86_64_XEN:
|
||||||
case GRUB_INSTALL_PLATFORM_I386_XEN_PVH:
|
case GRUB_INSTALL_PLATFORM_I386_XEN_PVH:
|
||||||
grub_util_warn ("%s",
|
grub_util_warn ("%s",
|
||||||
_("WARNING: no platform-specific install was performed"));
|
_("WARNING: no platform-specific install was performed"));
|
||||||
|
@ -160,11 +160,6 @@ fi
|
|||||||
if test -f ${sysconfdir}/default/grub ; then
|
if test -f ${sysconfdir}/default/grub ; then
|
||||||
. ${sysconfdir}/default/grub
|
. ${sysconfdir}/default/grub
|
||||||
fi
|
fi
|
||||||
for x in ${sysconfdir}/default/grub.d/*.cfg ; do
|
|
||||||
if [ -e "${x}" ]; then
|
|
||||||
. "${x}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "x${GRUB_DISABLE_UUID}" = "xtrue" ]; then
|
if [ "x${GRUB_DISABLE_UUID}" = "xtrue" ]; then
|
||||||
if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then
|
if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then
|
||||||
@ -201,10 +196,6 @@ GRUB_ACTUAL_DEFAULT="$GRUB_DEFAULT"
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
if [ "x${GRUB_RECOVERY_TITLE}" = "x" ]; then
|
|
||||||
GRUB_RECOVERY_TITLE="recovery mode"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# 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.
|
||||||
@ -260,9 +251,7 @@ export GRUB_DEFAULT \
|
|||||||
GRUB_ENABLE_CRYPTODISK \
|
GRUB_ENABLE_CRYPTODISK \
|
||||||
GRUB_BADRAM \
|
GRUB_BADRAM \
|
||||||
GRUB_OS_PROBER_SKIP_LIST \
|
GRUB_OS_PROBER_SKIP_LIST \
|
||||||
GRUB_DISABLE_SUBMENU \
|
GRUB_DISABLE_SUBMENU
|
||||||
GRUB_RECORDFAIL_TIMEOUT \
|
|
||||||
GRUB_RECOVERY_TITLE
|
|
||||||
|
|
||||||
if test "x${grub_cfg}" != "x"; then
|
if test "x${grub_cfg}" != "x"; then
|
||||||
rm -f "${grub_cfg}.new"
|
rm -f "${grub_cfg}.new"
|
||||||
@ -300,10 +289,6 @@ for i in "${grub_mkconfig_dir}"/* ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "x${grub_cfg}" != "x" ] && ! grep "^password" ${grub_cfg}.new >/dev/null; then
|
|
||||||
chmod 444 ${grub_cfg}.new || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x${grub_cfg}" != "x" ; then
|
if test "x${grub_cfg}" != "x" ; then
|
||||||
if ! ${grub_script_check} ${grub_cfg}.new; then
|
if ! ${grub_script_check} ${grub_cfg}.new; then
|
||||||
# TRANSLATORS: %s is replaced by filename
|
# TRANSLATORS: %s is replaced by filename
|
||||||
|
@ -133,22 +133,6 @@ prepare_grub_to_access_device ()
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
loop_file=
|
|
||||||
case $1 in
|
|
||||||
/dev/loop/*|/dev/loop[0-9])
|
|
||||||
grub_loop_device="${1#/dev/}"
|
|
||||||
loop_file=`losetup "$1" | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
|
|
||||||
case $loop_file in
|
|
||||||
/dev/*) ;;
|
|
||||||
*)
|
|
||||||
loop_device="$1"
|
|
||||||
shift
|
|
||||||
set -- `"${grub_probe}" --target=device "${loop_file}"` "$@" || return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Abstraction modules aren't auto-loaded.
|
# Abstraction modules aren't auto-loaded.
|
||||||
abstraction="`"${grub_probe}" --device $@ --target=abstraction`"
|
abstraction="`"${grub_probe}" --device $@ --target=abstraction`"
|
||||||
for module in ${abstraction} ; do
|
for module in ${abstraction} ; do
|
||||||
@ -185,14 +169,6 @@ prepare_grub_to_access_device ()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
IFS="$old_ifs"
|
IFS="$old_ifs"
|
||||||
|
|
||||||
if [ "x${loop_file}" != x ]; then
|
|
||||||
loop_mountpoint="$(awk '"'${loop_file}'" ~ "^"$2 && $2 != "/" { print $2 }' /proc/mounts | tail -n1)"
|
|
||||||
if [ "x${loop_mountpoint}" != x ]; then
|
|
||||||
echo "loopback ${grub_loop_device} ${loop_file#$loop_mountpoint}"
|
|
||||||
echo "set root=(${grub_loop_device})"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_get_device_id ()
|
grub_get_device_id ()
|
||||||
@ -267,9 +243,8 @@ version_test_numeric ()
|
|||||||
|
|
||||||
version_test_gt ()
|
version_test_gt ()
|
||||||
{
|
{
|
||||||
version_test_gt_sedexp="s/[^-]*-//;s/[._-]\(pre\|rc\|test\|git\|old\|trunk\)/~\1/g"
|
version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`"
|
||||||
version_test_gt_a="`echo "$1" | sed -e "$version_test_gt_sedexp"`"
|
version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`"
|
||||||
version_test_gt_b="`echo "$2" | sed -e "$version_test_gt_sedexp"`"
|
|
||||||
version_test_gt_cmp=gt
|
version_test_gt_cmp=gt
|
||||||
if [ "x$version_test_gt_b" = "x" ] ; then
|
if [ "x$version_test_gt_b" = "x" ] ; then
|
||||||
return 0
|
return 0
|
||||||
@ -279,7 +254,7 @@ version_test_gt ()
|
|||||||
*.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
|
*.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
|
||||||
*:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
|
*:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
|
||||||
esac
|
esac
|
||||||
dpkg --compare-versions "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
|
version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
|
||||||
return "$?"
|
return "$?"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,181 +0,0 @@
|
|||||||
/* grub-mkdevicemap.c - make a device map file automatically */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 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 <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include <grub/emu/misc.h>
|
|
||||||
#include <grub/emu/hostdisk.h>
|
|
||||||
#include <grub/util/misc.h>
|
|
||||||
#include <grub/util/deviceiter.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
#define _GNU_SOURCE 1
|
|
||||||
#include <getopt.h>
|
|
||||||
|
|
||||||
#include "progname.h"
|
|
||||||
|
|
||||||
/* Context for make_device_map. */
|
|
||||||
struct make_device_map_ctx
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
int num_fd;
|
|
||||||
int num_hd;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Helper for make_device_map. */
|
|
||||||
static int
|
|
||||||
process_device (const char *name, int is_floppy, void *data)
|
|
||||||
{
|
|
||||||
struct make_device_map_ctx *ctx = data;
|
|
||||||
|
|
||||||
grub_util_emit_devicemap_entry (ctx->fp, (char *) name,
|
|
||||||
is_floppy, &ctx->num_fd, &ctx->num_hd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
make_device_map (const char *device_map, int floppy_disks)
|
|
||||||
{
|
|
||||||
struct make_device_map_ctx ctx = {
|
|
||||||
.num_fd = 0,
|
|
||||||
.num_hd = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
if (strcmp (device_map, "-") == 0)
|
|
||||||
ctx.fp = stdout;
|
|
||||||
else
|
|
||||||
ctx.fp = fopen (device_map, "w");
|
|
||||||
|
|
||||||
if (! ctx.fp)
|
|
||||||
grub_util_error (_("cannot open %s"), device_map);
|
|
||||||
|
|
||||||
grub_util_iterate_devices (process_device, &ctx, floppy_disks);
|
|
||||||
|
|
||||||
if (ctx.fp != stdout)
|
|
||||||
fclose (ctx.fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct option options[] =
|
|
||||||
{
|
|
||||||
{"device-map", required_argument, 0, 'm'},
|
|
||||||
{"probe-second-floppy", no_argument, 0, 's'},
|
|
||||||
{"no-floppy", no_argument, 0, 'n'},
|
|
||||||
{"help", no_argument, 0, 'h'},
|
|
||||||
{"version", no_argument, 0, 'V'},
|
|
||||||
{"verbose", no_argument, 0, 'v'},
|
|
||||||
{0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
usage (int status)
|
|
||||||
{
|
|
||||||
if (status)
|
|
||||||
fprintf (stderr,
|
|
||||||
_("Try `%s --help' for more information.\n"), program_name);
|
|
||||||
else
|
|
||||||
printf (_("\
|
|
||||||
Usage: %s [OPTION]...\n\
|
|
||||||
\n\
|
|
||||||
Generate a device map file automatically.\n\
|
|
||||||
\n\
|
|
||||||
-n, --no-floppy do not probe any floppy drive\n\
|
|
||||||
-s, --probe-second-floppy probe the second floppy drive\n\
|
|
||||||
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
|
|
||||||
-h, --help display this message and exit\n\
|
|
||||||
-V, --version print version information and exit\n\
|
|
||||||
-v, --verbose print verbose messages\n\
|
|
||||||
\n\
|
|
||||||
Report bugs to <%s>.\n\
|
|
||||||
"), program_name,
|
|
||||||
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
|
|
||||||
|
|
||||||
exit (status);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
char *dev_map = 0;
|
|
||||||
int floppy_disks = 1;
|
|
||||||
|
|
||||||
grub_util_host_init (&argc, &argv);
|
|
||||||
|
|
||||||
/* Check for options. */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
int c = getopt_long (argc, argv, "snm:r:hVv", options, 0);
|
|
||||||
|
|
||||||
if (c == -1)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case 'm':
|
|
||||||
if (dev_map)
|
|
||||||
free (dev_map);
|
|
||||||
|
|
||||||
dev_map = xstrdup (optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'n':
|
|
||||||
floppy_disks = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 's':
|
|
||||||
floppy_disks = 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'h':
|
|
||||||
usage (0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'V':
|
|
||||||
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case 'v':
|
|
||||||
verbosity++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
usage (1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (verbosity > 1)
|
|
||||||
grub_env_set ("debug", "all");
|
|
||||||
|
|
||||||
make_device_map (dev_map ? : DEFAULT_DEVICE_MAP, floppy_disks);
|
|
||||||
|
|
||||||
free (dev_map);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -753,7 +753,6 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
grub_install_push_module ("part_gpt");
|
grub_install_push_module ("part_gpt");
|
||||||
grub_install_push_module ("part_msdos");
|
grub_install_push_module ("part_msdos");
|
||||||
grub_install_push_module ("fat");
|
|
||||||
|
|
||||||
imgname = grub_util_path_concat (2, efidir_efi_boot, "bootia64.efi");
|
imgname = grub_util_path_concat (2, efidir_efi_boot, "bootia64.efi");
|
||||||
make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname);
|
make_image_fwdisk_abs (GRUB_INSTALL_PLATFORM_IA64_EFI, "ia64-efi", imgname);
|
||||||
@ -831,7 +830,6 @@ main (int argc, char *argv[])
|
|||||||
free (efidir);
|
free (efidir);
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
grub_install_pop_module ();
|
grub_install_pop_module ();
|
||||||
grub_install_pop_module ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_install_push_module ("part_apple");
|
grub_install_push_module ("part_apple");
|
||||||
|
@ -21,8 +21,6 @@ prefix="@prefix@"
|
|||||||
exec_prefix="@exec_prefix@"
|
exec_prefix="@exec_prefix@"
|
||||||
datarootdir="@datarootdir@"
|
datarootdir="@datarootdir@"
|
||||||
grub_lang=`echo $LANG | cut -d . -f 1`
|
grub_lang=`echo $LANG | cut -d . -f 1`
|
||||||
grubdir="`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`"
|
|
||||||
quick_boot="@QUICK_BOOT@"
|
|
||||||
|
|
||||||
export TEXTDOMAIN=@PACKAGE@
|
export TEXTDOMAIN=@PACKAGE@
|
||||||
export TEXTDOMAINDIR="@localedir@"
|
export TEXTDOMAINDIR="@localedir@"
|
||||||
@ -46,7 +44,6 @@ if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT
|
|||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
if [ -s \$prefix/grubenv ]; then
|
if [ -s \$prefix/grubenv ]; then
|
||||||
set have_grubenv=true
|
|
||||||
load_env
|
load_env
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
@ -99,52 +96,7 @@ function savedefault {
|
|||||||
save_env saved_entry
|
save_env saved_entry
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ "$quick_boot" = 1 ]; then
|
|
||||||
cat <<EOF
|
|
||||||
function recordfail {
|
|
||||||
set recordfail=1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_writable () {
|
|
||||||
abstractions="$(grub-probe --target=abstraction "${grubdir}")"
|
|
||||||
for abstraction in $abstractions; do
|
|
||||||
case "$abstraction" in
|
|
||||||
diskfilter | lvm)
|
|
||||||
cat <<EOF
|
|
||||||
# GRUB lacks write support for $abstraction, so recordfail support is disabled.
|
|
||||||
EOF
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
FS="$(grub-probe --target=fs "${grubdir}")"
|
|
||||||
case "$FS" in
|
|
||||||
btrfs | cpiofs | newc | odc | romfs | squash4 | tarfs | zfs)
|
|
||||||
cat <<EOF
|
|
||||||
# GRUB lacks write support for $FS, so recordfail support is disabled.
|
|
||||||
EOF
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! check_writable; then
|
|
||||||
recordfail_broken=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
function load_video {
|
function load_video {
|
||||||
EOF
|
EOF
|
||||||
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
|
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
|
||||||
@ -330,16 +282,10 @@ fi
|
|||||||
|
|
||||||
make_timeout ()
|
make_timeout ()
|
||||||
{
|
{
|
||||||
cat << EOF
|
|
||||||
if [ "\${recordfail}" = 1 ] ; then
|
|
||||||
set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
|
|
||||||
else
|
|
||||||
EOF
|
|
||||||
if [ "x${3}" != "x" ] ; then
|
if [ "x${3}" != "x" ] ; then
|
||||||
timeout="${2}"
|
timeout="${2}"
|
||||||
style="${3}"
|
style="${3}"
|
||||||
elif [ "x${1}" != "x" ] && \
|
elif [ "x${1}" != "x" ] && [ "x${1}" != "x0" ] ; then
|
||||||
([ "$quick_boot" = 1 ] || [ "x${1}" != "x0" ]) ; then
|
|
||||||
# Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
|
# Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
|
||||||
timeout="${1}"
|
timeout="${1}"
|
||||||
if [ "x${2}" != "x0" ] ; then
|
if [ "x${2}" != "x0" ] ; then
|
||||||
@ -358,39 +304,28 @@ EOF
|
|||||||
style="menu"
|
style="menu"
|
||||||
fi
|
fi
|
||||||
cat << EOF
|
cat << EOF
|
||||||
if [ x\$feature_timeout_style = xy ] ; then
|
if [ x\$feature_timeout_style = xy ] ; then
|
||||||
set timeout_style=${style}
|
set timeout_style=${style}
|
||||||
set timeout=${timeout}
|
set timeout=${timeout}
|
||||||
EOF
|
EOF
|
||||||
if [ "x${style}" = "xmenu" ] ; then
|
if [ "x${style}" = "xmenu" ] ; then
|
||||||
cat << EOF
|
cat << EOF
|
||||||
# Fallback normal timeout code in case the timeout_style feature is
|
# Fallback normal timeout code in case the timeout_style feature is
|
||||||
# unavailable.
|
# unavailable.
|
||||||
else
|
else
|
||||||
set timeout=${timeout}
|
set timeout=${timeout}
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
cat << EOF
|
cat << EOF
|
||||||
# Fallback hidden-timeout code in case the timeout_style feature is
|
# Fallback hidden-timeout code in case the timeout_style feature is
|
||||||
# unavailable.
|
# unavailable.
|
||||||
elif sleep${verbose} --interruptible ${timeout} ; then
|
elif sleep${verbose} --interruptible ${timeout} ; then
|
||||||
set timeout=0
|
set timeout=0
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
cat << EOF
|
cat << EOF
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
if [ "$recordfail_broken" = 1 ]; then
|
|
||||||
cat << EOF
|
|
||||||
if [ \$grub_platform = efi ]; then
|
|
||||||
set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
|
|
||||||
if [ x\$feature_timeout_style = xy ] ; then
|
|
||||||
set timeout_style=menu
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
|
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
|
||||||
|
@ -88,8 +88,8 @@ hurd_entry () {
|
|||||||
|
|
||||||
if [ x$type != xsimple ] ; then
|
if [ x$type != xsimple ] ; then
|
||||||
if [ x$type = xrecovery ] ; then
|
if [ x$type = xrecovery ] ; then
|
||||||
title="$(gettext_printf "%s, with Hurd %s (%s)" "${OS}" "${kernel_base}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
|
title="$(gettext_printf "%s, with Hurd %s (recovery mode)" "${OS}" "${kernel_base}")"
|
||||||
oldtitle="$OS using $kernel_base ($GRUB_RECOVERY_TITLE)"
|
oldtitle="$OS using $kernel_base (recovery mode)"
|
||||||
else
|
else
|
||||||
title="$(gettext_printf "%s, with Hurd %s" "${OS}" "${kernel_base}")"
|
title="$(gettext_printf "%s, with Hurd %s" "${OS}" "${kernel_base}")"
|
||||||
oldtitle="$OS using $kernel_base"
|
oldtitle="$OS using $kernel_base"
|
||||||
|
@ -76,7 +76,7 @@ kfreebsd_entry ()
|
|||||||
fi
|
fi
|
||||||
if [ x$type != xsimple ] ; then
|
if [ x$type != xsimple ] ; then
|
||||||
if [ x$type = xrecovery ] ; then
|
if [ x$type = xrecovery ] ; then
|
||||||
title="$(gettext_printf "%s, with kFreeBSD %s (%s)" "${os}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
|
title="$(gettext_printf "%s, with kFreeBSD %s (recovery mode)" "${os}" "${version}")"
|
||||||
else
|
else
|
||||||
title="$(gettext_printf "%s, with kFreeBSD %s" "${os}" "${version}")"
|
title="$(gettext_printf "%s, with kFreeBSD %s" "${os}" "${version}")"
|
||||||
fi
|
fi
|
||||||
|
@ -20,11 +20,6 @@ set -e
|
|||||||
prefix="@prefix@"
|
prefix="@prefix@"
|
||||||
exec_prefix="@exec_prefix@"
|
exec_prefix="@exec_prefix@"
|
||||||
datarootdir="@datarootdir@"
|
datarootdir="@datarootdir@"
|
||||||
ubuntu_recovery="@UBUNTU_RECOVERY@"
|
|
||||||
quiet_boot="@QUIET_BOOT@"
|
|
||||||
quick_boot="@QUICK_BOOT@"
|
|
||||||
gfxpayload_dynamic="@GFXPAYLOAD_DYNAMIC@"
|
|
||||||
vt_handoff="@VT_HANDOFF@"
|
|
||||||
|
|
||||||
. "$pkgdatadir/grub-mkconfig_lib"
|
. "$pkgdatadir/grub-mkconfig_lib"
|
||||||
|
|
||||||
@ -32,19 +27,11 @@ export TEXTDOMAIN=@PACKAGE@
|
|||||||
export TEXTDOMAINDIR="@localedir@"
|
export TEXTDOMAINDIR="@localedir@"
|
||||||
|
|
||||||
CLASS="--class gnu-linux --class gnu --class os"
|
CLASS="--class gnu-linux --class gnu --class os"
|
||||||
SUPPORTED_INITS="sysvinit:/lib/sysvinit/init systemd:/lib/systemd/systemd upstart:/sbin/upstart"
|
|
||||||
|
|
||||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||||
OS=GNU/Linux
|
OS=GNU/Linux
|
||||||
else
|
else
|
||||||
case ${GRUB_DISTRIBUTOR} in
|
|
||||||
Ubuntu|Kubuntu)
|
|
||||||
OS="${GRUB_DISTRIBUTOR}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||||
;;
|
|
||||||
esac
|
|
||||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -53,11 +40,6 @@ fi
|
|||||||
case ${GRUB_DEVICE} in
|
case ${GRUB_DEVICE} in
|
||||||
/dev/loop/*|/dev/loop[0-9])
|
/dev/loop/*|/dev/loop[0-9])
|
||||||
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
|
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
|
||||||
# We can't cope with devices loop-mounted from files here.
|
|
||||||
case ${GRUB_DEVICE} in
|
|
||||||
/dev/*) ;;
|
|
||||||
*) exit 0 ;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -97,23 +79,6 @@ esac
|
|||||||
|
|
||||||
title_correction_code=
|
title_correction_code=
|
||||||
|
|
||||||
if [ -x /lib/recovery-mode/recovery-menu ]; then
|
|
||||||
GRUB_CMDLINE_LINUX_RECOVERY=recovery
|
|
||||||
else
|
|
||||||
GRUB_CMDLINE_LINUX_RECOVERY=single
|
|
||||||
fi
|
|
||||||
if [ "$ubuntu_recovery" = 1 ]; then
|
|
||||||
GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY nomodeset"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$vt_handoff" = 1 ]; then
|
|
||||||
for word in $GRUB_CMDLINE_LINUX_DEFAULT; do
|
|
||||||
if [ "$word" = splash ]; then
|
|
||||||
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \$vt_handoff"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
linux_entry ()
|
linux_entry ()
|
||||||
{
|
{
|
||||||
os="$1"
|
os="$1"
|
||||||
@ -127,9 +92,7 @@ linux_entry ()
|
|||||||
if [ x$type != xsimple ] ; then
|
if [ x$type != xsimple ] ; then
|
||||||
case $type in
|
case $type in
|
||||||
recovery)
|
recovery)
|
||||||
title="$(gettext_printf "%s, with Linux %s (%s)" "${os}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" ;;
|
title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
|
||||||
init-*)
|
|
||||||
title="$(gettext_printf "%s, with Linux %s (%s)" "${os}" "${version}" "${type#init-}")" ;;
|
|
||||||
*)
|
*)
|
||||||
title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
|
title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
|
||||||
esac
|
esac
|
||||||
@ -143,9 +106,6 @@ linux_entry ()
|
|||||||
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
|
||||||
if [ "$quick_boot" = 1 ]; then
|
|
||||||
echo " recordfail" | sed "s/^/$submenu_indentation/"
|
|
||||||
fi
|
|
||||||
if [ x$type != xrecovery ] ; then
|
if [ x$type != xrecovery ] ; then
|
||||||
save_default_entry | grub_add_tab
|
save_default_entry | grub_add_tab
|
||||||
fi
|
fi
|
||||||
@ -154,18 +114,18 @@ linux_entry ()
|
|||||||
# 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/"
|
||||||
|
if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \
|
||||||
|
&& grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then
|
||||||
|
echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
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
|
||||||
fi
|
echo " set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/"
|
||||||
if ([ "$ubuntu_recovery" = 0 ] || [ x$type != xrecovery ]) && \
|
|
||||||
([ "x$GRUB_GFXPAYLOAD_LINUX" != x ] || [ "$gfxpayload_dynamic" = 1 ]); then
|
|
||||||
echo " gfxmode \$linux_gfx_mode" | sed "s/^/$submenu_indentation/"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
||||||
echo " if [ x\$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi" | sed "s/^/$submenu_indentation/"
|
|
||||||
|
|
||||||
if [ x$dirname = x/ ]; then
|
if [ x$dirname = x/ ]; then
|
||||||
if [ -z "${prepare_root_cache}" ]; then
|
if [ -z "${prepare_root_cache}" ]; then
|
||||||
@ -178,34 +138,20 @@ linux_entry ()
|
|||||||
fi
|
fi
|
||||||
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
|
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
|
||||||
fi
|
fi
|
||||||
if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
|
|
||||||
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)'
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
if test -d /sys/firmware/efi && test -e "${linux}.efi.signed"; then
|
|
||||||
sed "s/^/$submenu_indentation/" << EOF
|
|
||||||
linux ${rel_dirname}/${basename}.efi.signed root=${linux_root_device_thisversion} ro ${args}
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
sed "s/^/$submenu_indentation/" << EOF
|
|
||||||
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
|
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
|
||||||
EOF
|
EOF
|
||||||
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.
|
||||||
if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
|
|
||||||
message="$(gettext_printf "Loading initial ramdisk ...")"
|
message="$(gettext_printf "Loading initial ramdisk ...")"
|
||||||
sed "s/^/$submenu_indentation/" << EOF
|
|
||||||
echo '$(echo "$message" | grub_quote)'
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
initrd_path=
|
initrd_path=
|
||||||
for i in ${initrd}; do
|
for i in ${initrd}; do
|
||||||
initrd_path="${initrd_path} ${rel_dirname}/${i}"
|
initrd_path="${initrd_path} ${rel_dirname}/${i}"
|
||||||
done
|
done
|
||||||
sed "s/^/$submenu_indentation/" << EOF
|
sed "s/^/$submenu_indentation/" << EOF
|
||||||
|
echo '$(echo "$message" | grub_quote)'
|
||||||
initrd $(echo $initrd_path)
|
initrd $(echo $initrd_path)
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
@ -241,52 +187,6 @@ prepare_root_cache=
|
|||||||
boot_device_id=
|
boot_device_id=
|
||||||
title_correction_code=
|
title_correction_code=
|
||||||
|
|
||||||
cat << 'EOF'
|
|
||||||
function gfxmode {
|
|
||||||
set gfxpayload="${1}"
|
|
||||||
EOF
|
|
||||||
if [ "$vt_handoff" = 1 ]; then
|
|
||||||
cat << 'EOF'
|
|
||||||
if [ "${1}" = "keep" ]; then
|
|
||||||
set vt_handoff=vt.handoff=7
|
|
||||||
else
|
|
||||||
set vt_handoff=
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
cat << EOF
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Use ELILO's generic "efifb" when it's known to be available.
|
|
||||||
# FIXME: We need an interface to select vesafb in case efifb can't be used.
|
|
||||||
if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ] || [ "$gfxpayload_dynamic" = 0 ]; then
|
|
||||||
echo "set linux_gfx_mode=$GRUB_GFXPAYLOAD_LINUX"
|
|
||||||
else
|
|
||||||
cat << EOF
|
|
||||||
if [ "\${recordfail}" != 1 ]; then
|
|
||||||
if [ -e \${prefix}/gfxblacklist.txt ]; then
|
|
||||||
if hwmatch \${prefix}/gfxblacklist.txt 3; then
|
|
||||||
if [ \${match} = 0 ]; then
|
|
||||||
set linux_gfx_mode=keep
|
|
||||||
else
|
|
||||||
set linux_gfx_mode=text
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
set linux_gfx_mode=text
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
set linux_gfx_mode=keep
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
set linux_gfx_mode=text
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
cat << EOF
|
|
||||||
export linux_gfx_mode
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Extra indentation to add to menu entries in a submenu. We're not in a submenu
|
# Extra indentation to add to menu entries in a submenu. We're not in a submenu
|
||||||
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
|
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
|
||||||
submenu_indentation=""
|
submenu_indentation=""
|
||||||
@ -294,13 +194,6 @@ submenu_indentation=""
|
|||||||
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`
|
||||||
case $linux in
|
|
||||||
*.efi.signed)
|
|
||||||
# We handle these in linux_entry.
|
|
||||||
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
gettext_printf "Found linux image: %s\n" "$linux" >&2
|
gettext_printf "Found linux image: %s\n" "$linux" >&2
|
||||||
basename=`basename $linux`
|
basename=`basename $linux`
|
||||||
dirname=`dirname $linux`
|
dirname=`dirname $linux`
|
||||||
@ -392,16 +285,9 @@ while [ "x$list" != "x" ] ; do
|
|||||||
|
|
||||||
linux_entry "${OS}" "${version}" advanced \
|
linux_entry "${OS}" "${version}" advanced \
|
||||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||||
for supported_init in ${SUPPORTED_INITS}; do
|
|
||||||
init_path="${supported_init#*:}"
|
|
||||||
if [ -x "${init_path}" ] && [ "$(readlink -f /sbin/init)" != "$(readlink -f "${init_path}")" ]; then
|
|
||||||
linux_entry "${OS}" "${version}" "init-${supported_init%%:*}" \
|
|
||||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} init=${init_path}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
||||||
linux_entry "${OS}" "${version}" recovery \
|
linux_entry "${OS}" "${version}" recovery \
|
||||||
"${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
|
"single ${GRUB_CMDLINE_LINUX}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
|
list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
|
||||||
|
@ -102,7 +102,7 @@ netbsd_entry ()
|
|||||||
|
|
||||||
if [ x$type != xsimple ] ; then
|
if [ x$type != xsimple ] ; then
|
||||||
if [ x$type = xrecovery ] ; then
|
if [ x$type = xrecovery ] ; then
|
||||||
title="$(gettext_printf "%s, with kernel %s (via %s, %s)" "${OS}" "$(echo ${kernel} | sed -e 's,^.*/,,')" "${loader}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
|
title="$(gettext_printf "%s, with kernel %s (via %s, recovery mode)" "${OS}" "$(echo ${kernel} | sed -e 's,^.*/,,')" "${loader}")"
|
||||||
else
|
else
|
||||||
title="$(gettext_printf "%s, with kernel %s (via %s)" "${OS}" "$(echo ${kernel} | sed -e 's,^.*/,,')" "${loader}")"
|
title="$(gettext_printf "%s, with kernel %s (via %s)" "${OS}" "$(echo ${kernel} | sed -e 's,^.*/,,')" "${loader}")"
|
||||||
fi
|
fi
|
||||||
|
@ -27,7 +27,6 @@ export TEXTDOMAIN=@PACKAGE@
|
|||||||
export TEXTDOMAINDIR="@localedir@"
|
export TEXTDOMAINDIR="@localedir@"
|
||||||
|
|
||||||
CLASS="--class gnu-linux --class gnu --class os --class xen"
|
CLASS="--class gnu-linux --class gnu --class os --class xen"
|
||||||
SUPPORTED_INITS="sysvinit:/lib/sysvinit/init systemd:/lib/systemd/systemd upstart:/sbin/upstart"
|
|
||||||
|
|
||||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||||
OS=GNU/Linux
|
OS=GNU/Linux
|
||||||
@ -41,11 +40,6 @@ fi
|
|||||||
case ${GRUB_DEVICE} in
|
case ${GRUB_DEVICE} in
|
||||||
/dev/loop/*|/dev/loop[0-9])
|
/dev/loop/*|/dev/loop[0-9])
|
||||||
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
|
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
|
||||||
# We can't cope with devices loop-mounted from files here.
|
|
||||||
case ${GRUB_DEVICE} in
|
|
||||||
/dev/*) ;;
|
|
||||||
*) exit 0 ;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -123,9 +117,7 @@ linux_entry_xsm ()
|
|||||||
fi
|
fi
|
||||||
if [ x$type != xsimple ] ; then
|
if [ x$type != xsimple ] ; then
|
||||||
if [ x$type = xrecovery ] ; then
|
if [ x$type = xrecovery ] ; then
|
||||||
title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
|
title="$(gettext_printf "%s, with Xen %s and Linux %s (recovery mode)" "${os}" "${xen_version}" "${version}")"
|
||||||
elif [ "${type#init-}" != "$type" ] ; then
|
|
||||||
title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "${type#init-}")"
|
|
||||||
else
|
else
|
||||||
title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
|
title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
|
||||||
fi
|
fi
|
||||||
@ -173,7 +165,7 @@ EOF
|
|||||||
${module_loader} --nounzip $(echo $initrd_path)
|
${module_loader} --nounzip $(echo $initrd_path)
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if ${xsm} && test -n "${xenpolicy}" ; then
|
if test -n "${xenpolicy}" ; then
|
||||||
message="$(gettext_printf "Loading XSM policy ...")"
|
message="$(gettext_printf "Loading XSM policy ...")"
|
||||||
sed "s/^/$submenu_indentation/" << EOF
|
sed "s/^/$submenu_indentation/" << EOF
|
||||||
echo '$(echo "$message" | grub_quote)'
|
echo '$(echo "$message" | grub_quote)'
|
||||||
@ -349,14 +341,6 @@ while [ "x${xen_list}" != "x" ] ; do
|
|||||||
|
|
||||||
linux_entry "${OS}" "${version}" "${xen_version}" advanced \
|
linux_entry "${OS}" "${version}" "${xen_version}" advanced \
|
||||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
|
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
|
||||||
for supported_init in ${SUPPORTED_INITS}; do
|
|
||||||
init_path="${supported_init#*:}"
|
|
||||||
if [ -x "${init_path}" ] && [ "$(readlink -f /sbin/init)" != "$(readlink -f "${init_path}")" ]; then
|
|
||||||
linux_entry "${OS}" "${version}" "${xen_version}" "init-${supported_init%%:*}" \
|
|
||||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} init=${init_path}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
|
|
||||||
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
||||||
linux_entry "${OS}" "${version}" "${xen_version}" recovery \
|
linux_entry "${OS}" "${version}" "${xen_version}" recovery \
|
||||||
"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
|
"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
|
||||||
|
@ -20,26 +20,12 @@ set -e
|
|||||||
prefix="@prefix@"
|
prefix="@prefix@"
|
||||||
exec_prefix="@exec_prefix@"
|
exec_prefix="@exec_prefix@"
|
||||||
datarootdir="@datarootdir@"
|
datarootdir="@datarootdir@"
|
||||||
quick_boot="@QUICK_BOOT@"
|
|
||||||
|
|
||||||
export TEXTDOMAIN=@PACKAGE@
|
export TEXTDOMAIN=@PACKAGE@
|
||||||
export TEXTDOMAINDIR="@localedir@"
|
export TEXTDOMAINDIR="@localedir@"
|
||||||
|
|
||||||
. "$pkgdatadir/grub-mkconfig_lib"
|
. "$pkgdatadir/grub-mkconfig_lib"
|
||||||
|
|
||||||
found_other_os=
|
|
||||||
|
|
||||||
adjust_timeout () {
|
|
||||||
if [ "$quick_boot" = 1 ] && [ "x${found_other_os}" != "x" ]; then
|
|
||||||
cat << EOF
|
|
||||||
set timeout_style=menu
|
|
||||||
if [ "\${timeout}" = 0 ]; then
|
|
||||||
set timeout=10
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
|
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
|
||||||
grub_warn "$(gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.")"
|
grub_warn "$(gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.")"
|
||||||
exit 0
|
exit 0
|
||||||
@ -59,7 +45,6 @@ if [ -z "${OSPROBED}" ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
osx_entry() {
|
osx_entry() {
|
||||||
found_other_os=1
|
|
||||||
if [ x$2 = x32 ]; then
|
if [ x$2 = x32 ]; then
|
||||||
# TRANSLATORS: it refers to kernel architecture (32-bit)
|
# TRANSLATORS: it refers to kernel architecture (32-bit)
|
||||||
bitstr="$(gettext "(32-bit)")"
|
bitstr="$(gettext "(32-bit)")"
|
||||||
@ -128,8 +113,6 @@ EOF
|
|||||||
|
|
||||||
used_osprober_linux_ids=
|
used_osprober_linux_ids=
|
||||||
|
|
||||||
wubi=
|
|
||||||
|
|
||||||
for OS in ${OSPROBED} ; do
|
for OS in ${OSPROBED} ; do
|
||||||
DEVICE="`echo ${OS} | cut -d ':' -f 1`"
|
DEVICE="`echo ${OS} | cut -d ':' -f 1`"
|
||||||
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
|
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
|
||||||
@ -166,24 +149,6 @@ for OS in ${OSPROBED} ; do
|
|||||||
case ${BOOT} in
|
case ${BOOT} in
|
||||||
chain)
|
chain)
|
||||||
|
|
||||||
case ${LONGNAME} in
|
|
||||||
Windows*)
|
|
||||||
if [ -z "$wubi" ]; then
|
|
||||||
if [ -x /usr/share/lupin-support/grub-mkimage ] && \
|
|
||||||
/usr/share/lupin-support/grub-mkimage --test; then
|
|
||||||
wubi=yes
|
|
||||||
else
|
|
||||||
wubi=no
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ "$wubi" = yes ]; then
|
|
||||||
echo "Skipping ${LONGNAME} on Wubi system" >&2
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
found_other_os=1
|
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
||||||
@ -214,7 +179,6 @@ EOF
|
|||||||
;;
|
;;
|
||||||
efi)
|
efi)
|
||||||
|
|
||||||
found_other_os=1
|
|
||||||
EFIPATH=${DEVICE#*@}
|
EFIPATH=${DEVICE#*@}
|
||||||
DEVICE=${DEVICE%@*}
|
DEVICE=${DEVICE%@*}
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
@ -258,14 +222,8 @@ EOF
|
|||||||
LINITRD="${LINITRD#/boot}"
|
LINITRD="${LINITRD#/boot}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${prepare_boot_cache}" ]; then
|
|
||||||
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
|
|
||||||
[ "${prepare_boot_cache}" ] || continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
found_other_os=1
|
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
|
recovery_params="$(echo "${LPARAMS}" | grep single)" || true
|
||||||
counter=1
|
counter=1
|
||||||
while echo "$used_osprober_linux_ids" | grep 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id' > /dev/null; do
|
while echo "$used_osprober_linux_ids" | grep 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id' > /dev/null; do
|
||||||
counter=$((counter+1));
|
counter=$((counter+1));
|
||||||
@ -275,6 +233,10 @@ EOF
|
|||||||
fi
|
fi
|
||||||
used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
|
used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
|
||||||
|
|
||||||
|
if [ -z "${prepare_boot_cache}" ]; then
|
||||||
|
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
|
||||||
|
fi
|
||||||
|
|
||||||
# The GRUB_DISABLE_SUBMENU option used to be different than others since it was
|
# The GRUB_DISABLE_SUBMENU option used to be different than others since it was
|
||||||
# mentioned in the documentation that has to be set to 'y' instead of 'true' to
|
# mentioned in the documentation that has to be set to 'y' instead of 'true' to
|
||||||
# enable it. This caused a lot of confusion to users that set the option to 'y',
|
# enable it. This caused a lot of confusion to users that set the option to 'y',
|
||||||
@ -340,7 +302,6 @@ EOF
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
hurd)
|
hurd)
|
||||||
found_other_os=1
|
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
|
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
|
||||||
@ -383,5 +344,3 @@ EOF
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
adjust_timeout
|
|
||||||
|
@ -841,7 +841,7 @@ init_pe_section(const struct grub_install_image_target_desc *image_target,
|
|||||||
|
|
||||||
section->raw_data_offset = grub_host_to_target32 (*rda);
|
section->raw_data_offset = grub_host_to_target32 (*rda);
|
||||||
section->raw_data_size = grub_host_to_target32 (rsz);
|
section->raw_data_size = grub_host_to_target32 (rsz);
|
||||||
(*rda) = *rda + rsz;
|
(*rda) = ALIGN_UP (*rda + rsz, GRUB_PE32_FILE_ALIGNMENT);
|
||||||
|
|
||||||
section->characteristics = grub_host_to_target32 (characteristics);
|
section->characteristics = grub_host_to_target32 (characteristics);
|
||||||
|
|
||||||
@ -1309,7 +1309,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
|||||||
char *pe_img, *pe_sbat, *header;
|
char *pe_img, *pe_sbat, *header;
|
||||||
struct grub_pe32_section_table *section;
|
struct grub_pe32_section_table *section;
|
||||||
size_t n_sections = 4;
|
size_t n_sections = 4;
|
||||||
size_t scn_size, raw_size;
|
size_t scn_size;
|
||||||
grub_uint32_t vma, raw_data;
|
grub_uint32_t vma, raw_data;
|
||||||
size_t pe_size, header_size;
|
size_t pe_size, header_size;
|
||||||
struct grub_pe32_coff_header *c;
|
struct grub_pe32_coff_header *c;
|
||||||
@ -1410,8 +1410,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
|||||||
GRUB_PE32_SCN_MEM_EXECUTE |
|
GRUB_PE32_SCN_MEM_EXECUTE |
|
||||||
GRUB_PE32_SCN_MEM_READ);
|
GRUB_PE32_SCN_MEM_READ);
|
||||||
|
|
||||||
raw_size = layout.kernel_size - layout.exec_size;
|
scn_size = ALIGN_UP (layout.kernel_size - layout.exec_size, GRUB_PE32_FILE_ALIGNMENT);
|
||||||
scn_size = ALIGN_UP (raw_size, GRUB_PE32_FILE_ALIGNMENT);
|
|
||||||
/* ALIGN_UP (sbat_size, GRUB_PE32_FILE_ALIGNMENT) is done earlier. */
|
/* ALIGN_UP (sbat_size, GRUB_PE32_FILE_ALIGNMENT) is done earlier. */
|
||||||
PE_OHDR (o32, o64, data_size) = grub_host_to_target32 (scn_size + sbat_size +
|
PE_OHDR (o32, o64, data_size) = grub_host_to_target32 (scn_size + sbat_size +
|
||||||
ALIGN_UP (total_module_size,
|
ALIGN_UP (total_module_size,
|
||||||
@ -1419,16 +1418,15 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
|||||||
|
|
||||||
section = init_pe_section (image_target, section, ".data",
|
section = init_pe_section (image_target, section, ".data",
|
||||||
&vma, scn_size, image_target->section_align,
|
&vma, scn_size, image_target->section_align,
|
||||||
&raw_data, raw_size,
|
&raw_data, scn_size,
|
||||||
GRUB_PE32_SCN_CNT_INITIALIZED_DATA |
|
GRUB_PE32_SCN_CNT_INITIALIZED_DATA |
|
||||||
GRUB_PE32_SCN_MEM_READ |
|
GRUB_PE32_SCN_MEM_READ |
|
||||||
GRUB_PE32_SCN_MEM_WRITE);
|
GRUB_PE32_SCN_MEM_WRITE);
|
||||||
|
|
||||||
raw_size = pe_size - layout.reloc_size - sbat_size - raw_data;
|
scn_size = pe_size - layout.reloc_size - sbat_size - raw_data;
|
||||||
scn_size = ALIGN_UP (raw_size, GRUB_PE32_FILE_ALIGNMENT);
|
|
||||||
section = init_pe_section (image_target, section, "mods",
|
section = init_pe_section (image_target, section, "mods",
|
||||||
&vma, scn_size, image_target->section_align,
|
&vma, scn_size, image_target->section_align,
|
||||||
&raw_data, raw_size,
|
&raw_data, scn_size,
|
||||||
GRUB_PE32_SCN_CNT_INITIALIZED_DATA |
|
GRUB_PE32_SCN_CNT_INITIALIZED_DATA |
|
||||||
GRUB_PE32_SCN_MEM_READ |
|
GRUB_PE32_SCN_MEM_READ |
|
||||||
GRUB_PE32_SCN_MEM_WRITE);
|
GRUB_PE32_SCN_MEM_WRITE);
|
||||||
@ -1438,22 +1436,21 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
|||||||
pe_sbat = pe_img + raw_data;
|
pe_sbat = pe_img + raw_data;
|
||||||
grub_util_load_image (sbat_path, pe_sbat);
|
grub_util_load_image (sbat_path, pe_sbat);
|
||||||
|
|
||||||
scn_size = ALIGN_UP (sbat_size, GRUB_PE32_FILE_ALIGNMENT);
|
|
||||||
section = init_pe_section (image_target, section, ".sbat",
|
section = init_pe_section (image_target, section, ".sbat",
|
||||||
&vma, scn_size,
|
&vma, sbat_size,
|
||||||
image_target->section_align,
|
image_target->section_align,
|
||||||
&raw_data, sbat_size,
|
&raw_data, sbat_size,
|
||||||
GRUB_PE32_SCN_CNT_INITIALIZED_DATA |
|
GRUB_PE32_SCN_CNT_INITIALIZED_DATA |
|
||||||
GRUB_PE32_SCN_MEM_READ);
|
GRUB_PE32_SCN_MEM_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
scn_size = ALIGN_UP (layout.reloc_size, GRUB_PE32_FILE_ALIGNMENT);
|
scn_size = layout.reloc_size;
|
||||||
PE_OHDR (o32, o64, base_relocation_table.rva) = grub_host_to_target32 (vma);
|
PE_OHDR (o32, o64, base_relocation_table.rva) = grub_host_to_target32 (vma);
|
||||||
PE_OHDR (o32, o64, base_relocation_table.size) = grub_host_to_target32 (scn_size);
|
PE_OHDR (o32, o64, base_relocation_table.size) = grub_host_to_target32 (scn_size);
|
||||||
memcpy (pe_img + raw_data, layout.reloc_section, scn_size);
|
memcpy (pe_img + raw_data, layout.reloc_section, scn_size);
|
||||||
init_pe_section (image_target, section, ".reloc",
|
init_pe_section (image_target, section, ".reloc",
|
||||||
&vma, scn_size, image_target->section_align,
|
&vma, scn_size, image_target->section_align,
|
||||||
&raw_data, layout.reloc_size,
|
&raw_data, scn_size,
|
||||||
GRUB_PE32_SCN_CNT_INITIALIZED_DATA |
|
GRUB_PE32_SCN_CNT_INITIALIZED_DATA |
|
||||||
GRUB_PE32_SCN_MEM_DISCARDABLE |
|
GRUB_PE32_SCN_MEM_DISCARDABLE |
|
||||||
GRUB_PE32_SCN_MEM_READ);
|
GRUB_PE32_SCN_MEM_READ);
|
||||||
|
@ -58,8 +58,6 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define CORE_IMG_IN_FS "setup_left_core_image_in_filesystem"
|
|
||||||
|
|
||||||
/* 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.
|
||||||
*
|
*
|
||||||
@ -672,8 +670,6 @@ SETUP (const char *dir,
|
|||||||
#endif
|
#endif
|
||||||
grub_free (sectors);
|
grub_free (sectors);
|
||||||
|
|
||||||
unlink (DEFAULT_DIRECTORY "/" CORE_IMG_IN_FS);
|
|
||||||
|
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,10 +711,6 @@ unable_to_embed:
|
|||||||
/* 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");
|
||||||
|
|
||||||
fp = grub_util_fd_open (DEFAULT_DIRECTORY "/" CORE_IMG_IN_FS,
|
|
||||||
GRUB_UTIL_FD_O_WRONLY);
|
|
||||||
grub_util_fd_close (fp);
|
|
||||||
|
|
||||||
grub_util_biosdisk_flush (root_dev->disk);
|
grub_util_biosdisk_flush (root_dev->disk);
|
||||||
|
|
||||||
/* Clean out the blocklists. */
|
/* Clean out the blocklists. */
|
||||||
|
Loading…
Reference in New Issue
Block a user