Quellcode durchsuchen

[build] Exclude selected directories from Secure Boot builds

When submitting binaries for UEFI Secure Boot signing, certain
known-dubious subsystems (such as 802.11 and NFS) must be excluded
from the build.  Mark the directories containing these subsystems as
insecure, and allow the build target to include an explicit "security
flag" (a literal "-sb" appended to the build platform) to exclude
these source directories from the build process.

For example:

  make bin-x86_64-efi-sb/ipxe.efi

will build iPXE with all code from the 802.11 and NFS subsystems
excluded from the build.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown vor 6 Jahren
Ursprung
Commit
7428ab7258
2 geänderte Dateien mit 34 neuen und 15 gelöschten Zeilen
  1. 11
    5
      src/Makefile
  2. 23
    10
      src/Makefile.housekeeping

+ 11
- 5
src/Makefile Datei anzeigen

62
 SRCDIRS		:=
62
 SRCDIRS		:=
63
 SRCDIRS		+= libgcc
63
 SRCDIRS		+= libgcc
64
 SRCDIRS		+= core
64
 SRCDIRS		+= core
65
-SRCDIRS		+= net net/oncrpc net/tcp net/udp net/infiniband net/80211
65
+SRCDIRS		+= net net/tcp net/udp net/infiniband
66
 SRCDIRS		+= image
66
 SRCDIRS		+= image
67
 SRCDIRS		+= drivers/bus
67
 SRCDIRS		+= drivers/bus
68
 SRCDIRS		+= drivers/net
68
 SRCDIRS		+= drivers/net
71
 SRCDIRS		+= drivers/net/igb
71
 SRCDIRS		+= drivers/net/igb
72
 SRCDIRS		+= drivers/net/igbvf
72
 SRCDIRS		+= drivers/net/igbvf
73
 SRCDIRS		+= drivers/net/phantom
73
 SRCDIRS		+= drivers/net/phantom
74
-SRCDIRS		+= drivers/net/rtl818x
75
-SRCDIRS		+= drivers/net/ath
76
-SRCDIRS		+= drivers/net/ath/ath5k
77
-SRCDIRS		+= drivers/net/ath/ath9k
78
 SRCDIRS		+= drivers/net/vxge
74
 SRCDIRS		+= drivers/net/vxge
79
 SRCDIRS		+= drivers/net/efi
75
 SRCDIRS		+= drivers/net/efi
80
 SRCDIRS		+= drivers/net/tg3
76
 SRCDIRS		+= drivers/net/tg3
105
 SRCDIRS		+= usr
101
 SRCDIRS		+= usr
106
 SRCDIRS		+= config
102
 SRCDIRS		+= config
107
 
103
 
104
+# These directories contain code that is not eligible for UEFI Secure
105
+# Boot signing.
106
+#
107
+SRCDIRS_INSEC	+= net/oncrpc
108
+SRCDIRS_INSEC	+= net/80211
109
+SRCDIRS_INSEC	+= drivers/net/rtl818x
110
+SRCDIRS_INSEC	+= drivers/net/ath
111
+SRCDIRS_INSEC	+= drivers/net/ath/ath5k
112
+SRCDIRS_INSEC	+= drivers/net/ath/ath9k
113
+
108
 # NON_AUTO_SRCS lists files that are excluded from the normal
114
 # NON_AUTO_SRCS lists files that are excluded from the normal
109
 # automatic build system.
115
 # automatic build system.
110
 #
116
 #

+ 23
- 10
src/Makefile.housekeeping Datei anzeigen

299
 #
299
 #
300
 # Select build architecture and platform based on $(BIN)
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
 ARCHS		:= $(patsubst arch/%,%,$(wildcard arch/*))
304
 ARCHS		:= $(patsubst arch/%,%,$(wildcard arch/*))
305
 PLATFORMS	:= $(patsubst config/defaults/%.h,%,\
305
 PLATFORMS	:= $(patsubst config/defaults/%.h,%,\
312
 
312
 
313
 ifdef BIN
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
 else
321
 else
324
-BIN_PLATFORM	:= $(patsubst bin-$(BIN_ARCH)-%,%,$(BIN))
322
+BIN_AP		:= $(BIN_APS)
323
+BIN_SECUREBOOT	:= 0
325
 endif
324
 endif
325
+BIN_PLATFORM	:= $(lastword $(BIN_AP))
326
+BIN_ARCH	:= $(wordlist 2,$(words $(BIN_AP)),discard $(BIN_AP))
326
 
327
 
327
 # Determine build architecture
328
 # Determine build architecture
328
 DEFAULT_ARCH	:= i386
329
 DEFAULT_ARCH	:= i386
339
 platform :
340
 platform :
340
 	@$(ECHO) $(PLATFORM)
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
 endif # defined(BIN)
350
 endif # defined(BIN)
343
 
351
 
344
 # Include architecture-specific Makefile
352
 # Include architecture-specific Makefile
357
 #
365
 #
358
 # Source file handling
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
 # SRCDIRS lists all directories containing source files.
373
 # SRCDIRS lists all directories containing source files.
361
 srcdirs :
374
 srcdirs :
362
 	@$(ECHO) $(SRCDIRS)
375
 	@$(ECHO) $(SRCDIRS)

Laden…
Abbrechen
Speichern