|
|
1.1 root 1: # *****************************************************************************
2: # * Copyright (c) 2004, 2008 IBM Corporation
3: # * All rights reserved.
4: # * This program and the accompanying materials
5: # * are made available under the terms of the BSD License
6: # * which accompanies this distribution, and is available at
7: # * http://www.opensource.org/licenses/bsd-license.php
8: # *
9: # * Contributors:
10: # * IBM Corporation - initial implementation
11: # ****************************************************************************/
12:
13:
14: MAKEARG = BOARD=$(BOARD) PLATFORM=$(PLATFORM) FLAG=$(FLAG) TARG=$(TARG)
15:
16: BUILDS = tools_build romfs_build
17:
18: include ../make.rules
19:
20: ifdef DRIVER
21: RELEASE=$(shell cat ../VERSION)
22: export DRIVER_NAME=$(shell cat ../VERSION | sed -e "s/-/./g" | awk -F . '{ printf("%s%02d%02d%1s%02s",$$1,$$2,$$3,$$4,$$5); }')
23: else
24: RELEASE="$(USER)@$(HOSTNAME)(private build)"
25: export DRIVER_NAME=HEAD
26: endif
27:
28:
29: DRVDATE=$(shell date +%Y-%h%d)
30:
31: FLASH_SIZE_MB = `echo $$[ $(FLASH_SIZE)/1024/1024 ]`
32:
33: DTB_ROMFS_FLAG ?= 0
34: DTB_ROMFS_ADDR ?= 0
35:
36: llfw_disassembly:
37: make -C $(LLFWBRDDIR) stage1.dis stage2.dis stageS.dis
38:
39: clients_build:
40: @echo " ====== Building clients ======"
41: make -C ../clients $(MAKEARG)
42:
43: other_licence_build:
44: make -C ../other-licence $(MAKEARG)
45:
46: tools_build:
47: make -C ../tools
48:
49: romfs_build:
50: make -C ../romfs/tools $(MAKEARG)
51:
52: ../build_info.img:
53: @echo "$(CC)" > ../build_info.img
54: @$(CC) -v >> ../build_info.img 2>&1
55: @$(LD) -V >> ../build_info.img 2>&1
56:
57: ../$(SUBBOARD).dtb:
58: @if [ -e dts/$(SUBBOARD).dts ]; then \
59: dtc -q -I dts -O dtb dts/$(SUBBOARD).dts > $@; \
60: fi
61:
62: boot_rom.bin boot_xdr.bin: $(BUILDS) ../build_info.img ../$(SUBBOARD).dtb
63: ifeq ($(DO_COMPRESS),1)
64:
65: @echo " ====== Building packed $@ ======"
66: @if [ -e $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).ffs ]; then \
67: cat $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).ffs > ../.boot_rom.ffs; \
68: cat $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).pack.ffs > ../.boot_rom.pack.ffs; \
69: else \
70: cat $(ROMFSBRDDIR)/boot_rom.ffs > ../.boot_rom.ffs; \
71: cat $(ROMFSBRDDIR)/boot_rom.pack.ffs > ../.boot_rom.pack.ffs; \
72: fi
73: @if [ -e $(PCDBRDDIR)/pcdfiles.ffs ]; then \
74: cat $(PCDBRDDIR)/pcdfiles.ffs >> ../.boot_rom.ffs; \
75: cat $(PCDBRDDIR)/pcdfiles.ffs >> ../.boot_rom.pack.ffs; \
76: fi
77:
78: @echo "romfs.pack boot_rom.bin.pack.nv 0 0" >> ../.boot_rom.ffs
79:
80: cat $(SLOFBRDDIR)/OF.ffs >> ../.boot_rom.pack.ffs
81: @echo build_info.img build_info.img 0 0 >> ../.boot_rom.pack.ffs
82: @if [ -e ../$(SUBBOARD).dtb ]; then \
83: echo dtb $(SUBBOARD).dtb $(DTB_ROMFS_FLAG) \
84: $(DTB_ROMFS_ADDR) >> ../.boot_rom.pack.ffs; \
85: fi;
86: cd .. && ./romfs/tools/build_romfs $(ROMFS_OPTIONS) .boot_rom.pack.ffs boot_rom.bin.pack
87: cd .. && ./tools/pknova -q boot_rom.bin.pack boot_rom.bin.pack.nv;
88: cd .. && ./romfs/tools/build_romfs $(ROMFS_OPTIONS) .boot_rom.ffs $@
89: if [ "$@" = "boot_rom.bin" ]; then \
90: rm ../boot_rom.bin.pack; \
91: rm ../boot_rom.bin.pack.nv; \
92: fi;
93: else
94: @echo " ====== Building $@ ======"
95: @if [ -e $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).ffs ]; then \
96: cat $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).ffs > ../.boot_rom.ffs; \
97: else \
98: cat $(ROMFSBRDDIR)/boot_rom.ffs > ../.boot_rom.ffs; \
99: fi
100: @if [ -e $(PCDBRDDIR)/pcdfiles.ffs ]; then \
101: cat $(PCDBRDDIR)/pcdfiles.ffs >> ../.boot_rom.ffs; \
102: fi
103: cat $(SLOFBRDDIR)/OF.ffs >> ../.boot_rom.ffs
104: @echo build_info.img build_info.img 0 0 >> ../.boot_rom.ffs
105: @if [ -e ../$(SUBBOARD).dtb ]; then \
106: echo dtb $(SUBBOARD).dtb $(DTB_ROMFS_FLAG) \
107: $(DTB_ROMFS_ADDR) >> ../.boot_rom.ffs; \
108: fi
109: @if [ -e slik.elf ]; then \
110: echo "slik.elf available ..."; \
111: echo slik board-$(BOARD)/slik.elf 0 0 >> \
112: ../.boot_rom.ffs; \
113: fi
114: cd .. && ./romfs/tools/build_romfs $(ROMFS_OPTIONS) .boot_rom.ffs $@
115: endif
116: cd .. && if [ -f [email protected] ]; then rm -f [email protected]; gzip -9 $@ ; fi
117: rm -f ../.boot_rom.*ffs
118: rm -f ../$(SUBBOARD).dtb
119:
120: ../boot_l2b.bin: $(BUILDS) ../romfs/copyright.img ../$(SUBBOARD).dtb
121: @if [ -e $(ROMFSBRDDIR)/boot_l2.$(SUBBOARD).ffs ]; then \
122: cd .. && ./romfs/tools/build_romfs $(ROMFS_OPTIONS) $(ROMFSBRDDIR)/boot_l2.$(SUBBOARD).ffs boot_l2b.bin; \
123: else \
124: cd .. && ./romfs/tools/build_romfs $(ROMFS_OPTIONS) $(ROMFSBRDDIR)/boot_l2.ffs boot_l2b.bin; \
125: fi
126: @if [ -e ../$(SUBBOARD).dtb ]; then \
127: echo dtb $(SUBBOARD).dtb $(DTB_ROMFS_FLAG) \
128: $(DTB_ROMFS_ADDR) >> ../.boot_rom.ffs; \
129: fi
130: rm -f ../$(SUBBOARD).dtb
131:
132: boot_l2.ad boot_l2-dd2.ad: ../boot_l2b.bin
133: @cd ../tools && ./elf2l2 dd2 ../boot_l2b.bin 0 ../$@
134:
135: external_flasher: ../boot_rom.bin
136: ../tools/make-flasher-image.sh $(FLASH_SIZE) ../boot_rom.bin \
137: ../boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin
138:
139: driver_dirs:
140: @rm -rf ../driver-$(RELEASE)
141: @mkdir -p ../driver-$(RELEASE)/{rom,l2b,disassemblies}
142:
143: driver_prep:
144: @echo "Building driver "$(RELEASE)" for $(BOARD)"
145:
146: copy_disassemblies: llfw_disassembly
147: cp $(LLFWBRDDIR)/stage1.dis \
148: ../driver-$(RELEASE)/disassemblies/$(RELEASE)-stage1.dis
149: cp $(LLFWBRDDIR)/stage2.dis \
150: ../driver-$(RELEASE)/disassemblies/$(RELEASE)-stage2.dis
151: cp $(LLFWBRDDIR)/stageS.dis \
152: ../driver-$(RELEASE)/disassemblies/$(RELEASE)-stageS.dis
153: cp $(LLFWBRDDIR)/meminit.dis \
154: ../driver-$(RELEASE)/disassemblies/$(RELEASE)-meminit.dis
155: @if [ -e ../clients/snk/client.dis ]; then cp ../clients/snk/client.dis \
156: ../driver-$(RELEASE)/disassemblies/$(RELEASE)-client.dis; fi
157:
158: copy_driver: copy_disassemblies external_flasher
159: mv ../boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin \
160: ../driver-$(RELEASE)/rom/$(RELEASE)-boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin
161: mv ../boot_rom.bin \
162: ../driver-$(RELEASE)/rom/$(RELEASE)-boot_rom.bin
163: if [ -e ../boot_l2-dd2.ad ]; then \
164: mv ../boot_l2-dd2.ad \
165: ../driver-$(RELEASE)/l2b/; \
166: else \
167: mv ../boot_l2.ad \
168: ../driver-$(RELEASE)/l2b/; fi
169: mv ../boot_xdr.bin \
170: ../driver-$(RELEASE)/l2b/
171: cp ../VERSION ../driver-$(RELEASE)
172: cd ../driver-$(RELEASE) && md5sum rom/*.bin > md5sum.txt
173:
174: tar_gz: copy_driver
175: @cp -a ../driver-$(RELEASE) ../driver-$(RELEASE)-$(DRVDATE)-devel
176: tar czf ../driver-$(RELEASE)-$(DRVDATE)-devel.tar.gz \
177: ../driver-$(RELEASE)-$(DRVDATE)-devel > /dev/null 2>&1
178: @rm -rf ../driver-$(RELEASE)-$(DRVDATE)-devel
179: @rm -rf ../driver-$(RELEASE)/disassemblies
180: @mv ../driver-$(RELEASE) ../driver-$(RELEASE)-$(DRVDATE)
181: tar czf ../driver-$(RELEASE)-$(DRVDATE).tar.gz \
182: ../driver-$(RELEASE)-$(DRVDATE) > /dev/null 2>&1
183: @rm -rf ../driver-$(RELEASE)-$(DRVDATE)
184:
185: clean_top:
186: @rm -f ../build_info.img
187: @rm -f ../.crc_flash
188: @rm -f ../$(SUBBOARD).dtb
189:
190: clean_gen: clean_top
191: make -C ../romfs/tools BOARD=$(BOARD) clean
192: make -C ../tools clean
193: make -C ../other-licence clean
194: make -C ../clients clean
195: @for dir in $(COMMON_LIBS); do \
196: $(MAKE) -C ../lib/$$dir clean || exit 1; \
197: done
198:
199: distclean_gen: clean_top
200: make -C ../romfs/tools BOARD=$(BOARD) distclean
201: make -C ../tools distclean
202: make -C ../other-licence distclean
203: make -C ../clients distclean
204: @for dir in $(COMMON_LIBS); do \
205: $(MAKE) -C ../lib/$$dir distclean || exit 1; \
206: done
207:
208: common-libs:
209: @echo " ====== Building common libraries ======"
210: $(MAKE) -C $(LIBCMNDIR) $(COMMON_LIBS)
211:
212: board-libs:
213: $(MAKE) -C lib $(MAKEARG)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.