Skip to content

Commit 340a025

Browse files
committed
certs: move scripts/extract-cert to certs/
extract-cert is only used in certs/Makefile. Move it there and build extract-cert on demand. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 129ab0d commit 340a025

File tree

7 files changed

+15
-16
lines changed

7 files changed

+15
-16
lines changed

MAINTAINERS

-1
Original file line numberDiff line numberDiff line change
@@ -4410,7 +4410,6 @@ L: [email protected]
44104410
S: Maintained
44114411
F: Documentation/admin-guide/module-signing.rst
44124412
F: certs/
4413-
F: scripts/extract-cert.c
44144413
F: scripts/sign-file.c
44154414

44164415
CFAG12864B LCD DRIVER

certs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2+
/extract-cert
23
/x509_certificate_list
34
/x509_revocation_list

certs/Makefile

+9-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
1313
endif
1414

1515
quiet_cmd_extract_certs = CERT $@
16-
cmd_extract_certs = scripts/extract-cert $(2) $@
16+
cmd_extract_certs = $(obj)/extract-cert $(2) $@
1717

1818
$(obj)/system_certificates.o: $(obj)/x509_certificate_list
1919

20-
$(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) scripts/extract-cert FORCE
20+
$(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) $(obj)/extract-cert FORCE
2121
$(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_TRUSTED_KEYS),$<,""))
2222

2323
targets += x509_certificate_list
@@ -74,15 +74,20 @@ endif
7474

7575
$(obj)/system_certificates.o: $(obj)/signing_key.x509
7676

77-
$(obj)/signing_key.x509: $(X509_DEP) scripts/extract-cert FORCE
77+
$(obj)/signing_key.x509: $(X509_DEP) $(obj)/extract-cert FORCE
7878
$(call if_changed,extract_certs,$(if $(X509_DEP),$<,$(CONFIG_MODULE_SIG_KEY)))
7979
endif # CONFIG_MODULE_SIG
8080

8181
targets += signing_key.x509
8282

8383
$(obj)/revocation_certificates.o: $(obj)/x509_revocation_list
8484

85-
$(obj)/x509_revocation_list: $(CONFIG_SYSTEM_REVOCATION_KEYS) scripts/extract-cert FORCE
85+
$(obj)/x509_revocation_list: $(CONFIG_SYSTEM_REVOCATION_KEYS) $(obj)/extract-cert FORCE
8686
$(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_REVOCATION_KEYS),$<,""))
8787

8888
targets += x509_revocation_list
89+
90+
hostprogs := extract-cert
91+
92+
HOSTCFLAGS_extract-cert.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)
93+
HOSTLDLIBS_extract-cert = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)

scripts/extract-cert.c certs/extract-cert.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static __attribute__((noreturn))
2929
void format(void)
3030
{
3131
fprintf(stderr,
32-
"Usage: scripts/extract-cert <source> <dest>\n");
32+
"Usage: extract-cert <source> <dest>\n");
3333
exit(2);
3434
}
3535

scripts/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
/asn1_compiler
33
/bin2c
4-
/extract-cert
54
/insert-sys-cert
65
/kallsyms
76
/module.lds

scripts/Makefile

+2-9
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,18 @@
33
# scripts contains sources for various helper programs used throughout
44
# the kernel for the build process.
55

6-
CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
7-
CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null)
8-
96
hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c
107
hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
118
hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount
129
hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
1310
hostprogs-always-$(CONFIG_ASN1) += asn1_compiler
1411
hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
15-
hostprogs-always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
1612
hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
17-
hostprogs-always-$(CONFIG_SYSTEM_REVOCATION_LIST) += extract-cert
1813

1914
HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
2015
HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
21-
HOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS)
22-
HOSTLDLIBS_sign-file = $(CRYPTO_LIBS)
23-
HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
24-
HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)
16+
HOSTCFLAGS_sign-file.o = $(shell pkg-config --cflags libcrypto 2> /dev/null)
17+
HOSTLDLIBS_sign-file = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
2518

2619
ifdef CONFIG_UNWINDER_ORC
2720
ifeq ($(ARCH),x86_64)

scripts/remove-stale-files

+2
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ if [ -n "${building_out_of_srctree}" ]; then
3434
rm -f arch/mips/boot/compressed/${f}
3535
done
3636
fi
37+
38+
rm -f scripts/extract-cert

0 commit comments

Comments
 (0)