kernel: Error on duplicate modules
This can happen when an out of tree module target uses a matching module name from the base kernel. This causes two problems: 1) Depmod gets confused and only pulls symbols from one of the modules 2) Copying the modules to modules_out is not entirely deterministic and is based on the first variant to be returned by find, meaning that the variant that gets copied to the device could change build to build. To avoid these issues, fail the build if this happens and force the build target to only generate one copy of each module name. Change-Id: I2e47ba4e142054feabaa1ab80fbbe0332fd84a62
This commit is contained in:
parent
cfaa5d0101
commit
49c4dd8f86
1 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
# Copyright (C) 2012 The CyanogenMod Project
|
||||
# (C) 2017-2023 The LineageOS Project
|
||||
# (C) 2017-2024 The LineageOS Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -482,6 +482,13 @@ $(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_CONFIG) $(DEPMOD) $(DTC)
|
|||
$(foreach s, $(TARGET_MODULE_ALIASES),\
|
||||
$(eval p := $(subst :,$(space),$(s))) \
|
||||
; mv $$(find $$kernel_modules_dir -name $(word 1,$(p))) $$kernel_modules_dir/$(word 2,$(p))); \
|
||||
dup_modules=$$(find $$kernel_modules_dir -type f -name '*.ko' -printf '%f\n' |sort |uniq -d); \
|
||||
$(if $$dup_modules,\
|
||||
err=$$(for m in $$dup_modules; do \
|
||||
echo "ERROR: Duplicate module $$m" 1>&2 && echo "dup"; \
|
||||
done); \
|
||||
[ -n "$$err" ] && exit 1; \
|
||||
) \
|
||||
all_modules=$$(find $$kernel_modules_dir -type f -name '*.ko'); \
|
||||
filtered_modules=""; \
|
||||
$(if $(SYSTEM_KERNEL_MODULES),\
|
||||
|
|
Loading…
Reference in a new issue