1. 10 7月, 2014 1 次提交
    • M
      x86/efi: Include a .bss section within the PE/COFF headers · c7fb93ec
      Michael Brown 提交于
      The PE/COFF headers currently describe only the initialised-data
      portions of the image, and result in no space being allocated for the
      uninitialised-data portions.  Consequently, the EFI boot stub will end
      up overwriting unexpected areas of memory, with unpredictable results.
      
      Fix by including a .bss section in the PE/COFF headers (functionally
      equivalent to the init_size field in the bzImage header).
      Signed-off-by: NMichael Brown <mbrown@fensystems.co.uk>
      Cc: Thomas Bächler <thomas@archlinux.org>
      Cc: Josh Boyer <jwboyer@fedoraproject.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      c7fb93ec
  2. 05 3月, 2014 3 次提交
    • M
      x86, tools: Fix up compiler warnings · b663a685
      Matt Fleming 提交于
      The kbuild test robot reported the following errors that were introduced
      with commit 993c30a0 ("x86, tools: Consolidate #ifdef code"),
      
        arch/x86/boot/tools/build.c: In function 'update_pecoff_setup_and_reloc':
      >> arch/x86/boot/tools/build.c:252:1: error: parameter name omitted
          static inline void update_pecoff_setup_and_reloc(unsigned int) {}
          ^
        arch/x86/boot/tools/build.c: In function 'update_pecoff_text':
      >> arch/x86/boot/tools/build.c:253:1: error: parameter name omitted
          static inline void update_pecoff_text(unsigned int, unsigned int) {}
          ^
      >> arch/x86/boot/tools/build.c:253:1: error: parameter name omitted
      
         arch/x86/boot/tools/build.c: In function 'main':
      >> arch/x86/boot/tools/build.c:372:2: warning: implicit declaration of function 'efi_stub_entry_update' [-Wimplicit-function-declaration]
          efi_stub_entry_update();
          ^
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      b663a685
    • M
      x86/efi: Firmware agnostic handover entry points · b8ff87a6
      Matt Fleming 提交于
      The EFI handover code only works if the "bitness" of the firmware and
      the kernel match, i.e. 64-bit firmware and 64-bit kernel - it is not
      possible to mix the two. This goes against the tradition that a 32-bit
      kernel can be loaded on a 64-bit BIOS platform without having to do
      anything special in the boot loader. Linux distributions, for one thing,
      regularly run only 32-bit kernels on their live media.
      
      Despite having only one 'handover_offset' field in the kernel header,
      EFI boot loaders use two separate entry points to enter the kernel based
      on the architecture the boot loader was compiled for,
      
          (1) 32-bit loader: handover_offset
          (2) 64-bit loader: handover_offset + 512
      
      Since we already have two entry points, we can leverage them to infer
      the bitness of the firmware we're running on, without requiring any boot
      loader modifications, by making (1) and (2) valid entry points for both
      CONFIG_X86_32 and CONFIG_X86_64 kernels.
      
      To be clear, a 32-bit boot loader will always use (1) and a 64-bit boot
      loader will always use (2). It's just that, if a single kernel image
      supports (1) and (2) that image can be used with both 32-bit and 64-bit
      boot loaders, and hence both 32-bit and 64-bit EFI.
      
      (1) and (2) must be 512 bytes apart at all times, but that is already
      part of the boot ABI and we could never change that delta without
      breaking existing boot loaders anyhow.
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      b8ff87a6
    • M
      x86, tools: Consolidate #ifdef code · 993c30a0
      Matt Fleming 提交于
      Instead of littering main() with #ifdef CONFIG_EFI_STUB, move the logic
      into separate functions that do nothing if the config option isn't set.
      This makes main() much easier to read.
      Acked-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      993c30a0
  3. 27 9月, 2013 1 次提交
  4. 19 6月, 2013 1 次提交
  5. 28 1月, 2013 1 次提交
    • D
      x86, build: Dynamically find entry points in compressed startup code · 99f857db
      David Woodhouse 提交于
      We have historically hard-coded entry points in head.S just so it's easy
      to build the executable/bzImage headers with references to them.
      
      Unfortunately, this leads to boot loaders abusing these "known" addresses
      even when they are *explicitly* told that they "should look at the ELF
      header to find this address, as it may change in the future". And even
      when the address in question *has* actually been changed in the past,
      without fanfare or thought to compatibility.
      
      Thus we have bootloaders doing stunningly broken things like jumping
      to offset 0x200 in the kernel startup code in 64-bit mode, *hoping*
      that startup_64 is still there (it has moved at least once
      before). And hoping that it's actually a 64-bit kernel despite the
      fact that we don't give them any indication of that fact.
      
      This patch should hopefully remove the temptation to abuse internal
      addresses in future, where sternly worded comments have not sufficed.
      Instead of having hard-coded addresses and saying "please don't abuse
      these", we actually pull the addresses out of the ELF payload into
      zoffset.h, and make build.c shove them back into the right places in
      the bzImage header.
      
      Rather than including zoffset.h into build.c and thus having to rebuild
      the tool for every kernel build, we parse it instead. The parsing code
      is small and simple.
      
      This patch doesn't actually move any of the interesting entry points, so
      any offending bootloader will still continue to "work" after this patch
      is applied. For some version of "work" which includes jumping into the
      compressed payload and crashing, if the bzImage it's given is a 32-bit
      kernel. No change there then.
      
      [ hpa: some of the issues in the description are addressed or
        retconned by the 2.12 boot protocol.  This patch has been edited to
        only remove fixed addresses that were *not* thus retconned. ]
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Link: http://lkml.kernel.org/r/1358513837.2397.247.camel@shinybook.infradead.orgSigned-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      Cc: Matt Fleming <matt.fleming@intel.com>
      99f857db
  6. 08 6月, 2012 1 次提交
  7. 17 4月, 2012 1 次提交
  8. 27 3月, 2012 1 次提交
  9. 29 2月, 2012 3 次提交
  10. 13 12月, 2011 1 次提交
    • M
      x86, efi: EFI boot stub support · 291f3632
      Matt Fleming 提交于
      There is currently a large divide between kernel development and the
      development of EFI boot loaders. The idea behind this patch is to give
      the kernel developers full control over the EFI boot process. As
      H. Peter Anvin put it,
      
      "The 'kernel carries its own stub' approach been very successful in
      dealing with BIOS, and would make a lot of sense to me for EFI as
      well."
      
      This patch introduces an EFI boot stub that allows an x86 bzImage to
      be loaded and executed by EFI firmware. The bzImage appears to the
      firmware as an EFI application. Luckily there are enough free bits
      within the bzImage header so that it can masquerade as an EFI
      application, thereby coercing the EFI firmware into loading it and
      jumping to its entry point. The beauty of this masquerading approach
      is that both BIOS and EFI boot loaders can still load and run the same
      bzImage, thereby allowing a single kernel image to work in any boot
      environment.
      
      The EFI boot stub supports multiple initrds, but they must exist on
      the same partition as the bzImage. Command-line arguments for the
      kernel can be appended after the bzImage name when run from the EFI
      shell, e.g.
      
      Shell> bzImage console=ttyS0 root=/dev/sdb initrd=initrd.img
      
      v7:
       - Fix checkpatch warnings.
      
      v6:
      
       - Try to allocate initrd memory just below hdr->inird_addr_max.
      
      v5:
      
       - load_options_size is UTF-16, which needs dividing by 2 to convert
         to the corresponding ASCII size.
      
      v4:
      
       - Don't read more than image->load_options_size
      
      v3:
      
       - Fix following warnings when compiling CONFIG_EFI_STUB=n
      
         arch/x86/boot/tools/build.c: In function ‘main’:
         arch/x86/boot/tools/build.c:138:24: warning: unused variable ‘pe_header’
         arch/x86/boot/tools/build.c:138:15: warning: unused variable ‘file_sz’
      
       - As reported by Matthew Garrett, some Apple machines have GOPs that
         don't have hardware attached. We need to weed these out by
         searching for ones that handle the PCIIO protocol.
      
       - Don't allocate memory if no initrds are on cmdline
       - Don't trust image->load_options_size
      
      Maarten Lankhorst noted:
       - Don't strip first argument when booted from efibootmgr
       - Don't allocate too much memory for cmdline
       - Don't update cmdline_size, the kernel considers it read-only
       - Don't accept '\n' for initrd names
      
      v2:
      
       - File alignment was too large, was 8192 should be 512. Reported by
         Maarten Lankhorst on LKML.
       - Added UGA support for graphics
       - Use VIDEO_TYPE_EFI instead of hard-coded number.
       - Move linelength assignment until after we've assigned depth
       - Dynamically fill out AddressOfEntryPoint in tools/build.c
       - Don't use magic number for GDT/TSS stuff. Requested by Andi Kleen
       - The bzImage may need to be relocated as it may have been loaded at
         a high address address by the firmware. This was required to get my
         macbook booting because the firmware loaded it at 0x7cxxxxxx, which
         triggers this error in decompress_kernel(),
      
      	if (heap > ((-__PAGE_OFFSET-(128<<20)-1) & 0x7fffffff))
      		error("Destination address too large");
      
      Cc: Mike Waychison <mikew@google.com>
      Cc: Matthew Garrett <mjg@redhat.com>
      Tested-by: NHenrik Rydberg <rydberg@euromail.se>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      Link: http://lkml.kernel.org/r/1321383097.2657.9.camel@mfleming-mobl1.ger.corp.intel.comSigned-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      291f3632
  11. 26 5月, 2011 1 次提交
  12. 12 3月, 2009 1 次提交
    • H
      x86: remove zImage support · 5e47c478
      H. Peter Anvin 提交于
      Impact: obsolete feature removal
      
      The zImage kernel format has been functionally unused for a very long
      time.  It is just barely possible to build a modern kernel that still
      fits within the zImage size limit, but it is highly unlikely that
      anyone ever uses it.  Furthermore, although it is still supported by
      most bootloaders, it has been at best poorly tested (or not tested at
      all); some bootloaders are even known to not support zImage at all and
      not having even noticed.
      
      Also remove some really obsolete constants that no longer have any
      meaning.
      
      LKML-Reference: <49B703D4.1000008@zytor.com>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      5e47c478
  13. 17 4月, 2008 1 次提交
  14. 11 10月, 2007 1 次提交
  15. 19 7月, 2007 1 次提交
  16. 13 7月, 2007 1 次提交
  17. 08 9月, 2005 1 次提交
  18. 29 6月, 2005 1 次提交
  19. 26 6月, 2005 1 次提交
  20. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4