summaryrefslogtreecommitdiffstats
path: root/qemu/roms/SLOF/Makefile.gen
blob: 2fdf23fb09d46abba97b3ae1c6538bdbeb0d79c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Si
# *****************************************************************************
# * Copyright (c) 2004, 2008 IBM Corporation
# * All rights reserved.
# * This program and the accompanying materials
# * are made available under the terms of the BSD License
# * which accompanies this distribution, and is available at
# * http://www.opensource.org/licenses/bsd-license.php
# *
# * Contributors:
# *     IBM Corporation - initial implementation
# ****************************************************************************/


MAKEARG = BOARD=$(BOARD) PLATFORM=$(PLATFORM) FLAG=$(FLAG) TARG=$(TARG)

BUILDS  = tools_build romfs_build

include ../make.rules

ifdef DRIVER
RELEASE=$(shell cat ../VERSION)
export DRIVER_NAME=$(shell cat ../VERSION | sed -e "s/-/./g" | awk -F . '{ printf("%s%02d%02d%1s%02s",$$1,$$2,$$3,$$4,$$5); }')
else
ifneq (,$(wildcard ../.git))
RELEASE=git-$(shell git rev-parse --short=16 HEAD)
else
ifneq (,$(shell cat ../VERSION))
RELEASE="$(USER)@$(HOSTNAME) release $(shell cat ../VERSION)"
export DRIVER_NAME=HEAD
else
RELEASE="$(USER)@$(HOSTNAME)(private build)"
export DRIVER_NAME=HEAD
endif
endif
endif


DRVDATE=$(shell date +%Y-%h%d)

FLASH_SIZE_MB = `echo $$[ $(FLASH_SIZE)/1024/1024 ]`

DTB_ROMFS_FLAG ?= 0
DTB_ROMFS_ADDR ?= 0

llfw_disassembly:
	$(MAKE) -C $(LLFWBRDDIR) stage1.dis stage2.dis stageS.dis

clients_build:
	@echo " ====== Building clients ======"
	$(MAKE) -C ../clients $(MAKEARG)

other_licence_build:
	$(MAKE) -C ../other-licence $(MAKEARG)

tools_build:
	$(MAKE) -C ../tools

romfs_build:
	$(MAKE) -C ../romfs/tools $(MAKEARG)

../build_info.img:
	@echo "$(CC)" > ../build_info.img
	@$(CC) -v >> ../build_info.img 2>&1
	@$(LD) -V >> ../build_info.img 2>&1

../$(SUBBOARD).dtb:
	@if [ -e dts/$(SUBBOARD).dts ]; then \
		 dtc -q -I dts -O dtb dts/$(SUBBOARD).dts > $@; \
	fi

boot_rom.bin:	$(BUILDS) ../build_info.img ../$(SUBBOARD).dtb
	@echo " ====== Building $@ ======"
	@if [ -e $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).ffs ]; then \
		cat $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).ffs > ../.boot_rom.ffs; \
	else \
		cat $(ROMFSBRDDIR)/boot_rom.ffs > ../.boot_rom.ffs; \
	fi
	@if [ -e $(PCDBRDDIR)/pcdfiles.ffs ]; then \
		cat $(PCDBRDDIR)/pcdfiles.ffs >> ../.boot_rom.ffs; \
	fi
	cat $(SLOFBRDDIR)/OF.ffs >> ../.boot_rom.ffs
	@echo build_info.img  build_info.img 0 0 >> ../.boot_rom.ffs
	@if [ -e ../$(SUBBOARD).dtb ]; then \
		echo dtb $(SUBBOARD).dtb $(DTB_ROMFS_FLAG) \
			$(DTB_ROMFS_ADDR) >> ../.boot_rom.ffs; \
	fi
	cd .. && ./romfs/tools/build_romfs $(ROMFS_OPTIONS) .boot_rom.ffs $@
	cd .. && if [ -f $@.gz ]; then rm -f $@.gz; gzip -9 $@ ; fi
	rm -f ../.boot_rom.*ffs
	rm -f ../$(SUBBOARD).dtb


external_flasher: ../boot_rom.bin
	../tools/make-flasher-image.sh $(FLASH_SIZE) ../boot_rom.bin \
		../boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin

driver_dirs:
	@rm -rf ../driver-$(RELEASE)
	@mkdir -p ../driver-$(RELEASE)/{rom,l2b,disassemblies}

driver_prep:
	@echo "Building driver "$(RELEASE)" for $(BOARD)"

copy_disassemblies:	llfw_disassembly
	cp $(LLFWBRDDIR)/stage1.dis  \
		../driver-$(RELEASE)/disassemblies/$(RELEASE)-stage1.dis
	cp $(LLFWBRDDIR)/stage2.dis  \
		../driver-$(RELEASE)/disassemblies/$(RELEASE)-stage2.dis
	cp $(LLFWBRDDIR)/stageS.dis  \
		../driver-$(RELEASE)/disassemblies/$(RELEASE)-stageS.dis
	cp $(LLFWBRDDIR)/meminit.dis  \
		../driver-$(RELEASE)/disassemblies/$(RELEASE)-meminit.dis
	@if [ -e ../clients/snk/client.dis ]; then cp ../clients/snk/client.dis \
		../driver-$(RELEASE)/disassemblies/$(RELEASE)-client.dis; fi

copy_driver:	copy_disassemblies external_flasher
	mv ../boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin \
		../driver-$(RELEASE)/rom/$(RELEASE)-boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin
	mv ../boot_rom.bin \
		../driver-$(RELEASE)/rom/$(RELEASE)-boot_rom.bin
	if [ -e ../boot_l2-dd2.ad ]; then \
		mv ../boot_l2-dd2.ad ../driver-$(RELEASE)/l2b/; \
	else \
		mv ../boot_l2.ad ../driver-$(RELEASE)/l2b/; \
	fi
	mv ../boot_xdr.bin ../driver-$(RELEASE)/l2b/
	cp ../VERSION ../driver-$(RELEASE)
	cd ../driver-$(RELEASE) && md5sum rom/*.bin > md5sum.txt

tar_gz:		copy_driver
	@cp -a ../driver-$(RELEASE) ../driver-$(RELEASE)-$(DRVDATE)-devel
	tar czf ../driver-$(RELEASE)-$(DRVDATE)-devel.tar.gz \
		../driver-$(RELEASE)-$(DRVDATE)-devel > /dev/null 2>&1
	@rm -rf ../driver-$(RELEASE)-$(DRVDATE)-devel
	@rm -rf ../driver-$(RELEASE)/disassemblies
	@mv ../driver-$(RELEASE) ../driver-$(RELEASE)-$(DRVDATE)
	tar czf ../driver-$(RELEASE)-$(DRVDATE).tar.gz \
		../driver-$(RELEASE)-$(DRVDATE) > /dev/null  2>&1
	@rm -rf ../driver-$(RELEASE)-$(DRVDATE)

clean_top:
	@rm -f ../build_info.img
	@rm -f ../.crc_flash
	@rm -f ../$(SUBBOARD).dtb

clean_gen:	clean_top
	$(MAKE) -C ../romfs/tools BOARD=$(BOARD) clean
	$(MAKE) -C ../tools clean
	$(MAKE) -C ../other-licence clean
	$(MAKE) -C ../clients clean
	@for dir in $(COMMON_LIBS); do \
		$(MAKE) -C ../lib/$$dir clean || exit 1; \
	done

distclean_gen:	clean_top
	$(MAKE) -C ../romfs/tools BOARD=$(BOARD) distclean
	$(MAKE) -C ../tools distclean
	$(MAKE) -C ../other-licence distclean
	$(MAKE) -C ../clients distclean
	@for dir in $(COMMON_LIBS); do \
		$(MAKE) -C ../lib/$$dir distclean || exit 1; \
	done

common-libs:
	@echo " ====== Building common libraries ======"
	$(MAKE) -C $(LIBCMNDIR) $(COMMON_LIBS)

board-libs:
	$(MAKE) -C lib $(MAKEARG)