Skip to content

Commit 88694cf

Browse files
Quentin Perretmasahir0y
authored andcommitted
kbuild: generate autoksyms.h early
When doing a cold build, autoksyms.h starts empty, and is updated late in the build process to have visibility over the symbols used by in-tree drivers. But since the symbol whitelist is known upfront, it can be used to pre-populate autoksyms.h and maximize the amount of code that can be compiled to its final state in a single pass, hence reducing build time. Do this by using gen_autoksyms.sh to initialize autoksyms.h instead of creating an empty file. Acked-by: Nicolas Pitre <nico@fluxnic.net> Tested-by: Matthias Maennich <maennich@google.com> Reviewed-by: Matthias Maennich <maennich@google.com> Signed-off-by: Quentin Perret <qperret@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent cd195bc commit 88694cf

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎Makefile‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,9 +1066,12 @@ endif
10661066

10671067
autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
10681068

1069+
quiet_cmd_autoksyms_h = GEN $@
1070+
cmd_autoksyms_h = mkdir -p $(dir $@); \
1071+
$(CONFIG_SHELL) $(srctree)/scripts/gen_autoksyms.sh $@
1072+
10691073
$(autoksyms_h):
1070-
$(Q)mkdir -p $(dir $@)
1071-
$(Q)touch $@
1074+
$(call cmd,autoksyms_h)
10721075

10731076
ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
10741077

‎scripts/gen_autoksyms.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ cat > "$output_file" << EOT
3939
4040
EOT
4141

42-
sed 's/ko$/mod/' modules.order |
42+
[ -f modules.order ] && modlist=modules.order || modlist=/dev/null
43+
sed 's/ko$/mod/' $modlist |
4344
xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- |
4445
cat - "$ksym_wl" |
4546
sort -u |

0 commit comments

Comments
 (0)