summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac J. Manjarres <isaacmanjarres@google.com>2024-02-04 00:45:41 -0800
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-02-07 11:55:15 +0000
commit7f72413fa45ef9055544fcf084dcd26a969ea736 (patch)
tree12ce02c43fa6800a919998f1134e243de3d0c615
parente5825a92a0f89999ca8ef83987a3c814cd59032a (diff)
downloadbuild-7f72413fa45ef9055544fcf084dcd26a969ea736.tar.gz
build_utils.sh: Ensure depmod runs on all modules last
When handling charger and recovery modules lists, depmod is run on the set of charger and recovery modules and all modules. However, the order in which this happens is such that depmod is run on the set of charger modules, instead of all modules last. This means that the final modules.dep file will contain the dependencies for the charger modules, and not the rest of the modules. This is not ideal, as the modules.dep file should contain the dependencies for all modules. Thus, ensure that depmod is run on all modules last after running depmod on the recovery and charger modules lists. Bug: 322408856 Bug: 323710246 Change-Id: I7e03be016877df3b528b810735efec6c55fd0f6e Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com> (cherry picked from commit 3f67b5ffe1348d438e47f95fe2f2250def080960)
-rw-r--r--build_utils.sh22
1 files changed, 13 insertions, 9 deletions
diff --git a/build_utils.sh b/build_utils.sh
index 9f3c5ed1..2c662123 100644
--- a/build_utils.sh
+++ b/build_utils.sh
@@ -283,17 +283,21 @@ function create_modules_staging() {
# Re-run depmod to detect any dependencies between in-kernel and external
# modules, as well as recovery and charger modules. Then, create the
# modules.order files based on all the modules compiled.
- declare -A module_load_lists_arr
- module_load_lists_arr["modules.order"]="modules.load"
- module_load_lists_arr["modules.order.recovery"]="modules.load.recovery"
- module_load_lists_arr["modules.order.charger"]="modules.load.charger"
-
- for mod_order_file in ${!module_load_lists_arr[@]}; do
- local mod_order_filepath=${dest_dir}/${mod_order_file}
- local mod_load_filepath=${dest_dir}/${module_load_lists_arr[${mod_order_file}]}
+ #
+ # It is important that "modules.order" is last, as that will force depmod
+ # to run on all the modules in the directory, instead of just a list of them.
+ # It is desirable for depmod to run with all the modules last so that the
+ # dependency information is available for all modules, not just the recovery
+ # or charger sets.
+ modules_order_files=("modules.order.recovery" "modules.order.charger" "modules.order")
+ modules_load_files=("modules.load.recovery" "modules.load.charger" "modules.load")
+
+ for i in ${!modules_order_files[@]}; do
+ local mod_order_filepath=${dest_dir}/${modules_order_files[$i]}
+ local mod_load_filepath=${dest_dir}/${modules_load_files[$i]}
if [[ -f ${mod_order_filepath} ]]; then
- if [[ "${mod_order_file}" == "modules.order" ]]; then
+ if [[ "${modules_order_files[$i]}" == "modules.order" ]]; then
run_depmod ${dest_stage} "${depmod_flags}" "${version}"
else
run_depmod ${dest_stage} "${depmod_flags}" "${version}" "${mod_order_filepath}"