# # Copyright (c) 2012, ARM Limited. All rights reserved. # # Redistribution and use in source and binary forms, with # or without modification, are permitted provided that the # following conditions are met: # # Redistributions of source code must retain the above # copyright notice, this list of conditions and the # following disclaimer. # # Redistributions in binary form must reproduce the # above copyright notice, this list of conditions and # the following disclaimer in the documentation # and/or other materials provided with the distribution. # # Neither the name of ARM nor the names of its # contributors may be used to endorse or promote products # derived from this software without specific prior written # permission. # # Decrease the verbosity of the make script # can be made verbose by passing V=1 at the make command line ifdef V KBUILD_VERBOSE = $(V) else KBUILD_VERBOSE = 0 endif ifeq "$(KBUILD_VERBOSE)" "0" Q=@ else Q= endif VE?=TRUE T2?=FALSE L2_POLICY?=WF LOBASE?=0x800 KERNADDR?=$(LOBASE)08000 # megabyte at which the vectors are located (almost always zero) VECTBASE?=$(LOBASE) # Set the megabyte that the BIOS code will execute at HIBASE?=0x8FF FSADDR?=0x8e400000 DEBUG=TRUE # BOOT_CLUSTER is also defined in big-little/Makefile! BOOT_CLUSTER?=0 # SWITCHER is also defined in big-little/Makefile! SWITCHER?=TRUE ifeq "$(BA)" "" BOOTARGS=mem=255M console=ttyAMA0,115200 migration_cost=500 cachepolicy=writealloc BA=$(BOOTARGS) else BOOTARGS=$(BA) endif V7_ASFLAGS=--apcs /inter --cpu=Eagle --keep \ --pd "BOOTARGS SETS \"$(BOOTARGS)\"" \ --pd "L2_POLICY SETS \"$(L2_POLICY)\"" \ --pd "VE SETL {$(VE)}" \ --pd "HIBASE SETS \"$(HIBASE)\"" CFLAGS:=--cpu=Eagle -O2 \ -DT2=$(T2) \ -DSETUPMMU=$(SETUPMMU) \ -DHIBASE=$(HIBASE) \ -DVE=$(VE) \ -DBOOT_CLUSTER=$(BOOT_CLUSTER) \ -DVECTBASE=$(VECTBASE) \ -DSWITCHER=$(SWITCHER) ifdef DEBUG CFLAGS += -g -O0 ASFLAGS += -g V7_ASFLAGS += -g endif OBJS= boot.o bootargs.o c_start.o helpers.o kernel.o filesystem.o uart.o vectors.o bl_sec.o bl.o .PHONY: all all: img.axf .PHONY: bl bl: make -C big-little bl.axf .PHONY: bl_sec bl_sec: make -C big-little bl_sec.axf wboot.bin .PHONY: clean clean: @echo " CLEAN" $(Q)rm -f $(OBJS) img.axf *.map bl.S bl_sec.S make -C big-little clean # Extra dependencies boot.o: emubuild.s helpers.o : emubuild.s %.o: %.S @echo " AS $<" $(Q)armasm $(V7_ASFLAGS) -o $@ $< %.o: %.c @echo " CC $<" $(Q)armcc $(CFLAGS) -o $@ -c $< bl.S: make -C big-little bl.axf @echo " MAP" $(Q)./makemap big-little/bl.axf bl bl.o: bl.S @echo " AS $<" $(Q)armasm $(V7_ASFLAGS) -o $@ $< bl_sec.S: make -C big-little bl_sec.axf wboot.bin @echo " MAP" $(Q)./makemap big-little/bl_sec.axf bl_sec bl_sec.o: bl_sec.S @echo " AS $<" $(Q)armasm $(V7_ASFLAGS) -o $@ $< img.axf: $(OBJS) $(Q)cat boot.map.template > boot.map $(Q)cat bl_sec.map >> boot.map $(Q)cat bl.map >> boot.map $(Q)sed -i \ -e "s/KERNADDRBA/$(shell perl -e "printf('0x%08X',$(KERNADDR)-0x7f00)")/g" \ -e "s/FSADDR/${FSADDR}/g" \ -e "s/HIBASE/${HIBASE}/g" \ -e "s/KERNADDR/${KERNADDR}/g" \ -e "s/VECTBASE/${VECTBASE}/g" \ boot.map @echo " LD $@" $(Q)armlink --entry $(VECTBASE)00000 -o $@ --scatter boot.map $(OBJS)