- 07 Mar, 2018 1 commit
-
-
Eric Snowberg authored
The grub_mkimage_load_image function (commit 7542af69, mkimage: refactor a bunch of section data into a struct.) introduces a build regression on SPARC: cc1: warnings being treated as errors In file included from util/grub-mkimage32.c:23: util/grub-mkimagexx.c: In function 'grub_mkimage_load_image32': util/grub-mkimagexx.c:1968: error: missing initializer util/grub-mkimagexx.c:1968: error: (near initialization for 'smd.sections') make[2]: *** [util/grub_mkimage-grub-mkimage32.o] Error 1 Initialize the entire section_metadata structure. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
- 05 Mar, 2018 17 commits
-
-
dann frazier authored
This can cause an issue where GRUB is trying to display both a text and graphical menu on the display at the same time, resulting in a flickering effect when e.g. scrolling quickly through a menu (LP: #1752767). Revert for now while we look for a better solution for the original issue. This reverts commit 52ef7b23. Signed-off-by:
dann frazier <dann.frazier@canonical.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
Return the 64bit number of blocks of storage associated with the device or instance. Where a "block" is a unit of storage consisting of the number of bytes returned by the package's "block-size" method. If the size cannot be determined, or if the number of blocks exceeds the range return -1. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
Return the number of blocks of storage associated with the device or instance. Where a "block" is a unit of storage consisting of the number of bytes returned by the package's "block-size" method. If the size cannot be determined, the #blocks method returns the maximum unsigned integer (which, because of Open Firmware's assumption of two's complement arithmetic, is equivalent to the signed number -1). If the number of blocks exceeds the range of an unsigned number, return 0 to alert the caller to try the #blocks64 command. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
IEEE Std 1275-1994 Standard for Boot (Initialization Configuration) Firmware: Core Requirements and Practices 3.8.3 deblocker support package Any package that uses the "deblocker" support package must define the following method, which the deblocker uses as a low-level interface to the device block-size ( -- block-len ) Return "granularity" for accesses to this device. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Daniel Kiper authored
IEEE 1275-1994 Standard for Boot (Initialization Configuration) Firmware: Core Requirements and Practices E.3.2.2 Bus-specific methods for bus nodes A package implementing the scsi-2 device type shall implement the following bus-specific method: no-data-command ( cmd-addr -- error? ) Executes a simple SCSI command, automatically retrying under certain conditions. cmd-addr is the address of a 6-byte command buffer containing an SCSI command that does not have a data transfer phase. Executes the command, retrying indefinitely with the same retry criteria as retry-command. error? is nonzero if an error occurred, zero otherwise. NOTE no-data-command is a convenience function. It provides no capabilities that are not present in retry-command, but for those commands that meet its restrictions, it is easier to use. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
IEEE 1275-1994 Standard for Boot (Initialization Configuration) Firmware: Core Requirements and Practices E.3.2.2 Bus-specific methods for bus nodes A package implementing the scsi-2 device type shall implement the following bus-specific method: set-address ( unit# target# -- ) Sets the SCSI target number (0x0..0xf) and unit number (0..7) to which subsequent commands apply. This function is for devices with #address-cells == 2 Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
Convert physical address to text unit-string. Convert phys.lo ... phys-high, the numerical representation, to unit-string, the text string representation of a physical address within the address space defined by this device node. The number of cells in the list phys.lo ... phys.hi is determined by the value of the #address-cells property of this node. This function is for devices with #address-cells == 4 Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
decode-unit ( addr len -- phys.lo ... phys.hi ) Convert text unit-string to physical address. Convert unit-string, the text string representation, to phys.lo ... phys.hi, the numerical representation of a physical address within the address space defined by this device node. The number of cells in the list phys.lo ... phys.hi is determined by the value of the #address-cells property of this node. This function is for devices with #address-cells == 4 Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
Limit NVMe of_path_of_nvme to just SPARC hardware for now. It has been found that non-Open Firmware hardware platforms can some how access this function. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
John Paul Adrian Glaubitz authored
The of_path_of_nvme function (commit 2391d579, ieee1275: add nvme support within ofpath) introduced a functional regression: On systems which are not based on Open Firmware but have at least one NVME device, find_obppath will return NULL and thus trying to append the disk name to of_path will result in a crash. The proper behavior of of_path_of_nvme is, however, to just return NULL in such cases, like other users of find_obppath, such as of_path_of_scsi. Signed-off-by:
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Reviewed-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Peter Jones authored
This way debuginfo built from the .module will still include this information, but the final result won't have the data we don't actually need in the modules, either on-disk, loaded at runtime, or in prebuilt images. Signed-off-by:
Peter Jones <pjones@redhat.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Peter Jones authored
Some versions of gcc include a plugin called "annobin", and in some build systems this is enabled by default. This plugin creates special ELF note sections to track which ABI-breaking features are used by a binary, as well as a series of relocations to annotate where. If grub is compiled with this feature, then when grub-mkimage translates the binary to another file format which does not strongly associate relocation data with sections (i.e. when platform is *-efi), these relocations appear to be against the .text section rather than the original note section. When the binary is loaded by the PE runtime loader, hilarity ensues. This issue is not necessarily limited to the annobin, but could arise any time there are relocations in sections that are not represented in grub-mkimage's output. This patch seeks to avoid this issue by only including relocations that refer to sections which will be included in the final binary. As an aside, this should also obviate the need to avoid -funwind-tables, -fasynchronous-unwind-tables, and any sections similar to .eh_frame in the future. I've tested it on x86-64-efi with the following gcc command line options (as recorded by -grecord-gcc-flags), but I still need to test the result on some other platforms that have been problematic in the past (especially ARM Aarch64) before I feel comfortable making changes to the configure.ac bits: GNU C11 7.2.1 20180116 (Red Hat 7.2.1-7) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -mno-stack-arg-probe -mcmodel=large -mno-red-zone -m64 -mtune=generic -march=x86-64 -g3 -Os -freg-struct-return -fno-stack-protector -ffreestanding -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing -fstack-clash-protection -fno-ident -fplugin=annobin Signed-off-by:
Peter Jones <pjones@redhat.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Peter Jones authored
This basically moves a bunch of the section information we pass around a lot into a struct, and passes a pointer to a single one of those instead. This shouldn't change the binary file output or the "grub-mkimage -v" output in any way. Signed-off-by:
Peter Jones <pjones@redhat.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Peter Jones authored
This puts both kinds of address initialization at the same place, and also lets us iterate through the section list one time fewer. Signed-off-by:
Peter Jones <pjones@redhat.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Peter Jones authored
This renames some things: - the "strtab" and "strtab_section" in relocate_symbols are changed to "symtab" instead, so as to be less confusing when "strtab" is moved to a struct in a later patch. - The places where we pass section_vaddresses to functions are changed to also be called section_vaddresses"inside those functions, so I get less confused when I put addresses and vaddresses in a struct in a later patch. Signed-off-by:
Peter Jones <pjones@redhat.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Peter Jones authored
This makes it so you can treat grub-mkimagexx.c as a file you can build directly, so syntax checkers like vim's "syntastic" plugin, which uses "gcc -x c -fsyntax-only" to build it, will work. One still has to do whatever setup is required to make it pick the right include dirs, which -W options we use, etc., but this makes it so you can do the checking on the file you're editing, rather than on a different file. Signed-off-by:
Peter Jones <pjones@redhat.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Peter Jones authored
grub_aout_load() has a grub_file_t parameter, and depending on what order includes land in, it's sometimes not defined. This patch explicitly adds file.h to aout.h so that it will always be defined. Signed-off-by:
Peter Jones <pjones@redhat.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
- 26 Feb, 2018 1 commit
-
-
Joakim Bech authored
The of_path_of_nvme function (commit 2391d579, ieee1275: add nvme support within ofpath) introduced a build regression: grub-core/osdep/linux/ofpath.c:365:21: error: comparison between pointer and zero character constant [-Werror=pointer-compare] if ((digit_string != '\0') && (*part_end == 'p')) Update digit_string to compare against the char instead of the pointer. Signed-off-by:
Joakim Bech <joakim.bech@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
- 23 Feb, 2018 12 commits
-
-
Leif Lindholm authored
<grub/machine/loader.h> (for machine arm/efi) and <grub/machine/kernel.h> (for machine arm/coreboot) will not always resolve (and will likely not be valid to) if pulled in when building non-native commands, such as host tools or the "file" command. So explicitly include them with their expanded pathnames. Signed-off-by:
Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Leif Lindholm authored
Use kernel header struct and magic definition to align (and coexist) with i386/arm64 ports. Signed-off-by:
Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Leif Lindholm authored
Change GRUB_ARM64_LINUX_MAGIC to GRUB_LINUX_ARM64_MAGIC_SIGNATURE. Signed-off-by:
Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Leif Lindholm authored
Rename struct grub_arm64_linux_kernel_header -> linux_arm64_kernel_header. Signed-off-by:
Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Leif Lindholm authored
struct linux_kernel_header -> struct linux_i386_kernel_header Signed-off-by:
Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Leif Lindholm authored
Rename GRUB_LINUX_MAGIC_SIGNATURE GRUB_LINUX_I386_MAGIC_SIGNATURE, to be usable in code that supports more than one image type. Signed-off-by:
Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Leif Lindholm authored
Replace uses of GRUB_LINUX_MACHINE_HEADER and GRUB_LINUX_CPU_HEADER with GRUB_<arch>_LINUX_HEADER include guards to prevent issues when including more than one of them. Signed-off-by:
Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Leif Lindholm authored
The EFI page definitions and macros are generic and should not be confined to arm64 headers - so move to efi/memory.h. Also add EFI_PAGE_SIZE macro. Update loader sources to reflect new header location. Signed-off-by:
Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Colin Watson authored
The CRC implementation imported from libgcrypt 1.5.3 is arguably non-free, due to being encumbered by the restrictive Internet Society licence on RFCs (see e.g. https://wiki.debian.org/NonFreeIETFDocuments). Fortunately, libgcrypt has since replaced it with a version that is both reportedly better-optimised and doesn't suffer from this encumbrance. The ideal solution would be to update to a new version of libgcrypt, and I spent some time trying to do that. However, util/import_gcry.py requires complex modifications to cope with the new version, and I stalled part-way through; furthermore, GRUB's libgcrypt tree already contains some backports of upstream changes. Rather than allowing the perfect to be the enemy of the good, I think it's best to backport this single change to at least sort out the licensing situation. Doing so won't make things any harder for a future wholesale upgrade. This commit is mostly a straightforward backport of https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=06e122baa3321483a47bbf82fd2a4540becfa0c9, but I also imported bufhelp.h from libgcrypt 1.7.0 (newer versions required further changes elsewhere). I've tested that "hashsum -h crc32" still produces correct output for a variety of files on both i386-pc and x86_64-emu targets. Signed-off-by:
Colin Watson <cjwatson@ubuntu.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
Add NVMe support within ofpath. The Open Firmware text representation for a NVMe device contains the Namespace ID. An invalid namespace ID is one whose value is zero or whose value is greater than the value reported by the Number of Namespaces (NN) field in the Identify Controller data structure. At the moment only a single Namespace is supported, therefore the value is currently hard coded to one. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Daniel Kiper authored
The definition of bpb's num_total_sectors_16 and num_total_sectors_32 is that either the 16-bit field is non-zero and is used (in which case eg mkfs.fat sets the 32-bit field to zero), or it is zero and the 32-bit field is used. Therefore, a BPB is invalid only if *both* fields are zero; having one field as zero and the other as non-zero is the case to be expected. (Indeed, according to Microsoft's specification one of the fields *must* be zero, and the other non-zero.) This affects all users of grub_chainloader_patch_bpb which are in chainloader.c, freedos.c, and ntldr.c Some descriptions of the semantics of these two fields: https://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html The old 2-byte fields "total number of sectors" and "number of sectors per FAT" are now zero; this information is now found in the new 4-byte fields. (Here given in the FAT32 EBPB section but the total sectors 16/32 bit fields semantic is true of FAT12 and FAT16 too.) https://wiki.osdev.org/FAT#BPB_.28BIOS_Parameter_Block.29 19 | 2 | The total sectors in the logical volume. If this value is 0, it means there are more than 65535 sectors in the volume, and the actual count is stored in "Large Sectors (bytes 32-35). 32 | 4 | Large amount of sector on media. This field is set if there are more than 65535 sectors in the volume. (Doesn't specify what the "large" field is set to when unused, but as mentioned mkfs.fat sets it to zero then.) https://technet.microsoft.com/en-us/library/cc976796.aspx 0x13 | WORD | 0x0000 | Small Sectors . The number of sectors on the volume represented in 16 bits (< 65,536). For volumes larger than 65,536 sectors, this field has a value of zero and the Large Sectors field is used instead. 0x20 | DWORD | 0x01F03E00 | Large Sectors . If the value of the Small Sectors field is zero, this field contains the total number of sectors in the FAT16 volume. If the value of the Small Sectors field is not zero, the value of this field is zero. https://staff.washington.edu/dittrich/misc/fatgen103.pdf page 10 BPB_TotSec16 | 19 | 2 | This field is the old 16-bit total count of sectors on the volume. This count includes the count of all sectors in all four regions of the volume. This field can be 0; if it is 0, then BPB_TotSec32 must be non-zero. For FAT32 volumes, this field must be 0. For FAT12 and FAT16 volumes, this field contains the sector count, and BPB_TotSec32 is 0 if the total sector count “fits” (is less than 0x10000). BPB_TotSec32 | 32 | 4 | This field is the new 32-bit total count of sectors on the volume. This count includes the count of all sectors in all four regions of the volume. This field can be 0; if it is 0, then BPB_TotSec16 must be non-zero. For FAT32 volumes, this field must be non-zero. For FAT12/FAT16 volumes, this field contains the sector count if BPB_TotSec16 is 0 (count is greater than or equal to 0x10000). (This specifies that an unused BPB_TotSec32 field is set to zero.) By the way fix offsets in include/grub/fat.h. Tested with lDebug booted in qemu via grub2's FreeDOS direct loading support, refer to https://bitbucket.org/ecm/ldosboot + https://bitbucket.org/ecm/ldebugSigned-off-by:
C. Masloch <pushbx@38.de> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
H.J. Lu authored
Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for 32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as R_X86_64_PC32. Signed-off-by:
H.J. Lu <hjl.tools@gmail.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
- 14 Feb, 2018 3 commits
-
-
Steve McIntyre authored
Code is currently ignoring errors from efibootmgr, giving users clearly bogus output like: Setting up grub-efi-amd64 (2.02~beta3-4) ... Installing for x86_64-efi platform. Could not delete variable: No space left on device Could not prepare Boot variable: No space left on device Installation finished. No error reported. and then potentially unbootable systems. If efibootmgr fails, grub-install should know that and report it! We've been using similar patch in Debian now for some time, with no ill effects. Signed-off-by:
Steve McIntyre <93sam@debian.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
Fix the Open Firmware (OF) path property for sun4v SPARC systems. These platforms do not have a /sas/ within their path. Over time different OF addressing schemes have been supported. There is no generic addressing scheme that works across every HBA. It looks that this functionality will not work if you try to cross-install SPARC GRUB2 binary using e.g. x86 grub-install. By default it should work. However, we will also have other issues here, like lack of access to OF firmware/paths, which make such configs unusable anyway. So, let's leave this patch as is for time being. If somebody cares then he/she should fix the issue(s) at some point. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Signed-off-by:
Daniel Kiper <daniel.kiper@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
Add block-list GPT support for SPARC. The OBP "load" and "boot" methods are partition aware and neither command can see the partition table. Also neither command can address the entire physical disk. When the install happens, grub generates the block-list entries based on the beginning of the physical disk, not the beginning of the partition. This patch fixes the block-list entries so they match what OBP expects during boot for a GPT disk. T5 and above now supports GPT as well as VTOC. This patch has been tested on T5-2 and newer SPARC systems. Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
- 29 Jan, 2018 2 commits
-
-
Stefan Fritsch authored
Check the error bits in the interrupt status register. According to the AHCI 1.2 spec, "Interrupt sources that are disabled (‘0’) are still reflected in the status registers.", so this should work even though grub uses polling This fixes the following problem on a Fujitsu E744 laptop: Sometimes there is a very long delay (up to several minutes) when booting from hard disk. It seems accessing the DVD drive (which has no disk inserted) sometimes fails with some errors, which leads to each access being stalled until the 20s timeout triggers. This seems to happen when grub is trying to read filesystem/partition data. The problem is that the command_issue bit that is checked in the loop is only reset if the "HBA receives a FIS which clears the BSY, DRQ, and ERR bits for the command", but the ERR bit is never cleared. Therefore command_issue is never reset and grub waits for the timeout. The relevant bit in our case is the Task File Error Status (TFES), which is equivalent to the ERR bit 0 in tfd. But this patch also checks the other error bits except for the "Interface non-fatal error status" bit. Signed-off-by:
Stefan Fritsch <fritsch@genua.de> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
dann frazier authored
grub-mkconfig will set GRUB_TERMINAL_OUTPUT to "gfxterm" unless the user has overridden it. On EFI systems, this will stop output from going to the default "console" terminal. When the EFI fw console is configured to output to both serial and video, this will cause GRUB to only display on video - while continuing to accept input from both video and serial. Instead of switching from "console" to "gfxterm", let's output to both. Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
- 06 Dec, 2017 3 commits
-
-
Julien Grall authored
The properties #address-cells and #size-cells are used to know the number of cells for ranges provided by "regs". If they don't exist, the value are resp. 2 and 1. Currently, when multiboot nodes are created it is assumed that #address-cells and #size-cells are exactly 2. However, they are never set by GRUB and will result to later failure when the device-tree is generated by GRUB or contain different values. To prevent this failure, create the both properties in the chosen nodes. Signed-off-by:
Julien Grall <julien.grall@linaro.org> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Jordan Glover authored
grub-mkconfig detects detached RSA signatures for kernel images used for signature checking as valid images and adds them to grub.cfg as separate menu entries. This patch adds .sig extension to common blacklist. Signed-off-by:
Jordan Glover <Golden_Miller83@protonmail.ch> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
Eric Snowberg authored
Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-
- 28 Nov, 2017 1 commit
-
-
Eric Snowberg authored
Signed-off-by:
Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by:
Daniel Kiper <daniel.kiper@oracle.com>
-