1. 23 Feb, 2018 3 commits
    • Eric Snowberg's avatar
      ieee1275: add nvme support within ofpath · 2391d579
      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: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • Daniel Kiper's avatar
      chainloader: Fix wrong break condition (must be AND not, OR) · ae2a2745
      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:
        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.)
        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.)
        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
        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: default avatarC. Masloch <pushbx@38.de>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • H.J. Lu's avatar
      x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32 · 842c3904
      H.J. Lu authored
      Starting from binutils commit 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
      Signed-off-by: default avatarH.J. Lu <hjl.tools@gmail.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
  2. 14 Feb, 2018 3 commits
    • Steve McIntyre's avatar
      Make grub-install check for errors from efibootmgr · 6400613a
      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: default avatarSteve McIntyre <93sam@debian.org>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • Eric Snowberg's avatar
      sparc64: fix OF path names for sun4v systems · d85c76b5
      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: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Signed-off-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • Eric Snowberg's avatar
      sparc64: Add blocklist GPT support for SPARC · 69e0a67b
      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: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
  3. 29 Jan, 2018 2 commits
    • Stefan Fritsch's avatar
      ahci: Improve error handling · 566a03a6
      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"
      Signed-off-by: default avatarStefan Fritsch <fritsch@genua.de>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • dann frazier's avatar
      Keep the native terminal active when enabling gfxterm · 52ef7b23
      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: default avatarDaniel Kiper <daniel.kiper@oracle.com>
  4. 06 Dec, 2017 3 commits
  5. 28 Nov, 2017 1 commit
  6. 24 Nov, 2017 1 commit
  7. 06 Oct, 2017 1 commit
  8. 07 Sep, 2017 5 commits
    • Alexander Graf's avatar
      efi: Free malloc regions on exit · 92bfc33d
      Alexander Graf authored
      When we exit grub, we don't free all the memory that we allocated earlier
      for our heap region. This can cause problems with setups where you try
      to descend the boot order using "exit" entries, such as PXE -> HD boot
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • Alexander Graf's avatar
      efi: Move grub_reboot() into kernel · 0ba90a7f
      Alexander Graf authored
      The reboot function calls machine_fini() and then reboots the system.
      Currently it lives in lib/ which means it gets compiled into the
      reboot module which lives on the heap.
      In a following patch, I want to free the heap on machine_fini()
      though, so we would free the memory that the code is running in. That
      obviously breaks with smarter UEFI implementations.
      So this patch moves it into the core. That way we ensure that all
      code running after machine_fini() in the UEFI case is running from
      memory that got allocated (and gets deallocated) by the UEFI core.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • Konrad Rzeszutek Wilk's avatar
      Use grub-file to figure out whether multiboot2 should be used for Xen.gz · b4d709b6
      Konrad Rzeszutek Wilk authored
      The multiboot2 is much more preferable than multiboot. Especiall
      if booting under EFI where multiboot does not have the functionality
      to pass ImageHandler.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • Konrad Rzeszutek Wilk's avatar
      Fix util/grub.d/20_linux_xen.in: Add xen_boot command support for aarch64 · a8e0f1ad
      Konrad Rzeszutek Wilk authored
      Commit d33045ce introduced
      the support for this, but it does not work under x86 (as it stops
      20_linux_xen from running).
      The 20_linux_xen is run under a shell and any exits from within it:
      (For example on x86):
      + /usr/bin/grub2-file --is-arm64-efi /boot/xen-4.9.0.gz
      [root@tst063 grub]# echo $?
      will result in 20_linux_xen exiting without continuing
      and also causing grub2-mkconfig to stop processing.
      As in:
       [root@tst063 grub]# ./grub-mkconfig | tail
       Generating grub configuration file ...
       Found linux image: /boot/vmlinuz-4.13.0-0.rc5.git1.1.fc27.x86_64
       Found initrd image: /boot/initramfs-4.13.0-0.rc5.git1.1.fc27.x86_64.img
       Found linux image: /boot/vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2
       Found initrd image: /boot/initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img
       		echo	'Loading Linux 0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 ...'
       		linux	/vmlinuz-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2 root=/dev/mapper/fedora_tst063-root ro single
       		echo	'Loading initial ramdisk ...'
       		initrd	/initramfs-0-rescue-ec082ee24aea41b9b16aca52a6d10cc2.img
       ### END /usr/local/etc/grub.d/10_linux ###
       ### BEGIN /usr/local/etc/grub.d/20_linux_xen ###
       root@tst063 grub]#
      And no more.
      This patch wraps the invocation of grub-file to be a in subshell
      and to process the return value in a conditional. That fixes
      the issue.
      RH-BZ 1486002: grub2-mkconfig does not work if xen.gz is installed.
      CC: Fu Wei <fu.wei@linaro.org>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    • Vladimir Serbinenko's avatar
      Fix compilation for x86_64-efi. · 78d2b81b
      Vladimir Serbinenko authored
  9. 05 Sep, 2017 1 commit
  10. 30 Aug, 2017 9 commits
  11. 14 Aug, 2017 10 commits
  12. 07 Aug, 2017 1 commit