Compare commits

..
Author SHA1 Message Date
Vladimir Serbinenko 3635094bf4 .org simplification 2013-12-24 02:48:31 +01:00
Vladimir Serbinenko aeebec13ab Fix .org 2013-12-24 02:31:44 +01:00
Vladimir Serbinenko 3863ea6088 Replace .= with .org 2013-12-24 01:22:27 +01:00
Vladimir Serbinenko 0290aa8596 Check for .code16 support 2013-12-24 01:17:34 +01:00
Vladimir Serbinenko 09f5da1df6 Remove addr32 2013-12-24 01:11:32 +01:00
Vladimir Serbinenko 002ba123eb Remove useless addr32 2013-12-24 00:47:58 +01:00
Vladimir Serbinenko a7831929d3 remove data32 2013-12-24 00:44:07 +01:00
Vladimir Serbinenko 2cbee7340c Merge branch 'master' into phcoder/scratch
Conflicts:
	grub-core/kern/arm/cache_armv6.S
	grub-core/kern/uboot/init.c
	include/grub/arm/system.h
2013-12-24 00:33:47 +01:00
Vladimir Serbinenko 850da8e056 dmraid 2013-12-24 00:32:40 +01:00
Colin Watson f9fa053b69 mkconfig fix by Colin 2013-12-24 00:32:20 +01:00
Vladimir Serbinenko 2f1fd54c38 Skip apple ghosts 2013-12-24 00:05:22 +01:00
Vladimir Serbinenko df056a2788 Gain more info about vendor path 2013-12-23 22:45:56 +01:00
Vladimir Serbinenko 72f099578e Merge branch 'master' of git.sv.gnu.org:/srv/git/grub 2013-12-23 18:17:29 +01:00
Vladimir Serbinenko 808e97c4e7 ARM64 support for grub-mkrescue. 2013-12-23 18:17:09 +01:00
Vladimir Serbinenko e388db904c Install modinfo.sh to keep build information around. 2013-12-23 18:17:09 +01:00
Vladimir Serbinenko cef394032d * grub-core/modinfo.sh.in: Add build config information. 2013-12-23 18:17:09 +01:00
Vladimir Serbinenko a4d610026f ARM64 grub-file and grub-mkconfig support. 2013-12-23 18:17:09 +01:00
Vladimir Serbinenko 0c930a841e Remove leftover options defines. 2013-12-23 18:17:02 +01:00
Colin Watson 3d369a01ac Update some documentation to refer to Git rather than Bazaar.
* docs/grub.texi (Obtaining and Building GRUB): Refer to Git rather
than Bazaar.
* po/README: Likewise.  Fix spelling mistake.
2013-12-23 14:43:41 +00:00
Colin Watson 5b83ef97e5 Don't distribute config.h.
* Makefile.am (platform_HEADERS): Move to ...
(nodist_platform_HEADERS): ... here.  Fixes gettext_strings_test
failure when building from a distributed tarball.
2013-12-23 14:30:35 +00:00
Colin Watson 16f7455b04 * configure.ac: Fix spelling.
* grub-core/commands/parttool.c: Fix grammar.
* grub-core/disk/ldm.c: Use consistent capitalisation for "LDM
Embedding Partition".
2013-12-23 13:32:35 +00:00
Vladimir Serbinenko 74fa9ac1a6 * include/grub/arm64/linux.h: Remove leftovers. Add missing prefixes. 2013-12-23 05:56:31 +01:00
Vladimir Serbinenko 62956fe7b9 * grub-core/loader/arm64/linux.c: Add missing bracket. 2013-12-23 05:34:13 +01:00
Vladimir Serbinenko 260632161f Add arm64-efi recognition to grub-file. 2013-12-23 05:33:44 +01:00
Vladimir Serbinenko 4cd0b55fd0 Fix ia64-efi recognition in grub-file. 2013-12-23 05:27:04 +01:00
Vladimir Serbinenko 95b56e3a97 Recognize raspberry pi kernel in grub-file. 2013-12-23 05:19:42 +01:00
Vladimir Serbinenko bbc52c228f Enable cache on ARM U-Boot port.
Without it the port is reidiculously slow.
2013-12-23 05:01:58 +01:00
Vladimir Serbinenko 943981ff65 Fix ARM cache maintainance.
More code was converted from ASM to C for easier handling.
2013-12-23 04:27:53 +01:00
Vladimir Serbinenko 1d83f4d467 Merge branch 'master' into phcoder/scratch 2013-12-23 04:16:55 +01:00
Vladimir Serbinenko b2b8ed7032 ARM cache 2013-12-23 04:14:24 +01:00
Vladimir Serbinenko 4b03082fa9 EFI debug 2013-12-22 23:15:43 +01:00
Vladimir Serbinenko adabfb5418 * grub-core/kern/arm/cache.c (grub_arm_disable_caches_mmu): Use v6
algorithm on v5.

	Suggested by: Leif Lindholm.
2013-12-22 22:33:35 +01:00
Vladimir Serbinenko d5edef1a77 Half boot time on pi when using standalone by using greffs 2013-12-22 21:17:54 +01:00
Andrey Borzenkov 77ec462a56 grub-mkconfig: fix Xen platform conditions 2013-12-22 23:47:26 +04:00
Andrey Borzenkov 3bf2db8959 split grub-mkresecue help text to facilitate translations
Split single string in help message into several strings used before in shell
grub-mkrescue to minimize changes to existing translations.

Reported by Benno Schulenberg
2013-12-22 22:51:54 +04:00
Leif Lindholm 30a9ab952f arm64: add EFI Linux loader
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
2013-12-22 18:38:44 +00:00
Leif Lindholm c415eaa98f fdt: additions required for arm64 Linux loader
- Add grub_fdt_create_empty_tree() function.
- Add 64-bit setprop.
2013-12-22 18:38:44 +00: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
129 changed files with 2511 additions and 757 deletions

No files matched your search

+290
View File
@@ -1,3 +1,293 @@
2013-12-23 Colin Watson <cjwatson@debian.org>
Update some documentation to refer to Git rather than Bazaar.
* docs/grub.texi (Obtaining and Building GRUB): Refer to Git rather
than Bazaar.
* po/README: Likewise. Fix spelling mistake.
2013-12-23 Colin Watson <cjwatson@ubuntu.com>
Don't distribute config.h.
* Makefile.am (platform_HEADERS): Move to ...
(nodist_platform_HEADERS): ... here. Fixes gettext_strings_test
failure when building from a distributed tarball.
2013-12-23 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Fix spelling.
* grub-core/commands/parttool.c: Fix grammar.
* grub-core/disk/ldm.c: Use consistent capitalisation for "LDM
Embedding Partition".
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
ARM64 support for grub-mkrescue.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
Install modinfo.sh to keep build information around.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/modinfo.sh.in: Add build config information.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
ARM64 grub-file and grub-mkconfig support.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
Remove leftover options defines.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/arm64/linux.h: Remove leftovers. Add missing prefixes.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/arm64/linux.c: Add missing bracket.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
Add arm64-efi recognition to grub-file.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
Fix ia64-efi recognition in grub-file.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
Recognize raspberry pi kernel in grub-file.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
Enable cache on ARM U-Boot port.
Without it the port is reidiculously slow.
2013-12-23 Vladimir Serbinenko <phcoder@gmail.com>
Fix ARM cache maintainance.
More code was converted from ASM to C for easier handling.
2013-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/arm/cache.c (grub_arm_disable_caches_mmu): Use v6
algorithm on v5.
Suggested by: Leif Lindholm.
2013-12-22 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub-mkconfig.in: Fix Xen platform conditions.
2013-12-22 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub-mkrescue.c: Split single help message string in several
strings used in previous shell version.
2013-12-22 Leif Lindholm <leif.lindholm@linaro.org>
Add arm64 Linux loader.
2013-12-22 Leif Lindholm <leif.lindholm@linaro.org>
Add grub_fdt_create_empty_tree() and grub_fdt_set_prop64().
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>
* configure.ac: Set version to 2.02~beta1.
+1 -1
View File
@@ -127,7 +127,7 @@ widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec
CLEANFILES += widthspec.h
# Install config.h into platformdir
platform_HEADERS = config.h
nodist_platform_HEADERS = config.h
pkgdata_DATA += grub-mkconfig_lib
+1
View File
@@ -119,6 +119,7 @@ library = {
common = grub-core/fs/sfs.c;
common = grub-core/fs/squash4.c;
common = grub-core/fs/tar.c;
common = grub-core/fs/greffs.c;
common = grub-core/fs/udf.c;
common = grub-core/fs/ufs2.c;
common = grub-core/fs/ufs.c;
-74
View File
@@ -210,80 +210,6 @@ fi
])
dnl Mass confusion!
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit
dnl instructions, but implicitly insert addr32 and data32 bytes so
dnl that the code works in real mode''.
dnl
dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit
dnl instructions,'' which seems right. This requires the programmer
dnl to explicitly insert addr32 and data32 instructions when they want
dnl them.
dnl
dnl We only support the newer versions, because the old versions cause
dnl major pain, by requiring manual assembly to get 16-bit instructions into
dnl asm files.
AC_DEFUN([grub_I386_ASM_ADDR32],
[AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT])
AC_MSG_CHECKING([for .code16 addr32 assembler support])
AC_CACHE_VAL(grub_cv_i386_asm_addr32,
[cat > conftest.s.in <<\EOF
.code16
l1: @ADDR32@ movb %al, l1
EOF
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s
else
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
fi
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
grub_cv_i386_asm_addr32=yes
else
grub_cv_i386_asm_addr32=no
fi
rm -f conftest*])
AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
dnl Later versions of GAS requires that addr32 and data32 prefixes
dnl appear in the same lines as the instructions they modify, while
dnl earlier versions requires that they appear in separate lines.
AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(dnl
[whether addr32 must be in the same line as the instruction])
AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement,
[cat > conftest.s <<\EOF
.code16
l1: addr32 movb %al, l1
EOF
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
grub_cv_i386_asm_prefix_requirement=yes
else
grub_cv_i386_asm_prefix_requirement=no
fi
rm -f conftest*])
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
grub_tmp_addr32="addr32"
grub_tmp_data32="data32"
else
grub_tmp_addr32="addr32;"
grub_tmp_data32="data32;"
fi
ADDR32=$grub_tmp_addr32
DATA32=$grub_tmp_data32
AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
dnl Check what symbol is defined as a bss start symbol.
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
-1
View File
@@ -35,7 +35,6 @@ CPPFLAGS_DEFAULT += -I$(top_builddir)
CPPFLAGS_DEFAULT += -I$(top_srcdir)
CPPFLAGS_DEFAULT += -I$(top_srcdir)/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/
CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
-10
View File
@@ -31,10 +31,6 @@
#define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@
/* Define if C symbols get an underscore after compilation. */
#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */
#define ADDR32 @ADDR32@
/* Define it to \"data32\" or \"data32;\" to make GAS happy. */
#define DATA32 @DATA32@
/* Define it to one of __bss_start, edata and _edata. */
#define BSS_START_SYMBOL @BSS_START_SYMBOL@
/* Define it to either end or _end. */
@@ -51,12 +47,6 @@
#define PACKAGE_NAME "@PACKAGE_NAME@"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
/* Default boot directory name" */
#define GRUB_BOOT_DIR_NAME "@bootdirname@"
/* Default grub directory name */
#define GRUB_DIR_NAME "@grubdirname@"
/* Define to 1 if GCC generates calls to __register_frame_info(). */
#define NEED_REGISTER_FRAME_INFO @NEED_REGISTER_FRAME_INFO@
#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
#define GRUB_PLATFORM "@GRUB_PLATFORM@"
+72 -33
View File
@@ -214,20 +214,14 @@ case "$platform" in
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1" ;;
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1" ;;
arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
esac
case "$target_cpu" in
arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
arm64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM64=1" ;;
mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
esac
if test x${target_cpu} = xmipsel ; then
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
else
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1"
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
fi
case "${target_cpu}-$platform" in
@@ -432,8 +426,8 @@ esac
# For gnulib.
gl_INIT
WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes"
EXTRA_WARN_FLAGS="-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"
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 -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2"
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
@@ -544,12 +538,33 @@ AC_COMPILE_IFELSE(
# on arm clang doesn't support .arch directive
# on mips clang doesn't support privilegied instructions, doubleword store/load
# and crashes with hand-written assembly
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
|| test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xarm \
|| test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
fi
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
|| test "x$target_cpu" = xx86_64 ); then
AC_CACHE_CHECK([if clang can handle .code16], [grub_cv_cc_target_clang_code16]
[
CFLAGS="$TARGET_CCASFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
asm volatile (".code16\n"
"xorw %ax, %ax\n"
#ifdef __x86_64__
".code64\n"
#else
".code32\n"
#endif
);
]])],
[grub_cv_cc_target_clang_code16=yes], [grub_cv_cc_target_clang_code16=no])])
if test x$grub_cv_cc_target_clang_code16 = xno ; then
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
fi
fi
if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then
AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame]
[
@@ -745,7 +760,7 @@ if test x"$efiemu_excuse" = x ; then
fi
fi
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
if test x"$efiemu_excuse" = x ; then
enable_efiemu=yes
@@ -757,14 +772,35 @@ AC_SUBST([EFIEMU64_LINK_FORMAT])
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], [
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
if test x${target_cpu} != xi386 && test x$format = xi386pe; then
if test x${target_cpu} != xi386 && test x$format = x-mi386pe; then
continue
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
fi
CFLAGS="$TARGET_CFLAGS"
@@ -1031,8 +1067,6 @@ if test "x$target_cpu" = xi386; then
grub_CHECK_END_SYMBOL
fi
CFLAGS="$TARGET_CFLAGS"
grub_I386_ASM_PREFIX_REQUIREMENT
grub_I386_ASM_ADDR32
fi
grub_PROG_NM_WORKS
@@ -1144,7 +1178,7 @@ AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
[grub_emu_usb_excuse=["need libusb headers"]])
[fi]
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
if test x"$grub_emu_usb_excuse" = x ; then
enable_grub_emu_usb=yes
@@ -1153,7 +1187,7 @@ enable_grub_emu_usb=no
fi
if test x"$enable_grub_emu_sdl" = xno ; then
grub_emu_sdl_excuse="explicitely disabled"
grub_emu_sdl_excuse="explicitly disabled"
fi
[if [ x"$grub_emu_sdl_excuse" = x ]; then
# Check for libSDL libraries.]
@@ -1169,7 +1203,7 @@ AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
[fi]
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 explicitly requested but can't be compiled ($grub_emu_sdl_excuse)])
fi
if test x"$grub_emu_sdl_excuse" = x ; then
enable_grub_emu_sdl=yes
@@ -1249,7 +1283,7 @@ if test x"$grub_mkfont_excuse" = x ; then
fi
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
if test x"$grub_mkfont_excuse" = x ; then
enable_grub_mkfont=yes
@@ -1308,7 +1342,7 @@ if test x"$grub_build_mkfont_excuse" = x ; then
fi
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
if test x"$grub_build_mkfont_excuse" = x ; then
enable_build_grub_mkfont=yes
@@ -1316,7 +1350,11 @@ else
enable_build_grub_mkfont=no
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
AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont])
if test x"$grub_build_mkfont_excuse" = x ; then
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
AC_SUBST([build_freetype_cflags])
@@ -1359,7 +1397,7 @@ if test x"$starfield_excuse" = x; then
fi
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
AC_SUBST([DJVU_FONT_SOURCE])
@@ -1385,7 +1423,11 @@ if test x"$enable_build_grub_mkfont" = xno ; then
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
AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont])
if test x"$grub_build_mkfont_excuse" = x ; then
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
AC_SUBST([FONT_SOURCE])
@@ -1417,7 +1459,7 @@ if test x"$grub_mount_excuse" = x ; then
fi
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
if test x"$grub_mount_excuse" = x ; then
enable_grub_mount=yes
@@ -1485,7 +1527,7 @@ AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
fi
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
@@ -1522,7 +1564,7 @@ if test x"$libzfs_excuse" = x ; then
fi
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
if test x"$libzfs_excuse" = x ; then
@@ -1545,13 +1587,10 @@ AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
[AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
AC_SUBST(HAVE_ASM_USCORE)
AC_SUBST(ADDR32)
AC_SUBST(DATA32)
AC_SUBST(BSS_START_SYMBOL)
AC_SUBST(END_SYMBOL)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(NEED_REGISTER_FRAME_INFO)
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--disable-werror],
+1 -1
View File
@@ -6385,7 +6385,7 @@ just do:
@end group
@end example
Also, the latest version is available using Bazaar. See
Also, the latest version is available using Git. See
@uref{http://www.gnu.org/software/grub/grub-download.html} for more
information.
+2
View File
@@ -221,12 +221,14 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/uboot.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
endif
if COND_arm_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
endif
if COND_arm64_efi
+7 -1
View File
@@ -1399,6 +1399,11 @@ module = {
common = fs/tar.c;
};
module = {
name = greffs;
common = fs/greffs.c;
};
module = {
name = udf;
common = fs/udf.c;
@@ -1672,7 +1677,8 @@ module = {
sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
ia64_efi = loader/ia64/efi/linux.c;
arm = loader/arm/linux.c;
arm = lib/fdt.c;
arm64 = loader/arm64/linux.c;
fdt = lib/fdt.c;
common = loader/linux.c;
common = lib/cmdline.c;
enable = noemu;
+10 -10
View File
@@ -165,8 +165,8 @@ start:
* this area.
*/
. = _start + GRUB_BOOT_MACHINE_BPB_START
. = _start + 4
.org GRUB_BOOT_MACHINE_BPB_START
.org 4
#endif
#ifdef HYBRID_BOOT
floppy
@@ -174,7 +174,7 @@ start:
scratch
#endif
. = _start + GRUB_BOOT_MACHINE_BPB_END
.org GRUB_BOOT_MACHINE_BPB_END
/*
* End of BIOS parameter block.
*/
@@ -183,14 +183,14 @@ kernel_address:
.word GRUB_BOOT_MACHINE_KERNEL_ADDR
#ifndef HYBRID_BOOT
. = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR
.org GRUB_BOOT_MACHINE_KERNEL_SECTOR
kernel_sector:
.long 1
kernel_sector_high:
.long 0
#endif
. = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE
.org GRUB_BOOT_MACHINE_BOOT_DRIVE
boot_drive:
.byte 0xff /* the disk to load kernel from */
/* 0xff means use the boot drive */
@@ -208,7 +208,7 @@ LOCAL(after_BPB):
* possible boot drive. If GRUB is installed into a floppy,
* this does nothing (only jump).
*/
. = _start + GRUB_BOOT_MACHINE_DRIVE_CHECK
.org GRUB_BOOT_MACHINE_DRIVE_CHECK
boot_drive_check:
jmp 3f /* grub-setup may overwrite this jump */
testb $0x80, %dl
@@ -511,13 +511,13 @@ LOCAL(message):
*/
#ifdef HYBRID_BOOT
. = _start + 0x1b0
.org 0x1b0
kernel_sector:
.long 1
kernel_sector_high:
.long 0
#endif
. = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
.org GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
nt_magic:
.long 0
.word 0
@@ -528,7 +528,7 @@ nt_magic:
* sneaky, huh?
*/
. = _start + GRUB_BOOT_MACHINE_PART_START
.org GRUB_BOOT_MACHINE_PART_START
#ifndef HYBRID_BOOT
floppy
@@ -536,7 +536,7 @@ nt_magic:
scratch
#endif
. = _start + GRUB_BOOT_MACHINE_PART_END
.org GRUB_BOOT_MACHINE_PART_END
/* the last 2 bytes in the sector 0 contain the signature */
.word GRUB_BOOT_MACHINE_SIGNATURE
+2 -2
View File
@@ -43,7 +43,7 @@ _start:
LOCAL(next):
jmp 1f
. = start + 8
.org 8
bi_pvd:
.long 0 /* LBA of primary volume descriptor. */
@@ -168,6 +168,6 @@ err_noboot_msg:
err_cdfail_msg:
.ascii "cdrom read fails\0"
. = start + 0x7FF
.org 0x7FF
.byte 0
+1 -1
View File
@@ -362,7 +362,7 @@ LOCAL(message):
.word 0
.word 0
. = _start + 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE
.org 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE
LOCAL(firstlist): /* this label has to be before the first list entry!!! */
/* fill the first data listing with the default */
blocklist_default_start:
+2 -2
View File
@@ -41,7 +41,7 @@ data_start:
xorl %ebp, %ebp
jmp LOCAL(linux_next)
. = data_start + 0x1F1
.org 0x1F1
setup_sects:
.byte CODE_SECTORS
@@ -292,4 +292,4 @@ LOCAL(fail):
err_int15_msg:
.ascii "move memory fails\0"
. = _start + CODE_SECTORS * 512
.org (CODE_SECTORS + 1) * 512
+1 -1
View File
@@ -38,5 +38,5 @@ start:
/* This region is a junk. Do you say that this is wasteful?
But I like that the memory layout of the body is consistent
among different kernels rather than scamping just for 1.5KB. */
. = _start + 0x8200 - 0x7C00 - 0x200 - 1
.org 0x8200 - 0x7C00 - 0x200 - 1
.byte 0
+8 -8
View File
@@ -50,23 +50,23 @@ LOCAL (base):
* This is a special data area.
*/
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
LOCAL(compressed_size):
.long 0
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
LOCAL(uncompressed_size):
.long 0
. = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
.org GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
reed_solomon_redundancy:
.long 0
. = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH
.org GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH
.short (LOCAL(reed_solomon_part) - _start)
/*
* This is the area for all of the special variables.
*/
. = _start + GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE
.org GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE
LOCAL(boot_dev):
.byte 0xFF, 0xFF, 0xFF
LOCAL(boot_drive):
@@ -89,13 +89,13 @@ LOCAL (codestart):
sti /* we're safe again */
/* save the boot drive */
ADDR32 movb %dl, LOCAL(boot_drive)
movb %dl, LOCAL(boot_drive)
/* reset disk system (%ah = 0) */
int $0x13
/* transition to protected mode */
DATA32 call real_to_prot
calll real_to_prot
/* The ".code32" directive takes GAS out of 16-bit mode. */
.code32
@@ -149,7 +149,7 @@ gate_a20_try_bios:
movw $0x2401, %ax
int $0x15
DATA32 call real_to_prot
calll real_to_prot
.code32
popl %ebp
+4 -4
View File
@@ -31,7 +31,7 @@ _start:
jmp 1f
. = _start + GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
.org GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
VARIABLE(grub_core_entry_addr)
.long 0
1:
@@ -48,7 +48,7 @@ VARIABLE(grub_core_entry_addr)
/* Transition to protected mode. We use pushl to force generation
of a flat return address. */
pushl $1f
DATA32 jmp real_to_prot
jmpl real_to_prot
.code32
/* Ensure A20 is enabled. We're in qemu, so control port A works
and there is no need to wait since there is no real logic, it's
@@ -66,9 +66,9 @@ VARIABLE(grub_core_entry_addr)
/* Intel, in its infinite wisdom, decided to put the i8086 entry point
*right here* and this is why we need this kludge. */
. = GRUB_BOOT_MACHINE_SIZE - 16
.org GRUB_BOOT_MACHINE_SIZE - 16
.code16
jmp _start
. = GRUB_BOOT_MACHINE_SIZE
.org GRUB_BOOT_MACHINE_SIZE
+3 -3
View File
@@ -162,7 +162,7 @@ retry_cs5536:
b continue
. = start + GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START
.org GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START
tlb_refill:
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR
@@ -196,13 +196,13 @@ tlb_refill:
b fatal
addiu $a0, $a0, %lo(unhandled_tlb_refill)
. = start + GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START
.org GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START
cache_error:
lui $a0, %hi(unhandled_cache_error)
b fatal
addiu $a0, $a0, %lo(unhandled_cache_error)
. = start + GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START
.org GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START
other_exception:
mfc0 $s0, GRUB_CPU_LOONGSON_COP0_CAUSE
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
+3 -3
View File
@@ -39,13 +39,13 @@ start:
bal codestart
nop
base:
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
compressed_size:
.long 0
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
uncompressed_size:
.long 0
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
uncompressed_addr:
.long 0
codestart:
+4 -4
View File
@@ -41,9 +41,9 @@ pic_base:
* After loading in that block we will execute it by jumping to the
* load address plus the size of the prepended A.OUT header (32 bytes).
*/
. = _start + GRUB_BOOT_MACHINE_BOOT_DEVPATH
.org GRUB_BOOT_MACHINE_BOOT_DEVPATH
boot_path:
. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
.org GRUB_BOOT_MACHINE_KERNEL_BYTE
boot_path_end:
kernel_byte: .xword (2 << 9)
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
@@ -52,7 +52,7 @@ kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
#define boot_path_end (_start + 1024)
#include <grub/offsets.h>
. = _start + 8
.org 8
kernel_byte: .xword (2 << 9)
kernel_size: .word 512
kernel_address: .word GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
@@ -224,7 +224,7 @@ bootpath_known:
#else
nop
#endif
. = _start + GRUB_BOOT_MACHINE_CODE_END
.org GRUB_BOOT_MACHINE_CODE_END
/* the last 4 bytes in the sector 0 contain the signature */
.word GRUB_BOOT_MACHINE_SIGNATURE
+1 -1
View File
@@ -136,7 +136,7 @@ lastlist:
.word 0
.word 0
. = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
.org (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
blocklist_default_start:
.word 0
.word 2
+1 -1
View File
@@ -56,7 +56,7 @@ GRUB_MOD_INIT(boottime)
{
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)
+62 -25
View File
@@ -36,62 +36,66 @@ GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = {
{"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},
{"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,
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,
N_("Check if FILE can be used as x86 multiboot kernel"), 0, 0},
{"is-x86-multiboot2", 0, 0,
N_("Check if FILE can be used as x86 multiboot2 kernel"), 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-arm64-linux", 0, 0,
N_("Check if FILE is ARM64 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,
N_("Check if FILE is MIPS linux"), 0, 0},
N_("Check if FILE is MIPS 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,
N_("Check if FILE is SPARC64 linux"), 0, 0},
N_("Check if FILE is SPARC64 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,
N_("Check if FILE is x86 linux"), 0, 0},
N_("Check if FILE is x86 Linux"), 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,
N_("Check if FILE is x86 kfreebsd"), 0, 0},
N_("Check if FILE is x86 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,
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,
N_("Check if FILE is x86 knetbsd"), 0, 0},
N_("Check if FILE is x86 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,
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,
N_("Check if FILE is i386 EFI file"), 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,
N_("Check if FILE is IA64 EFI file"), 0, 0},
{"is-arm64-efi", 0, 0,
N_("Check if FILE is ARM64 EFI file"), 0, 0},
{"is-arm-efi", 0, 0,
N_("Check if FILE is ARM EFI file"), 0, 0},
{"is-hibernated-hiberfil", 0, 0,
N_("Check if FILE is hiberfil.sys in hibernated state"), 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,
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,
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,
N_("Check if FILE is BIOS bootsector"), 0, 0},
{0, 0, 0, 0, 0, 0}
@@ -105,6 +109,7 @@ enum
IS_MULTIBOOT,
IS_MULTIBOOT2,
IS_ARM_LINUX,
IS_ARM64_LINUX,
IS_IA64_LINUX,
IS_MIPS_LINUX,
IS_MIPSEL_LINUX,
@@ -121,6 +126,7 @@ enum
IS_32_EFI,
IS_64_EFI,
IS_IA_EFI,
IS_ARM64_EFI,
IS_ARM_EFI,
IS_HIBERNATED,
IS_XNU64,
@@ -377,14 +383,40 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
}
case IS_ARM_LINUX:
{
grub_uint32_t sig;
grub_uint32_t sig, sig_pi;
if (grub_file_read (file, &sig_pi, 4) != 4)
break;
/* Raspberry pi. */
if (sig_pi == grub_cpu_to_le32_compile_time (0xea000006))
{
ret = 1;
break;
}
if (grub_file_seek (file, 0x24) == (grub_size_t) -1)
break;
if (grub_file_read (file, &sig, 4) != 4)
break;
if (sig != grub_cpu_to_le32_compile_time (0x016f2818))
if (sig == grub_cpu_to_le32_compile_time (0x016f2818))
{
ret = 1;
break;
}
break;
}
case IS_ARM64_LINUX:
{
grub_uint32_t sig;
if (grub_file_seek (file, 0x38) == (grub_size_t) -1)
break;
ret = 1;
if (grub_file_read (file, &sig, 4) != 4)
break;
if (sig == grub_cpu_to_le32_compile_time (0x644d5241))
{
ret = 1;
break;
}
break;
}
case IS_PAE_DOMU ... IS_DOM0:
@@ -535,6 +567,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
case IS_32_EFI:
case IS_64_EFI:
case IS_IA_EFI:
case IS_ARM64_EFI:
case IS_ARM_EFI:
{
char signature[4];
@@ -573,11 +606,15 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
&& coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_IA64))
break;
if (type == IS_ARM64_EFI
&& coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARM64))
break;
if (type == IS_ARM_EFI
&& coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARMTHUMB_MIXED))
break;
if (type == IS_64_EFI || type == IS_64_EFI)
if (type == IS_IA_EFI || type == IS_64_EFI || type == IS_ARM64_EFI)
{
struct grub_pe64_optional_header o64;
if (grub_file_read (file, &o64, sizeof (o64)) != sizeof (o64))
+1 -1
View File
@@ -55,7 +55,7 @@ GRUB_MOD_INIT(cmosdump)
{
cmd = grub_register_command ("cmosdump", grub_cmd_cmosdump,
0,
N_("Dump CMOS contents."));
N_("Show raw dump of the CMOS contents."));
}
GRUB_MOD_FINI(cmosdump)
+2 -1
View File
@@ -109,9 +109,10 @@ GRUB_MOD_INIT(cmostest)
N_("Test bit at BYTE:BIT in CMOS."));
cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
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,
N_("BYTE:BIT"),
/* TRANSLATORS: A bit may be either set (1) or clear (0). */
N_("Set bit at BYTE:BIT in CMOS."));
}
@@ -109,7 +109,7 @@ GRUB_MOD_INIT(cbtime)
{
cmd_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)
+1 -1
View File
@@ -455,7 +455,7 @@ GRUB_MOD_INIT(loadenv)
{
cmd_load =
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."),
options);
cmd_list =
+3 -3
View File
@@ -59,7 +59,7 @@ find_inode (const char *filename,
}
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)
{
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);
return grub_mac_bless_inode (dev, ctx.inode_found, (ctx.found == DIR),
intel);
return grub_mac_bless_inode (dev, (grub_uint32_t) ctx.inode_found,
(ctx.found == DIR), intel);
}
static grub_err_t
+1 -1
View File
@@ -133,7 +133,7 @@ show_help (grub_device_t dev)
}
}
if (! found)
grub_printf_ (N_("Sorry no parttool is available for %s\n"),
grub_printf_ (N_("Sorry, no parttool is available for %s\n"),
dev->disk->partition->partmap->name);
return GRUB_ERR_NONE;
}
+1 -1
View File
@@ -166,7 +166,7 @@ GRUB_MOD_INIT(pcidump)
{
cmd = grub_register_extcmd ("pcidump", grub_cmd_pcidump, 0,
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)
+9 -9
View File
@@ -47,14 +47,14 @@ syslinux_file_getline (char **line, int cont __attribute__ ((unused)),
static const struct grub_arg_option options[] =
{
{"root", 'r', 0,
N_("root directory of the syslinux disk (default /)."),
N_("root directory of the syslinux disk [default=/]."),
N_("DIR"), ARG_TYPE_STRING},
{"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},
{"isolinux", 'i', 0, N_("assume isolinux."), 0, 0},
{"pxelinux", 'p', 0, N_("assume pxelinux."), 0, 0},
{"syslinux", 's', 0, N_("assume syslinux."), 0, 0},
{"isolinux", 'i', 0, N_("assume input is an isolinux configuration file."), 0, 0},
{"pxelinux", 'p', 0, N_("assume input is a pxelinux configuration file."), 0, 0},
{"syslinux", 's', 0, N_("assume input is a syslinux configuration file."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
@@ -183,25 +183,25 @@ GRUB_MOD_INIT(syslinuxcfg)
N_("FILE"),
/* TRANSLATORS: "syslinux config" means
"config as used by syslinux". */
N_("Parse syslinux config in same context"),
N_("Execute syslinux config in same context"),
options);
cmd_configfile
= grub_register_extcmd ("syslinux_configfile",
grub_cmd_syslinux_source, 0,
N_("FILE"),
N_("Parse syslinux config in new context"),
N_("Execute syslinux config in new context"),
options);
cmd_source_extract
= grub_register_extcmd ("extract_syslinux_entries_source",
grub_cmd_syslinux_source, 0,
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);
cmd_configfile_extract
= grub_register_extcmd ("extract_syslinux_entries_configfile",
grub_cmd_syslinux_source, 0,
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);
}
+4 -4
View File
@@ -41,7 +41,7 @@ enum
static const struct grub_arg_option options[] =
{
{"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}
};
@@ -966,14 +966,14 @@ GRUB_MOD_INIT(verify)
options);
cmd_trust = grub_register_extcmd ("trust", grub_cmd_trust, 0,
N_("[-s|--skip-sig] PUBKEY_FILE"),
N_("Add PKFILE to trusted keys."),
N_("Add PUBKEY_FILE to trusted keys."),
options);
cmd_list = grub_register_command ("list_trusted", grub_cmd_list,
0,
N_("List trusted keys."));
N_("Show the list of trusted keys."));
cmd_distrust = grub_register_command ("distrust", grub_cmd_distrust,
N_("PUBKEY_ID"),
N_("Remove KEYID from trusted keys."));
N_("Remove PUBKEY_ID from trusted keys."));
}
GRUB_MOD_FINI(verify)
+2 -2
View File
@@ -78,9 +78,9 @@ static grub_command_t cmd_ls, cmd_cat;
GRUB_MOD_INIT (lsxen)
{
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]"),
N_("List XEN storage."));
N_("List Xen storage."));
}
GRUB_MOD_FINI (lsxen)
+29 -2
View File
@@ -333,6 +333,21 @@ name_devices (struct grub_efidisk_data *devices)
if (! dp)
continue;
/* Ghosts proudly presented by Apple. */
if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
== GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE)
{
grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
const struct grub_efi_guid apple = GRUB_EFI_VENDOR_APPLE_GUID;
if (vendor->header.length == sizeof (*vendor)
&& grub_memcmp (&vendor->vendor_guid, &apple,
sizeof (vendor->vendor_guid)) == 0
&& find_parent_device (devices, d))
continue;
}
m = d->block_io->media;
if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_ACPI_DEVICE_PATH_TYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
@@ -654,6 +669,7 @@ grub_efidisk_get_device_handle (grub_disk_t disk)
case 'h':
/* If this is the whole disk, just return its own data. */
grub_printf ("parent handle = %p\n", d->handle);
if (! disk->partition)
return d->handle;
@@ -664,13 +680,24 @@ grub_efidisk_get_device_handle (grub_disk_t disk)
struct grub_efidisk_data *c;
devices = make_devices ();
FOR_CHILDREN (c, devices)
grub_efi_print_device_path (d->device_path);
for (c = devices; c; c = c->next)
{
grub_efi_hard_drive_device_path_t *hd;
hd = (grub_efi_hard_drive_device_path_t *) c->last_device_path;
if ((GRUB_EFI_DEVICE_PATH_TYPE (c->last_device_path)
grub_efi_print_device_path (c->device_path);
grub_printf ("part %d = %x, %x, %x, %x, %x, %x\n",
is_child (c, d),
(int) GRUB_EFI_DEVICE_PATH_TYPE (c->last_device_path),
(int) GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path),
(int) hd->partition_start, (int) hd->partition_size,
(int) grub_partition_get_start (disk->partition),
(int) grub_partition_get_len (disk->partition));
if (is_child (c, d)
&& (GRUB_EFI_DEVICE_PATH_TYPE (c->last_device_path)
== GRUB_EFI_MEDIA_DEVICE_PATH_TYPE)
&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path)
== GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)
+1 -1
View File
@@ -1012,7 +1012,7 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
usable for bootloaders (called generically
"embedding zone") and this operation is
called "embedding". */
N_("your LDM embedding Partition is too small;"
N_("your LDM Embedding Partition is too small;"
" embedding won't be possible"));
*nsectors = lv->size;
if (*nsectors > max_nsectors)
+5 -4
View File
@@ -65,7 +65,7 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl)
static int
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)
{
char *q;
@@ -111,7 +111,8 @@ grub_lvm_detect (grub_disk_t disk,
struct grub_lvm_disk_locn *dlocn;
struct grub_lvm_mda_header *mdah;
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_pv *pv;
@@ -273,7 +274,7 @@ grub_lvm_detect (grub_disk_t disk,
/* Add all the pvs to the volume group. */
while (1)
{
int s;
grub_ssize_t s;
while (grub_isspace (*p))
p++;
@@ -340,7 +341,7 @@ grub_lvm_detect (grub_disk_t disk,
/* And add all the lvs to the volume group. */
while (1)
{
int s;
grub_ssize_t s;
int skip_lv = 0;
struct grub_diskfilter_lv *lv;
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 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;
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));
}
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void
label_set_state (void *vself, int visible, int start __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;
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
static struct grub_gui_component_ops label_ops =
{
.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
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
progress_bar_paint (void *vself, const grub_video_rect_t *region)
{
+12 -32
View File
@@ -37,20 +37,16 @@
* Simple cache maintenance functions
*/
dlinesz_addr:
.long EXT_C(grub_arch_cache_dlinesz)
ilinesz_addr:
.long EXT_C(grub_arch_cache_ilinesz)
@ r0 - *beg (inclusive)
@ r1 - *end (exclusive)
clean_dcache_range:
@void grub_arm_clean_dcache_range (grub_addr_t start, grub_addr_t end, grub_addr_t dlinesz)
#ifdef ARMV6
FUNCTION(grub_arm_clean_dcache_range_armv6)
#else
FUNCTION(grub_arm_clean_dcache_range_armv7)
#endif
DSB
@ Clean data cache for range to point-of-unification
ldr r2, dlinesz_addr
ldr r2, [r2]
sub r3, r2, #1 @ align "beg" to start of line
mvn r3, r3
and r0, r0, r3
1: cmp r0, r1
bge 2f
#ifdef ARMV6
@@ -65,13 +61,12 @@ clean_dcache_range:
@ r0 - *beg (inclusive)
@ r1 - *end (exclusive)
invalidate_icache_range:
#ifdef ARMV6
FUNCTION(grub_arm_invalidate_icache_range_armv6)
#else
FUNCTION(grub_arm_invalidate_icache_range_armv7)
#endif
@ Invalidate instruction cache for range to point-of-unification
ldr r2, ilinesz_addr
ldr r2, [r2]
sub r3, r2, #1 @ align "beg" to start of line
mvn r3, r3
and r0, r0, r3
1: cmp r0, r1
bge 2f
mcr p15, 0, r0, c7, c5, 1 @ ICIMVAU
@@ -83,21 +78,6 @@ invalidate_icache_range:
ISB
bx lr
@void grub_arch_sync_caches (void *address, grub_size_t len)
#ifdef ARMV6
FUNCTION(grub_arch_sync_caches_armv6)
#else
FUNCTION(grub_arch_sync_caches_armv7)
#endif
DSB
add r1, r0, r1
push {r0-r2, lr}
bl clean_dcache_range
pop {r0, r1}
bl invalidate_icache_range
pop {r2, lr}
bx lr
#ifdef ARMV6
FUNCTION(grub_arm_disable_caches_mmu_armv6)
#else
+152 -9
View File
@@ -1,6 +1,11 @@
#include <grub/dl.h>
#include <grub/cache.h>
#include <grub/arm/system.h>
#ifdef GRUB_MACHINE_UBOOT
#include <grub/uboot/uboot.h>
#include <grub/uboot/api_public.h>
#include <grub/mm.h>
#endif
/* This is only about cache architecture. It doesn't imply
the CPU architecture. */
@@ -13,12 +18,21 @@ static enum
ARCH_ARMV7
} type = ARCH_UNKNOWN;
grub_uint32_t grub_arch_cache_dlinesz;
grub_uint32_t grub_arch_cache_ilinesz;
static int is_v6_mmu;
static grub_uint32_t grub_arch_cache_dlinesz;
static grub_uint32_t grub_arch_cache_ilinesz;
static grub_uint32_t grub_arch_cache_max_linesz;
/* Prototypes for asm functions. */
void grub_arch_sync_caches_armv6 (void *address, grub_size_t len);
void grub_arch_sync_caches_armv7 (void *address, grub_size_t len);
void grub_arm_clean_dcache_range_armv6 (grub_addr_t start, grub_addr_t end,
grub_addr_t dlinesz);
void grub_arm_clean_dcache_range_armv7 (grub_addr_t start, grub_addr_t end,
grub_addr_t dlinesz);
void grub_arm_invalidate_icache_range_armv6 (grub_addr_t start, grub_addr_t end,
grub_addr_t dlinesz);
void grub_arm_invalidate_icache_range_armv7 (grub_addr_t start, grub_addr_t end,
grub_addr_t dlinesz);
void grub_arm_disable_caches_mmu_armv6 (void);
void grub_arm_disable_caches_mmu_armv7 (void);
grub_uint32_t grub_arm_main_id (void);
@@ -38,8 +52,11 @@ probe_caches (void)
case 0x4:
case 0x5:
case 0x6:
is_v6_mmu = 0;
break;
case 0x7:
case 0xf:
is_v6_mmu = 1;
break;
default:
grub_fatal ("Unsupported ARM ID 0x%x", main_id);
@@ -82,20 +99,148 @@ probe_caches (void)
default:
grub_fatal ("Unsupported cache type 0x%x", cache_type);
}
if (grub_arch_cache_dlinesz > grub_arch_cache_ilinesz)
grub_arch_cache_max_linesz = grub_arch_cache_dlinesz;
else
grub_arch_cache_max_linesz = grub_arch_cache_ilinesz;
}
#ifdef GRUB_MACHINE_UBOOT
static void subdivide (grub_uint32_t *table, grub_uint32_t *subtable,
grub_uint32_t addr)
{
grub_uint32_t j;
addr = addr >> 20 << 20;
table[addr >> 20] = (grub_addr_t) subtable | 1;
for (j = 0; j < 256; j++)
subtable[j] = addr | (j << 12)
| (3 << 4) | (3 << 6) | (3 << 8) | (3 << 10)
| (0 << 3) | (1 << 2) | 2;
}
void
grub_arm_enable_caches_mmu (void)
{
grub_uint32_t *table;
grub_uint32_t i;
grub_uint32_t border_crossing = 0;
grub_uint32_t *subtable;
struct sys_info *si = grub_uboot_get_sys_info ();
if (!si || (si->mr_no == 0))
{
grub_printf ("couldn't get memory map, not enabling caches");
grub_errno = GRUB_ERR_NONE;
return;
}
if (type == ARCH_UNKNOWN)
probe_caches ();
for (i = 0; (signed) i < si->mr_no; i++)
{
if (si->mr[i].start & ((1 << 20) - 1))
border_crossing++;
if ((si->mr[i].start + si->mr[i].size) & ((1 << 20) - 1))
border_crossing++;
}
grub_printf ("%d crossers\n", border_crossing);
table = grub_memalign (1 << 14, (1 << 14) + (border_crossing << 10));
if (!table)
{
grub_printf ("couldn't allocate place for MMU table, not enabling caches");
grub_errno = GRUB_ERR_NONE;
return;
}
subtable = table + (1 << 12);
/* Map all unknown as device. */
for (i = 0; i < (1 << 12); i++)
table[i] = (i << 20) | (3 << 10) | (0 << 3) | (1 << 2) | 2;
/*
Device: TEX= 0, C=0, B=1
normal: TEX= 0, C=1, B=1
AP = 3
IMP = 0
Domain = 0
*/
for (i = 0; (signed) i < si->mr_no; i++)
{
if (si->mr[i].start & ((1 << 20) - 1))
{
subdivide (table, subtable, si->mr[i].start);
subtable += (1 << 8);
}
if ((si->mr[i].start + si->mr[i].size) & ((1 << 20) - 1))
{
subdivide (table, subtable, si->mr[i].start + si->mr[i].size);
subtable += (1 << 8);
}
}
for (i = 0; (signed) i < si->mr_no; i++)
if ((si->mr[i].flags & MR_ATTR_MASK) == MR_ATTR_DRAM
|| (si->mr[i].flags & MR_ATTR_MASK) == MR_ATTR_SRAM
|| (si->mr[i].flags & MR_ATTR_MASK) == MR_ATTR_FLASH)
{
grub_uint32_t cur, end;
cur = si->mr[i].start;
end = si->mr[i].start + si->mr[i].size;
while (cur < end)
{
grub_uint32_t *st;
if ((table[cur >> 20] & 3) == 2)
{
cur = cur >> 20 << 20;
table[cur >> 20] = cur | (3 << 10) | (1 << 3) | (1 << 2) | 2;
cur += (1 << 20);
continue;
}
cur = cur >> 12 << 12;
st = (grub_uint32_t *) (table[cur >> 20] & ~0x3ff);
st[(cur >> 12) & 0xff] = cur | (3 << 4) | (3 << 6)
| (3 << 8) | (3 << 10)
| (1 << 3) | (1 << 2) | 2;
cur += (1 << 12);
}
}
grub_printf ("MMU tables generated\n");
if (is_v6_mmu)
grub_arm_clear_mmu_v6 ();
grub_printf ("enabling MMU\n");
grub_arm_enable_mmu (table);
grub_printf ("MMU enabled\n");
}
#endif
void
grub_arch_sync_caches (void *address, grub_size_t len)
{
grub_addr_t start = (grub_addr_t) address;
grub_addr_t end = start + len;
if (type == ARCH_UNKNOWN)
probe_caches ();
start = ALIGN_DOWN (start, grub_arch_cache_max_linesz);
end = ALIGN_UP (end, grub_arch_cache_max_linesz);
switch (type)
{
case ARCH_ARMV6:
grub_arch_sync_caches_armv6 (address, len);
grub_arm_clean_dcache_range_armv6 (start, end, grub_arch_cache_dlinesz);
grub_arm_invalidate_icache_range_armv6 (start, end,
grub_arch_cache_ilinesz);
break;
case ARCH_ARMV7:
grub_arch_sync_caches_armv7 (address, len);
grub_arm_clean_dcache_range_armv7 (start, end, grub_arch_cache_dlinesz);
grub_arm_invalidate_icache_range_armv7 (start, end,
grub_arch_cache_ilinesz);
break;
/* Nothing to do. */
case ARCH_ARMV5_WRITE_THROUGH:
@@ -114,15 +259,13 @@ grub_arm_disable_caches_mmu (void)
probe_caches ();
switch (type)
{
case ARCH_ARMV5_WRITE_THROUGH:
case ARCH_ARMV6_UNIFIED:
case ARCH_ARMV6:
grub_arm_disable_caches_mmu_armv6 ();
break;
case ARCH_ARMV7:
grub_arm_disable_caches_mmu_armv7 ();
break;
/* Nothing to do. */
case ARCH_ARMV5_WRITE_THROUGH:
break;
/* Pacify GCC. */
case ARCH_UNKNOWN:
+30 -1
View File
@@ -41,4 +41,33 @@ FUNCTION(grub_arm_main_id)
FUNCTION(grub_arm_cache_type)
mrc p15, 0, r0, c0, c0, 1
bx lr
bx lr
FUNCTION(grub_arm_clear_mmu_v6)
mov r0, #0
mcr p15, 0, r0, c2, c0, 2
bx lr
FUNCTION(grub_arm_enable_mmu)
mcr p15, 0, r0, c2, c0, 0
mvn r0, #0
mcr p15, 0, r0, c3, c0, 0
mrc p15, 0, r0, c1, c0, 0
bic r0, r0, #(1 << 23)
mcr p15, 0, r0, c1, c0, 0
mrc p15, 0, r0, c1, c0, 0
orr r0, r0, #(1 << 0)
mcr p15, 0, r0, c1, c0, 0
mrc p15, 0, r0, c1, c0, 0
orr r0, r0, #(1 << 2)
mcr p15, 0, r0, c1, c0, 0
mrc p15, 0, r0, c1, c0, 0
orr r0, r0, #(1 << 12)
mcr p15, 0, r0, c1, c0, 0
bx lr
-1
View File
@@ -198,6 +198,5 @@ grub_efi_prepare_platform (void)
if (err != GRUB_ERR_NONE)
return err;
grub_arm_disable_caches_mmu();
return GRUB_ERR_NONE;
}
+1 -1
View File
@@ -51,7 +51,7 @@ FUNCTION(_start)
b codestart
@ Size of final image integrated module blob - set by grub-mkimage
.org _start + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
.org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
VARIABLE(grub_total_module_size)
.long 0
+7 -7
View File
@@ -342,9 +342,9 @@ grub_disk_read_small_real (grub_disk_t disk, grub_disk_addr_t sector,
{
grub_err_t err;
err = (disk->dev->read) (disk, transform_sector (disk, sector),
1 << (GRUB_DISK_CACHE_BITS
+ GRUB_DISK_SECTOR_BITS
- disk->log_sector_size), tmp_buf);
1U << (GRUB_DISK_CACHE_BITS
+ GRUB_DISK_SECTOR_BITS
- disk->log_sector_size), tmp_buf);
if (!err)
{
/* Copy it and store it in the disk cache. */
@@ -366,11 +366,11 @@ grub_disk_read_small_real (grub_disk_t disk, grub_disk_addr_t sector,
sector += (offset >> GRUB_DISK_SECTOR_BITS);
offset &= ((1 << GRUB_DISK_SECTOR_BITS) - 1);
aligned_sector = (sector & ~((1 << (disk->log_sector_size
- GRUB_DISK_SECTOR_BITS))
aligned_sector = (sector & ~((1ULL << (disk->log_sector_size
- GRUB_DISK_SECTOR_BITS))
- 1));
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));
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_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;
len = ((GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS)
- 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)
{
unsigned i;
Elf_Shdr *s;
const Elf_Shdr *s;
grub_size_t tsize = 0, talign = 1;
#if !defined (__i386__) && !defined (__x86_64__)
grub_size_t tramp;
@@ -232,9 +232,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
#endif
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++, 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;
if (talign < s->sh_addralign)
@@ -657,6 +657,8 @@ grub_dl_load_core (void *addr, grub_size_t size)
{
grub_dl_t mod;
grub_boot_time ("Parsing module");
mod = grub_dl_load_core_noinit (addr, size);
if (!mod)
@@ -678,6 +680,8 @@ grub_dl_load_file (const char *filename)
void *core = 0;
grub_dl_t mod = 0;
grub_boot_time ("Loading module %s", filename);
file = grub_file_open (filename);
if (! file)
return 0;
+34 -47
View File
@@ -385,6 +385,34 @@ grub_efi_get_device_path (grub_efi_handle_t handle)
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
}
static void
dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor)
{
grub_uint32_t vendor_data_len = vendor->header.length - sizeof (*vendor);
grub_printf ("/%sVendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)[%x: ",
type,
(unsigned) vendor->vendor_guid.data1,
(unsigned) vendor->vendor_guid.data2,
(unsigned) vendor->vendor_guid.data3,
(unsigned) vendor->vendor_guid.data4[0],
(unsigned) vendor->vendor_guid.data4[1],
(unsigned) vendor->vendor_guid.data4[2],
(unsigned) vendor->vendor_guid.data4[3],
(unsigned) vendor->vendor_guid.data4[4],
(unsigned) vendor->vendor_guid.data4[5],
(unsigned) vendor->vendor_guid.data4[6],
(unsigned) vendor->vendor_guid.data4[7],
vendor_data_len);
if (vendor->header.length > sizeof (*vendor))
{
grub_uint32_t i;
for (i = 0; i < vendor_data_len; i++)
grub_printf ("%02x ", vendor->vendor_defined_data[i]);
}
grub_printf ("]");
}
/* Print the chain of Device Path nodes. This is mainly for debugging. */
void
grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -444,21 +472,8 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
}
break;
case GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE:
{
grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
(unsigned) vendor->vendor_guid.data1,
(unsigned) vendor->vendor_guid.data2,
(unsigned) vendor->vendor_guid.data3,
(unsigned) vendor->vendor_guid.data4[0],
(unsigned) vendor->vendor_guid.data4[1],
(unsigned) vendor->vendor_guid.data4[2],
(unsigned) vendor->vendor_guid.data4[3],
(unsigned) vendor->vendor_guid.data4[4],
(unsigned) vendor->vendor_guid.data4[5],
(unsigned) vendor->vendor_guid.data4[6],
(unsigned) vendor->vendor_guid.data4[7]);
}
dump_vendor_path ("Hardware",
(grub_efi_vendor_device_path_t *) dp);
break;
case GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE:
{
@@ -663,22 +678,8 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
}
break;
case GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE:
{
grub_efi_vendor_messaging_device_path_t *vendor
= (grub_efi_vendor_messaging_device_path_t *) dp;
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
(unsigned) vendor->vendor_guid.data1,
(unsigned) vendor->vendor_guid.data2,
(unsigned) vendor->vendor_guid.data3,
(unsigned) vendor->vendor_guid.data4[0],
(unsigned) vendor->vendor_guid.data4[1],
(unsigned) vendor->vendor_guid.data4[2],
(unsigned) vendor->vendor_guid.data4[3],
(unsigned) vendor->vendor_guid.data4[4],
(unsigned) vendor->vendor_guid.data4[5],
(unsigned) vendor->vendor_guid.data4[6],
(unsigned) vendor->vendor_guid.data4[7]);
}
dump_vendor_path ("Messaging",
(grub_efi_vendor_device_path_t *) dp);
break;
default:
grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype);
@@ -719,22 +720,8 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
}
break;
case GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE:
{
grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
(unsigned) vendor->vendor_guid.data1,
(unsigned) vendor->vendor_guid.data2,
(unsigned) vendor->vendor_guid.data3,
(unsigned) vendor->vendor_guid.data4[0],
(unsigned) vendor->vendor_guid.data4[1],
(unsigned) vendor->vendor_guid.data4[2],
(unsigned) vendor->vendor_guid.data4[3],
(unsigned) vendor->vendor_guid.data4[4],
(unsigned) vendor->vendor_guid.data4[5],
(unsigned) vendor->vendor_guid.data4[6],
(unsigned) vendor->vendor_guid.data4[7]);
}
dump_vendor_path ("Media",
(grub_efi_vendor_device_path_t *) dp);
break;
case GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE:
{
+1
View File
@@ -21,6 +21,7 @@
#include <config-util.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define _GNU_SOURCE 1
#include <stdlib.h>
+4
View File
@@ -98,6 +98,8 @@ static struct argp_option options[] = {
{ 0, 0, 0, 0, 0, 0 }
};
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char *
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
{
const char *dev_map;
+2
View File
@@ -67,6 +67,8 @@ grub_file_open (const char *name)
const char *file_name;
grub_file_filter_id_t filter;
grub_boot_time ("Opening '%s'", name);
device_name = grub_file_get_device_name (name);
if (grub_errno)
goto fail;
+1 -1
View File
@@ -135,7 +135,7 @@ LOCAL(prot_to_real_addr):
.macro REAL_TO_PROT
movl LOCAL(real_to_prot_addr), %eax
DATA32 call *%ax
calll *%eax
.endm
/*
+1 -1
View File
@@ -28,7 +28,7 @@
_start:
jmp codestart
. = _start + GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR
.org GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR
VARIABLE(grub_core_entry_addr)
.long 0
+5 -5
View File
@@ -54,7 +54,7 @@ protstack:
.endm
.macro REAL_TO_PROT
DATA32 call real_to_prot
calll real_to_prot
.endm
/*
@@ -137,7 +137,7 @@ real_to_prot:
/* load the GDT register */
xorw %ax, %ax
movw %ax, %ds
DATA32 ADDR32 lgdt gdtdesc
lgdtl gdtdesc
/* turn on protected mode */
movl %cr0, %eax
@@ -145,7 +145,7 @@ real_to_prot:
movl %eax, %cr0
/* jump to relocation, flush prefetch queue, and reload %cs */
DATA32 ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg
ljmpl $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg
.code32
protcseg:
@@ -237,7 +237,7 @@ tmpcseg:
movl %eax, %cr0
/* flush prefetch queue, reload %cs */
DATA32 ljmp $0, $realcseg
ljmpl $0, $realcseg
realcseg:
/* we are in real mode now
@@ -258,6 +258,6 @@ realcseg:
#endif
/* return on new stack! */
DATA32 ret
retl
.code32
+3 -3
View File
@@ -271,7 +271,7 @@ grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
grub_ieee1275_cell_t mode;
grub_ieee1275_cell_t size;
grub_ieee1275_cell_t virt;
#ifdef GRUB_MACHINE_SPARC64
#ifdef __sparc__
grub_ieee1275_cell_t phys_high;
#endif
grub_ieee1275_cell_t phys_low;
@@ -279,7 +279,7 @@ grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
} args;
INIT_IEEE1275_COMMON (&args.common, "call-method",
#ifdef GRUB_MACHINE_SPARC64
#ifdef __sparc__
7,
#else
6,
@@ -287,7 +287,7 @@ grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
1);
args.method = (grub_ieee1275_cell_t) "map";
args.ihandle = grub_ieee1275_mmu;
#ifdef GRUB_MACHINE_SPARC64
#ifdef __sparc__
args.phys_high = 0;
#endif
args.phys_low = phys;
+1 -1
View File
@@ -36,7 +36,7 @@ start:
bal cont
nop
. = _start + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
.org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
VARIABLE(grub_total_modules_size)
.long 0
+1 -1
View File
@@ -27,7 +27,7 @@ _start:
ba codestart
mov %o4, %o0
. = EXT_C(_start) + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
.org GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
VARIABLE(grub_total_module_size)
.word 0
+31 -2
View File
@@ -30,6 +30,8 @@
#include <grub/uboot/disk.h>
#include <grub/uboot/uboot.h>
#include <grub/uboot/api_public.h>
#include <grub/cpu/system.h>
#include <grub/cache.h>
extern char __bss_start[];
extern char _end[];
@@ -69,6 +71,19 @@ uboot_timer_ms (void)
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
grub_machine_init (void)
{
@@ -93,6 +108,11 @@ grub_machine_init (void)
/* Enumerate memory and initialize the memory management system. */
grub_uboot_mm_init ();
/* Should be earlier but it needs memalign. */
#ifdef __arm__
grub_arm_enable_caches_mmu ();
#endif
grub_dprintf ("init", "__bss_start: %p\n", __bss_start);
grub_dprintf ("init", "_end: %p\n", _end);
grub_dprintf ("init", "grub_modbase: %p\n", (void *) grub_modbase);
@@ -106,8 +126,17 @@ grub_machine_init (void)
grub_uboot_probe_hardware ();
/* Initialise timer */
timer_start = grub_uboot_get_timer (0);
grub_install_get_time_ms (uboot_timer_ms);
#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);
grub_install_get_time_ms (uboot_timer_ms);
}
/* Initialize */
grub_ubootdisk_init ();
+11 -11
View File
@@ -35,22 +35,22 @@ static const struct grub_arg_option help_options[] =
};
/* 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)
{
while (opt->doc)
{
if (opt->shortarg == c)
return (struct grub_arg_option *) opt;
return opt;
opt++;
}
return 0;
}
static struct grub_arg_option *
static const struct grub_arg_option *
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)
found = fnd_short (options, c);
@@ -60,11 +60,11 @@ find_short (const struct grub_arg_option *options, char c)
switch (c)
{
case 'h':
found = (struct grub_arg_option *) help_options;
found = help_options;
break;
case 'u':
found = (struct grub_arg_option *) (help_options + 1);
found = (help_options + 1);
break;
default:
@@ -76,23 +76,23 @@ find_short (const struct grub_arg_option *options, char c)
}
/* 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)
{
while (opt->doc)
{
if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) &&
opt->longarg[len] == '\0')
return (struct grub_arg_option *) opt;
return opt;
opt++;
}
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)
{
struct grub_arg_option *found = 0;
const struct grub_arg_option *found = 0;
if (options)
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++)
{
char *arg = argv[curarg];
struct grub_arg_option *opt;
const struct grub_arg_option *opt;
char *option = 0;
/* 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,
void *out, const void *in, grub_size_t size)
{
const grub_uint8_t *inptr;
grub_uint8_t *outptr, *end;
const grub_uint8_t *inptr, *end;
grub_uint8_t *outptr;
if (!cipher->cipher->decrypt)
return GPG_ERR_NOT_SUPPORTED;
if (size % cipher->cipher->blocksize != 0)
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;
inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize)
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,
void *out, const void *in, grub_size_t size)
{
const grub_uint8_t *inptr;
grub_uint8_t *outptr, *end;
const grub_uint8_t *inptr, *end;
grub_uint8_t *outptr;
if (!cipher->cipher->encrypt)
return GPG_ERR_NOT_SUPPORTED;
if (size % cipher->cipher->blocksize != 0)
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;
inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize)
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
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)
{
grub_uint8_t *inptr, *outptr, *end;
grub_uint8_t *outptr;
const grub_uint8_t *inptr, *end;
void *iv;
if (!cipher->cipher->decrypt)
return GPG_ERR_NOT_SUPPORTED;
if (size % cipher->cipher->blocksize != 0)
return GPG_ERR_INV_ARG;
end = (grub_uint8_t *) in + size;
end = (const grub_uint8_t *) in + size;
iv = iv_in;
for (inptr = in, outptr = out; inptr < end;
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 *iv)
{
const grub_uint8_t *inptr;
grub_uint8_t *outptr, *end;
const grub_uint8_t *inptr, *end;
grub_uint8_t *outptr;
grub_uint8_t ivt[GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE];
if (!cipher->cipher->decrypt)
return GPG_ERR_NOT_SUPPORTED;
@@ -271,7 +272,7 @@ grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher,
return GPG_ERR_INV_ARG;
if (cipher->cipher->blocksize > GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE)
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;
inptr += cipher->cipher->blocksize, outptr += cipher->cipher->blocksize)
{
+9 -9
View File
@@ -37,7 +37,7 @@ grub_disk_cache_invalidate (unsigned long dev_id, unsigned long disk_id,
unsigned cache_index;
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 = grub_disk_cache_table + cache_index;
@@ -63,8 +63,8 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE)
return -1;
aligned_sector = (sector & ~((1 << (disk->log_sector_size
- GRUB_DISK_SECTOR_BITS)) - 1));
aligned_sector = (sector & ~((1ULL << (disk->log_sector_size
- GRUB_DISK_SECTOR_BITS)) - 1));
real_offset = offset + ((sector - aligned_sector) << GRUB_DISK_SECTOR_BITS);
sector = aligned_sector;
@@ -77,14 +77,14 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t len;
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)
return grub_errno;
part = disk->partition;
disk->partition = 0;
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)
{
disk->partition = part;
@@ -93,7 +93,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
}
disk->partition = part;
len = (1 << disk->log_sector_size) - real_offset;
len = (1U << disk->log_sector_size) - real_offset;
if (len > size)
len = size;
@@ -110,7 +110,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
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;
size -= len;
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 n;
len = size & ~((1 << disk->log_sector_size) - 1);
len = size & ~((1ULL << disk->log_sector_size) - 1);
n = size >> disk->log_sector_size;
if (n > (disk->max_agglomerate
@@ -137,7 +137,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
while (n--)
{
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;
+39 -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
functions in this file and returns success, the other functions are
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)
|| (grub_fdt_get_totalsize (fdt) > size)
|| (grub_fdt_get_version (fdt) < FDT_SUPPORTED_VERSION)
|| (grub_fdt_get_last_comp_version (fdt) > FDT_SUPPORTED_VERSION)
|| (grub_fdt_get_off_dt_struct (fdt) & 0x00000003)
@@ -284,6 +283,15 @@ int grub_fdt_check_header (void *fdt, unsigned int size)
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. */
int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset,
const char *name)
@@ -423,3 +431,32 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
grub_memcpy (prop + 3, val, len);
return 0;
}
int
grub_fdt_create_empty_tree (void *fdt, unsigned int size)
{
struct grub_fdt_empty_tree *et;
if (size < GRUB_FDT_EMPTY_TREE_SZ)
return -1;
grub_memset (fdt, 0, size);
et = fdt;
et->empty_node.tree_end = grub_cpu_to_be32_compile_time (FDT_END);
et->empty_node.node_end = grub_cpu_to_be32_compile_time (FDT_END_NODE);
et->empty_node.node_start = grub_cpu_to_be32_compile_time (FDT_BEGIN_NODE);
((struct grub_fdt_empty_tree *) fdt)->header.off_mem_rsvmap =
grub_cpu_to_be32 (ALIGN_UP (sizeof (grub_fdt_header_t), 8));
grub_fdt_set_off_dt_strings (fdt, sizeof (*et));
grub_fdt_set_off_dt_struct (fdt,
sizeof (et->header) + sizeof (et->empty_rsvmap));
grub_fdt_set_version (fdt, FDT_SUPPORTED_VERSION);
grub_fdt_set_last_comp_version (fdt, FDT_SUPPORTED_VERSION);
grub_fdt_set_size_dt_struct (fdt, sizeof (et->empty_node));
grub_fdt_set_totalsize (fdt, size);
grub_fdt_set_magic (fdt, FDT_MAGIC);
return 0;
}
+2
View File
@@ -24,6 +24,8 @@
#include <grub/i386/pc/vesa_modes_table.h>
#include <grub/i18n.h>
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
struct legacy_command
{
const char *name;
+158 -27
View File
@@ -44,15 +44,112 @@ static char *linux_args;
static grub_uint32_t machine_type;
static void *fdt_addr;
typedef void (*kernel_entry_t) (int, unsigned long, void *);
#define LINUX_ZIMAGE_OFFSET 0x24
#define LINUX_ZIMAGE_MAGIC 0x016f2818
#define ARM_FDT_MACHINE_TYPE 0xFFFFFFFF
#define LINUX_PHYS_OFFSET (0x00008000)
#define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
#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():
* Prepares a loaded FDT for being passed to Linux.
@@ -128,20 +225,44 @@ static grub_err_t
linux_boot (void)
{
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,
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_dprintf ("loader", "Kernel at: 0x%x\n", linux_addr);
err = linux_prepare_fdt ();
if (err)
return err;
grub_dprintf ("loader", "FDT @ 0x%p\n", fdt_addr);
if (fdt_valid)
{
grub_err_t err;
err = linux_prepare_fdt ();
if (err)
return err;
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");
@@ -154,14 +275,19 @@ linux_boot (void)
linuxmain = (kernel_entry_t) linux_addr;
#ifdef GRUB_MACHINE_EFI
err = grub_efi_prepare_platform();
if (err != GRUB_ERR_NONE)
return err;
{
grub_err_t err;
err = grub_efi_prepare_platform();
if (err != GRUB_ERR_NONE)
return err;
}
#endif
grub_arm_disable_caches_mmu ();
linuxmain (0, machine_type, fdt_addr);
return err;
return grub_error (GRUB_ERR_BAD_OS, "Linux call returned");
}
/*
@@ -173,8 +299,6 @@ linux_load (const char *filename, grub_file_t file)
int size;
size = grub_file_size (file);
if (size == 0)
return grub_error (GRUB_ERR_BAD_OS, "empty kernel");
#ifdef GRUB_MACHINE_EFI
linux_addr = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_PHYS_OFFSET, size);
@@ -194,11 +318,16 @@ linux_load (const char *filename, grub_file_t file)
return grub_errno;
}
if (*(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET)
!= LINUX_ZIMAGE_MAGIC)
{
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("invalid zImage"));
}
if (size > LINUX_ZIMAGE_OFFSET + 4
&& *(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"));
linux_size = size;
@@ -281,14 +410,15 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
size = grub_get_initrd_size (&initrd_ctx);
if (initrd_start)
grub_free ((void *) initrd_start);
#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);
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;
}
#else
@@ -347,7 +477,7 @@ grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)),
fdt_addr = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size);
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;
}
#else
@@ -367,7 +497,7 @@ grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)),
* We've successfully loaded an FDT, so any machine type passed
* from firmware is now obsolete.
*/
machine_type = ARM_FDT_MACHINE_TYPE;
machine_type = GRUB_ARM_MACHINE_TYPE_FDT;
out:
grub_file_close (dtb);
@@ -384,10 +514,11 @@ GRUB_MOD_INIT (linux)
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
0, N_("Load initrd."));
cmd_devicetree = grub_register_command ("devicetree", grub_cmd_devicetree,
/* TRANSLATORS: DTB stands for device tree blob. */
0, N_("Load DTB file."));
my_mod = mod;
fdt_addr = (void *) firmware_get_boot_data ();
machine_type = firmware_get_machine_type ();
fdt_addr = (void *) grub_arm_firmware_get_boot_data ();
machine_type = grub_arm_firmware_get_machine_type ();
}
GRUB_MOD_FINI (linux)
+487
View File
@@ -0,0 +1,487 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/charset.h>
#include <grub/command.h>
#include <grub/err.h>
#include <grub/file.h>
#include <grub/fdt.h>
#include <grub/linux.h>
#include <grub/loader.h>
#include <grub/mm.h>
#include <grub/types.h>
#include <grub/cpu/linux.h>
#include <grub/efi/efi.h>
#include <grub/efi/pe32.h>
#include <grub/i18n.h>
#include <grub/lib/cmdline.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_EFI_PAGE_SHIFT 12
#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> GRUB_EFI_PAGE_SHIFT)
#define GRUB_EFI_PE_MAGIC 0x5A4D
static grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
static grub_dl_t my_mod;
static int loaded;
static void *kernel_addr;
static grub_uint64_t kernel_size;
static char *linux_args;
static grub_uint32_t cmdline_size;
static grub_addr_t initrd_start;
static grub_addr_t initrd_end;
static void *loaded_fdt;
static void *fdt;
static void *
get_firmware_fdt (void)
{
grub_efi_configuration_table_t *tables;
void *firmware_fdt = NULL;
unsigned int i;
/* Look for FDT in UEFI config tables. */
tables = grub_efi_system_table->configuration_table;
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
{
firmware_fdt = tables[i].vendor_table;
grub_dprintf ("linux", "found registered FDT @ 0x%p\n", firmware_fdt);
break;
}
return firmware_fdt;
}
static void
get_fdt (void)
{
void *raw_fdt;
grub_size_t size;
if (fdt)
{
size = BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt));
grub_efi_free_pages ((grub_efi_physical_address_t) fdt, size);
}
if (loaded_fdt)
raw_fdt = loaded_fdt;
else
raw_fdt = get_firmware_fdt();
size =
raw_fdt ? grub_fdt_get_totalsize (raw_fdt) : GRUB_FDT_EMPTY_TREE_SZ;
size += 0x400;
grub_dprintf ("linux", "allocating %ld bytes for fdt\n", size);
fdt = grub_efi_allocate_pages (0, BYTES_TO_PAGES (size));
if (!fdt)
return;
if (raw_fdt)
{
grub_memmove (fdt, raw_fdt, size);
grub_fdt_set_totalsize (fdt, size);
}
else
{
grub_fdt_create_empty_tree (fdt, size);
}
}
static grub_err_t
check_kernel (struct grub_arm64_linux_kernel_header *lh)
{
if (lh->magic != GRUB_ARM64_LINUX_MAGIC)
return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");
if ((lh->code0 & 0xffff) != GRUB_EFI_PE_MAGIC)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
N_("plain Image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
grub_dprintf ("linux", "UEFI stub kernel:\n");
grub_dprintf ("linux", "text_offset = 0x%012llx\n",
(long long unsigned) lh->text_offset);
grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset);
return GRUB_ERR_NONE;
}
static grub_err_t
finalize_params (void)
{
grub_efi_boot_services_t *b;
grub_efi_status_t status;
int node, retval;
get_fdt ();
if (!fdt)
goto failure;
node = grub_fdt_find_subnode (fdt, 0, "chosen");
if (node < 0)
node = grub_fdt_add_subnode (fdt, 0, "chosen");
if (node < 1)
goto failure;
/* Set initrd info */
if (initrd_start && initrd_end > initrd_start)
{
grub_dprintf ("linux", "Initrd @ 0x%012lx-0x%012lx\n",
initrd_start, initrd_end);
retval = grub_fdt_set_prop64 (fdt, node, "linux,initrd-start",
initrd_start);
if (retval)
goto failure;
retval = grub_fdt_set_prop64 (fdt, node, "linux,initrd-end",
initrd_end);
if (retval)
goto failure;
}
b = grub_efi_system_table->boot_services;
status = b->install_configuration_table (&fdt_guid, fdt);
if (status != GRUB_EFI_SUCCESS)
goto failure;
grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n",
fdt);
return GRUB_ERR_NONE;
failure:
grub_efi_free_pages ((grub_efi_physical_address_t) fdt,
BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt)));
fdt = NULL;
return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
}
static grub_err_t
grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
grub_file_t dtb;
void *blob = NULL;
int size;
if (!loaded)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,
N_("you need to load the kernel first"));
return GRUB_ERR_BAD_OS;
}
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
if (loaded_fdt)
grub_free (loaded_fdt);
loaded_fdt = NULL;
dtb = grub_file_open (argv[0]);
if (!dtb)
goto out;
size = grub_file_size (dtb);
blob = grub_malloc (size);
if (!blob)
goto out;
if (grub_file_read (dtb, blob, size) < size)
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), argv[0]);
goto out;
}
if (grub_fdt_check_header (blob, size) != 0)
{
grub_error (GRUB_ERR_BAD_OS, N_("invalid device tree"));
goto out;
}
out:
if (dtb)
grub_file_close (dtb);
if (blob)
{
if (grub_errno == GRUB_ERR_NONE)
loaded_fdt = blob;
else
grub_free (blob);
}
return grub_errno;
}
static grub_err_t
grub_linux_boot (void)
{
grub_efi_memory_mapped_device_path_t *mempath;
grub_efi_handle_t image_handle;
grub_efi_boot_services_t *b;
grub_efi_status_t status;
grub_err_t retval;
grub_efi_loaded_image_t *loaded_image;
int len;
retval = finalize_params();
if (retval != GRUB_ERR_NONE)
return retval;
mempath = grub_malloc (2 * sizeof (grub_efi_memory_mapped_device_path_t));
if (!mempath)
return grub_errno;
mempath[0].header.type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE;
mempath[0].header.subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE;
mempath[0].header.length = grub_cpu_to_le16_compile_time (sizeof (*mempath));
mempath[0].memory_type = GRUB_EFI_LOADER_DATA;
mempath[0].start_address = (grub_addr_t) kernel_addr;
mempath[0].end_address = (grub_addr_t) kernel_addr + kernel_size;
mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE;
mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
mempath[1].header.length = 0;
b = grub_efi_system_table->boot_services;
status = b->load_image (0, grub_efi_image_handle,
(grub_efi_device_path_t *) mempath,
kernel_addr, kernel_size, &image_handle);
if (status != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_BAD_OS, "cannot load image");
grub_dprintf ("linux", "linux command line: '%s'\n", linux_args);
/* Convert command line to UCS-2 */
loaded_image = grub_efi_get_loaded_image (image_handle);
loaded_image->load_options_size = len =
(grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t);
loaded_image->load_options =
grub_efi_allocate_pages (0,
BYTES_TO_PAGES (loaded_image->load_options_size));
if (!loaded_image->load_options)
return grub_errno;
loaded_image->load_options_size =
2 * grub_utf8_to_utf16 (loaded_image->load_options, len,
(grub_uint8_t *) linux_args, len, NULL);
grub_dprintf("linux", "starting image %p\n", image_handle);
status = b->start_image (image_handle, 0, NULL);
/* When successful, not reached */
b->unload_image (image_handle);
grub_efi_free_pages ((grub_efi_physical_address_t) loaded_image->load_options,
BYTES_TO_PAGES (loaded_image->load_options_size));
return grub_errno;
}
static grub_err_t
grub_linux_unload (void)
{
grub_dl_unref (my_mod);
loaded = 0;
if (initrd_start)
grub_efi_free_pages ((grub_efi_physical_address_t) initrd_start,
BYTES_TO_PAGES (initrd_end - initrd_start));
initrd_start = initrd_end = 0;
grub_free (linux_args);
if (kernel_addr)
grub_efi_free_pages ((grub_efi_physical_address_t) kernel_addr,
BYTES_TO_PAGES (kernel_size));
if (fdt)
grub_efi_free_pages ((grub_efi_physical_address_t) fdt,
BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt)));
return GRUB_ERR_NONE;
}
static grub_err_t
grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
struct grub_linux_initrd_context initrd_ctx;
int initrd_size, initrd_pages;
void *initrd_mem = NULL;
if (argc == 0)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (!loaded)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,
N_("you need to load the kernel first"));
goto fail;
}
if (grub_initrd_init (argc, argv, &initrd_ctx))
goto fail;
initrd_size = grub_get_initrd_size (&initrd_ctx);
grub_dprintf ("linux", "Loading initrd\n");
initrd_pages = (BYTES_TO_PAGES (initrd_size));
initrd_mem = grub_efi_allocate_pages (0, initrd_pages);
if (!initrd_mem)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
goto fail;
}
if (grub_initrd_load (&initrd_ctx, argv, initrd_mem))
goto fail;
initrd_start = (grub_addr_t) initrd_mem;
initrd_end = initrd_start + initrd_size;
grub_dprintf ("linux", "[addr=%p, size=0x%x]\n",
(void *) initrd_start, initrd_size);
fail:
grub_initrd_close (&initrd_ctx);
if (initrd_mem && !initrd_start)
grub_efi_free_pages ((grub_efi_physical_address_t) initrd_mem,
initrd_pages);
return grub_errno;
}
static grub_err_t
grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
grub_file_t file = 0;
struct grub_arm64_linux_kernel_header lh;
grub_dl_ref (my_mod);
if (argc == 0)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
file = grub_file_open (argv[0]);
if (!file)
goto fail;
kernel_size = grub_file_size (file);
if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh))
return grub_errno;
if (check_kernel (&lh) != GRUB_ERR_NONE)
goto fail;
grub_loader_unset();
grub_dprintf ("linux", "kernel file size: %lld\n", (long long) kernel_size);
kernel_addr = grub_efi_allocate_pages (0, BYTES_TO_PAGES (kernel_size));
grub_dprintf ("linux", "kernel numpages: %lld\n",
(long long) BYTES_TO_PAGES (kernel_size));
if (!kernel_addr)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
goto fail;
}
grub_file_seek (file, 0);
if (grub_file_read (file, kernel_addr, kernel_size)
< (grub_int64_t) kernel_size)
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), argv[0]);
goto fail;
}
grub_dprintf ("linux", "kernel @ %p\n", kernel_addr);
cmdline_size = grub_loader_cmdline_size (argc, argv) + sizeof (LINUX_IMAGE);
linux_args = grub_malloc (cmdline_size);
if (!linux_args)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
goto fail;
}
grub_memcpy (linux_args, LINUX_IMAGE, sizeof (LINUX_IMAGE));
grub_create_loader_cmdline (argc, argv,
linux_args + sizeof (LINUX_IMAGE) - 1,
cmdline_size);
if (grub_errno == GRUB_ERR_NONE)
{
grub_loader_set (grub_linux_boot, grub_linux_unload, 0);
loaded = 1;
}
fail:
if (file)
grub_file_close (file);
if (grub_errno != GRUB_ERR_NONE)
{
grub_dl_unref (my_mod);
loaded = 0;
}
if (linux_args && !loaded)
grub_free (linux_args);
if (kernel_addr && !loaded)
grub_efi_free_pages ((grub_efi_physical_address_t) kernel_addr,
BYTES_TO_PAGES (kernel_size));
return grub_errno;
}
static grub_command_t cmd_linux, cmd_initrd, cmd_devicetree;
GRUB_MOD_INIT (linux)
{
cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0,
N_("Load Linux."));
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, 0,
N_("Load initrd."));
cmd_devicetree =
grub_register_command ("devicetree", grub_cmd_devicetree, 0,
N_("Load DTB file."));
my_mod = mod;
}
GRUB_MOD_FINI (linux)
{
grub_unregister_command (cmd_linux);
grub_unregister_command (cmd_initrd);
grub_unregister_command (cmd_devicetree);
}
+1 -2
View File
@@ -89,8 +89,7 @@ struct piwg_full_device_path
.subtype = GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE, \
.length = sizeof (struct grub_efi_piwg_device_path) \
}, \
.guid = {0x2B0585EB, 0xD8B8, 0x49A9, {0x8B, 0x8C, 0xE2, 0x1B, \
0x01, 0xAE, 0xF2, 0xB7}} \
.guid = GRUB_EFI_VENDOR_APPLE_GUID \
}, \
.end = \
{ \
+2 -1
View File
@@ -249,7 +249,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
if (! dp)
{
grub_error (GRUB_ERR_BAD_DEVICE, "not a valid root device");
grub_error (GRUB_ERR_BAD_DEVICE, "not a valid root device (%p, %p)",
dev_handle, dp);
goto fail;
}
+29
View File
@@ -1,4 +1,33 @@
#!/bin/sh
# User-controllable options
grub_modinfo_target_cpu=@target_cpu@
grub_modinfo_platform=@platform@
grub_disk_cache_stats=@DISK_CACHE_STATS@
grub_boot_time_stats=@BOOT_TIME_STATS@
grub_have_font_source=@HAVE_FONT_SOURCE@
# Autodetected config
grub_have_asm_uscore=@HAVE_ASM_USCORE@
grub_bss_start_symbol="@BSS_START_SYMBOL@"
grub_end_symbol="@END_SYMBOL@"
# Build environment
grub_target_cc='@TARGET_CC@'
grub_target_cflags='@TARGET_CFLAGS@'
grub_target_cppflags='@TARGET_CPPFLAGS@'
grub_target_ccasflags='@TARGET_CCASFLAGS@'
grub_target_ldflags='@TARGET_LDFLAGS@'
grub_target_strip='@TARGET_STRIP@'
grub_target_nm='@TARGET_NM@'
grub_target_ranlib='@TARGET_RANLIB@'
grub_target_objconf='@TARGET_OBJCONV@'
grub_target_obj2elf='@TARGET_OBJ2ELF@'
# Version
grub_version="@VERSION@"
grub_package="@PACKAGE@"
grub_package_string="@PACKAGE_STRING@"
grub_package_version="@PACKAGE_VERSION@"
grub_package_name="@PACKAGE_NAME@"
grub_package_bugreport="@PACKAGE_BUGREPORT@"
+1 -1
View File
@@ -415,7 +415,7 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
else
{
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_ERR_NONE;
+11 -6
View File
@@ -194,14 +194,13 @@ grub_normal_init_page (struct grub_term_output *term,
{
grub_ssize_t msg_len;
int posx;
const char *msg = _("GNU GRUB version %s");
char *msg_formatted;
grub_uint32_t *unicode_msg;
grub_uint32_t *last_position;
grub_term_cls (term);
msg_formatted = grub_xasprintf (msg, PACKAGE_VERSION);
msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
if (!msg_formatted)
return;
@@ -231,12 +230,18 @@ read_lists (const char *val)
{
if (! grub_no_modules)
{
grub_boot_time ("Reading commands");
read_command_list (val);
grub_boot_time ("Reading filesystems");
read_fs_list (val);
grub_boot_time ("Reading crypto");
read_crypto_list (val);
grub_boot_time ("Reading terminal");
read_terminal_list (val);
}
grub_boot_time ("Reading gettext");
grub_gettext_reread_prefix (val);
grub_boot_time ("Lists reread");
}
static char *
@@ -350,13 +355,13 @@ static grub_err_t
grub_normal_reader_init (int nested)
{
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.");
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)
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
{
const char *msg = _("Use the %C and %C keys to select which "
"entry is highlighted.");
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);
if (!msg_translated)
return 0;
@@ -430,9 +430,6 @@ grub_menu_init_page (int nested, int edit,
static void
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;
char *msg_translated = 0;
@@ -441,9 +438,9 @@ menu_text_print_timeout (int timeout, void *dataptr)
if (data->timeout_msg == TIMEOUT_TERSE
|| data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN)
msg_translated = grub_xasprintf (msg_terse, timeout);
msg_translated = grub_xasprintf (_("%ds"), timeout);
else
msg_translated = grub_xasprintf (msg, timeout);
msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout);
if (!msg_translated)
{
grub_print_error ();
@@ -459,7 +456,7 @@ menu_text_print_timeout (int timeout, void *dataptr)
if (data->timeout_msg == TIMEOUT_TERSE)
{
grub_free (msg_translated);
msg_translated = grub_xasprintf (msg_terse, timeout);
msg_translated = grub_xasprintf (_("%ds"), timeout);
if (grub_term_width (data->term) < 10)
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);
}
else
grub_util_warn (_("cannot open config file `%s': %s"),
grub_util_warn (_("cannot open configuration file `%s': %s"),
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 \
disabled."
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"));
}
+8 -115
View File
@@ -198,124 +198,17 @@ char *
grub_util_devmapper_part_to_disk (struct stat *st,
int *is_part, const char *path)
{
struct dm_tree *tree;
uint32_t maj, min;
struct dm_tree_node *node = NULL, *child;
void *handle;
const char *node_uuid, *mapper_name = NULL, *child_uuid, *child_name;
int major, minor;
tree = dm_tree_create ();
if (! tree)
if (grub_util_get_dm_node_linear_info (st->st_rdev,
&major, &minor, 0))
{
grub_util_info ("dm_tree_create failed");
goto devmapper_out;
*is_part = 1;
return grub_find_device ("/dev",
(major << 8) | minor);
}
maj = major (st->st_rdev);
min = minor (st->st_rdev);
if (! dm_tree_add_dev (tree, maj, min))
{
grub_util_info ("dm_tree_add_dev failed");
goto devmapper_out;
}
node = dm_tree_find_node (tree, maj, min);
if (! node)
{
grub_util_info ("dm_tree_find_node failed");
goto devmapper_out;
}
reiterate:
node_uuid = dm_tree_node_get_uuid (node);
if (! node_uuid)
{
grub_util_info ("%s has no DM uuid", path);
goto devmapper_out;
}
if (strncmp (node_uuid, "LVM-", 4) == 0)
{
grub_util_info ("%s is an LVM", path);
goto devmapper_out;
}
if (strncmp (node_uuid, "mpath-", 6) == 0)
{
/* Multipath partitions have partN-mpath-* UUIDs, and are
linear mappings so are handled by
grub_util_get_dm_node_linear_info. Multipath disks are not
linear mappings and must be handled specially. */
grub_util_info ("%s is a multipath disk", path);
goto devmapper_out;
}
if (strncmp (node_uuid, "DMRAID-", 7) != 0)
{
int major, minor;
const char *node_name;
grub_util_info ("%s is not DM-RAID", path);
if ((node_name = dm_tree_node_get_name (node))
&& grub_util_get_dm_node_linear_info (node_name,
&major, &minor, 0))
{
*is_part = 1;
if (tree)
dm_tree_free (tree);
char *ret = grub_find_device ("/dev",
(major << 8) | minor);
return ret;
}
goto devmapper_out;
}
handle = NULL;
/* Counter-intuitively, device-mapper refers to the disk-like
device containing a DM-RAID partition device as a "child" of
the partition device. */
child = dm_tree_next_child (&handle, node, 0);
if (! child)
{
grub_util_info ("%s has no DM children", path);
goto devmapper_out;
}
child_uuid = dm_tree_node_get_uuid (child);
if (! child_uuid)
{
grub_util_info ("%s child has no DM uuid", path);
goto devmapper_out;
}
else if (strncmp (child_uuid, "DMRAID-", 7) != 0)
{
grub_util_info ("%s child is not DM-RAID", path);
goto devmapper_out;
}
child_name = dm_tree_node_get_name (child);
if (! child_name)
{
grub_util_info ("%s child has no DM name", path);
goto devmapper_out;
}
mapper_name = child_name;
*is_part = 1;
node = child;
goto reiterate;
devmapper_out:
if (! mapper_name && node)
{
/* This is a DM-RAID disk, not a partition. */
mapper_name = dm_tree_node_get_name (node);
if (! mapper_name)
grub_util_info ("%s has no DM name", path);
}
char *ret;
if (mapper_name)
ret = xasprintf ("/dev/mapper/%s", mapper_name);
else
ret = NULL;
if (tree)
dm_tree_free (tree);
return ret;
*is_part = 0;
return xstrdup (path);
}
int
+7 -6
View File
@@ -83,7 +83,7 @@ grub_util_device_is_mapped (const char *dev)
}
int
grub_util_get_dm_node_linear_info (const char *dev,
grub_util_get_dm_node_linear_info (dev_t dev,
int *maj, int *min,
grub_disk_addr_t *st)
{
@@ -97,14 +97,16 @@ grub_util_get_dm_node_linear_info (const char *dev,
grub_disk_addr_t partstart = 0;
const char *node_uuid;
major = major (dev);
minor = minor (dev);
while (1)
{
dmt = dm_task_create(DM_DEVICE_TABLE);
if (!dmt)
break;
if (! (first ? dm_task_set_name (dmt, dev)
: dm_task_set_major_minor (dmt, major, minor, 0)))
if (! (dm_task_set_major_minor (dmt, major, minor, 0)))
{
dm_task_destroy (dmt);
break;
@@ -117,8 +119,7 @@ grub_util_get_dm_node_linear_info (const char *dev,
}
node_uuid = dm_task_get_uuid (dmt);
if (node_uuid && (strncmp (node_uuid, "LVM-", 4) == 0
|| strncmp (node_uuid, "mpath-", 6) == 0
|| strncmp (node_uuid, "DMRAID-", 7) == 0))
|| strncmp (node_uuid, "mpath-", 6) == 0))
{
dm_task_destroy (dmt);
break;
@@ -190,7 +191,7 @@ grub_util_device_is_mapped (const char *dev __attribute__ ((unused)))
}
int
grub_util_get_dm_node_linear_info (const char *dev __attribute__ ((unused)),
grub_util_get_dm_node_linear_info (dev_t dev __attribute__ ((unused)),
int *maj __attribute__ ((unused)),
int *min __attribute__ ((unused)),
grub_disk_addr_t *st __attribute__ ((unused)))
+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);
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)
grub_util_error (_("`%s' is not a local disk"), dev);
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)
{
*parent = NULL;
+1 -1
View File
@@ -888,7 +888,7 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
return path;
}
char *
static char *
grub_util_get_raid_grub_dev (const char *os_dev)
{
char *grub_dev = NULL;
+10 -3
View File
@@ -237,6 +237,8 @@ have_devfs (void)
return dev_devfsd_exists;
}
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int
grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
{
@@ -286,6 +288,7 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
{
grub_util_fd_t fd;
grub_disk_addr_t start;
struct stat st;
sprintf (p, format, i);
@@ -298,14 +301,16 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
return 0;
}
missing = 0;
close (fd);
if (!grub_util_device_is_mapped (real_dev)
|| !grub_util_get_dm_node_linear_info (real_dev, 0, 0, &start))
if (fstat (fd, &st) < 0
|| !grub_util_device_is_mapped_stat (&st)
|| !grub_util_get_dm_node_linear_info (st.st_rdev, 0, 0, &start))
start = grub_util_find_partition_start_os (real_dev);
/* We don't care about errors here. */
grub_errno = GRUB_ERR_NONE;
close (fd);
if (start == sector)
{
struct linux_partition_cache *new_cache_item;
@@ -325,6 +330,8 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
return 0;
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
void
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);
}
else
grub_util_warn (_("cannot open config file `%s': %s"),
grub_util_warn (_("cannot open configuration file `%s': %s"),
cfgfile, strerror (errno));
}
+12 -9
View File
@@ -116,6 +116,7 @@
#include <sys/mount.h>
#endif
#if !defined (__GNU__)
static void
strip_extra_slashes (char *dir)
{
@@ -155,7 +156,6 @@ xgetcwd (void)
return path;
}
#if !defined (__GNU__)
char **
grub_util_find_root_devices_from_poolname (char *poolname)
{
@@ -443,17 +443,18 @@ grub_find_device (const char *dir, dev_t dev)
/* Found! */
char *res;
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 ();
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);
free (cwd);
@@ -763,6 +764,8 @@ grub_util_biosdisk_is_floppy (grub_disk_t disk)
#else
#include <grub/emu/getroot.h>
void
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;
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);
}
+1 -1
View File
@@ -52,6 +52,6 @@ grub_util_load_config (struct grub_util_config *cfg)
fclose (f);
}
else
grub_util_warn (_("cannot open config file `%s': %s"),
grub_util_warn (_("cannot open configuration file `%s': %s"),
cfgfile, strerror (errno));
}
+1 -1
View File
@@ -94,7 +94,7 @@ get_platform (void)
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;
}
+6
View File
@@ -229,6 +229,9 @@ grub_partition_msdos_iterate (grub_disk_t disk,
}
#ifdef GRUB_UTIL
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static grub_err_t
pc_partition_map_embed (struct grub_disk *disk, unsigned int *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. "
"core.img won't fit in it."));
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
#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},
{"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},
{"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},
{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;
else
return grub_error (GRUB_ERR_BAD_ARGUMENT,
N_("unsupported serial port flow"));
N_("unsupported serial port flow control"));
}
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
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);
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
static inline void
save_char(int c)
{
+1 -1
View File
@@ -46,5 +46,5 @@ message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
.byte 0
. = base + 510
.org 510
.short 0xaa55
+6 -8
View File
@@ -23,15 +23,15 @@
#define LINUX_ZIMAGE_OFFSET 0x24
#define LINUX_ZIMAGE_MAGIC 0x016f2818
#define ARM_FDT_MACHINE_TYPE 0xFFFFFFFF
#include "system.h"
#if defined GRUB_MACHINE_UBOOT
# include <grub/uboot/uboot.h>
# define LINUX_ADDRESS (start_of_ram + 0x8000)
# define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
# define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000)
# define firmware_get_boot_data grub_uboot_get_boot_data
# define firmware_get_machine_type grub_uboot_get_machine_type
# define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data
# define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type
#elif defined GRUB_MACHINE_EFI
# include <grub/efi/efi.h>
# include <grub/machine/loader.h>
@@ -41,19 +41,17 @@
# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
static inline grub_addr_t
firmware_get_boot_data (void)
grub_arm_firmware_get_boot_data (void)
{
return 0;
}
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
#define FDT_ADDITIONAL_ENTRIES_SIZE 0x300
typedef void (*kernel_entry_t) (int, unsigned long, void *);
#endif /* ! GRUB_LINUX_CPU_HEADER */
+12 -1
View File
@@ -1,7 +1,18 @@
#ifndef GRUB_SYSTEM_CPU_HEADER
#define GRUB_SYSTEM_CPU_HEADER
void grub_arm_disable_caches_mmu (void);
#include <grub/types.h>
enum
{
GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI = 3138,
GRUB_ARM_MACHINE_TYPE_FDT = 0xFFFFFFFF
};
void EXPORT_FUNC(grub_arm_disable_caches_mmu) (void);
void grub_arm_enable_caches_mmu (void);
void grub_arm_enable_mmu (grub_uint32_t *mmu_tables);
void grub_arm_clear_mmu_v6 (void);
#endif /* ! GRUB_SYSTEM_CPU_HEADER */
+1 -1
View File
@@ -27,6 +27,6 @@
#endif /* ! ASM_FILE */
#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 */
+41
View File
@@ -0,0 +1,41 @@
/*
* 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_LINUX_CPU_HEADER
#define GRUB_LINUX_CPU_HEADER 1
#include <grub/efi/efi.h>
#define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */
/* From linux/Documentation/arm64/booting.txt */
struct grub_arm64_linux_kernel_header
{
grub_uint32_t code0; /* Executable code */
grub_uint32_t code1; /* Executable code */
grub_uint64_t text_offset; /* Image load offset */
grub_uint64_t res0; /* reserved */
grub_uint64_t res1; /* reserved */
grub_uint64_t res2; /* reserved */
grub_uint64_t res3; /* reserved */
grub_uint64_t res4; /* reserved */
grub_uint32_t magic; /* Magic number, little endian, "ARM\x64" */
grub_uint32_t hdr_offset; /* Offset of PE/COFF header */
};
#endif /* ! GRUB_LINUX_CPU_HEADER */
+5
View File
@@ -45,4 +45,9 @@ grub_arch_sync_dma_caches (void *address __attribute__ ((unused)),
#endif
#endif
#ifdef __arm__
void
grub_arm_cache_enable (void);
#endif
#endif /* ! GRUB_CACHE_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))
{
/* We've already checked that all pointers are aligned. */
*(grub_uint64_t *) (void *) outptr
= (*(grub_uint64_t *) (void *) in1ptr
^ *(grub_uint64_t *) (void *) in2ptr);
= (*(const grub_uint64_t *) (const void *) in1ptr
^ *(const grub_uint64_t *) (const void *) in2ptr);
in1ptr += sizeof (grub_uint64_t);
in2ptr += 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);
gcry_err_code_t
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);
gcry_err_code_t
grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher,
+10 -8
View File
@@ -276,6 +276,16 @@
{ 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 } \
}
#define GRUB_EFI_DEVICE_TREE_GUID \
{ 0xb1b621d5, 0xf19c, 0x41a5, \
{ 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \
}
#define GRUB_EFI_VENDOR_APPLE_GUID \
{ 0x2B0585EB, 0xD8B8, 0x49A9, \
{ 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \
}
struct grub_efi_sal_system_table
{
grub_uint32_t signature;
@@ -811,14 +821,6 @@ typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
struct grub_efi_vendor_messaging_device_path
{
grub_efi_device_path_t header;
grub_efi_packed_guid_t vendor_guid;
grub_efi_uint8_t vendor_defined_data[0];
} GRUB_PACKED;
typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t;
/* Media Device Path. */
#define GRUB_EFI_MEDIA_DEVICE_PATH_TYPE 4
+7 -1
View File
@@ -61,7 +61,7 @@ char *
grub_util_get_os_disk (const char *os_dev);
int
grub_util_get_dm_node_linear_info (const char *dev,
grub_util_get_dm_node_linear_info (dev_t dev,
int *maj, int *min,
grub_disk_addr_t *st);
@@ -75,6 +75,12 @@ grub_hostdisk_find_partition_start_os (const char *dev);
void
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
{
char *dev;
+21
View File
@@ -36,6 +36,19 @@ typedef struct {
grub_uint32_t size_dt_struct;
} grub_fdt_header_t;
struct grub_fdt_empty_tree {
grub_fdt_header_t header;
grub_uint64_t empty_rsvmap[2];
struct {
grub_uint32_t node_start;
grub_uint8_t name[1];
grub_uint32_t node_end;
grub_uint32_t tree_end;
} empty_node;
};
#define GRUB_FDT_EMPTY_TREE_SZ sizeof (struct grub_fdt_empty_tree)
#define grub_fdt_get_header(fdt, field) \
grub_be_to_cpu32(((const grub_fdt_header_t *)(fdt))->field)
#define grub_fdt_set_header(fdt, field, value) \
@@ -82,7 +95,9 @@ typedef struct {
#define grub_fdt_set_size_dt_struct(fdt, value) \
grub_fdt_set_header(fdt, size_dt_struct, value)
int grub_fdt_create_empty_tree (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,
const char *name);
int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset,
@@ -96,4 +111,10 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
grub_fdt_set_prop ((fdt), (nodeoffset), (name), &_val, 4); \
})
#define grub_fdt_set_prop64(fdt, nodeoffset, name, val) \
({ \
grub_uint64_t _val = grub_cpu_to_be64(val); \
grub_fdt_set_prop ((fdt), (nodeoffset), (name), &_val, 8); \
})
#endif /* ! GRUB_FDT_HEADER */
+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,
grub_off_t *keyoffset);
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);
grub_err_t
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)
{
int negative = 0;
unsigned long magnitude;
unsigned long long magnitude;
while (*str && grub_isspace (*str))
str++;
+1 -1
View File
@@ -405,7 +405,7 @@ grub_unicode_estimate_width (const struct grub_unicode_glyph *c);
#else
static inline grub_ssize_t
static inline grub_size_t
grub_unicode_estimate_width (const struct grub_unicode_glyph *c __attribute__ ((unused)))
{
if (grub_unicode_get_comb_type (c->base))
Loaded 100 of 129 files, more files were not shown because too many files have changed in this diff. Show more