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
65
|
#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildtools.mk
export DH_VERBOSE=1
export TF_CFLAGS += -ffile-prefix-map=$(CURDIR)=.
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# Enable verbose build by default, disable when terse is specified.
ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
VERBOSE=0
else
VERBOSE=1
endif
platforms := g12a gxbb sun50i_h6 rk3328 rk3399 rpi3 rpi4 imx8mn
platforms_nodebug := sun50i_a64 imx8mq
# By default, iMX8MN uses UART2 console. However, other boards supported
# upstream (e.g. Variscite VAR-SOM-MX8M-NANO board) uses UART4.
# Add two subplatforms for imx8mn platform:
# * imx8mn: default configuration
# * imx8mn_uart4: console set to UART4
imx8mn_subplatforms := imx8mn imx8mn_uart4
imx8mn_uart4_assigns := IMX_BOOT_UART_BASE=0x30a60000
# Always set CROSS_COMPILE, which also works for native builds.
define build_platform
$(eval platform := $(1))
$(eval debug := $(2))
$(eval buildtype := $(3))
$(eval subplatforms := $(if $($(platform)_subplatforms), $($(platform)_subplatforms), $(platform)))
$(eval target := $(if $(filter rk3328 rk3399,$(platform)),bl31/bl31.elf,bl31.bin))
$(foreach subplatform, $(subplatforms), \
CROSS_COMPILE=aarch64-linux-gnu- CFLAGS=--param=min-pagesize=0 LDFLAGS= TF_LDFLAGS=--no-warn-rwx-segments dh_auto_build -- V=$(VERBOSE) DEBUG=$(debug) $($(subplatform)_assigns) PLAT=$(platform) bl31 ; \
install -m644 build/$(platform)/$(buildtype)/$(target) -Dt build/renamed/$(subplatform) ; \
# For each subplatform, make is called using the same PLAT variable. If
# the build is not cleaned between each call, objects will remain the
# same, without rebuilding them.
make DEBUG=$(debug) PLAT=$(platform) clean ; \
)
endef
%:
dh $@
override_dh_auto_build:
# Disable building of arm-trusted-firmware-tools
ifeq ($(filter pkg.arm-trusted-firmware.notools,$(DEB_BUILD_PROFILES)),)
dh_auto_build --sourcedir=tools/fiptool -- DEBUG=1 V=$(VERBOSE) HOSTCC=$(CC) HOSTCCFLAGS="$(CFLAGS) $(CPPFLAGS)"
dh_auto_build --sourcedir=tools/cert_create -- DEBUG=1 V=$(VERBOSE) HOSTCC=$(CC) HOSTCCFLAGS="$(CFLAGS) $(CPPFLAGS) -std=c99 -DUSE_TBBR_DEFS=1"
endif
# Only build firmware on arm64.
ifeq ($(DEB_HOST_ARCH),arm64)
override_dh_auto_build: $(platforms) $(platforms_nodebug)
$(platforms):
$(call build_platform,$@,1,debug)
$(platforms_nodebug):
$(call build_platform,$@,0,release)
endif
override_dh_installchangelogs:
dh_installchangelogs -parm-trusted-firmware docs/change-log.md
dh_installchangelogs -parm-trusted-firmware-tools
|