|
@@ -299,7 +299,7 @@ endif
|
299
|
299
|
#
|
300
|
300
|
# Select build architecture and platform based on $(BIN)
|
301
|
301
|
#
|
302
|
|
-# BIN has the form bin[-[arch-]platform]
|
|
302
|
+# BIN has the form bin[-[<arch>-]<platform>[-sb]]
|
303
|
303
|
|
304
|
304
|
ARCHS := $(patsubst arch/%,%,$(wildcard arch/*))
|
305
|
305
|
PLATFORMS := $(patsubst config/defaults/%.h,%,\
|
|
@@ -312,17 +312,18 @@ platforms :
|
312
|
312
|
|
313
|
313
|
ifdef BIN
|
314
|
314
|
|
315
|
|
-# Determine architecture portion of $(BIN), if present
|
316
|
|
-BIN_ARCH := $(strip $(foreach A,$(ARCHS),\
|
317
|
|
- $(patsubst bin-$(A)-%,$(A),\
|
318
|
|
- $(filter bin-$(A)-%,$(BIN)))))
|
319
|
|
-
|
320
|
|
-# Determine platform portion of $(BIN), if present
|
321
|
|
-ifeq ($(BIN_ARCH),)
|
322
|
|
-BIN_PLATFORM := $(patsubst bin-%,%,$(filter bin-%,$(BIN)))
|
|
315
|
+# Split $(BIN) into architecture, platform, and security flag (where present)
|
|
316
|
+BIN_ELEMENTS := $(subst -,$(SPACE),$(BIN))
|
|
317
|
+BIN_APS := $(wordlist 2,4,$(BIN_ELEMENTS))
|
|
318
|
+ifeq ($(lastword $(BIN_APS)),sb)
|
|
319
|
+BIN_AP := $(wordlist 2,$(words $(BIN_APS)),discard $(BIN_APS))
|
|
320
|
+BIN_SECUREBOOT := 1
|
323
|
321
|
else
|
324
|
|
-BIN_PLATFORM := $(patsubst bin-$(BIN_ARCH)-%,%,$(BIN))
|
|
322
|
+BIN_AP := $(BIN_APS)
|
|
323
|
+BIN_SECUREBOOT := 0
|
325
|
324
|
endif
|
|
325
|
+BIN_PLATFORM := $(lastword $(BIN_AP))
|
|
326
|
+BIN_ARCH := $(wordlist 2,$(words $(BIN_AP)),discard $(BIN_AP))
|
326
|
327
|
|
327
|
328
|
# Determine build architecture
|
328
|
329
|
DEFAULT_ARCH := i386
|
|
@@ -339,6 +340,13 @@ CFLAGS += -DPLATFORM=$(PLATFORM)
|
339
|
340
|
platform :
|
340
|
341
|
@$(ECHO) $(PLATFORM)
|
341
|
342
|
|
|
343
|
+# Determine security flag
|
|
344
|
+DEFAULT_SECUREBOOT := 0
|
|
345
|
+SECUREBOOT := $(firstword $(BIN_SECUREBOOT) $(DEFAULT_SECUREBOOT))
|
|
346
|
+CFLAGS += -DSECUREBOOT=$(SECUREBOOT)
|
|
347
|
+secureboot :
|
|
348
|
+ @$(ECHO) $(SECUREBOOT)
|
|
349
|
+
|
342
|
350
|
endif # defined(BIN)
|
343
|
351
|
|
344
|
352
|
# Include architecture-specific Makefile
|
|
@@ -357,6 +365,11 @@ endif
|
357
|
365
|
#
|
358
|
366
|
# Source file handling
|
359
|
367
|
|
|
368
|
+# Exclude known-insecure files from Secure Boot builds
|
|
369
|
+ifeq ($(SECUREBOOT),0)
|
|
370
|
+SRCDIRS += $(SRCDIRS_INSEC)
|
|
371
|
+endif
|
|
372
|
+
|
360
|
373
|
# SRCDIRS lists all directories containing source files.
|
361
|
374
|
srcdirs :
|
362
|
375
|
@$(ECHO) $(SRCDIRS)
|