]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-linux/boot-monitor.git/blob - Makefile
boot-monitor: fix makefile to support multiple jobs
[keystone-linux/boot-monitor.git] / Makefile
1 # /*
2 #  * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
3 #  *
4 #  *  Redistribution and use in source and binary forms, with or without
5 #  *  modification, are permitted provided that the following conditions
6 #  *  are met:
7 #  *
8 #  *    Redistributions of source code must retain the above copyright
9 #  *    notice, this list of conditions and the following disclaimer.
10 #  *
11 #  *    Redistributions in binary form must reproduce the above copyright
12 #  *    notice, this list of conditions and the following disclaimer in the
13 #  *    documentation and/or other materials provided with the
14 #  *    distribution.
15 #  *
16 #  *    Neither the name of Texas Instruments Incorporated nor the names of
17 #  *    its contributors may be used to endorse or promote products derived
18 #  *    from this software without specific prior written permission.
19 #  *
20 #  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 #  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 #  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 #  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 #  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 #  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 #  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 #  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 #  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 #  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 #  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #  *
32 #  */
33 include makedefs
35 NONSECPADBIN = non-sec/nonsec_pad.bin
36 SECPADBIN = sec/s-kernel_pad.bin
37 IMAGE = skern
38 NONSECLDS = non-sec/nonsec.lds
39 SECLDS = sec/s-kernel.lds
40 NONSECLDS2 = non-sec/nonsec2.lds
41 SECLDS2 = sec/s-kernel2.lds
44 BOOTROM_VERSION = 1
46 .PHONY: all k2hk k2l k2e build_clean
48 all:
49         $(MAKE) k2hk
50         $(MAKE) k2l
51         $(MAKE) k2e
53 k2hk:
54         @if [ -f $(IMAGE).bin ] ; \
55         then \
56                 make build_clean; \
57         fi
59         @echo "#define IMAGE_LOAD_ADDR ${IMAGE_LOAD_ADDR_K2HK}" >>config.h
60         @echo "#define RBL_MON_STACK_START ${RBL_MON_STACK_START_K2HK}" >>config.h
61         @echo "#define ARM_NUM_CORES ${ARM_NUM_CORES_K2HK}" >>config.h
63         make copy_common_headers
64         make build_image
65         cp $(IMAGE).bin $(IMAGE)-k2hk.bin
67 k2e:
68         @if [ -f $(IMAGE).bin ] ; \
69         then \
70                 make build_clean; \
71         fi
73         @echo "#define IMAGE_LOAD_ADDR ${IMAGE_LOAD_ADDR_K2LE}" >>config.h
74         @echo "#define RBL_MON_STACK_START ${RBL_MON_STACK_START_K2E}" >>config.h
75         @echo "#define ARM_NUM_CORES ${ARM_NUM_CORES_K2E}" >>config.h
77         cp $(NONSECLDS) $(NONSECLDS2)
78         cp $(SECLDS) $(SECLDS2)
79         sed -i 's/${IMAGE_LOAD_ADDR_K2HK}/${IMAGE_LOAD_ADDR_K2LE}/g' $(NONSECLDS)
80         sed -i 's/${IMAGE_LOAD_ADDR_SEC_K2HK}/${IMAGE_LOAD_ADDR_SEC_K2LE}/g' $(SECLDS)
82         make copy_common_headers
83         make build_image
84         cp $(IMAGE).bin $(IMAGE)-k2e.bin
85         mv $(NONSECLDS2) $(NONSECLDS)
86         mv $(SECLDS2) $(SECLDS)
88 k2l:
89         @if [ -f $(IMAGE).bin ] ; \
90         then \
91                 make build_clean; \
92         fi
94         @echo "#define IMAGE_LOAD_ADDR ${IMAGE_LOAD_ADDR_K2LE}" >>config.h
95         @echo "#define RBL_MON_STACK_START ${RBL_MON_STACK_START_K2L}" >>config.h
96         @echo "#define ARM_NUM_CORES ${ARM_NUM_CORES_K2L}" >>config.h
98         cp $(NONSECLDS) $(NONSECLDS2)
99         cp $(SECLDS) $(SECLDS2)
100         sed -i 's/${IMAGE_LOAD_ADDR_K2HK}/${IMAGE_LOAD_ADDR_K2LE}/g' $(NONSECLDS)
101         sed -i 's/${IMAGE_LOAD_ADDR_SEC_K2HK}/${IMAGE_LOAD_ADDR_SEC_K2LE}/g' $(SECLDS)
103         make copy_common_headers
104         make build_image
105         cp $(IMAGE).bin $(IMAGE)-k2l.bin
106         mv $(NONSECLDS2) $(NONSECLDS)
107         mv $(SECLDS2) $(SECLDS)
109 copy_common_headers:
110         @echo "#define RBL_MON_STACK_SIZE 0x800" >>config.h
111         @echo "#define ARM_ERRATA_763126 1" >>config.h
112         @echo "#define ARM_ERRATA_798870 1" >>config.h
113         @echo "#define ARM_ERRATA_799270 1" >>config.h
114         @echo "#define NONSEC_IMAGE_SIZE ${NONSEC_IMAGE_SIZE}" >>config.h
116 build_image:
117         (cd sec; make)
118         (cd non-sec; make)
119         cat $(NONSECPADBIN) >> $(IMAGE).bin
120         cat $(SECPADBIN) >> $(IMAGE).bin
122 build_clean:
123         rm -rf $(IMAGE).bin
124         rm -f config.h
125         cd non-sec; make clean;
126         cd sec; make clean;
128 clean: build_clean
129         rm -rf $(IMAGE)-k2hk.bin
130         rm -rf $(IMAGE)-k2e.bin
131         rm -rf $(IMAGE)-k2l.bin