1 #
   2 # This file and its contents are supplied under the terms of the
   3 # Common Development and Distribution License ("CDDL"), version 1.0.
   4 # You may only use this file in accordance with the terms of version
   5 # 1.0 of the CDDL.
   6 #
   7 # A full copy of the text of the CDDL should have accompanied this
   8 # source.  A copy of the CDDL is also available via the Internet at
   9 # http://www.illumos.org/license/CDDL.
  10 #
  11 
  12 #
  13 # Copyright (c) 2013, Joyent, Inc.  All rights reserved.
  14 # Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  15 #
  16 
  17 #
  18 #       Path to the base of the uts directory tree (usually /usr/src/uts).
  19 #
  20 UTSBASE = ../../..
  21 
  22 #
  23 #       Define the module and object file sets.
  24 #
  25 LOADER          = loader
  26 LOADER_BIN      = $(OBJS_DIR)/$(LOADER)
  27 LOADER_ELF      = $(LOADER).elf
  28 LOADER_ELF_BIN  = $(OBJS_DIR)/$(LOADER_ELF)
  29 ROOTMODULE      = $(ROOT_BCM2835_KERN_DIR)/$(LOADER)
  30 OBJECTS         = $(ARM_LOADER_OBJS:%=$(OBJS_DIR)/%) \
  31                   $(BCM2835_LOADER_OBJS:%=$(OBJS_DIR)/%)
  32 
  33 #
  34 #       Include common rules.
  35 #
  36 include $(UTSBASE)/armv6/bcm2835/Makefile.bcm2835
  37 
  38 #
  39 #       Define targets
  40 #
  41 ALL_TARGET      = $(LOADER_BIN)
  42 INSTALL_TARGET  = $(LOADER_BIN) $(ROOTMODULE)
  43 
  44 #
  45 #       Overrides
  46 #
  47 CLEANFILES      += $(OBJECTS)
  48 
  49 CLOBBERFILES    = $(CLEANFILES) $(LOADER_BIN)
  50 
  51 CFLAGS          += $(CCVERBOSE) \
  52                 -DELF_TARGET_ARM
  53 
  54 CERRWARN        += -_gcc=-Wno-parentheses
  55 CERRWARN        += -_gcc=-Wno-uninitialized
  56 CERRWARN        += -_gcc=-Wno-unused-label
  57 CERRWARN        += -_gcc=-Wno-unused-function
  58 CERRWARN        += -_gcc=-Wno-unused-variable
  59 CERRWARN        += -_gcc=-Wno-unused-but-set-variable
  60 
  61 # The mapfile used to link unix
  62 MAPFILE         = $(UTSBASE)/armv6/bcm2835/conf/Mapfile.loader
  63 
  64 #
  65 #       Default build targets.
  66 #
  67 .KEEP_STATE:
  68 
  69 def:            $(DEF_DEPS)
  70 
  71 all:            $(ALL_DEPS)
  72 
  73 clean:          $(CLEAN_DEPS)
  74 
  75 clobber:        $(CLOBBER_DEPS)
  76 
  77 install:        $(INSTALL_DEPS)
  78 
  79 symcheck:       $(SYM_DEPS)
  80 
  81 $(LOADER_ELF_BIN): $(OBJECTS)
  82         $(LD) -dy -b -znointerp -o $@ -e _start -M $(MAPFILE) \
  83         $(OBJECTS)
  84         $(CTFMERGE) $(CTFMRGFLAGS) -L VERSION -o $(LOADER_ELF_BIN) $(OBJECTS)
  85 
  86 $(LOADER_BIN): $(LOADER_ELF_BIN)
  87         /opt/armtc/usr/gnu/bin/gobjcopy $(LOADER_ELF_BIN) -O binary $(LOADER_BIN)
  88 
  89 
  90 #
  91 #       Include common targets.
  92 #
  93 include $(UTSBASE)/armv6/bcm2835/Makefile.targ