Skip to content
Snippets Groups Projects
  1. Sep 04, 2019
    • Alexander Graf's avatar
      efi_loader: Rename sections to allow for implicit data · 770cfef7
      Alexander Graf authored
      
      Some times gcc may generate data that is then used within code that may
      be part of an efi runtime section. That data could be jump tables,
      constants or strings.
      
      In order to make sure we catch these, we need to ensure that gcc emits
      them into a section that we can relocate together with all the other
      efi runtime bits. This only works if the -ffunction-sections and
      -fdata-sections flags are passed and the efi runtime functions are
      in a section that starts with ".text".
      
      Up to now we had all efi runtime bits in sections that did not
      interfere with the normal section naming scheme, but this forces
      us to do so. Hence we need to move the efi_loader text/data/rodata
      sections before the global *(.text*) catch-all section.
      
      With this patch in place, we should hopefully have an easier time
      to extend the efi runtime functionality in the future.
      
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      [agraf: Fix x86_64 breakage]
      770cfef7
  2. May 07, 2018
    • Tom Rini's avatar
      SPDX: Convert all of our single license tags to Linux Kernel style · 83d290c5
      Tom Rini authored
      
      When U-Boot started using SPDX tags we were among the early adopters and
      there weren't a lot of other examples to borrow from.  So we picked the
      area of the file that usually had a full license text and replaced it
      with an appropriate SPDX-License-Identifier: entry.  Since then, the
      Linux Kernel has adopted SPDX tags and they place it as the very first
      line in a file (except where shebangs are used, then it's second line)
      and with slightly different comment styles than us.
      
      In part due to community overlap, in part due to better tag visibility
      and in part for other minor reasons, switch over to that style.
      
      This commit changes all instances where we have a single declared
      license in the tag as both the before and after are identical in tag
      contents.  There's also a few places where I found we did not have a tag
      and have introduced one.
      
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      83d290c5
  3. Jun 14, 2017
  4. Jun 12, 2017
    • Manfred Schlaegl's avatar
      ARM: fixed relocation using proper alignment · cdde7de0
      Manfred Schlaegl authored
      Using u-boot-2017.05 on i.MX6UL we ran into following problem:
      Initially U-Boot could be started normally.
      If we added one random command in configuration, the newly generated
      image hung at startup (last output was DRAM:  256 MiB).
      
      We tracked this down to a data abort within relocation (relocated_code).
      
      relocated_code in arch/arm/lib/relocate.S copies 8 bytes per loop
      iteration until the source pointer is equal to __image_copy_end.
      In a good case __image_copy_end was aligned to 8 bytes, so the loop
      stopped as suggested, but in an errornous case __image_copy_end was
      not aligned to 8 bytes, so the loop ran out of bounds and caused a
      data abort exception.
      
      This patches solves the issue by aligning __image_copy_end to 8 byte
      using the linker script related to arm.
      
      I don't know if it's the correct way to solve this, so some review would
      be very appreciated.
      cdde7de0
  5. Oct 14, 2016
  6. Sep 07, 2016
  7. Jul 15, 2016
    • Chen-Yu Tsai's avatar
      ARM: Add secure section for initialized data · a5aa7ff3
      Chen-Yu Tsai authored
      
      The secure monitor may need to store global or static values within the
      secure section of memory, such as target PC or CPU power status.
      
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      a5aa7ff3
    • Chen-Yu Tsai's avatar
      ARM: Add CONFIG_ARMV7_SECURE_MAX_SIZE and check size of secure section · 3eff6818
      Chen-Yu Tsai authored
      
      As the PSCI implementation grows, we might exceed the size of the secure
      memory that holds the firmware.
      
      Add a configurable CONFIG_ARMV7_SECURE_MAX_SIZE so platforms can define
      how much secure memory is available. The linker then checks the size of
      the whole secure section against this.
      
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      3eff6818
    • Chen-Yu Tsai's avatar
      ARM: Add an empty secure stack section · 980d6a55
      Chen-Yu Tsai authored
      
      Until now we've been using memory beyond psci_text_end as stack space
      for the secure monitor or PSCI implementation, even if space was not
      allocated for it.
      
      This was partially fixed in ("ARM: allocate extra space for PSCI stack
      in secure section during link phase"). However, calculating stack space
      from psci_text_end in one place, while allocating the space in another
      is error prone.
      
      This patch adds a separate empty secure stack section, with space for
      CONFIG_ARMV7_PSCI_NR_CPUS stacks, each 1 KB. There's also
      __secure_stack_start and __secure_stack_end symbols. The linker script
      handles calculating the correct VMAs for the stack section. For
      platforms that relocate/copy the secure monitor before using it, the
      space is not allocated in the executable, saving space.
      
      For platforms that do not define CONFIG_ARMV7_PSCI_NR_CPUS, a whole page
      of stack space for 4 CPUs is allocated, matching the previous behavior.
      
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      980d6a55
    • Chen-Yu Tsai's avatar
      ARM: Page align secure section only when it is executed in situ · a1274cc9
      Chen-Yu Tsai authored
      
      Targets that define CONFIG_ARMV7_SECURE_BASE will copy the secure section
      to another address before execution.
      
      Since the secure section in the u-boot image is only storage, there's
      no reason to page align it and increase the binary image size.
      
      Page align the secure section only when CONFIG_ARMV7_SECURE_BASE is not
      defined. And instead of just aligning the __secure_start symbol, align
      the whole .__secure_start section. This also makes the section empty,
      so we need to add KEEP() to the input entry to prevent the section from
      being garbage collected.
      
      Also use ld constant "COMMONPAGESIZE" instead of hardcoded page size.
      
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      a1274cc9
  8. Jun 20, 2016
    • Chen-Yu Tsai's avatar
      ARM: allocate extra space for PSCI stack in secure section during link phase · b56e06d3
      Chen-Yu Tsai authored
      
      The PSCI implementation expects at most 2 pages worth of space reserved
      at the end of the secure section for its stacks. If PSCI is relocated to
      secure SRAM, then everything is fine. If no secure SRAM is available,
      and PSCI remains in main memory, the reserved memory space doesn't cover
      the space used by the stack.
      
      If one accesses PSCI after Linux has fully booted, the memory that should
      have been reserved for the PSCI stacks may have been used by the kernel
      or userspace, and would be corrupted. Observed after effects include the
      system hanging or telinit core dumping when trying to reboot. It seems
      the init process gets hit the most on my test bed.
      
      This fix allocates the space used by the PSCI stacks in the secure
      section by skipping pages in the linker script, but only when there is
      no secure SRAM, to avoid bloating the binary.
      
      This fix is only a stop gap. It would be better to rework the stack
      allocation mechanism, maybe with proper usage of CONFIG_ macros and an
      explicit symbol.
      
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      b56e06d3
  9. Mar 22, 2016
  10. Mar 15, 2016
    • Alexander Graf's avatar
      efi_loader: Add runtime services · 50149ea3
      Alexander Graf authored
      
      After booting has finished, EFI allows firmware to still interact with the OS
      using the "runtime services". These callbacks live in a separate address space,
      since they are available long after U-Boot has been overwritten by the OS.
      
      This patch adds enough framework for arbitrary code inside of U-Boot to become
      a runtime service with the right section attributes set. For now, we don't make
      use of it yet though.
      
      We could maybe in the future map U-boot environment variables to EFI variables
      here.
      
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
      Tested-by: default avatarSimon Glass <sjg@chromium.org>
      50149ea3
  11. Jan 31, 2016
    • Wang Dongsheng's avatar
      ARM: Disable "DISCARD" for secure section if CONFIG_ARMV7_SECURE_BASE isn't defined · c5e954ec
      Wang Dongsheng authored
      
      "DISCARD" will remove ._secure.text relocate, but PSCI framework
      has already used some absolute address those need to relocate.
      
      Use readelf -t -r u-boot show us:
      .__secure_start		addr: 601408e4
      .__secure_end		addr: 60141460
      
      60141140  00000017 R_ARM_RELATIVE
      46	_secure_monitor:
      47	#ifdef CONFIG_ARMV7_PSCI
      48      ldr     r5, =_psci_vectors
      
      60141194  00000017 R_ARM_RELATIVE
      6014119c  00000017 R_ARM_RELATIVE
      601411a4  00000017 R_ARM_RELATIVE
      601411ac  00000017 R_ARM_RELATIVE
      64	_psci_table:
      66	.word	psci_cpu_suspend
      ...
      72	.word	psci_migrate
      
      60141344  00000017 R_ARM_RELATIVE
      6014145c  00000017 R_ARM_RELATIVE
      202	ldr     r5, =psci_text_end
      
      Solutions:
      1. Change absolute address to RelAdr.
         Based on LDR (immediate, ARM), we only have 4K offset to jump.
      Now PSCI code size is close to 4K size that is LDR limit jump size,
      so even if the LDR is based on the current instruction address,
      there is also have a risk for RelAdr. If we use two jump steps I
      think we can fix this issue, but looks too hack, so give up this way.
      
      2. Enable "DISCARD" only for CONFIG_ARMV7_SECURE_BASE has defined.
         If CONFIG_ARMV7_SECURE_BASE is defined in platform, all of secure
      will in the BASE address that is absolute.
      
      Signed-off-by: default avatarWang Dongsheng <dongsheng.wang@nxp.com>
      Reviewed-by: default avatarTom Rini <trini@konsulko.com>
      c5e954ec
  12. Nov 12, 2015
    • Peng Fan's avatar
      arm: discard relocation entries for secure text · d47cb0b6
      Peng Fan authored
      
      The code such as PSCI in section named secure is bundled with
      u-boot image, and when bootm, the code will be copied to their
      runtime address same to compliation/linking address -
      CONFIG_ARMV7_SECURE_BASE.
      
      When compile the PSCI code and link it into the u-boot image,
      there will be relocation entries in .rel.dyn section for PSCI.
      Actually, we do not needs these relocation entries.
      
      If still keep the relocation entries in .rel.dyn section,
      r0 at line 103 and 106 in arch/arm/lib/relocate.S may be an invalid
      address which may not support read/write for one SoC.
      102         /* relative fix: increase location by offset */
      103         add     r0, r0, r4
      104         ldr     r1, [r0]
      105         add     r1, r1, r4
      106         str     r1, [r0]
      
      So discard them to avoid touching the relocation entry in
      arch/arm/lib/relocate.S.
      
      Signed-off-by: default avatarPeng Fan <Peng.Fan@freescale.com>
      Cc: Tom Warren <twarren@nvidia.com>
      Cc: York Sun <yorksun@freescale.com>
      Cc: Hans De Goede <hdegoede@redhat.com>
      Cc: Ian Campbell <ijc@hellion.org.uk>
      Cc: Albert Aribaud <albert.u.boot@aribaud.net>
      Cc: Tom Rini <trini@konsulko.com>
      Cc: Jan Kiszka <jan.kiszka@siemens.com>
      Cc: Stefano Babic <sbabic@denx.de>
      Acked-by: default avatarAlbert ARIBAUD <albert.u.boot@aribaud.net>
      d47cb0b6
  13. May 13, 2015
  14. Jul 28, 2014
  15. May 15, 2014
  16. Apr 07, 2014
  17. Feb 26, 2014
  18. Jan 14, 2014
  19. Dec 07, 2013
  20. Sep 05, 2013
  21. Jul 24, 2013
  22. Jun 21, 2013
  23. Apr 14, 2013
    • Albert ARIBAUD's avatar
      ARM: fix CONFIG_SPL_MAX_SIZE semantics · 6ebc3461
      Albert ARIBAUD authored
      
      Remove SPL-related ASSERT() in arch/arm/cpu/u-boot.lds
      as this file is never used for SPL builds.
      
      Rewrite the ASSERT() in arch/arm/cpu/u-boot-spl.lds
      to separately test image (text,data,rodata...) size,
      BSS size, and full footprint each against its own max,
      and make Tegra boards check full footprint.
      
      Also, output section mmutable is not used in SPL builds.
      Remove it.
      
      Finally, update README regarding the (now homogeneous)
      semantics of CONFIG_SPL_[BSS_]MAX_SIZE and add the new
      CONFIG_SPL_MAX_FOOTPRINT macro.
      
      Signed-off-by: default avatarAlbert ARIBAUD <albert.u.boot@aribaud.net>
      Reported-by: default avatarBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
      6ebc3461
  24. Apr 13, 2013
  25. Mar 15, 2013
    • Simon Glass's avatar
      Replace __bss_end__ with __bss_end · 3929fb0a
      Simon Glass authored
      
      Note this is a tree-wide change affecting multiple architectures.
      
      At present we use __bss_start, but mostly __bss_end__. This seems
      inconsistent and in a number of places __bss_end is used instead.
      
      Change to use __bss_end for the BSS end symbol throughout U-Boot. This
      makes it possible to use the asm-generic/sections.h file on all
      archs.
      
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      3929fb0a
  26. Mar 12, 2013
    • Albert ARIBAUD's avatar
      Refactor linker-generated arrays · ef123c52
      Albert ARIBAUD authored
      
      Refactor linker-generated array code so that symbols
      which were previously linker-generated are now compiler-
      generated. This causes relocation records of type
      R_ARM_ABS32 to become R_ARM_RELATIVE, which makes
      code which uses LGA able to run before relocation as
      well as after.
      
      Note: this affects more than ARM targets, as linker-
      lists span possibly all target architectures, notably
      PowerPC.
      
      Conflicts:
      	arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
      	arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds
      	arch/arm/cpu/armv7/omap-common/u-boot-spl.lds
      	board/ait/cam_enc_4xx/u-boot-spl.lds
      	board/davinci/da8xxevm/u-boot-spl-da850evm.lds
      	board/davinci/da8xxevm/u-boot-spl-hawk.lds
      	board/vpac270/u-boot-spl.lds
      
      Signed-off-by: default avatarAlbert ARIBAUD <albert.u.boot@aribaud.net>
      ef123c52
    • Albert ARIBAUD's avatar
      arm: make __bss_start and __bss_end__ compiler-generated · 3ebd1cbc
      Albert ARIBAUD authored
      
      Turn __bss_start and __bss_end__ from linker-generated
      to compiler-generated symbols, causing relocations for
      these symbols to change type, from R_ARM_ABS32 to
      R_ARM_RELATIVE.
      
      This should have no functional impact, as it affects
      references to __bss_start and __bss_end__ only before
      relocation, and no such references are done.
      
      Signed-off-by: default avatarAlbert ARIBAUD <albert.u.boot@aribaud.net>
      3ebd1cbc
  27. Oct 29, 2012
  28. Oct 26, 2012
  29. Oct 22, 2012
    • Marek Vasut's avatar
      common: Discard the __u_boot_cmd section · 8b493a52
      Marek Vasut authored
      
      The command declaration now uses the new LG-array method to generate
      list of commands. Thus the __u_boot_cmd section is now superseded and
      redundant and therefore can be removed. Also, remove externed symbols
      associated with this section from include/command.h .
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Joe Hershberger <joe.hershberger@gmail.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      8b493a52
    • Marek Vasut's avatar
      common: Add .u_boot_list into all linker files · 55675142
      Marek Vasut authored
      
      Add section for the linker-generated lists into all possible linker
      files, so that everyone can easily use these lists. This is mostly
      a mechanical adjustment.
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Joe Hershberger <joe.hershberger@gmail.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      55675142
  30. Mar 30, 2012
    • Simon Glass's avatar
      arm: add a common .lds link script · dde3b70d
      Simon Glass authored
      
      Most ARM CPUs use a very similar link script. This adds a basic
      script that can be used by most CPUs.
      
      Two new symbols are introduced which are intended to eventually be
      defined on all architectures to make things easier for generic relocation
      and reduce special-case code for each architecture:
      
      __image_copy_start is the start of the text area (equivalent to the
      existing _start on ARM). It marks the start of the region which must be
      copied to a new location during relocation. This symbol is called
      __text_start on x86 and microblaze.
      
      __image_copy_end is the end of the region which must be copied to a new
      location during relocation. It is normally equal to the start of the BSS
      region, but this can vary in some cases (SPL?). Making this an explicit
      symbol on its own removes any ambiguity and permits common code to always
      do the right thing.
      
      This new script makes use of CPUDIR, now defined by both Makefile and
      spl/Makefile, to find the directory containing the start.o object file,
      which is always placed first in the image.
      
      To permit MMU setup prior to relocation (as used by pxa) we add an area
      to the link script which contains space for this. This is taken
      from commit 7f4cfcf4. CPUs can put the contents in there using their
      start.S file. BTW, shouldn't that area be 16KB-aligned?
      
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      dde3b70d
  31. Aug 03, 2011
  32. Mar 27, 2011
Loading