Compare commits

..
Author SHA1 Message Date
Vladimir Serbinenko d5edef1a77 Half boot time on pi when using standalone by using greffs 2013-12-22 21:17:54 +01:00
Vladimir Serbinenko 313fb3cef8 Add module loading and parsing boot time checkpoints. 2013-12-22 18:14:42 +01:00
Vladimir Serbinenko 37f617c025 * grub-core/loader/arm/linux.c: Pass arguments through on ATAG
platforms.
2013-12-22 18:14:00 +01:00
Lars Wendler 3deedfc033 * util/grub-mkconfig.in: Skip non-executable files. 2013-12-22 16:38:28 +01:00
Vladimir Serbinenko 5ad9f728eb Workaround buggy timer in raspberry pie by using our own timer
implementation.
2013-12-22 02:48:42 +01:00
Vladimir Serbinenko eeb8499721 * include/grub/arm/uboot/kernel.h (GRUB_KERNEL_MACHINE_HEAP_SIZE):
Increase to 16 MiB to allow loading the whole memdisk.
2013-12-22 00:32:55 +01:00
Vladimir Serbinenko 0d8b81f89a Fix ARM Linux Loader on non-FDT platforms. 2013-12-22 00:30:19 +01:00
Vladimir Serbinenko bf082198e2 * configure.ac: Choose link format based on host_os on emu. 2013-12-21 20:19:34 +01:00
Vladimir Serbinenko 0b602bf9ad * grub-core/osdep/unix/getroot.c: Non-unix build fix. 2013-12-21 18:10:05 +01:00
Vladimir Serbinenko 96650a82ec * grub-core/kern/emu/main.c: Build fix for emu. 2013-12-21 18:09:19 +01:00
Vladimir Serbinenko ca3e20886e Build fixes for argp.h with older gcc. 2013-12-21 18:08:25 +01:00
Vladimir Serbinenko 27db1a9b64 * util/grub-glue-efi.c: Use "universal binary" rather "fat binary"
in strings.

	Suggested by: David Prévot.
2013-12-21 16:12:24 +01:00
Vladimir Serbinenko 8a913e664e * include/grub/crypto.h (grub_crypto_xor): Fix cast-align warning. 2013-12-21 15:35:15 +01:00
Vladimir Serbinenko ae558c2ccf Enable -Wformat=2 if it's supported. 2013-12-21 15:28:28 +01:00
Vladimir Serbinenko bbac6789aa * configure.ac: Add -Wmissing-include-dirs -Wmissing-prototypes
-Wmissing-declarations if supported.
2013-12-21 14:47:55 +01:00
Vladimir Serbinenko ab216512d7 * grub-core/commands/macbless.c (grub_mac_bless_inode): Pass inode as u32
as both HFS and HFS+ have 32-bit inodes.
2013-12-21 14:40:53 +01:00
Vladimir Serbinenko 0d4aa91d0d * include/grub/misc.h (grub_strtol): Fix overflow. 2013-12-21 14:35:46 +01:00
Vladimir Serbinenko a997af68e3 * include/grub/term.h (grub_unicode_estimate_width): Use grub_size_t
as return type in both conditionals.
2013-12-21 14:33:36 +01:00
Vladimir Serbinenko 36bcaf2903 * include/grub/video.h (grub_video_rgba_color_rgb): Fix prototype
to use uint8_t for color.
2013-12-21 14:31:47 +01:00
Vladimir Serbinenko 74763e9615 * util/misc.c (grub_util_get_image_size): Check for overflow. 2013-12-21 14:28:14 +01:00
Vladimir Serbinenko 80b29fc9b4 * grub-core/disk/raid6_recover.c (grub_raid_block_mulx): Use grub_size_t
for size.
2013-12-21 14:16:49 +01:00
Vladimir Serbinenko 6e327fcd4c * grub-core/disk/lvm.c: Use grub_size_t for sizes and grub_ssize_t
for pointer difference.
2013-12-21 14:15:04 +01:00
Vladimir Serbinenko 62ce03cf40 * util/import_gcry.py: Skip sample keys. 2013-12-21 14:07:42 +01:00
Vladimir Serbinenko f4d70fd02b * util/misc.c (grub_qsort_strcmp): Don't discard const attribute. 2013-12-21 14:04:50 +01:00
Vladimir Serbinenko 93bf55e616 * configure.ac: Remove duplicate warning arguments. 2013-12-21 13:53:42 +01:00
Vladimir Serbinenko 579ee114b1 Add missing static qualifiers. 2013-12-21 13:50:13 +01:00
Vladimir Serbinenko ee5283d66b Add missing includes. 2013-12-21 13:47:27 +01:00
Vladimir Serbinenko 5dbde526a8 Inline printf templates when possible to enable format checking. 2013-12-21 13:40:18 +01:00
Vladimir Serbinenko d88ae4f0a4 * include/grub/crypto.h: Don't discard const attribute. 2013-12-21 13:36:42 +01:00
Vladimir Serbinenko 17b4355943 * grub-core/net/bootp.c (grub_cmd_dhcpopt): Use snprintf where it
was intended.
2013-12-21 13:35:28 +01:00
Vladimir Serbinenko 76a2a43011 * grub-core/lib/crypto.c: Don't discard const attribute. 2013-12-21 13:34:03 +01:00
Vladimir Serbinenko 0d26164edd * grub-core/lib/disk.c: Fix potential overflow. 2013-12-21 13:32:39 +01:00
Vladimir Serbinenko 2622b1e8a8 * grub-core/lib/arg.c: Don't discard const attribute. 2013-12-21 13:28:52 +01:00
Vladimir Serbinenko 05126706b0 * grub-core/kern/dl.c: Don't discard const attribute. 2013-12-21 13:26:27 +01:00
Vladimir Serbinenko 2f9c48041a * grub-core/kern/disk.c: Fix potential overflow. 2013-12-21 13:23:37 +01:00
Vladimir Serbinenko 0438ebf1c3 * conf/Makefile.common: Don't include non-existing directory
grub-core/lib/libgcrypt-grub/include.
2013-12-21 13:21:42 +01:00
Vladimir Serbinenko 065adc346c Clarify several translatable messages. 2013-12-21 03:21:45 +01:00
David Prévot 496a6b3024 Correct some translatable strings. 2013-12-21 03:03:31 +01:00
Colin Watson 971038be55 * util/grub-mkrescue.c: Rephrase mkrescue description. 2013-12-21 02:37:14 +01:00
Vladimir Serbinenko bfdfeb2508 Clarify several translatable messages. 2013-12-21 01:41:16 +01:00
Vladimir Serbinenko c00c34efe1 Merge branch 'master' of git.sv.gnu.org:/srv/git/grub 2013-12-20 17:13:24 +01:00
Colin Watson d642d76197 Be more verbose about some configure failures. 2013-12-20 16:09:43 +00:00
Vladimir Serbinenko 871aa709af * util/grub-install.c: Inform user about install platform. 2013-12-20 16:57:48 +01:00
Colin Watson 3bc1b2daab Fix various build problems on GNU/Hurd.
* grub-core/osdep/unix/getroot.c (strip_extra_slashes): Move inside
!defined (__GNU__).
(xgetcwd): Likewise.
* include/grub/emu/hostdisk.h (grub_util_hurd_get_disk_info)
[__GNU__]: Add prototype.
* util/getroot.c (grub_util_biosdisk_get_grub_dev) [__GNU__]: Format
long int using %ld rather than %d.
2013-12-20 14:02:27 +00:00
86 changed files with 1294 additions and 323 deletions

No files matched your search

+191
View File
@@ -1,3 +1,194 @@
2013-12-22 Vladimir Serbinenko <phcoder@gmail.com>
Add module loading and parsing boot time checkpoints.
2013-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/arm/linux.c: Pass arguments through on ATAG
platforms.
2013-12-22 Lars Wendler <polynomial-c@gentoo.org>
* util/grub-mkconfig.in: Skip non-executable files.
2013-12-22 Vladimir Serbinenko <phcoder@gmail.com>
Workaround buggy timer in raspberry pie by using our own timer
implementation.
2013-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/arm/uboot/kernel.h (GRUB_KERNEL_MACHINE_HEAP_SIZE):
Increase to 16 MiB to allow loading the whole memdisk.
2013-12-22 Vladimir Serbinenko <phcoder@gmail.com>
Fix ARM Linux Loader on non-FDT platforms.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Choose link format based on host_os on emu.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/osdep/unix/getroot.c: Non-unix build fix.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/main.c: Build fix for emu.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
Build fixes for argp.h with older gcc.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-glue-efi.c: Use "universal binary" rather "fat binary"
in strings.
Suggested by: David Prévot.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/crypto.h (grub_crypto_xor): Fix cast-align warning.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
Enable -Wformat=2 if it's supported.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Add -Wmissing-include-dirs -Wmissing-prototypes
-Wmissing-declarations if supported.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/macbless.c (grub_mac_bless_inode): Pass inode as
u32 as both HFS and HFS+ have 32-bit inodes.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/misc.h (grub_strtol): Fix overflow.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/term.h (grub_unicode_estimate_width): Use grub_size_t
as return type in both conditionals.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/video.h (grub_video_rgba_color_rgb): Fix prototype
to use uint8_t for color.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* util/misc.c (grub_util_get_image_size): Check for overflow.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/raid6_recover.c (grub_raid_block_mulx): Use grub_size_t
for size.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/lvm.c: Use grub_size_t for sizes and grub_ssize_t
for pointer difference.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* util/import_gcry.py: Skip sample keys.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* util/misc.c (grub_qsort_strcmp): Don't discard const attribute.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Remove duplicate warning arguments.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
Add missing static qualifiers.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
Add missing includes.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
Inline printf templates when possible to enable format checking.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/crypto.h: Don't discard const attribute.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/net/bootp.c (grub_cmd_dhcpopt): Use snprintf where it
was intended.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/crypto.c: Don't discard const attribute.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/disk.c: Fix potential overflow.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/arg.c: Don't discard const attribute.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/dl.c: Don't discard const attribute.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/disk.c: Fix potential overflow.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* conf/Makefile.common: Don't include non-existing directory
grub-core/lib/libgcrypt-grub/include.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
Clarify several translatable messages.
2013-12-21 David Prévot <david@tilapin.org>
Correct some translatable strings.
2013-12-21 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkrescue.c: Rephrase mkrescue description.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
2013-12-21 Colin Watson <cjwatson@ubuntu.com>
Clarify several translatable messages.
2013-12-20 Colin Watson <cjwatson@ubuntu.com>
Be more verbose about some configure failures.
2013-12-20 Colin Watson <cjwatson@ubuntu.com>
Fix various build problems on GNU/Hurd.
* grub-core/osdep/unix/getroot.c (strip_extra_slashes): Move inside
!defined (__GNU__).
(xgetcwd): Likewise.
* include/grub/emu/hostdisk.h (grub_util_hurd_get_disk_info)
[__GNU__]: Add prototype.
* util/getroot.c (grub_util_biosdisk_get_grub_dev) [__GNU__]: Format
long int using %ld rather than %d.
2013-12-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.c: Inform user about install platform.
2013-12-18 Vladimir Serbinenko <phcoder@gmail.com> 2013-12-18 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Set version to 2.02~beta1. * configure.ac: Set version to 2.02~beta1.
+1
View File
@@ -119,6 +119,7 @@ library = {
common = grub-core/fs/sfs.c; common = grub-core/fs/sfs.c;
common = grub-core/fs/squash4.c; common = grub-core/fs/squash4.c;
common = grub-core/fs/tar.c; common = grub-core/fs/tar.c;
common = grub-core/fs/greffs.c;
common = grub-core/fs/udf.c; common = grub-core/fs/udf.c;
common = grub-core/fs/ufs2.c; common = grub-core/fs/ufs2.c;
common = grub-core/fs/ufs.c; common = grub-core/fs/ufs.c;
-1
View File
@@ -35,7 +35,6 @@ CPPFLAGS_DEFAULT += -I$(top_builddir)
CPPFLAGS_DEFAULT += -I$(top_srcdir) CPPFLAGS_DEFAULT += -I$(top_srcdir)
CPPFLAGS_DEFAULT += -I$(top_srcdir)/include CPPFLAGS_DEFAULT += -I$(top_srcdir)/include
CPPFLAGS_DEFAULT += -I$(top_builddir)/include CPPFLAGS_DEFAULT += -I$(top_builddir)/include
CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/include
CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/ CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1 CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT) BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
+43 -14
View File
@@ -432,8 +432,8 @@ esac
# For gnulib. # For gnulib.
gl_INIT gl_INIT
WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes" WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes"
EXTRA_WARN_FLAGS="-Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign" EXTRA_WARN_FLAGS="-Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2"
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align" HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
@@ -745,7 +745,7 @@ if test x"$efiemu_excuse" = x ; then
fi fi
fi fi
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)])
fi fi
if test x"$efiemu_excuse" = x ; then if test x"$efiemu_excuse" = x ; then
enable_efiemu=yes enable_efiemu=yes
@@ -757,14 +757,35 @@ AC_SUBST([EFIEMU64_LINK_FORMAT])
CFLAGS="$TARGET_CFLAGS" CFLAGS="$TARGET_CFLAGS"
if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
if test x"$platform" = xemu ; then
TARGET_OBJ2ELF=
grub_cv_target_cc_link_format=
case "$host_os" in
*darwin* | *mac*)
grub_cv_target_cc_link_format="-arch,${target_cpu}"
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
;;
*windows* | *cygwin* | *mingw*)
if test x${target_cpu} = xi386 ; then
grub_cv_target_cc_link_format=-mi386pe;
TARGET_OBJ2ELF='./build-grub-pe2elf';
fi
if test x${target_cpu} = xx86_64 ; then
grub_cv_target_cc_link_format=-mi386pep;
TARGET_OBJ2ELF='./build-grub-pep2elf';
fi
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
;;
esac
elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [ AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
grub_cv_target_cc_link_format=unknown grub_cv_target_cc_link_format=unknown
for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -mi386pe -mi386pep -arch,${target_cpu}; do for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -mi386pe -mi386pep -arch,${target_cpu}; do
if test x${target_cpu} != xi386 && test x$format = xi386pe; then if test x${target_cpu} != xi386 && test x$format = x-mi386pe; then
continue continue
fi fi
if test x${target_cpu} != xx86_64 && test x$format = xi386pep; then if test x${target_cpu} != xx86_64 && test x$format = x-mi386pep; then
continue continue
fi fi
CFLAGS="$TARGET_CFLAGS" CFLAGS="$TARGET_CFLAGS"
@@ -1144,7 +1165,7 @@ AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
[grub_emu_usb_excuse=["need libusb headers"]]) [grub_emu_usb_excuse=["need libusb headers"]])
[fi] [fi]
if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled ($grub_emu_usb_excuse)])
fi fi
if test x"$grub_emu_usb_excuse" = x ; then if test x"$grub_emu_usb_excuse" = x ; then
enable_grub_emu_usb=yes enable_grub_emu_usb=yes
@@ -1169,7 +1190,7 @@ AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
[fi] [fi]
if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled]) AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled ($grub_emu_sdl_excuse)])
fi fi
if test x"$grub_emu_sdl_excuse" = x ; then if test x"$grub_emu_sdl_excuse" = x ; then
enable_grub_emu_sdl=yes enable_grub_emu_sdl=yes
@@ -1249,7 +1270,7 @@ if test x"$grub_mkfont_excuse" = x ; then
fi fi
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled ($grub_mkfont_excuse)])
fi fi
if test x"$grub_mkfont_excuse" = x ; then if test x"$grub_mkfont_excuse" = x ; then
enable_grub_mkfont=yes enable_grub_mkfont=yes
@@ -1308,7 +1329,7 @@ if test x"$grub_build_mkfont_excuse" = x ; then
fi fi
if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled]) AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled ($grub_build_mkfont_excuse)])
fi fi
if test x"$grub_build_mkfont_excuse" = x ; then if test x"$grub_build_mkfont_excuse" = x ; then
enable_build_grub_mkfont=yes enable_build_grub_mkfont=yes
@@ -1316,7 +1337,11 @@ else
enable_build_grub_mkfont=no enable_build_grub_mkfont=no
fi fi
if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xcoreboot ); then if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xcoreboot ); then
if test x"$grub_build_mkfont_excuse" = x ; then
AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont]) AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont])
else
AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont ($grub_build_mkfont_excuse)])
fi
fi fi
AC_SUBST([build_freetype_cflags]) AC_SUBST([build_freetype_cflags])
@@ -1359,7 +1384,7 @@ if test x"$starfield_excuse" = x; then
fi fi
if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied]) AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied ($starfield_excuse)])
fi fi
AC_SUBST([DJVU_FONT_SOURCE]) AC_SUBST([DJVU_FONT_SOURCE])
@@ -1385,7 +1410,11 @@ if test x"$enable_build_grub_mkfont" = xno ; then
fi fi
if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xcoreboot ); then if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xcoreboot ); then
if test x"$grub_build_mkfont_excuse" = x ; then
AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont]) AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont])
else
AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont ($grub_build_mkfont_excuse)])
fi
fi fi
AC_SUBST([FONT_SOURCE]) AC_SUBST([FONT_SOURCE])
@@ -1417,7 +1446,7 @@ if test x"$grub_mount_excuse" = x ; then
fi fi
if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled]) AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled ($grub_mount_excuse)])
fi fi
if test x"$grub_mount_excuse" = x ; then if test x"$grub_mount_excuse" = x ; then
enable_grub_mount=yes enable_grub_mount=yes
@@ -1485,7 +1514,7 @@ AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
fi fi
if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied]) AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied ($liblzma_excuse)])
fi fi
@@ -1522,7 +1551,7 @@ if test x"$libzfs_excuse" = x ; then
fi fi
if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied]) AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied ($libzfs_excuse)])
fi fi
if test x"$libzfs_excuse" = x ; then if test x"$libzfs_excuse" = x ; then
+5
View File
@@ -1399,6 +1399,11 @@ module = {
common = fs/tar.c; common = fs/tar.c;
}; };
module = {
name = greffs;
common = fs/greffs.c;
};
module = { module = {
name = udf; name = udf;
common = fs/udf.c; common = fs/udf.c;
+1 -1
View File
@@ -56,7 +56,7 @@ GRUB_MOD_INIT(boottime)
{ {
cmd_boottime = cmd_boottime =
grub_register_command ("boottime", grub_cmd_boottime, grub_register_command ("boottime", grub_cmd_boottime,
0, N_("Get boot time statistics.")); 0, N_("Show boot time statistics."));
} }
GRUB_MOD_FINI(boottime) GRUB_MOD_FINI(boottime)
+21 -21
View File
@@ -36,50 +36,50 @@ GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = { static const struct grub_arg_option options[] = {
{"is-i386-xen-pae-domu", 0, 0, {"is-i386-xen-pae-domu", 0, 0,
N_("Check if FILE can be booted as i386 PAE xen unprivilegied guest"), N_("Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel"),
0, 0}, 0, 0},
{"is-x86_64-xen-domu", 0, 0, {"is-x86_64-xen-domu", 0, 0,
N_("Check if FILE can be booted as x86_64 xen unprivilegied guest"), 0, 0}, N_("Check if FILE can be booted as x86_64 Xen unprivileged guest kernel"), 0, 0},
{"is-x86-xen-dom0", 0, 0, {"is-x86-xen-dom0", 0, 0,
N_("Check if FILE can be used as xen x86 privilegied guest kernel"), 0, 0}, N_("Check if FILE can be used as Xen x86 privileged guest kernel"), 0, 0},
{"is-x86-multiboot", 0, 0, {"is-x86-multiboot", 0, 0,
N_("Check if FILE can be used as x86 multiboot kernel"), 0, 0}, N_("Check if FILE can be used as x86 multiboot kernel"), 0, 0},
{"is-x86-multiboot2", 0, 0, {"is-x86-multiboot2", 0, 0,
N_("Check if FILE can be used as x86 multiboot2 kernel"), 0, 0}, N_("Check if FILE can be used as x86 multiboot2 kernel"), 0, 0},
{"is-arm-linux", 0, 0, {"is-arm-linux", 0, 0,
N_("Check if FILE is ARM linux"), 0, 0}, N_("Check if FILE is ARM Linux"), 0, 0},
{"is-ia64-linux", 0, 0, {"is-ia64-linux", 0, 0,
N_("Check if FILE is IA64 linux"), 0, 0}, N_("Check if FILE is IA64 Linux"), 0, 0},
{"is-mips-linux", 0, 0, {"is-mips-linux", 0, 0,
N_("Check if FILE is MIPS linux"), 0, 0}, N_("Check if FILE is MIPS Linux"), 0, 0},
{"is-mipsel-linux", 0, 0, {"is-mipsel-linux", 0, 0,
N_("Check if FILE is MIPSEL linux"), 0, 0}, N_("Check if FILE is MIPSEL Linux"), 0, 0},
{"is-sparc64-linux", 0, 0, {"is-sparc64-linux", 0, 0,
N_("Check if FILE is SPARC64 linux"), 0, 0}, N_("Check if FILE is SPARC64 Linux"), 0, 0},
{"is-powerpc-linux", 0, 0, {"is-powerpc-linux", 0, 0,
N_("Check if FILE is POWERPC linux"), 0, 0}, N_("Check if FILE is POWERPC Linux"), 0, 0},
{"is-x86-linux", 0, 0, {"is-x86-linux", 0, 0,
N_("Check if FILE is x86 linux"), 0, 0}, N_("Check if FILE is x86 Linux"), 0, 0},
{"is-x86-linux32", 0, 0, {"is-x86-linux32", 0, 0,
N_("Check if FILE is x86 linux supporting 32-bit protocol"), 0, 0}, N_("Check if FILE is x86 Linux supporting 32-bit protocol"), 0, 0},
{"is-x86-kfreebsd", 0, 0, {"is-x86-kfreebsd", 0, 0,
N_("Check if FILE is x86 kfreebsd"), 0, 0}, N_("Check if FILE is x86 kFreeBSD"), 0, 0},
{"is-i386-kfreebsd", 0, 0, {"is-i386-kfreebsd", 0, 0,
N_("Check if FILE is i386 kfreebsd"), 0, 0}, N_("Check if FILE is i386 kFreeBSD"), 0, 0},
{"is-x86_64-kfreebsd", 0, 0, {"is-x86_64-kfreebsd", 0, 0,
N_("Check if FILE is x86_64 kfreebsd"), 0, 0}, N_("Check if FILE is x86_64 kFreeBSD"), 0, 0},
{"is-x86-knetbsd", 0, 0, {"is-x86-knetbsd", 0, 0,
N_("Check if FILE is x86 knetbsd"), 0, 0}, N_("Check if FILE is x86 kNetBSD"), 0, 0},
{"is-i386-knetbsd", 0, 0, {"is-i386-knetbsd", 0, 0,
N_("Check if FILE is i386 knetbsd"), 0, 0}, N_("Check if FILE is i386 kNetBSD"), 0, 0},
{"is-x86_64-knetbsd", 0, 0, {"is-x86_64-knetbsd", 0, 0,
N_("Check if FILE is x86_64 knetbsd"), 0, 0}, N_("Check if FILE is x86_64 kNetBSD"), 0, 0},
{"is-i386-efi", 0, 0, {"is-i386-efi", 0, 0,
N_("Check if FILE is i386 EFI file"), 0, 0}, N_("Check if FILE is i386 EFI file"), 0, 0},
{"is-x86_64-efi", 0, 0, {"is-x86_64-efi", 0, 0,
N_("Check if FILE is x86-64 EFI file"), 0, 0}, N_("Check if FILE is x86_64 EFI file"), 0, 0},
{"is-ia64-efi", 0, 0, {"is-ia64-efi", 0, 0,
N_("Check if FILE is IA64 EFI file"), 0, 0}, N_("Check if FILE is IA64 EFI file"), 0, 0},
{"is-arm-efi", 0, 0, {"is-arm-efi", 0, 0,
@@ -87,11 +87,11 @@ static const struct grub_arg_option options[] = {
{"is-hibernated-hiberfil", 0, 0, {"is-hibernated-hiberfil", 0, 0,
N_("Check if FILE is hiberfil.sys in hibernated state"), 0, 0}, N_("Check if FILE is hiberfil.sys in hibernated state"), 0, 0},
{"is-x86_64-xnu", 0, 0, {"is-x86_64-xnu", 0, 0,
N_("Check if FILE is x86_64 xnu (Mac OS X kernel)"), 0, 0}, N_("Check if FILE is x86_64 XNU (Mac OS X kernel)"), 0, 0},
{"is-i386-xnu", 0, 0, {"is-i386-xnu", 0, 0,
N_("Check if FILE is i386 xnu (Mac OS X kernel)"), 0, 0}, N_("Check if FILE is i386 XNU (Mac OS X kernel)"), 0, 0},
{"is-xnu-hibr", 0, 0, {"is-xnu-hibr", 0, 0,
N_("Check if FILE is xnu (Mac OS X kernel) hibernated image"), 0, 0}, N_("Check if FILE is XNU (Mac OS X kernel) hibernated image"), 0, 0},
{"is-x86-bios-bootsector", 0, 0, {"is-x86-bios-bootsector", 0, 0,
N_("Check if FILE is BIOS bootsector"), 0, 0}, N_("Check if FILE is BIOS bootsector"), 0, 0},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
+1 -1
View File
@@ -55,7 +55,7 @@ GRUB_MOD_INIT(cmosdump)
{ {
cmd = grub_register_command ("cmosdump", grub_cmd_cmosdump, cmd = grub_register_command ("cmosdump", grub_cmd_cmosdump,
0, 0,
N_("Dump CMOS contents.")); N_("Show raw dump of the CMOS contents."));
} }
GRUB_MOD_FINI(cmosdump) GRUB_MOD_FINI(cmosdump)
+2 -1
View File
@@ -109,9 +109,10 @@ GRUB_MOD_INIT(cmostest)
N_("Test bit at BYTE:BIT in CMOS.")); N_("Test bit at BYTE:BIT in CMOS."));
cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean, cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
N_("BYTE:BIT"), N_("BYTE:BIT"),
N_("Clean bit at BYTE:BIT in CMOS.")); N_("Clear bit at BYTE:BIT in CMOS."));
cmd_set = grub_register_command ("cmosset", grub_cmd_cmosset, cmd_set = grub_register_command ("cmosset", grub_cmd_cmosset,
N_("BYTE:BIT"), N_("BYTE:BIT"),
/* TRANSLATORS: A bit may be either set (1) or clear (0). */
N_("Set bit at BYTE:BIT in CMOS.")); N_("Set bit at BYTE:BIT in CMOS."));
} }
@@ -109,7 +109,7 @@ GRUB_MOD_INIT(cbtime)
{ {
cmd_boottime = cmd_boottime =
grub_register_command ("coreboot_boottime", grub_cmd_coreboot_boottime, grub_register_command ("coreboot_boottime", grub_cmd_coreboot_boottime,
0, N_("Get coreboot boot time statistics.")); 0, N_("Show coreboot boot time statistics."));
} }
GRUB_MOD_FINI(cbtime) GRUB_MOD_FINI(cbtime)
+1 -1
View File
@@ -455,7 +455,7 @@ GRUB_MOD_INIT(loadenv)
{ {
cmd_load = cmd_load =
grub_register_extcmd ("load_env", grub_cmd_load_env, 0, grub_register_extcmd ("load_env", grub_cmd_load_env, 0,
N_("[-f FILE] [-s|--skip-sig] [whitelisted_variable_name] [...]"), N_("[-f FILE] [-s|--skip-sig] [variable_name_to_whitelist] [...]"),
N_("Load variables from environment block file."), N_("Load variables from environment block file."),
options); options);
cmd_list = cmd_list =
+3 -3
View File
@@ -59,7 +59,7 @@ find_inode (const char *filename,
} }
grub_err_t grub_err_t
grub_mac_bless_inode (grub_device_t dev, grub_uint64_t inode, int is_dir, grub_mac_bless_inode (grub_device_t dev, grub_uint32_t inode, int is_dir,
int intel) int intel)
{ {
grub_err_t err; grub_err_t err;
@@ -174,8 +174,8 @@ grub_mac_bless_file (grub_device_t dev, const char *path_in, int intel)
} }
grub_free (path); grub_free (path);
return grub_mac_bless_inode (dev, ctx.inode_found, (ctx.found == DIR), return grub_mac_bless_inode (dev, (grub_uint32_t) ctx.inode_found,
intel); (ctx.found == DIR), intel);
} }
static grub_err_t static grub_err_t
+1 -1
View File
@@ -166,7 +166,7 @@ GRUB_MOD_INIT(pcidump)
{ {
cmd = grub_register_extcmd ("pcidump", grub_cmd_pcidump, 0, cmd = grub_register_extcmd ("pcidump", grub_cmd_pcidump, 0,
N_("[-s POSITION] [-d DEVICE]"), N_("[-s POSITION] [-d DEVICE]"),
N_("Dump PCI configuration space."), options); N_("Show raw dump of the PCI configuration space."), options);
} }
GRUB_MOD_FINI(pcidump) GRUB_MOD_FINI(pcidump)
+9 -9
View File
@@ -47,14 +47,14 @@ syslinux_file_getline (char **line, int cont __attribute__ ((unused)),
static const struct grub_arg_option options[] = static const struct grub_arg_option options[] =
{ {
{"root", 'r', 0, {"root", 'r', 0,
N_("root directory of the syslinux disk (default /)."), N_("root directory of the syslinux disk [default=/]."),
N_("DIR"), ARG_TYPE_STRING}, N_("DIR"), ARG_TYPE_STRING},
{"cwd", 'c', 0, {"cwd", 'c', 0,
N_("home directory of the syslinux config (default directory of configfile)."), N_("current directory of the syslinux [default is parent directory of input file]."),
N_("DIR"), ARG_TYPE_STRING}, N_("DIR"), ARG_TYPE_STRING},
{"isolinux", 'i', 0, N_("assume isolinux."), 0, 0}, {"isolinux", 'i', 0, N_("assume input is an isolinux configuration file."), 0, 0},
{"pxelinux", 'p', 0, N_("assume pxelinux."), 0, 0}, {"pxelinux", 'p', 0, N_("assume input is a pxelinux configuration file."), 0, 0},
{"syslinux", 's', 0, N_("assume syslinux."), 0, 0}, {"syslinux", 's', 0, N_("assume input is a syslinux configuration file."), 0, 0},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
@@ -183,25 +183,25 @@ GRUB_MOD_INIT(syslinuxcfg)
N_("FILE"), N_("FILE"),
/* TRANSLATORS: "syslinux config" means /* TRANSLATORS: "syslinux config" means
"config as used by syslinux". */ "config as used by syslinux". */
N_("Parse syslinux config in same context"), N_("Execute syslinux config in same context"),
options); options);
cmd_configfile cmd_configfile
= grub_register_extcmd ("syslinux_configfile", = grub_register_extcmd ("syslinux_configfile",
grub_cmd_syslinux_source, 0, grub_cmd_syslinux_source, 0,
N_("FILE"), N_("FILE"),
N_("Parse syslinux config in new context"), N_("Execute syslinux config in new context"),
options); options);
cmd_source_extract cmd_source_extract
= grub_register_extcmd ("extract_syslinux_entries_source", = grub_register_extcmd ("extract_syslinux_entries_source",
grub_cmd_syslinux_source, 0, grub_cmd_syslinux_source, 0,
N_("FILE"), N_("FILE"),
N_("Parse syslinux config in same context taking only menu entries"), N_("Execute syslinux config in same context taking only menu entries"),
options); options);
cmd_configfile_extract cmd_configfile_extract
= grub_register_extcmd ("extract_syslinux_entries_configfile", = grub_register_extcmd ("extract_syslinux_entries_configfile",
grub_cmd_syslinux_source, 0, grub_cmd_syslinux_source, 0,
N_("FILE"), N_("FILE"),
N_("Parse syslinux config in new context taking only menu entries"), N_("Execute syslinux config in new context taking only menu entries"),
options); options);
} }
+4 -4
View File
@@ -41,7 +41,7 @@ enum
static const struct grub_arg_option options[] = static const struct grub_arg_option options[] =
{ {
{"skip-sig", 's', 0, {"skip-sig", 's', 0,
N_("Skip signature-checking of the signature file."), 0, ARG_TYPE_NONE}, N_("Skip signature-checking of the public key file."), 0, ARG_TYPE_NONE},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
@@ -966,14 +966,14 @@ GRUB_MOD_INIT(verify)
options); options);
cmd_trust = grub_register_extcmd ("trust", grub_cmd_trust, 0, cmd_trust = grub_register_extcmd ("trust", grub_cmd_trust, 0,
N_("[-s|--skip-sig] PUBKEY_FILE"), N_("[-s|--skip-sig] PUBKEY_FILE"),
N_("Add PKFILE to trusted keys."), N_("Add PUBKEY_FILE to trusted keys."),
options); options);
cmd_list = grub_register_command ("list_trusted", grub_cmd_list, cmd_list = grub_register_command ("list_trusted", grub_cmd_list,
0, 0,
N_("List trusted keys.")); N_("Show the list of trusted keys."));
cmd_distrust = grub_register_command ("distrust", grub_cmd_distrust, cmd_distrust = grub_register_command ("distrust", grub_cmd_distrust,
N_("PUBKEY_ID"), N_("PUBKEY_ID"),
N_("Remove KEYID from trusted keys.")); N_("Remove PUBKEY_ID from trusted keys."));
} }
GRUB_MOD_FINI(verify) GRUB_MOD_FINI(verify)
+2 -2
View File
@@ -78,9 +78,9 @@ static grub_command_t cmd_ls, cmd_cat;
GRUB_MOD_INIT (lsxen) GRUB_MOD_INIT (lsxen)
{ {
cmd_ls = grub_register_command ("xen_ls", grub_cmd_lsxen, N_("[DIR]"), cmd_ls = grub_register_command ("xen_ls", grub_cmd_lsxen, N_("[DIR]"),
N_("List XEN storage.")); N_("List Xen storage."));
cmd_cat = grub_register_command ("xen_cat", grub_cmd_catxen, N_("[DIR]"), cmd_cat = grub_register_command ("xen_cat", grub_cmd_catxen, N_("[DIR]"),
N_("List XEN storage.")); N_("List Xen storage."));
} }
GRUB_MOD_FINI (lsxen) GRUB_MOD_FINI (lsxen)
+5 -4
View File
@@ -65,7 +65,7 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl)
static int static int
grub_lvm_check_flag (char *p, const char *str, const char *flag) grub_lvm_check_flag (char *p, const char *str, const char *flag)
{ {
int len_str = grub_strlen (str), len_flag = grub_strlen (flag); grub_size_t len_str = grub_strlen (str), len_flag = grub_strlen (flag);
while (1) while (1)
{ {
char *q; char *q;
@@ -111,7 +111,8 @@ grub_lvm_detect (grub_disk_t disk,
struct grub_lvm_disk_locn *dlocn; struct grub_lvm_disk_locn *dlocn;
struct grub_lvm_mda_header *mdah; struct grub_lvm_mda_header *mdah;
struct grub_lvm_raw_locn *rlocn; struct grub_lvm_raw_locn *rlocn;
unsigned int i, j, vgname_len; unsigned int i, j;
grub_size_t vgname_len;
struct grub_diskfilter_vg *vg; struct grub_diskfilter_vg *vg;
struct grub_diskfilter_pv *pv; struct grub_diskfilter_pv *pv;
@@ -273,7 +274,7 @@ grub_lvm_detect (grub_disk_t disk,
/* Add all the pvs to the volume group. */ /* Add all the pvs to the volume group. */
while (1) while (1)
{ {
int s; grub_ssize_t s;
while (grub_isspace (*p)) while (grub_isspace (*p))
p++; p++;
@@ -340,7 +341,7 @@ grub_lvm_detect (grub_disk_t disk,
/* And add all the lvs to the volume group. */ /* And add all the lvs to the volume group. */
while (1) while (1)
{ {
int s; grub_ssize_t s;
int skip_lv = 0; int skip_lv = 0;
struct grub_diskfilter_lv *lv; struct grub_diskfilter_lv *lv;
struct grub_diskfilter_segment *seg; struct grub_diskfilter_segment *seg;
+2 -2
View File
@@ -34,9 +34,9 @@ static unsigned powx_inv[256];
static const grub_uint8_t poly = 0x1d; static const grub_uint8_t poly = 0x1d;
static void static void
grub_raid_block_mulx (unsigned mul, char *buf, int size) grub_raid_block_mulx (unsigned mul, char *buf, grub_size_t size)
{ {
int i; grub_size_t i;
grub_uint8_t *p; grub_uint8_t *p;
p = (grub_uint8_t *) buf; p = (grub_uint8_t *) buf;
+314
View File
@@ -0,0 +1,314 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/misc.h>
#include <grub/disk.h>
#include <grub/archelp.h>
#include <grub/file.h>
#include <grub/mm.h>
#include <grub/dl.h>
#include <grub/i18n.h>
#include <grub/greffs.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_greffs_data
{
grub_uint32_t dofs;
};
static grub_err_t
get_string (grub_disk_t disk,
const struct grub_greffs_header *head,
grub_uint32_t fn,
char **buf, grub_size_t *size)
{
grub_uint32_t desc[2];
grub_size_t read_size;
if (grub_disk_read (disk, 0,
grub_cpu_to_le32 (head->string_ptrs_offset)
+ fn * sizeof (desc[0]), sizeof (desc), &desc))
return grub_errno;
read_size = desc[1] - desc[0];
if (*size < read_size + 1)
{
grub_free (*buf);
*size = (read_size + 4) * 2;
*buf = grub_malloc (*size);
if (!*buf)
{
*size = 0;
return grub_errno;
}
}
if (grub_disk_read (disk, 0, desc[0], read_size, *buf))
return grub_errno;
(*buf)[read_size] = '\0';
return GRUB_ERR_NONE;
}
static grub_err_t
find_file (grub_disk_t disk,
struct grub_greffs_header *head,
const char *name_in, grub_uint32_t *f, int exact)
{
grub_uint32_t num_files, cur_file = 0;
int i;
char *buf = NULL;
grub_size_t buf_size = 0;
grub_err_t err;
num_files = grub_le_to_cpu32 (head->nfiles);
for (i = 31; i >= 0; i--)
{
int cmp;
if ((cur_file | (1 << i)) > num_files)
continue;
err = get_string (disk, head, (cur_file | (1 << i)) - 1, &buf, &buf_size);
if (err)
{
grub_free (buf);
return err;
}
cmp = grub_strcmp (buf, name_in);
if (cmp <= 0)
cur_file |= (1 << i);
if (cmp == 0)
{
grub_free (buf);
*f = cur_file - 1;
return GRUB_ERR_NONE;
}
}
grub_free (buf);
if (!exact)
{
*f = cur_file;
return GRUB_ERR_NONE;
}
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"),
name_in);
}
static char *
canonicalize (const char *name_in, int make_dir)
{
const char *iptr;
char *out, *optr;
out = grub_malloc (grub_strlen (name_in) + 2);
if (!out)
return NULL;
for (iptr = name_in, optr = out; *iptr; )
{
while (*iptr == '/')
iptr++;
if (iptr[0] == '.' && (iptr[1] == '/' || iptr[1] == 0))
{
iptr += 2;
continue;
}
if (iptr[0] == '.' && iptr[1] == '.' && (iptr[2] == '/' || iptr[2] == 0))
{
iptr += 3;
if (optr == out)
continue;
for (optr -= 2; optr >= out && *optr != '/'; optr--);
optr++;
continue;
}
while (*iptr && *iptr != '/')
*optr++ = *iptr++;
if (*iptr)
*optr++ = *iptr++;
else if (make_dir && optr != out)
*optr++ = '/';
}
*optr = 0;
return out;
}
static grub_err_t
grub_greffs_dir (grub_device_t device, const char *path_in,
grub_fs_dir_hook_t hook, void *hook_data)
{
grub_err_t err;
grub_uint32_t cur_file, num_files;
char *buf = 0;
grub_size_t buf_size = 0;
char *can;
grub_size_t len;
struct grub_greffs_header head;
if (grub_disk_read (device->disk, 0, 0, sizeof (head), &head))
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
if (grub_memcmp (head.magic, GRUB_GREFFS_MAGIC, sizeof (head.magic)) != 0)
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
can = canonicalize (path_in, 1);
if (!can)
return grub_errno;
if (can[0] == '\0')
cur_file = 0;
else
{
err = find_file (device->disk, &head, can, &cur_file, 0);
if (err)
goto fail;
}
num_files = grub_le_to_cpu32 (head.nfiles);
len = grub_strlen (can);
while (cur_file < num_files)
{
char *p, *n;
struct grub_dirhook_info info;
err = get_string (device->disk, &head, cur_file, &buf, &buf_size);
if (err)
goto fail;
if (grub_memcmp (can, buf, len) != 0)
break;
grub_memset (&info, 0, sizeof (info));
n = buf + len;
while (*n == '/')
n++;
p = grub_strchr (n, '/');
if (p)
*p = 0;
info.dir = (p != NULL);
if (hook (n, &info, hook_data))
goto fail;
if (!p)
cur_file++;
else
{
*p = '/' + 1;
p[1] = '\0';
err = find_file (device->disk, &head, buf, &cur_file, 0);
if (err)
goto fail;
}
}
fail:
grub_free (buf);
grub_free (can);
return grub_errno;
}
static grub_err_t
grub_greffs_open (grub_file_t file, const char *name_in)
{
struct grub_greffs_header head;
struct grub_greffs_data *data;
struct grub_greffs_inode inode;
grub_err_t err;
grub_uint32_t cur_file;
char *can;
if (grub_disk_read (file->device->disk, 0, 0, sizeof (head), &head))
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
if (grub_memcmp (head.magic, GRUB_GREFFS_MAGIC, sizeof (head.magic)) != 0)
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
can = canonicalize (name_in, 0);
if (!can)
return grub_errno;
err = find_file (file->device->disk, &head, can, &cur_file, 1);
grub_free (can);
if (err)
return err;
data = grub_malloc (sizeof (*data));
if (!data)
return grub_errno;
if (grub_disk_read (file->device->disk,
0, grub_le_to_cpu32 (head.inodes_offset)
+ sizeof (inode) * cur_file, sizeof (inode), &inode))
return grub_error (GRUB_ERR_BAD_FS, "not a greffs filesystem");
data->dofs = grub_cpu_to_le32 (inode.start);
file->size = grub_cpu_to_le32 (inode.size);
file->data = data;
return GRUB_ERR_NONE;
}
static grub_ssize_t
grub_greffs_read (grub_file_t file, char *buf, grub_size_t len)
{
struct grub_greffs_data *data;
grub_ssize_t ret;
data = file->data;
file->device->disk->read_hook = file->read_hook;
file->device->disk->read_hook_data = file->read_hook_data;
ret = (grub_disk_read (file->device->disk, 0, data->dofs + file->offset,
len, buf)) ? -1 : (grub_ssize_t) len;
file->device->disk->read_hook = 0;
return ret;
}
static grub_err_t
grub_greffs_close (grub_file_t file)
{
struct grub_greffs_data *data;
data = file->data;
grub_free (data);
return grub_errno;
}
static struct grub_fs grub_greffs_fs = {
.name = "greffs",
.dir = grub_greffs_dir,
.open = grub_greffs_open,
.read = grub_greffs_read,
.close = grub_greffs_close,
#ifdef GRUB_UTIL
.reserved_first_sector = 0,
.blocklist_install = 0,
#endif
};
GRUB_MOD_INIT (greffs)
{
grub_fs_register (&grub_greffs_fs);
}
GRUB_MOD_FINI (greffs)
{
grub_fs_unregister (&grub_greffs_fs);
}
+4
View File
@@ -154,6 +154,8 @@ label_get_minimal_size (void *vself, unsigned *width, unsigned *height)
+ grub_font_get_descent (self->font)); + grub_font_get_descent (self->font));
} }
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void static void
label_set_state (void *vself, int visible, int start __attribute__ ((unused)), label_set_state (void *vself, int visible, int start __attribute__ ((unused)),
int current, int end __attribute__ ((unused))) int current, int end __attribute__ ((unused)))
@@ -235,6 +237,8 @@ label_set_property (void *vself, const char *name, const char *value)
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
static struct grub_gui_component_ops label_ops = static struct grub_gui_component_ops label_ops =
{ {
.destroy = label_destroy, .destroy = label_destroy,
+4
View File
@@ -183,6 +183,8 @@ draw_pixmap_bar (grub_gui_progress_bar_t self)
} }
} }
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void static void
draw_text (grub_gui_progress_bar_t self) draw_text (grub_gui_progress_bar_t self)
{ {
@@ -212,6 +214,8 @@ draw_text (grub_gui_progress_bar_t self)
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
static void static void
progress_bar_paint (void *vself, const grub_video_rect_t *region) progress_bar_paint (void *vself, const grub_video_rect_t *region)
{ {
+4 -4
View File
@@ -342,7 +342,7 @@ grub_disk_read_small_real (grub_disk_t disk, grub_disk_addr_t sector,
{ {
grub_err_t err; grub_err_t err;
err = (disk->dev->read) (disk, transform_sector (disk, sector), err = (disk->dev->read) (disk, transform_sector (disk, sector),
1 << (GRUB_DISK_CACHE_BITS 1U << (GRUB_DISK_CACHE_BITS
+ GRUB_DISK_SECTOR_BITS + GRUB_DISK_SECTOR_BITS
- disk->log_sector_size), tmp_buf); - disk->log_sector_size), tmp_buf);
if (!err) if (!err)
@@ -366,11 +366,11 @@ grub_disk_read_small_real (grub_disk_t disk, grub_disk_addr_t sector,
sector += (offset >> GRUB_DISK_SECTOR_BITS); sector += (offset >> GRUB_DISK_SECTOR_BITS);
offset &= ((1 << GRUB_DISK_SECTOR_BITS) - 1); offset &= ((1 << GRUB_DISK_SECTOR_BITS) - 1);
aligned_sector = (sector & ~((1 << (disk->log_sector_size aligned_sector = (sector & ~((1ULL << (disk->log_sector_size
- GRUB_DISK_SECTOR_BITS)) - GRUB_DISK_SECTOR_BITS))
- 1)); - 1));
offset += ((sector - aligned_sector) << GRUB_DISK_SECTOR_BITS); offset += ((sector - aligned_sector) << GRUB_DISK_SECTOR_BITS);
num = ((size + offset + (1 << (disk->log_sector_size)) num = ((size + offset + (1ULL << (disk->log_sector_size))
- 1) >> (disk->log_sector_size)); - 1) >> (disk->log_sector_size));
tmp_buf = grub_malloc (num << disk->log_sector_size); tmp_buf = grub_malloc (num << disk->log_sector_size);
@@ -431,7 +431,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_err_t err; grub_err_t err;
grub_size_t len; grub_size_t len;
start_sector = sector & ~(GRUB_DISK_CACHE_SIZE - 1); start_sector = sector & ~((grub_disk_addr_t) GRUB_DISK_CACHE_SIZE - 1);
pos = (sector - start_sector) << GRUB_DISK_SECTOR_BITS; pos = (sector - start_sector) << GRUB_DISK_SECTOR_BITS;
len = ((GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS) len = ((GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS)
- pos - offset); - pos - offset);
+7 -3
View File
@@ -223,7 +223,7 @@ static grub_err_t
grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
{ {
unsigned i; unsigned i;
Elf_Shdr *s; const Elf_Shdr *s;
grub_size_t tsize = 0, talign = 1; grub_size_t tsize = 0, talign = 1;
#if !defined (__i386__) && !defined (__x86_64__) #if !defined (__i386__) && !defined (__x86_64__)
grub_size_t tramp; grub_size_t tramp;
@@ -232,9 +232,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
#endif #endif
char *ptr; char *ptr;
for (i = 0, s = (Elf_Shdr *)((char *) e + e->e_shoff); for (i = 0, s = (const Elf_Shdr *)((const char *) e + e->e_shoff);
i < e->e_shnum; i < e->e_shnum;
i++, s = (Elf_Shdr *)((char *) s + e->e_shentsize)) i++, s = (const Elf_Shdr *)((const char *) s + e->e_shentsize))
{ {
tsize = ALIGN_UP (tsize, s->sh_addralign) + s->sh_size; tsize = ALIGN_UP (tsize, s->sh_addralign) + s->sh_size;
if (talign < s->sh_addralign) if (talign < s->sh_addralign)
@@ -657,6 +657,8 @@ grub_dl_load_core (void *addr, grub_size_t size)
{ {
grub_dl_t mod; grub_dl_t mod;
grub_boot_time ("Parsing module");
mod = grub_dl_load_core_noinit (addr, size); mod = grub_dl_load_core_noinit (addr, size);
if (!mod) if (!mod)
@@ -678,6 +680,8 @@ grub_dl_load_file (const char *filename)
void *core = 0; void *core = 0;
grub_dl_t mod = 0; grub_dl_t mod = 0;
grub_boot_time ("Loading module %s", filename);
file = grub_file_open (filename); file = grub_file_open (filename);
if (! file) if (! file)
return 0; return 0;
+1
View File
@@ -21,6 +21,7 @@
#include <config-util.h> #include <config-util.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes" #pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <stdlib.h> #include <stdlib.h>
+4
View File
@@ -98,6 +98,8 @@ static struct argp_option options[] = {
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char * static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused))) help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{ {
@@ -112,6 +114,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct arguments struct arguments
{ {
const char *dev_map; const char *dev_map;
+23
View File
@@ -30,6 +30,7 @@
#include <grub/uboot/disk.h> #include <grub/uboot/disk.h>
#include <grub/uboot/uboot.h> #include <grub/uboot/uboot.h>
#include <grub/uboot/api_public.h> #include <grub/uboot/api_public.h>
#include <grub/cpu/system.h>
extern char __bss_start[]; extern char __bss_start[];
extern char _end[]; extern char _end[];
@@ -69,6 +70,19 @@ uboot_timer_ms (void)
return (((grub_uint64_t) high) << 32) | cur; return (((grub_uint64_t) high) << 32) | cur;
} }
#ifdef __arm__
static grub_uint64_t
rpi_timer_ms (void)
{
static grub_uint32_t last = 0, high = 0;
grub_uint32_t cur = *(volatile grub_uint32_t *) 0x20003004;
if (cur < last)
high++;
last = cur;
return grub_divmod64 ((((grub_uint64_t) high) << 32) | cur, 1000, 0);
}
#endif
void void
grub_machine_init (void) grub_machine_init (void)
{ {
@@ -106,8 +120,17 @@ grub_machine_init (void)
grub_uboot_probe_hardware (); grub_uboot_probe_hardware ();
/* Initialise timer */ /* Initialise timer */
#ifdef __arm__
if (grub_uboot_get_machine_type () == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)
{
grub_install_get_time_ms (rpi_timer_ms);
}
else
#endif
{
timer_start = grub_uboot_get_timer (0); timer_start = grub_uboot_get_timer (0);
grub_install_get_time_ms (uboot_timer_ms); grub_install_get_time_ms (uboot_timer_ms);
}
/* Initialize */ /* Initialize */
grub_ubootdisk_init (); grub_ubootdisk_init ();
+11 -11
View File
@@ -35,22 +35,22 @@ static const struct grub_arg_option help_options[] =
}; };
/* Helper for find_short. */ /* Helper for find_short. */
static struct grub_arg_option * static const struct grub_arg_option *
fnd_short (const struct grub_arg_option *opt, char c) fnd_short (const struct grub_arg_option *opt, char c)
{ {
while (opt->doc) while (opt->doc)
{ {
if (opt->shortarg == c) if (opt->shortarg == c)
return (struct grub_arg_option *) opt; return opt;
opt++; opt++;
} }
return 0; return 0;
} }
static struct grub_arg_option * static const struct grub_arg_option *
find_short (const struct grub_arg_option *options, char c) find_short (const struct grub_arg_option *options, char c)
{ {
struct grub_arg_option *found = 0; const struct grub_arg_option *found = 0;
if (options) if (options)
found = fnd_short (options, c); found = fnd_short (options, c);
@@ -60,11 +60,11 @@ find_short (const struct grub_arg_option *options, char c)
switch (c) switch (c)
{ {
case 'h': case 'h':
found = (struct grub_arg_option *) help_options; found = help_options;
break; break;
case 'u': case 'u':
found = (struct grub_arg_option *) (help_options + 1); found = (help_options + 1);
break; break;
default: default:
@@ -76,23 +76,23 @@ find_short (const struct grub_arg_option *options, char c)
} }
/* Helper for find_long. */ /* Helper for find_long. */
static struct grub_arg_option * static const struct grub_arg_option *
fnd_long (const struct grub_arg_option *opt, const char *s, int len) fnd_long (const struct grub_arg_option *opt, const char *s, int len)
{ {
while (opt->doc) while (opt->doc)
{ {
if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) && if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) &&
opt->longarg[len] == '\0') opt->longarg[len] == '\0')
return (struct grub_arg_option *) opt; return opt;
opt++; opt++;
} }
return 0; return 0;
} }
static struct grub_arg_option * static const struct grub_arg_option *
find_long (const struct grub_arg_option *options, const char *s, int len) find_long (const struct grub_arg_option *options, const char *s, int len)
{ {
struct grub_arg_option *found = 0; const struct grub_arg_option *found = 0;
if (options) if (options)
found = fnd_long (options, s, len); found = fnd_long (options, s, len);
@@ -240,7 +240,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
for (curarg = 0; curarg < argc; curarg++) for (curarg = 0; curarg < argc; curarg++)
{ {
char *arg = argv[curarg]; char *arg = argv[curarg];
struct grub_arg_option *opt; const struct grub_arg_option *opt;
char *option = 0; char *option = 0;
/* No option is used. */ /* No option is used. */
+13 -12
View File
@@ -203,13 +203,13 @@ gcry_err_code_t
grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher, grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher,
void *out, const void *in, grub_size_t size) void *out, const void *in, grub_size_t size)
{ {
const grub_uint8_t *inptr; const grub_uint8_t *inptr, *end;
grub_uint8_t *outptr, *end; grub_uint8_t *outptr;
if (!cipher->cipher->decrypt) if (!cipher->cipher->decrypt)
return GPG_ERR_NOT_SUPPORTED; return GPG_ERR_NOT_SUPPORTED;
if (size % cipher->cipher->blocksize != 0) if (size % cipher->cipher->blocksize != 0)
return GPG_ERR_INV_ARG; return GPG_ERR_INV_ARG;
end = (grub_uint8_t *) in + size; end = (const grub_uint8_t *) in + size;
for (inptr = in, outptr = out; inptr < end; for (inptr = in, outptr = out; inptr < end;
inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize)
cipher->cipher->decrypt (cipher->ctx, outptr, inptr); cipher->cipher->decrypt (cipher->ctx, outptr, inptr);
@@ -220,13 +220,13 @@ gcry_err_code_t
grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher, grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher,
void *out, const void *in, grub_size_t size) void *out, const void *in, grub_size_t size)
{ {
const grub_uint8_t *inptr; const grub_uint8_t *inptr, *end;
grub_uint8_t *outptr, *end; grub_uint8_t *outptr;
if (!cipher->cipher->encrypt) if (!cipher->cipher->encrypt)
return GPG_ERR_NOT_SUPPORTED; return GPG_ERR_NOT_SUPPORTED;
if (size % cipher->cipher->blocksize != 0) if (size % cipher->cipher->blocksize != 0)
return GPG_ERR_INV_ARG; return GPG_ERR_INV_ARG;
end = (grub_uint8_t *) in + size; end = (const grub_uint8_t *) in + size;
for (inptr = in, outptr = out; inptr < end; for (inptr = in, outptr = out; inptr < end;
inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize)
cipher->cipher->encrypt (cipher->ctx, outptr, inptr); cipher->cipher->encrypt (cipher->ctx, outptr, inptr);
@@ -235,16 +235,17 @@ grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher,
gcry_err_code_t gcry_err_code_t
grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher, grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher,
void *out, void *in, grub_size_t size, void *out, const void *in, grub_size_t size,
void *iv_in) void *iv_in)
{ {
grub_uint8_t *inptr, *outptr, *end; grub_uint8_t *outptr;
const grub_uint8_t *inptr, *end;
void *iv; void *iv;
if (!cipher->cipher->decrypt) if (!cipher->cipher->decrypt)
return GPG_ERR_NOT_SUPPORTED; return GPG_ERR_NOT_SUPPORTED;
if (size % cipher->cipher->blocksize != 0) if (size % cipher->cipher->blocksize != 0)
return GPG_ERR_INV_ARG; return GPG_ERR_INV_ARG;
end = (grub_uint8_t *) in + size; end = (const grub_uint8_t *) in + size;
iv = iv_in; iv = iv_in;
for (inptr = in, outptr = out; inptr < end; for (inptr = in, outptr = out; inptr < end;
inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize)
@@ -262,8 +263,8 @@ grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher,
void *out, const void *in, grub_size_t size, void *out, const void *in, grub_size_t size,
void *iv) void *iv)
{ {
const grub_uint8_t *inptr; const grub_uint8_t *inptr, *end;
grub_uint8_t *outptr, *end; grub_uint8_t *outptr;
grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE]; grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE];
if (!cipher->cipher->decrypt) if (!cipher->cipher->decrypt)
return GPG_ERR_NOT_SUPPORTED; return GPG_ERR_NOT_SUPPORTED;
@@ -271,7 +272,7 @@ grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher,
return GPG_ERR_INV_ARG; return GPG_ERR_INV_ARG;
if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE) if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE)
return GPG_ERR_INV_ARG; return GPG_ERR_INV_ARG;
end = (grub_uint8_t *) in + size; end = (const grub_uint8_t *) in + size;
for (inptr = in, outptr = out; inptr < end; for (inptr = in, outptr = out; inptr < end;
inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize) inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize)
{ {
+8 -8
View File
@@ -37,7 +37,7 @@ grub_disk_cache_invalidate (unsigned long dev_id, unsigned long disk_id,
unsigned cache_index; unsigned cache_index;
struct grub_disk_cache *cache; struct grub_disk_cache *cache;
sector &= ~(GRUB_DISK_CACHE_SIZE - 1); sector &= ~((grub_disk_addr_t) GRUB_DISK_CACHE_SIZE - 1);
cache_index = grub_disk_cache_get_index (dev_id, disk_id, sector); cache_index = grub_disk_cache_get_index (dev_id, disk_id, sector);
cache = grub_disk_cache_table + cache_index; cache = grub_disk_cache_table + cache_index;
@@ -63,7 +63,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE) if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE)
return -1; return -1;
aligned_sector = (sector & ~((1 << (disk->log_sector_size aligned_sector = (sector & ~((1ULL << (disk->log_sector_size
- GRUB_DISK_SECTOR_BITS)) - 1)); - GRUB_DISK_SECTOR_BITS)) - 1));
real_offset = offset + ((sector - aligned_sector) << GRUB_DISK_SECTOR_BITS); real_offset = offset + ((sector - aligned_sector) << GRUB_DISK_SECTOR_BITS);
sector = aligned_sector; sector = aligned_sector;
@@ -77,14 +77,14 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t len; grub_size_t len;
grub_partition_t part; grub_partition_t part;
tmp_buf = grub_malloc (1 << disk->log_sector_size); tmp_buf = grub_malloc (1U << disk->log_sector_size);
if (!tmp_buf) if (!tmp_buf)
return grub_errno; return grub_errno;
part = disk->partition; part = disk->partition;
disk->partition = 0; disk->partition = 0;
if (grub_disk_read (disk, sector, if (grub_disk_read (disk, sector,
0, (1 << disk->log_sector_size), tmp_buf) 0, (1U << disk->log_sector_size), tmp_buf)
!= GRUB_ERR_NONE) != GRUB_ERR_NONE)
{ {
disk->partition = part; disk->partition = part;
@@ -93,7 +93,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
} }
disk->partition = part; disk->partition = part;
len = (1 << disk->log_sector_size) - real_offset; len = (1U << disk->log_sector_size) - real_offset;
if (len > size) if (len > size)
len = size; len = size;
@@ -110,7 +110,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_free (tmp_buf); grub_free (tmp_buf);
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)); sector += (1U << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
buf = (const char *) buf + len; buf = (const char *) buf + len;
size -= len; size -= len;
real_offset = 0; real_offset = 0;
@@ -120,7 +120,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t len; grub_size_t len;
grub_size_t n; grub_size_t n;
len = size & ~((1 << disk->log_sector_size) - 1); len = size & ~((1ULL << disk->log_sector_size) - 1);
n = size >> disk->log_sector_size; n = size >> disk->log_sector_size;
if (n > (disk->max_agglomerate if (n > (disk->max_agglomerate
@@ -137,7 +137,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
while (n--) while (n--)
{ {
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector); grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)); sector += (1U << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
} }
buf = (const char *) buf + len; buf = (const char *) buf + len;
+10 -2
View File
@@ -265,10 +265,9 @@ static grub_uint32_t *find_prop (void *fdt, unsigned int nodeoffset,
the size allocated for the FDT; if this function is called before the other the size allocated for the FDT; if this function is called before the other
functions in this file and returns success, the other functions are functions in this file and returns success, the other functions are
guaranteed not to access memory locations outside the allocated memory. */ guaranteed not to access memory locations outside the allocated memory. */
int grub_fdt_check_header (void *fdt, unsigned int size) int grub_fdt_check_header_nosize (void *fdt)
{ {
if (((grub_addr_t) fdt & 0x7) || (grub_fdt_get_magic (fdt) != FDT_MAGIC) if (((grub_addr_t) fdt & 0x7) || (grub_fdt_get_magic (fdt) != FDT_MAGIC)
|| (grub_fdt_get_totalsize (fdt) > size)
|| (grub_fdt_get_version (fdt) < FDT_SUPPORTED_VERSION) || (grub_fdt_get_version (fdt) < FDT_SUPPORTED_VERSION)
|| (grub_fdt_get_last_comp_version (fdt) > FDT_SUPPORTED_VERSION) || (grub_fdt_get_last_comp_version (fdt) > FDT_SUPPORTED_VERSION)
|| (grub_fdt_get_off_dt_struct (fdt) & 0x00000003) || (grub_fdt_get_off_dt_struct (fdt) & 0x00000003)
@@ -284,6 +283,15 @@ int grub_fdt_check_header (void *fdt, unsigned int size)
return 0; return 0;
} }
int grub_fdt_check_header (void *fdt, unsigned int size)
{
if (size < sizeof (grub_fdt_header_t)
|| (grub_fdt_get_totalsize (fdt) > size)
|| grub_fdt_check_header_nosize (fdt) == -1)
return -1;
return 0;
}
/* Find a direct sub-node of a given parent node. */ /* Find a direct sub-node of a given parent node. */
int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset, int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset,
const char *name) const char *name)
+2
View File
@@ -24,6 +24,8 @@
#include <grub/i386/pc/vesa_modes_table.h> #include <grub/i386/pc/vesa_modes_table.h>
#include <grub/i18n.h> #include <grub/i18n.h>
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
struct legacy_command struct legacy_command
{ {
const char *name; const char *name;
+148 -19
View File
@@ -44,15 +44,112 @@ static char *linux_args;
static grub_uint32_t machine_type; static grub_uint32_t machine_type;
static void *fdt_addr; static void *fdt_addr;
typedef void (*kernel_entry_t) (int, unsigned long, void *);
#define LINUX_ZIMAGE_OFFSET 0x24 #define LINUX_ZIMAGE_OFFSET 0x24
#define LINUX_ZIMAGE_MAGIC 0x016f2818 #define LINUX_ZIMAGE_MAGIC 0x016f2818
#define ARM_FDT_MACHINE_TYPE 0xFFFFFFFF
#define LINUX_PHYS_OFFSET (0x00008000) #define LINUX_PHYS_OFFSET (0x00008000)
#define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000) #define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
#define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000) #define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
static grub_size_t
get_atag_size (grub_uint32_t *atag)
{
grub_uint32_t *atag0 = atag;
while (atag[0] && atag[1])
atag += atag[0];
return atag - atag0;
}
/*
* linux_prepare_fdt():
* Prepares a loaded FDT for being passed to Linux.
* Merges in command line parameters and sets up initrd addresses.
*/
static grub_err_t
linux_prepare_atag (void)
{
grub_uint32_t *atag_orig = (grub_uint32_t *) fdt_addr;
grub_uint32_t *tmp_atag, *from, *to;
grub_size_t tmp_size;
grub_size_t arg_size = grub_strlen (linux_args);
char *cmdline_orig = NULL;
grub_size_t cmdline_orig_len = 0;
/* some place for cmdline, initrd and terminator. */
tmp_size = get_atag_size (atag_orig) + 20 + (arg_size) / 4;
tmp_atag = grub_malloc (tmp_size * sizeof (grub_uint32_t));
if (!tmp_atag)
return grub_errno;
for (from = atag_orig, to = tmp_atag; from[0] && from[1];
from += from[0])
switch (from[1])
{
case 0x54410004:
case 0x54410005:
case 0x54420005:
break;
case 0x54410009:
if (*(char *) (from + 2))
{
cmdline_orig = (char *) (from + 2);
cmdline_orig_len = grub_strlen (cmdline_orig) + 1;
}
break;
default:
grub_memcpy (to, from, sizeof (grub_uint32_t) * from[0]);
to += from[0];
break;
}
grub_dprintf ("linux", "linux inherited args: '%s'\n",
cmdline_orig ? : "");
grub_dprintf ("linux", "linux_args: '%s'\n", linux_args);
/* Generate and set command line */
to[0] = 3 + (arg_size + cmdline_orig_len) / 4;
to[1] = 0x54410009;
if (cmdline_orig)
{
grub_memcpy ((char *) to + 8, cmdline_orig, cmdline_orig_len - 1);
*((char *) to + 8 + cmdline_orig_len - 1) = ' ';
}
grub_memcpy ((char *) to + 8 + cmdline_orig_len, linux_args, arg_size);
grub_memset ((char *) to + 8 + cmdline_orig_len + arg_size, 0,
4 - ((arg_size + cmdline_orig_len) & 3));
to += to[0];
if (initrd_start && initrd_end)
{
/*
* We're using physical addresses, so even if we have LPAE, we're
* restricted to a 32-bit address space.
*/
grub_dprintf ("loader", "Initrd @ 0x%08x-0x%08x\n",
initrd_start, initrd_end);
to[0] = 4;
to[1] = 0x54420005;
to[2] = initrd_start;
to[3] = initrd_end - initrd_start;
to += 4;
}
to[0] = 0;
to[1] = 0;
to += 2;
/* Copy updated FDT to its launch location */
grub_memcpy (atag_orig, tmp_atag, sizeof (grub_uint32_t) * (to - tmp_atag));
grub_free (tmp_atag);
grub_dprintf ("loader", "ATAG updated for Linux boot\n");
return GRUB_ERR_NONE;
}
/* /*
* linux_prepare_fdt(): * linux_prepare_fdt():
* Prepares a loaded FDT for being passed to Linux. * Prepares a loaded FDT for being passed to Linux.
@@ -128,20 +225,44 @@ static grub_err_t
linux_boot (void) linux_boot (void)
{ {
kernel_entry_t linuxmain; kernel_entry_t linuxmain;
grub_err_t err; int fdt_valid, atag_valid;
if (!fdt_addr && machine_type == ARM_FDT_MACHINE_TYPE) fdt_valid = (fdt_addr && grub_fdt_check_header_nosize (fdt_addr) == 0);
atag_valid = ((((grub_uint16_t *) fdt_addr)[3] & ~3) == 0x5440
&& *((grub_uint32_t *) fdt_addr));
grub_dprintf ("loader", "atag: %p, %x, %x, %s, %s\n",
fdt_addr,
((grub_uint16_t *) fdt_addr)[3],
*((grub_uint32_t *) fdt_addr),
(char *) fdt_addr,
(char *) fdt_addr + 1);
if (!fdt_valid && machine_type == GRUB_ARM_MACHINE_TYPE_FDT)
return grub_error (GRUB_ERR_FILE_NOT_FOUND, return grub_error (GRUB_ERR_FILE_NOT_FOUND,
N_("device tree must be supplied")); N_("device tree must be supplied (see `devicetree' command)"));
grub_arch_sync_caches ((void *) linux_addr, linux_size); grub_arch_sync_caches ((void *) linux_addr, linux_size);
grub_dprintf ("loader", "Kernel at: 0x%x\n", linux_addr); grub_dprintf ("loader", "Kernel at: 0x%x\n", linux_addr);
if (fdt_valid)
{
grub_err_t err;
err = linux_prepare_fdt (); err = linux_prepare_fdt ();
if (err) if (err)
return err; return err;
grub_dprintf ("loader", "FDT @ 0x%p\n", fdt_addr); grub_dprintf ("loader", "FDT @ 0x%p\n", fdt_addr);
}
else if (atag_valid)
{
grub_err_t err;
err = linux_prepare_atag ();
if (err)
return err;
grub_dprintf ("loader", "ATAG @ 0x%p\n", fdt_addr);
}
grub_dprintf ("loader", "Jumping to Linux...\n"); grub_dprintf ("loader", "Jumping to Linux...\n");
@@ -154,14 +275,17 @@ linux_boot (void)
linuxmain = (kernel_entry_t) linux_addr; linuxmain = (kernel_entry_t) linux_addr;
#ifdef GRUB_MACHINE_EFI #ifdef GRUB_MACHINE_EFI
{
grub_err_t err;
err = grub_efi_prepare_platform(); err = grub_efi_prepare_platform();
if (err != GRUB_ERR_NONE) if (err != GRUB_ERR_NONE)
return err; return err;
}
#endif #endif
linuxmain (0, machine_type, fdt_addr); linuxmain (0, machine_type, fdt_addr);
return err; return grub_error (GRUB_ERR_BAD_OS, "Linux call returned");
} }
/* /*
@@ -173,8 +297,6 @@ linux_load (const char *filename, grub_file_t file)
int size; int size;
size = grub_file_size (file); size = grub_file_size (file);
if (size == 0)
return grub_error (GRUB_ERR_BAD_OS, "empty kernel");
#ifdef GRUB_MACHINE_EFI #ifdef GRUB_MACHINE_EFI
linux_addr = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_PHYS_OFFSET, size); linux_addr = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_PHYS_OFFSET, size);
@@ -194,11 +316,16 @@ linux_load (const char *filename, grub_file_t file)
return grub_errno; return grub_errno;
} }
if (*(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET) if (size > LINUX_ZIMAGE_OFFSET + 4
!= LINUX_ZIMAGE_MAGIC) && *(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET)
{ == LINUX_ZIMAGE_MAGIC)
;
else if (size > 0x8000 && *(grub_uint32_t *) (linux_addr) == 0xea000006
&& machine_type == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)
grub_memmove ((void *) linux_addr, (void *) (linux_addr + 0x8000),
size - 0x8000);
else
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("invalid zImage")); return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("invalid zImage"));
}
linux_size = size; linux_size = size;
@@ -281,14 +408,15 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
size = grub_get_initrd_size (&initrd_ctx); size = grub_get_initrd_size (&initrd_ctx);
if (initrd_start)
grub_free ((void *) initrd_start);
#ifdef GRUB_MACHINE_EFI #ifdef GRUB_MACHINE_EFI
if (initrd_start)
grub_efi_free_pages (initrd_start,
(initrd_end - initrd_start + 0xfff) >> 12);
initrd_start = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_INITRD_PHYS_OFFSET, size); initrd_start = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_INITRD_PHYS_OFFSET, size);
if (!initrd_start) if (!initrd_start)
{ {
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("memory allocation failed")); grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
goto fail; goto fail;
} }
#else #else
@@ -347,7 +475,7 @@ grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)),
fdt_addr = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size); fdt_addr = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size);
if (!fdt_addr) if (!fdt_addr)
{ {
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("memory allocation failed")); grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
goto out; goto out;
} }
#else #else
@@ -367,7 +495,7 @@ grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)),
* We've successfully loaded an FDT, so any machine type passed * We've successfully loaded an FDT, so any machine type passed
* from firmware is now obsolete. * from firmware is now obsolete.
*/ */
machine_type = ARM_FDT_MACHINE_TYPE; machine_type = GRUB_ARM_MACHINE_TYPE_FDT;
out: out:
grub_file_close (dtb); grub_file_close (dtb);
@@ -384,10 +512,11 @@ GRUB_MOD_INIT (linux)
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
0, N_("Load initrd.")); 0, N_("Load initrd."));
cmd_devicetree = grub_register_command ("devicetree", grub_cmd_devicetree, cmd_devicetree = grub_register_command ("devicetree", grub_cmd_devicetree,
/* TRANSLATORS: DTB stands for device tree blob. */
0, N_("Load DTB file.")); 0, N_("Load DTB file."));
my_mod = mod; my_mod = mod;
fdt_addr = (void *) firmware_get_boot_data (); fdt_addr = (void *) grub_arm_firmware_get_boot_data ();
machine_type = firmware_get_machine_type (); machine_type = grub_arm_firmware_get_machine_type ();
} }
GRUB_MOD_FINI (linux) GRUB_MOD_FINI (linux)
+1 -1
View File
@@ -415,7 +415,7 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
else else
{ {
char valn[64]; char valn[64];
grub_printf (valn, sizeof (valn), "%lld\n", (unsigned long long) val); grub_snprintf (valn, sizeof (valn), "%lld\n", (unsigned long long) val);
return grub_env_set (args[0], valn); return grub_env_set (args[0], valn);
} }
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
+5 -6
View File
@@ -194,14 +194,13 @@ grub_normal_init_page (struct grub_term_output *term,
{ {
grub_ssize_t msg_len; grub_ssize_t msg_len;
int posx; int posx;
const char *msg = _("GNU GRUB version %s");
char *msg_formatted; char *msg_formatted;
grub_uint32_t *unicode_msg; grub_uint32_t *unicode_msg;
grub_uint32_t *last_position; grub_uint32_t *last_position;
grub_term_cls (term); grub_term_cls (term);
msg_formatted = grub_xasprintf (msg, PACKAGE_VERSION); msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
if (!msg_formatted) if (!msg_formatted)
return; return;
@@ -350,13 +349,13 @@ static grub_err_t
grub_normal_reader_init (int nested) grub_normal_reader_init (int nested)
{ {
struct grub_term_output *term; struct grub_term_output *term;
const char *msg = _("Minimal BASH-like line editing is supported. For "
"the first word, TAB lists possible command completions. Anywhere "
"else TAB lists possible device or file completions. %s");
const char *msg_esc = _("ESC at any time exits."); const char *msg_esc = _("ESC at any time exits.");
char *msg_formatted; char *msg_formatted;
msg_formatted = grub_xasprintf (msg, nested ? msg_esc : ""); msg_formatted = grub_xasprintf (_("Minimal BASH-like line editing is supported. For "
"the first word, TAB lists possible command completions. Anywhere "
"else TAB lists possible device or file completions. %s"),
nested ? msg_esc : "");
if (!msg_formatted) if (!msg_formatted)
return grub_errno; return grub_errno;
+6 -9
View File
@@ -165,11 +165,11 @@ command-line or ESC to discard edits and return to the GRUB menu."),
} }
else else
{ {
const char *msg = _("Use the %C and %C keys to select which "
"entry is highlighted.");
char *msg_translated; char *msg_translated;
msg_translated = grub_xasprintf (msg, GRUB_UNICODE_UPARROW, msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which "
"entry is highlighted."),
GRUB_UNICODE_UPARROW,
GRUB_UNICODE_DOWNARROW); GRUB_UNICODE_DOWNARROW);
if (!msg_translated) if (!msg_translated)
return 0; return 0;
@@ -430,9 +430,6 @@ grub_menu_init_page (int nested, int edit,
static void static void
menu_text_print_timeout (int timeout, void *dataptr) menu_text_print_timeout (int timeout, void *dataptr)
{ {
const char *msg =
_("The highlighted entry will be executed automatically in %ds.");
const char *msg_terse = _("%ds");
struct menu_viewer_data *data = dataptr; struct menu_viewer_data *data = dataptr;
char *msg_translated = 0; char *msg_translated = 0;
@@ -441,9 +438,9 @@ menu_text_print_timeout (int timeout, void *dataptr)
if (data->timeout_msg == TIMEOUT_TERSE if (data->timeout_msg == TIMEOUT_TERSE
|| data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN) || data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN)
msg_translated = grub_xasprintf (msg_terse, timeout); msg_translated = grub_xasprintf (_("%ds"), timeout);
else else
msg_translated = grub_xasprintf (msg, timeout); msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout);
if (!msg_translated) if (!msg_translated)
{ {
grub_print_error (); grub_print_error ();
@@ -459,7 +456,7 @@ menu_text_print_timeout (int timeout, void *dataptr)
if (data->timeout_msg == TIMEOUT_TERSE) if (data->timeout_msg == TIMEOUT_TERSE)
{ {
grub_free (msg_translated); grub_free (msg_translated);
msg_translated = grub_xasprintf (msg_terse, timeout); msg_translated = grub_xasprintf (_("%ds"), timeout);
if (grub_term_width (data->term) < 10) if (grub_term_width (data->term) < 10)
data->timeout_msg = TIMEOUT_TERSE_NO_MARGIN; data->timeout_msg = TIMEOUT_TERSE_NO_MARGIN;
} }
+1 -1
View File
@@ -89,6 +89,6 @@ grub_util_load_config (struct grub_util_config *cfg)
fclose (f); fclose (f);
} }
else else
grub_util_warn (_("cannot open config file `%s': %s"), grub_util_warn (_("cannot open configuration file `%s': %s"),
cfgfile, strerror (errno)); cfgfile, strerror (errno));
} }
+2
View File
@@ -37,5 +37,7 @@ grub_get_random (void *out, grub_size_t len)
Some functions like grub-mkpaswd and installing on UUID-less disks will be \ Some functions like grub-mkpaswd and installing on UUID-less disks will be \
disabled." disabled."
grub_util_error ("%s", grub_util_error ("%s",
/* TRANSLATORS: The OS itself may very well have a random
number generator but GRUB doesn't know how to access it. */
_("no random number generator is available for your OS")); _("no random number generator is available for your OS"));
} }
+2 -2
View File
@@ -70,12 +70,12 @@ grub_util_hurd_get_disk_info (const char *dev, grub_uint32_t *secsize, grub_disk
&data, &data_len); &data, &data_len);
if (num_ints < 1) if (num_ints < 1)
grub_util_error (_("Storage info for `%s' does not include type"), dev); grub_util_error (_("Storage information for `%s' does not include type"), dev);
if (ints[0] != STORAGE_DEVICE) if (ints[0] != STORAGE_DEVICE)
grub_util_error (_("`%s' is not a local disk"), dev); grub_util_error (_("`%s' is not a local disk"), dev);
if (num_offsets != 2) if (num_offsets != 2)
grub_util_error (_("Storage info for `%s' does indicate neither plain partition nor plain disk"), dev); grub_util_error (_("Storage information for `%s' indicates neither a plain partition nor a plain disk"), dev);
if (parent) if (parent)
{ {
*parent = NULL; *parent = NULL;
+1 -1
View File
@@ -888,7 +888,7 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
return path; return path;
} }
char * static char *
grub_util_get_raid_grub_dev (const char *os_dev) grub_util_get_raid_grub_dev (const char *os_dev)
{ {
char *grub_dev = NULL; char *grub_dev = NULL;
+4
View File
@@ -237,6 +237,8 @@ have_devfs (void)
return dev_devfsd_exists; return dev_devfsd_exists;
} }
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int static int
grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector) grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
{ {
@@ -325,6 +327,8 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
return 0; return 0;
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
void void
grub_hostdisk_flush_initial_buffer (const char *os_dev) grub_hostdisk_flush_initial_buffer (const char *os_dev)
{ {
+1 -1
View File
@@ -134,6 +134,6 @@ grub_util_load_config (struct grub_util_config *cfg)
fclose (f); fclose (f);
} }
else else
grub_util_warn (_("cannot open config file `%s': %s"), grub_util_warn (_("cannot open configuration file `%s': %s"),
cfgfile, strerror (errno)); cfgfile, strerror (errno));
} }
+12 -9
View File
@@ -116,6 +116,7 @@
#include <sys/mount.h> #include <sys/mount.h>
#endif #endif
#if !defined (__GNU__)
static void static void
strip_extra_slashes (char *dir) strip_extra_slashes (char *dir)
{ {
@@ -155,7 +156,6 @@ xgetcwd (void)
return path; return path;
} }
#if !defined (__GNU__)
char ** char **
grub_util_find_root_devices_from_poolname (char *poolname) grub_util_find_root_devices_from_poolname (char *poolname)
{ {
@@ -443,17 +443,18 @@ grub_find_device (const char *dir, dev_t dev)
/* Found! */ /* Found! */
char *res; char *res;
char *cwd; char *cwd;
#if defined(__NetBSD__) || defined(__OpenBSD__)
/* Convert this block device to its character (raw) device. */
const char *template = "%s/r%s";
#else
/* Keep the device name as it is. */
const char *template = "%s/%s";
#endif
cwd = xgetcwd (); cwd = xgetcwd ();
res = xmalloc (strlen (cwd) + strlen (ent->d_name) + 3); res = xmalloc (strlen (cwd) + strlen (ent->d_name) + 3);
sprintf (res, template, cwd, ent->d_name); sprintf (res,
#if defined(__NetBSD__) || defined(__OpenBSD__)
/* Convert this block device to its character (raw) device. */
"%s/r%s",
#else
/* Keep the device name as it is. */
"%s/%s",
#endif
cwd, ent->d_name);
strip_extra_slashes (res); strip_extra_slashes (res);
free (cwd); free (cwd);
@@ -763,6 +764,8 @@ grub_util_biosdisk_is_floppy (grub_disk_t disk)
#else #else
#include <grub/emu/getroot.h>
void void
grub_util_pull_lvm_by_command (const char *os_dev __attribute__ ((unused))) grub_util_pull_lvm_by_command (const char *os_dev __attribute__ ((unused)))
{ {
+1 -1
View File
@@ -74,7 +74,7 @@ get_ofpathname (const char *dev)
return ret; return ret;
fail: fail:
grub_util_error (_("couldn't find IEEE1275 device tree path for %s.\nYou will have to set `boot-device' variable manually"), grub_util_error (_("couldn't find IEEE1275 device path for %s.\nYou will have to set `boot-device' variable manually"),
dev); dev);
} }
+1 -1
View File
@@ -52,6 +52,6 @@ grub_util_load_config (struct grub_util_config *cfg)
fclose (f); fclose (f);
} }
else else
grub_util_warn (_("cannot open config file `%s': %s"), grub_util_warn (_("cannot open configuration file `%s': %s"),
cfgfile, strerror (errno)); cfgfile, strerror (errno));
} }
+1 -1
View File
@@ -94,7 +94,7 @@ get_platform (void)
if (!get_efi_privilegies ()) if (!get_efi_privilegies ())
{ {
grub_util_warn (_("Insufficient privilegies to access firmware, assuming BIOS")); grub_util_warn (_("Insufficient privileges to access firmware, assuming BIOS"));
platform = PLAT_BIOS; platform = PLAT_BIOS;
} }
+6
View File
@@ -229,6 +229,9 @@ grub_partition_msdos_iterate (grub_disk_t disk,
} }
#ifdef GRUB_UTIL #ifdef GRUB_UTIL
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static grub_err_t static grub_err_t
pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors, pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
unsigned int max_nsectors, unsigned int max_nsectors,
@@ -401,6 +404,9 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
N_("your embedding area is unusually small. " N_("your embedding area is unusually small. "
"core.img won't fit in it.")); "core.img won't fit in it."));
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
#endif #endif
+2 -2
View File
@@ -60,7 +60,7 @@ static const struct grub_arg_option options[] =
{"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT}, {"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT},
{"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING}, {"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING},
{"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT}, {"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT},
{"base-clock", 'b', 0, N_("Set the base clock."), 0, ARG_TYPE_STRING}, {"base-clock", 'b', 0, N_("Set the base frequency."), 0, ARG_TYPE_STRING},
{"rtscts", 'f', 0, N_("Enable/disable RTS/CTS."), "on|off", ARG_TYPE_STRING}, {"rtscts", 'f', 0, N_("Enable/disable RTS/CTS."), "on|off", ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
@@ -247,7 +247,7 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args)
config.rtscts = 0; config.rtscts = 0;
else else
return grub_error (GRUB_ERR_BAD_ARGUMENT, return grub_error (GRUB_ERR_BAD_ARGUMENT,
N_("unsupported serial port flow")); N_("unsupported serial port flow control"));
} }
if (state[OPTION_STOP].set) if (state[OPTION_STOP].set)
+4
View File
@@ -158,6 +158,8 @@ get_space(grub_size_t need)
} }
} }
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static inline void static inline void
save_text(const char *fmt, const char *s, int len) save_text(const char *fmt, const char *s, int len)
{ {
@@ -183,6 +185,8 @@ save_number(const char *fmt, int number, int len)
out_used += grub_strlen(out_buff + out_used); out_used += grub_strlen(out_buff + out_used);
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
static inline void static inline void
save_char(int c) save_char(int c)
{ {
+6 -8
View File
@@ -23,15 +23,15 @@
#define LINUX_ZIMAGE_OFFSET 0x24 #define LINUX_ZIMAGE_OFFSET 0x24
#define LINUX_ZIMAGE_MAGIC 0x016f2818 #define LINUX_ZIMAGE_MAGIC 0x016f2818
#define ARM_FDT_MACHINE_TYPE 0xFFFFFFFF #include "system.h"
#if defined GRUB_MACHINE_UBOOT #if defined GRUB_MACHINE_UBOOT
# include <grub/uboot/uboot.h> # include <grub/uboot/uboot.h>
# define LINUX_ADDRESS (start_of_ram + 0x8000) # define LINUX_ADDRESS (start_of_ram + 0x8000)
# define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000) # define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
# define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000) # define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000)
# define firmware_get_boot_data grub_uboot_get_boot_data # define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data
# define firmware_get_machine_type grub_uboot_get_machine_type # define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type
#elif defined GRUB_MACHINE_EFI #elif defined GRUB_MACHINE_EFI
# include <grub/efi/efi.h> # include <grub/efi/efi.h>
# include <grub/machine/loader.h> # include <grub/machine/loader.h>
@@ -41,19 +41,17 @@
# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000) # define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000) # define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
static inline grub_addr_t static inline grub_addr_t
firmware_get_boot_data (void) grub_arm_firmware_get_boot_data (void)
{ {
return 0; return 0;
} }
static inline grub_uint32_t static inline grub_uint32_t
firmware_get_machine_type (void) grub_arm_firmware_get_machine_type (void)
{ {
return ARM_FDT_MACHINE_TYPE; return GRUB_ARM_MACHINE_TYPE_FDT;
} }
#endif #endif
#define FDT_ADDITIONAL_ENTRIES_SIZE 0x300 #define FDT_ADDITIONAL_ENTRIES_SIZE 0x300
typedef void (*kernel_entry_t) (int, unsigned long, void *);
#endif /* ! GRUB_LINUX_CPU_HEADER */ #endif /* ! GRUB_LINUX_CPU_HEADER */
+6
View File
@@ -1,6 +1,12 @@
#ifndef GRUB_SYSTEM_CPU_HEADER #ifndef GRUB_SYSTEM_CPU_HEADER
#define GRUB_SYSTEM_CPU_HEADER #define GRUB_SYSTEM_CPU_HEADER
enum
{
GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI = 3138,
GRUB_ARM_MACHINE_TYPE_FDT = 0xFFFFFFFF
};
void grub_arm_disable_caches_mmu (void); void grub_arm_disable_caches_mmu (void);
#endif /* ! GRUB_SYSTEM_CPU_HEADER */ #endif /* ! GRUB_SYSTEM_CPU_HEADER */
+1 -1
View File
@@ -27,6 +27,6 @@
#endif /* ! ASM_FILE */ #endif /* ! ASM_FILE */
#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000 #define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000
#define GRUB_KERNEL_MACHINE_HEAP_SIZE (grub_size_t) (2 * 1024 * 1024) #define GRUB_KERNEL_MACHINE_HEAP_SIZE (grub_size_t) (16 * 1024 * 1024)
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */ #endif /* ! GRUB_KERNEL_MACHINE_HEADER */
+4 -3
View File
@@ -293,9 +293,10 @@ grub_crypto_xor (void *out, const void *in1, const void *in2, grub_size_t size)
} }
while (size >= sizeof (grub_uint64_t)) while (size >= sizeof (grub_uint64_t))
{ {
/* We've already checked that all pointers are aligned. */
*(grub_uint64_t *) (void *) outptr *(grub_uint64_t *) (void *) outptr
= (*(grub_uint64_t *) (void *) in1ptr = (*(const grub_uint64_t *) (const void *) in1ptr
^ *(grub_uint64_t *) (void *) in2ptr); ^ *(const grub_uint64_t *) (const void *) in2ptr);
in1ptr += sizeof (grub_uint64_t); in1ptr += sizeof (grub_uint64_t);
in2ptr += sizeof (grub_uint64_t); in2ptr += sizeof (grub_uint64_t);
outptr += sizeof (grub_uint64_t); outptr += sizeof (grub_uint64_t);
@@ -320,7 +321,7 @@ grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher,
void *out, const void *in, grub_size_t size); void *out, const void *in, grub_size_t size);
gcry_err_code_t gcry_err_code_t
grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher, grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher,
void *out, void *in, grub_size_t size, void *out, const void *in, grub_size_t size,
void *iv_in); void *iv_in);
gcry_err_code_t gcry_err_code_t
grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher, grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher,
+6
View File
@@ -75,6 +75,12 @@ grub_hostdisk_find_partition_start_os (const char *dev);
void void
grub_hostdisk_flush_initial_buffer (const char *os_dev); grub_hostdisk_flush_initial_buffer (const char *os_dev);
#ifdef __GNU__
int
grub_util_hurd_get_disk_info (const char *dev, grub_uint32_t *secsize, grub_disk_addr_t *offset,
grub_disk_addr_t *size, char **parent);
#endif
struct grub_util_hostdisk_data struct grub_util_hostdisk_data
{ {
char *dev; char *dev;
+1
View File
@@ -83,6 +83,7 @@ typedef struct {
grub_fdt_set_header(fdt, size_dt_struct, value) grub_fdt_set_header(fdt, size_dt_struct, value)
int grub_fdt_check_header (void *fdt, unsigned int size); int grub_fdt_check_header (void *fdt, unsigned int size);
int grub_fdt_check_header_nosize (void *fdt);
int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset, int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset,
const char *name); const char *name);
int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset, int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset,
+55
View File
@@ -0,0 +1,55 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_GREFFS_HEADER
#define GRUB_GREFFS_HEADER 1
#include <grub/types.h>
/*
Layout:
header
grub_uint32_t[] pointers to names
inodes
names
contents.
Everything is little-endian.
*/
struct grub_greffs_header
{
char magic[4];
#define GRUB_GREFFS_MAGIC "gref"
grub_uint32_t nfiles;
/* must be divisible by 4. */
grub_uint32_t inodes_offset;
/* must be divisible by 4. */
grub_uint32_t string_ptrs_offset;
};
struct grub_greffs_inode
{
grub_uint32_t start;
grub_uint32_t size;
grub_uint32_t mtime;
/* Currently always 0. If we ever need symlinks,
it could be added. */
grub_uint32_t type;
};
#endif
+1 -1
View File
@@ -247,7 +247,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree,
struct grub_hfsplus_btnode **matchnode, struct grub_hfsplus_btnode **matchnode,
grub_off_t *keyoffset); grub_off_t *keyoffset);
grub_err_t grub_err_t
grub_mac_bless_inode (grub_device_t dev, grub_uint64_t inode, int is_dir, grub_mac_bless_inode (grub_device_t dev, grub_uint32_t inode, int is_dir,
int intel); int intel);
grub_err_t grub_err_t
grub_mac_bless_file (grub_device_t dev, const char *path_in, int intel); grub_mac_bless_file (grub_device_t dev, const char *path_in, int intel);
+1 -1
View File
@@ -296,7 +296,7 @@ static inline long
grub_strtol (const char *str, char **end, int base) grub_strtol (const char *str, char **end, int base)
{ {
int negative = 0; int negative = 0;
unsigned long magnitude; unsigned long long magnitude;
while (*str && grub_isspace (*str)) while (*str && grub_isspace (*str))
str++; str++;
+1 -1
View File
@@ -405,7 +405,7 @@ grub_unicode_estimate_width (const struct grub_unicode_glyph *c);
#else #else
static inline grub_ssize_t static inline grub_size_t
grub_unicode_estimate_width (const struct grub_unicode_glyph *c __attribute__ ((unused))) grub_unicode_estimate_width (const struct grub_unicode_glyph *c __attribute__ ((unused)))
{ {
if (grub_unicode_get_comb_type (c->base)) if (grub_unicode_get_comb_type (c->base))
+1 -1
View File
@@ -552,7 +552,7 @@ grub_video_check_mode_flag (grub_video_mode_type_t flags,
grub_video_driver_id_t EXPORT_FUNC (grub_video_get_driver_id) (void); grub_video_driver_id_t EXPORT_FUNC (grub_video_get_driver_id) (void);
static __inline grub_video_rgba_color_t static __inline grub_video_rgba_color_t
grub_video_rgba_color_rgb (int r, int g, int b) grub_video_rgba_color_rgb (grub_uint8_t r, grub_uint8_t g, grub_uint8_t b)
{ {
grub_video_rgba_color_t c; grub_video_rgba_color_t c;
c.red = r; c.red = r;
+1
View File
@@ -21,6 +21,7 @@
#include <grub/types.h> #include <grub/types.h>
#include <grub/emu/misc.h> #include <grub/emu/misc.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/install.h>
#include <grub/lib/envblk.h> #include <grub/lib/envblk.h>
#include <grub/i18n.h> #include <grub/i18n.h>
#include <grub/emu/hostfile.h> #include <grub/emu/hostfile.h>
+2 -2
View File
@@ -363,9 +363,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
char *t; char *t;
t = dri; t = dri;
if (*q >= 'a' && *q <= 'g') if (*q >= 'a' && *q <= 'g')
dri = xasprintf ("%s,%d,%d", t, n, *q - 'a' + 1); dri = xasprintf ("%s,%ld,%d", t, n, *q - 'a' + 1);
else else
dri = xasprintf ("%s,%d", t, n); dri = xasprintf ("%s,%ld", t, n);
free (t); free (t);
} }
} }
+1 -1
View File
@@ -19,6 +19,7 @@
#include <config.h> #include <config.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/install.h>
#include <grub/i18n.h> #include <grub/i18n.h>
#include <grub/term.h> #include <grub/term.h>
#include <grub/macho.h> #include <grub/macho.h>
@@ -28,7 +29,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <argp.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
+9
View File
@@ -30,7 +30,12 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h> #include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
@@ -87,6 +92,8 @@ static error_t argp_parser (int key, char *arg, struct argp_state *state)
return 0; return 0;
} }
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char * static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused))) help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{ {
@@ -100,6 +107,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct argp argp = { struct argp argp = {
options, argp_parser, N_("FILENAME COMMAND"), options, argp_parser, N_("FILENAME COMMAND"),
"\n"N_("\ "\n"N_("\
-1
View File
@@ -34,7 +34,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <argp.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
+4
View File
@@ -41,7 +41,11 @@
#include <string.h> #include <string.h>
#include "progname.h" #include "progname.h"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include "argp.h" #include "argp.h"
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
static grub_err_t static grub_err_t
execute_command (const char *name, int n, char **args) execute_command (const char *name, int n, char **args)
+7 -2
View File
@@ -29,10 +29,15 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <argp.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
struct arguments struct arguments
@@ -87,7 +92,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
static struct argp argp = { static struct argp argp = {
options, argp_parser, N_("[OPTIONS]"), options, argp_parser, N_("[OPTIONS]"),
N_("Glue 32-bit and 64-binary into Apple fat one."), N_("Glue 32-bit and 64-bit binary into Apple universal one."),
NULL, NULL, NULL NULL, NULL, NULL
}; };
+5 -1
View File
@@ -45,6 +45,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
char * char *
grub_install_help_filter (int key, const char *text, grub_install_help_filter (int key, const char *text,
void *input __attribute__ ((unused))) void *input __attribute__ ((unused)))
@@ -67,6 +69,8 @@ grub_install_help_filter (int key, const char *text,
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
static int (*compress_func) (const char *src, const char *dest) = NULL; static int (*compress_func) (const char *src, const char *dest) = NULL;
char *grub_install_copy_buffer; char *grub_install_copy_buffer;
@@ -120,7 +124,7 @@ grub_install_copy_file (const char *src,
return 1; return 1;
} }
int static int
grub_install_compress_file (const char *in_name, grub_install_compress_file (const char *in_name,
const char *out_name, const char *out_name,
int is_needed) int is_needed)
+19 -5
View File
@@ -45,7 +45,11 @@
#include <string.h> #include <string.h>
#include "argp.h" #pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
@@ -326,6 +330,8 @@ get_default_platform (void)
#endif #endif
} }
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char * static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused))) help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{ {
@@ -342,6 +348,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
/* TRANSLATORS: INSTALL_DEVICE isn't an identifier and is the DEVICE you /* TRANSLATORS: INSTALL_DEVICE isn't an identifier and is the DEVICE you
install to. */ install to. */
struct argp argp = { struct argp argp = {
@@ -536,7 +544,7 @@ is_same_disk (const char *a, const char *b)
} }
} }
char * static char *
get_rndstr (void) get_rndstr (void)
{ {
grub_uint8_t rnd[15]; grub_uint8_t rnd[15];
@@ -862,6 +870,12 @@ main (int argc, char *argv[])
platform = grub_install_get_target (grub_install_source_directory); platform = grub_install_get_target (grub_install_source_directory);
{
char *platname = grub_install_get_platform_name (platform);
fprintf (stderr, _("Installing for %s platform.\n"), platname);
free (platname);
}
switch (platform) switch (platform)
{ {
case GRUB_INSTALL_PLATFORM_I386_PC: case GRUB_INSTALL_PLATFORM_I386_PC:
@@ -1176,7 +1190,7 @@ main (int argc, char *argv[])
if (grub_strcmp (fs->name, "hfs") != 0 if (grub_strcmp (fs->name, "hfs") != 0
&& grub_strcmp (fs->name, "hfsplus") != 0 && grub_strcmp (fs->name, "hfsplus") != 0
&& !is_guess) && !is_guess)
grub_util_error (_("%s is neither hfs nor hfsplus"), grub_util_error (_("filesystem on %s is neither HFS nor HFS+"),
macppcdir); macppcdir);
if (grub_strcmp (fs->name, "hfs") == 0 if (grub_strcmp (fs->name, "hfs") == 0
|| grub_strcmp (fs->name, "hfsplus") == 0) || grub_strcmp (fs->name, "hfsplus") == 0)
@@ -1244,7 +1258,7 @@ main (int argc, char *argv[])
} }
if (!config.is_cryptodisk_enabled && have_cryptodisk) if (!config.is_cryptodisk_enabled && have_cryptodisk)
grub_util_error (_("attempt to install to cryptodisk without cryptodisk enabled. " grub_util_error (_("attempt to install to encrypted disk without cryptodisk enabled. "
"Set `%s' in file `%s'."), "GRUB_ENABLE_CRYPTODISK=1", "Set `%s' in file `%s'."), "GRUB_ENABLE_CRYPTODISK=1",
grub_util_get_config_filename ()); grub_util_get_config_filename ());
@@ -1839,7 +1853,7 @@ main (int argc, char *argv[])
/* Try to make this image bootable using the EFI Boot Manager, if available. */ /* Try to make this image bootable using the EFI Boot Manager, if available. */
if (!efi_distributor || efi_distributor[0] == '\0') if (!efi_distributor || efi_distributor[0] == '\0')
grub_util_error ("%s", _("EFI distributor id isn't specified.")); grub_util_error ("%s", _("EFI bootloader id isn't specified."));
efifile_path = xasprintf ("\\EFI\\%s\\%s", efifile_path = xasprintf ("\\EFI\\%s\\%s",
efi_distributor, efi_distributor,
efi_file); efi_file);
+4
View File
@@ -45,7 +45,11 @@
#include <sys/stat.h> #include <sys/stat.h>
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h> #include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
+2
View File
@@ -260,10 +260,12 @@ for i in "${grub_mkconfig_dir}"/* ; do
| "${grub_mkconfig_dir}"/30_os-prober \ | "${grub_mkconfig_dir}"/30_os-prober \
| "${grub_mkconfig_dir}"/40_custom \ | "${grub_mkconfig_dir}"/40_custom \
| "${grub_mkconfig_dir}"/41_custom) | "${grub_mkconfig_dir}"/41_custom)
if test -x "$i" ; then
echo echo
echo "### BEGIN $i ###" echo "### BEGIN $i ###"
"$i" "$i"
echo "### END $i ###" echo "### END $i ###"
fi
;; ;;
# emacsen backup files. FIXME: support other editors # emacsen backup files. FIXME: support other editors
*~) ;; *~) ;;
+12 -2
View File
@@ -48,7 +48,13 @@
#include <grub/emu/config.h> #include <grub/emu/config.h>
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h> #include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
@@ -63,8 +69,8 @@ static struct argp_option options[] = {
/* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated. /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated.
"embed" is a verb (command description). "*/ "embed" is a verb (command description). "*/
N_("embed FILE as a memdisk image\n" N_("embed FILE as a memdisk image\n"
"Implies `-p (memdisk)/boot/grub' but prefix can be overridden by " "Implies `-p (memdisk)/boot/grub' and overrides any prefix supplied previously,"
"later options"), 0}, " but the prefix itself can be overridden by later options"), 0},
/* TRANSLATORS: "embed" is a verb (command description). "*/ /* TRANSLATORS: "embed" is a verb (command description). "*/
{"config", 'c', N_("FILE"), 0, N_("embed FILE as an early config"), 0}, {"config", 'c', N_("FILE"), 0, N_("embed FILE as an early config"), 0},
/* TRANSLATORS: "embed" is a verb (command description). "*/ /* TRANSLATORS: "embed" is a verb (command description). "*/
@@ -78,6 +84,8 @@ static struct argp_option options[] = {
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char * static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused))) help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{ {
@@ -100,6 +108,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct arguments struct arguments
{ {
size_t nmodules; size_t nmodules;
+1 -1
View File
@@ -1379,7 +1379,7 @@ SUFFIX (locate_sections) (const char *kernel_path,
!= image_target->link_addr) != image_target->link_addr)
{ {
char *msg char *msg
= grub_xasprintf (_("`%s' is miscompiled: it's start address is 0x%llx" = grub_xasprintf (_("`%s' is miscompiled: its start address is 0x%llx"
" instead of 0x%llx: ld.gold bug?"), " instead of 0x%llx: ld.gold bug?"),
kernel_path, kernel_path,
(unsigned long long) grub_host_to_target_addr (s->sh_addr), (unsigned long long) grub_host_to_target_addr (s->sh_addr),
+8 -1
View File
@@ -28,10 +28,17 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <argp.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
struct arguments struct arguments
+8 -2
View File
@@ -21,10 +21,15 @@
#include <grub/emu/config.h> #include <grub/emu/config.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <argp.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
static char *rootdir = NULL, *subdir = NULL; static char *rootdir = NULL, *subdir = NULL;
static char *debug_image = NULL; static char *debug_image = NULL;
@@ -80,7 +85,8 @@ argp_parser (int key, char *arg, struct argp_state *state)
struct argp argp = { struct argp argp = {
options, argp_parser, NULL, options, argp_parser, NULL,
"\v"N_("copies GRUB images into net_directory/subdir/target_cpu-platform."), "\v"N_("Prepares GRUB network boot images at net_directory/subdir "
"assuming net_directory being TFTP root."),
NULL, grub_install_help_filter, NULL NULL, grub_install_help_filter, NULL
}; };
+5
View File
@@ -33,7 +33,12 @@
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h> #include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
+4
View File
@@ -26,7 +26,11 @@
#include <grub/i18n.h> #include <grub/i18n.h>
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h> #include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
+7 -1
View File
@@ -112,6 +112,8 @@ static struct argp_option options[] = {
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char * static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused))) help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{ {
@@ -124,6 +126,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
enum { enum {
SYS_AREA_AUTO, SYS_AREA_AUTO,
SYS_AREA_COMMON, SYS_AREA_COMMON,
@@ -212,7 +216,9 @@ struct argp argp = {
options, argp_parser, N_("[OPTION] SOURCE..."), options, argp_parser, N_("[OPTION] SOURCE..."),
/* TRANSLATORS: it generates one single image which is bootable through any method. */ /* TRANSLATORS: it generates one single image which is bootable through any method. */
N_("Make GRUB CD-ROM, disk, pendrive and floppy bootable image.")"\v" N_("Make GRUB CD-ROM, disk, pendrive and floppy bootable image.")"\v"
N_("Generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of `%s'.\n\n" N_("Generates a bootable CD/USB/floppy image. Arguments other than options to this program"
" are passed to xorriso, and indicate source files, source directories, or any of the "
"mkisofs options listed by the output of `%s'.\n\n"
"Option -- switches to native xorriso command mode.\n\n" "Option -- switches to native xorriso command mode.\n\n"
"Mail xorriso support requests to <bug-xorriso@gnu.org>."), "Mail xorriso support requests to <bug-xorriso@gnu.org>."),
NULL, help_filter, NULL NULL, help_filter, NULL
+153 -117
View File
@@ -21,15 +21,20 @@
#include <grub/util/install.h> #include <grub/util/install.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/emu/config.h> #include <grub/emu/config.h>
#include <grub/greffs.h>
#include <argp.h>
#include <string.h> #include <string.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
static char *output_image; static char *output_image;
static char **files; static char **files;
static int nfiles; static int nfiles;
const struct grub_install_image_target_desc *format; const struct grub_install_image_target_desc *format;
static FILE *memdisk;
enum enum
{ {
@@ -111,91 +116,56 @@ struct argp argp = {
NULL, help_filter, NULL NULL, help_filter, NULL
}; };
/* tar support */ struct file_desc
#define MAGIC "ustar"
struct head
{ {
char name[100]; char *name;
char mode[8]; char *source;
char uid[8]; grub_size_t size;
char gid[8]; grub_size_t mtime;
char size[12]; };
char mtime[12]; static struct file_desc *file_descs;
char chksum[8]; static size_t n_file_descs, alloc_file_descs;
char typeflag;
char linkname[100];
char magic[6];
char version[2];
char uname[32];
char gname[32];
char devmajor[8];
char devminor[8];
char prefix[155];
char pad[12];
} GRUB_PACKED;
static void static inline void
write_zeros (unsigned rsz) canonicalize (char *name)
{ {
char buf[512]; char *iptr, *optr;
for (iptr = name, optr = name; *iptr; )
memset (buf, 0, 512); {
fwrite (buf, 1, rsz, memdisk); while (*iptr == '/')
iptr++;
if (iptr[0] == '.' && (iptr[1] == '/' || iptr[1] == 0))
{
iptr += 2;
continue;
} }
if (iptr[0] == '.' && iptr[1] == '.' && (iptr[2] == '/' || iptr[2] == 0))
static void
write_pad (unsigned sz)
{ {
write_zeros ((~sz + 1) & 511); iptr += 3;
if (optr == name)
continue;
for (optr -= 2; optr >= name && *optr != '/'; optr--);
optr++;
continue;
} }
while (*iptr && *iptr != '/')
static void *optr++ = *iptr++;
set_tar_value (char *field, grub_uint32_t val, if (*iptr)
unsigned len) *optr++ = *iptr++;
{
unsigned i;
for (i = 0; i < len - 1; i++)
field[len - 2 - i] = '0' + ((val >> (3 * i)) & 7);
} }
*optr = 0;
static void
compute_checksum (struct head *hd)
{
unsigned int chk = 0;
unsigned char *ptr;
memset (hd->chksum, ' ', 8);
for (ptr = (unsigned char *) hd; ptr < (unsigned char *) (hd + 1); ptr++)
chk += *ptr;
set_tar_value (hd->chksum, chk, 8);
} }
static void static void
add_tar_file (const char *from, add_tar_file (const char *from,
const char *to) const char *to)
{ {
char *tcn;
const char *iptr;
char *optr;
struct head hd;
grub_util_fd_t in; grub_util_fd_t in;
ssize_t r; size_t idx;
grub_uint32_t mtime = 0;
grub_uint32_t size;
COMPILE_TIME_ASSERT (sizeof (hd) == 512);
if (grub_util_is_special_file (from)) if (grub_util_is_special_file (from))
return; return;
mtime = grub_util_get_mtime (from);
optr = tcn = xmalloc (strlen (to) + 1);
for (iptr = to; *iptr == '/'; iptr++);
for (; *iptr; iptr++)
if (!(iptr[0] == '/' && iptr[1] == '/'))
*optr++ = *iptr;
*optr = '\0';
if (grub_util_is_directory (from)) if (grub_util_is_directory (from))
{ {
grub_util_fd_dir_t d; grub_util_fd_dir_t d;
@@ -216,69 +186,138 @@ add_tar_file (const char *from,
free (fp); free (fp);
} }
grub_util_fd_closedir (d); grub_util_fd_closedir (d);
free (tcn);
return; return;
} }
if (optr - tcn > 99) idx = n_file_descs++;
if (idx >= alloc_file_descs)
{ {
memset (&hd, 0, sizeof (hd)); alloc_file_descs = 2 * n_file_descs;
memcpy (hd.name, tcn, 99); file_descs = xrealloc (file_descs, alloc_file_descs
memcpy (hd.mode, "0000600", 7); * sizeof (file_descs[0]));
memcpy (hd.uid, "0001750", 7);
memcpy (hd.gid, "0001750", 7);
set_tar_value (hd.size, optr - tcn, 12);
set_tar_value (hd.mtime, mtime, 12);
hd.typeflag = 'L';
memcpy (hd.magic, "ustar ", 7);
memcpy (hd.uname, "grub", 4);
memcpy (hd.gname, "grub", 4);
compute_checksum (&hd);
fwrite (&hd, 1, sizeof (hd), memdisk);
fwrite (tcn, 1, optr - tcn, memdisk);
write_pad (optr - tcn);
} }
in = grub_util_fd_open (from, GRUB_UTIL_FD_O_RDONLY); in = grub_util_fd_open (from, GRUB_UTIL_FD_O_RDONLY);
if (!GRUB_UTIL_FD_IS_VALID (in)) if (!GRUB_UTIL_FD_IS_VALID (in))
grub_util_error (_("cannot open `%s': %s"), from, grub_util_fd_strerror ()); grub_util_error (_("cannot open `%s': %s"), from, grub_util_fd_strerror ());
file_descs[idx].name = xstrdup (to);
file_descs[idx].source = xstrdup (from);
canonicalize (file_descs[idx].name);
file_descs[idx].mtime = grub_util_get_mtime (from);
file_descs[idx].size = grub_util_get_fd_size (in, from, NULL);
grub_util_fd_close (in);
}
static int
filecmp (const void *p1, const void *p2)
{
const struct file_desc *a = p1, *b = p2;
/* Don't use strcmp, it's buggy on some systems. */
return grub_strcmp (a->name, b->name);
}
static void
write_memdisk (char *memdisk_img)
{
FILE *memdisk;
struct grub_greffs_header head;
struct grub_greffs_inode inode;
size_t total_strlen = 0, i;
size_t name_pad = 0;
grub_uint32_t file_offset;
qsort (file_descs, n_file_descs, sizeof (file_descs[0]), filecmp);
for (i = 0; i < n_file_descs; i++)
total_strlen += grub_strlen (file_descs[i].name);
name_pad = ALIGN_UP (total_strlen, 4) - total_strlen;
total_strlen += name_pad;
grub_memcpy (head.magic, GRUB_GREFFS_MAGIC, sizeof (head.magic));
head.nfiles = grub_cpu_to_le32 (n_file_descs);
head.inodes_offset = grub_cpu_to_le32 (sizeof (head)
+ sizeof (grub_uint32_t)
* (n_file_descs + 1));
head.string_ptrs_offset = grub_cpu_to_le32 (sizeof (head));
memdisk = grub_util_fopen (memdisk_img, "wb");
if (!memdisk)
grub_util_error (_("Can't create file: %s"), strerror (errno));
fwrite (&head, 1, sizeof (head), memdisk);
grub_uint32_t curname = sizeof (head) + sizeof (grub_uint32_t)
* (n_file_descs + 1) + sizeof (inode) * n_file_descs;
for (i = 0; i <= n_file_descs; i++)
{
grub_uint32_t curname_le = grub_cpu_to_le32 (curname);
fwrite (&curname_le, 1, sizeof (curname_le), memdisk);
if (i != n_file_descs)
curname += grub_strlen (file_descs[i].name);
}
file_offset = sizeof (head) + sizeof (grub_uint32_t)
* (n_file_descs + 1) + sizeof (inode) * n_file_descs + total_strlen;
for (i = 0; i < n_file_descs; i++)
{
inode.start = grub_cpu_to_le32 (file_offset);
inode.size = grub_cpu_to_le32 (file_descs[i].size);
inode.mtime = grub_cpu_to_le32 (file_descs[i].mtime);
inode.type = 0;
fwrite (&inode, 1, sizeof (inode), memdisk);
file_offset += file_descs[i].size;
}
for (i = 0; i < n_file_descs; i++)
fwrite (file_descs[i].name, 1, grub_strlen (file_descs[i].name), memdisk);
if (!grub_install_copy_buffer) if (!grub_install_copy_buffer)
grub_install_copy_buffer = xmalloc (GRUB_INSTALL_COPY_BUFFER_SIZE); grub_install_copy_buffer = xmalloc (GRUB_INSTALL_COPY_BUFFER_SIZE);
size = grub_util_get_fd_size (in, from, NULL); grub_memset (grub_install_copy_buffer, 0, 4);
fwrite (grub_install_copy_buffer, 1, name_pad, memdisk);
memset (&hd, 0, sizeof (hd)); for (i = 0; i < n_file_descs; i++)
memcpy (hd.name, tcn, optr - tcn < 99 ? optr - tcn : 99);
memcpy (hd.mode, "0000600", 7);
memcpy (hd.uid, "0001750", 7);
memcpy (hd.gid, "0001750", 7);
set_tar_value (hd.size, size, 12);
set_tar_value (hd.mtime, mtime, 12);
hd.typeflag = '0';
memcpy (hd.magic, "ustar ", 7);
memcpy (hd.uname, "grub", 4);
memcpy (hd.gname, "grub", 4);
compute_checksum (&hd);
fwrite (&hd, 1, sizeof (hd), memdisk);
while (1)
{ {
r = grub_util_fd_read (in, grub_install_copy_buffer, GRUB_INSTALL_COPY_BUFFER_SIZE); grub_util_fd_t in;
size_t remaining = file_descs[i].size;
in = grub_util_fd_open (file_descs[i].source, GRUB_UTIL_FD_O_RDONLY);
if (!GRUB_UTIL_FD_IS_VALID (in))
grub_util_error (_("cannot open `%s': %s"),
file_descs[i].source, grub_util_fd_strerror ());
while (remaining)
{
size_t toread = remaining;
ssize_t r;
if (remaining > GRUB_INSTALL_COPY_BUFFER_SIZE)
toread = GRUB_INSTALL_COPY_BUFFER_SIZE;
r = grub_util_fd_read (in, grub_install_copy_buffer, toread);
if (r <= 0) if (r <= 0)
break; break;
fwrite (grub_install_copy_buffer, 1, r, memdisk); fwrite (grub_install_copy_buffer, 1, r, memdisk);
if (r >= remaining)
remaining = 0;
else
remaining -= r;
} }
grub_util_fd_close (in); grub_util_fd_close (in);
write_pad (size); grub_memset (grub_install_copy_buffer, 0, GRUB_INSTALL_COPY_BUFFER_SIZE);
while (remaining)
{
size_t toread = remaining;
if (remaining > GRUB_INSTALL_COPY_BUFFER_SIZE)
toread = GRUB_INSTALL_COPY_BUFFER_SIZE;
fwrite (grub_install_copy_buffer, 1, toread, memdisk);
remaining -= toread;
}
}
fclose (memdisk);
} }
int int
@@ -314,8 +353,6 @@ main (int argc, char *argv[])
char *memdisk_img = grub_util_make_temporary_file (); char *memdisk_img = grub_util_make_temporary_file ();
memdisk = grub_util_fopen (memdisk_img, "wb");
add_tar_file (memdisk_dir, ""); add_tar_file (memdisk_dir, "");
for (i = 0; i < nfiles; i++) for (i = 0; i < nfiles; i++)
{ {
@@ -336,14 +373,12 @@ main (int argc, char *argv[])
to++; to++;
add_tar_file (from, to); add_tar_file (from, to);
} }
write_zeros (512);
fclose (memdisk);
write_memdisk (memdisk_img);
grub_util_unlink_recursive (memdisk_dir); grub_util_unlink_recursive (memdisk_dir);
grub_install_push_module ("memdisk"); grub_install_push_module ("memdisk");
grub_install_push_module ("tar"); grub_install_push_module ("greffs");
grub_install_make_image_wrap (grub_install_source_directory, grub_install_make_image_wrap (grub_install_source_directory,
"(memdisk)/boot/grub", output_image, "(memdisk)/boot/grub", output_image,
@@ -351,5 +386,6 @@ main (int argc, char *argv[])
grub_util_get_target_name (format), 0); grub_util_get_target_name (format), 0);
grub_util_unlink (memdisk_img); grub_util_unlink (memdisk_img);
return 0; return 0;
} }
+9
View File
@@ -46,7 +46,12 @@
#include <assert.h> #include <assert.h>
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h> #include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
@@ -661,6 +666,8 @@ static struct argp_option options[] = {
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char * static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused))) help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{ {
@@ -674,6 +681,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct arguments struct arguments
{ {
char **devices; char **devices;
+14 -2
View File
@@ -33,10 +33,15 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <argp.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
struct arguments struct arguments
@@ -58,7 +63,10 @@ static struct argp_option options[] = {
{"bgcolor", 'b', N_("COLOR"), 0, {"bgcolor", 'b', N_("COLOR"), 0,
N_("use COLOR for background"), 0}, N_("use COLOR for background"), 0},
{"text", 't', N_("STRING"), 0, {"text", 't', N_("STRING"), 0,
N_("set the label to render."), 0}, /* TRANSLATORS: The result is always stored to file and
never shown directly, so don't use "show" as synonym for render. Use "create" if
"render" doesn't translate directly. */
N_("set the label to render"), 0},
{"output", 'o', N_("FILE"), 0, {"output", 'o', N_("FILE"), 0,
N_("set output filename. Default is STDOUT"), 0}, N_("set output filename. Default is STDOUT"), 0},
{"font", 'f', N_("FILE"), 0, {"font", 'f', N_("FILE"), 0,
@@ -121,6 +129,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
static struct argp argp = { static struct argp argp = {
options, argp_parser, N_("[OPTIONS]"), options, argp_parser, N_("[OPTIONS]"),
/* TRANSLATORS: This file takes a text and creates a graphical representation of it,
putting the result into .disk_label file. The result is always stored to file and
never shown directly, so don't use "show" as synonym for render. Use "create" if
"render" doesn't translate directly. */
N_("Render Apple .disk_label."), N_("Render Apple .disk_label."),
NULL, NULL, NULL NULL, NULL, NULL
}; };
+4
View File
@@ -34,7 +34,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h> #include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
+8
View File
@@ -39,7 +39,11 @@
#include <grub/emu/getroot.h> #include <grub/emu/getroot.h>
#include <grub/util/install.h> #include <grub/util/install.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h> #include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
/* 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.
@@ -94,6 +98,8 @@ static struct argp_option options[] = {
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char * static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused))) help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{ {
@@ -116,6 +122,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
} }
} }
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct arguments struct arguments
{ {
char *boot_file; char *boot_file;
+13 -6
View File
@@ -30,7 +30,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <argp.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <grub/err.h> #include <grub/err.h>
@@ -40,6 +39,12 @@
#include <grub/mm.h> #include <grub/mm.h>
#include <grub/syslinux_parse.h> #include <grub/syslinux_parse.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#include <argp.h>
#pragma GCC diagnostic error "-Wmissing-prototypes"
#pragma GCC diagnostic error "-Wmissing-declarations"
#include "progname.h" #include "progname.h"
struct arguments struct arguments
@@ -60,14 +65,16 @@ static struct argp_option options[] = {
{"root", 'r', N_("DIR"), 0, {"root", 'r', N_("DIR"), 0,
N_("root directory of the syslinux disk [default=/]."), 0}, N_("root directory of the syslinux disk [default=/]."), 0},
{"target-cwd", 'T', N_("DIR"), 0, {"target-cwd", 'T', N_("DIR"), 0,
N_("current directory as it will be seen on runtime [default=$pwd]."), 0}, N_(
"current directory of the syslinux as it will be seen on runtime [default is parent directory of input file]."
), 0},
{"cwd", 'c', N_("DIR"), 0, {"cwd", 'c', N_("DIR"), 0,
N_("current directory of the syslinux disk [default=$pwd]."), 0}, N_("current directory of the syslinux [default is parent directory of input file]."), 0},
{"output", 'o', N_("FILE"), 0, N_("write output to FILE [default=stdout]."), 0}, {"output", 'o', N_("FILE"), 0, N_("write output to FILE [default=stdout]."), 0},
{"isolinux", 'i', 0, 0, N_("assume isolinux."), 0}, {"isolinux", 'i', 0, 0, N_("assume input is an isolinux configuration file."), 0},
{"pxelinux", 'p', 0, 0, N_("assume pxelinux."), 0}, {"pxelinux", 'p', 0, 0, N_("assume input is a pxelinux configuration file."), 0},
{"syslinux", 's', 0, 0, N_("assume syslinux."), 0}, {"syslinux", 's', 0, 0, N_("assume input is a syslinux configuration file."), 0},
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
+8
View File
@@ -366,6 +366,14 @@ for cipher_file in cipher_files:
skip_statement = True skip_statement = True
continue continue
m = re.match ("static int tripledes_set3keys \(", line) m = re.match ("static int tripledes_set3keys \(", line)
if not m is None:
skip_statement = True
continue
m = re.match ("static const char sample_secret_key", line)
if not m is None:
skip_statement = True
continue
m = re.match ("static const char sample_public_key", line)
if not m is None: if not m is None:
skip_statement = True skip_statement = True
continue continue
+6 -2
View File
@@ -79,6 +79,7 @@ grub_util_get_image_size (const char *path)
{ {
FILE *f; FILE *f;
size_t ret; size_t ret;
off_t sz;
f = grub_util_fopen (path, "rb"); f = grub_util_fopen (path, "rb");
@@ -87,7 +88,10 @@ grub_util_get_image_size (const char *path)
fseeko (f, 0, SEEK_END); fseeko (f, 0, SEEK_END);
ret = ftello (f); sz = ftello (f);
if (sz != (size_t) sz)
grub_util_error (_("file `%s' is too big"), path);
ret = (size_t) sz;
fclose (f); fclose (f);
@@ -262,6 +266,6 @@ grub_register_exported_symbols (void)
int int
grub_qsort_strcmp (const void *p1, const void *p2) grub_qsort_strcmp (const void *p1, const void *p2)
{ {
return strcmp(*(char **)p1, *(char **)p2); return strcmp(*(char *const *)p1, *(char *const *)p2);
} }
+1 -1
View File
@@ -20,6 +20,7 @@
#include <config.h> #include <config.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/install.h>
#include <grub/i18n.h> #include <grub/i18n.h>
#include <grub/term.h> #include <grub/term.h>
#include <grub/font.h> #include <grub/font.h>
@@ -32,7 +33,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <argp.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>