Print this page
bcm2835: we need a loader on this platform as well
As stated before, the Raspberry Pi loader is terrible.  It claims to
supporte ELF file loading, but what it does is crazy.  It loads the ELF file
into memory, gets the start address from the header, converts it into file
offset, adds it to the address where the file was loaded and jumps there.
This is very wrong.  So, instead of booting the loader as an ELF file, we
objcopy it into a plain ol' binary image.  This should be safe because (1)
the loader has no relocations left, (2) whatever benefit we lose from not
having the whole ELF file in memory is only temporary until the loader hands
off control to unix.
Finally, we force the entry point to appear at the beginning of the binary
file by moving _start into its own section (.text.init) and using the
mapfile to put that section before everything else.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/armv6/bcm2835/Makefile.files
          +++ new/usr/src/uts/armv6/bcm2835/Makefile.files
↓ open down ↓ 3 lines elided ↑ open up ↑
   4    4  # You may only use this file in accordance with the terms of version
   5    5  # 1.0 of the CDDL.
   6    6  #
   7    7  # A full copy of the text of the CDDL should have accompanied this
   8    8  # source.  A copy of the CDDL is also available via the Internet at
   9    9  # http://www.illumos.org/license/CDDL.
  10   10  #
  11   11  
  12   12  #
  13   13  # Copyright (c) 2013, Joyent, Inc.  All rights reserved.
       14 +# Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  14   15  #
  15   16  
  16   17  BCM2835_OBJS =                  \
  17   18          bcm2835_bsmdep.o        \
  18   19          boot_console.o          \
  19   20          locore.o                \
  20   21          miniuart.o
       22 +
       23 +BCM2835_LOADER_OBJS = \
       24 +        bcm2835_ldep.o  
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX