diff options
author | Raghavendra Rao Ananta <rananta@codeaurora.org> | 2020-04-03 19:55:31 -0700 |
---|---|---|
committer | Raghavendra Rao Ananta <rananta@codeaurora.org> | 2020-04-04 23:12:08 -0700 |
commit | ebec614ce0e7aea5b76eaeab7fe6e843f6484709 (patch) | |
tree | ae693609b62b8f988b2f48f27933e1c36c401b6d | |
parent | ea7596fe1de82bef38f37229284273f949ea15a1 (diff) |
buildkernel: Save unstripped modules for debugging
Currently, the build script installs the modules by stripping off
the symbol information, which further then gets placed on the target.
However, this symbol information is really useful for performing
postmortem analysis. Hence, install a separate copy of unstripped
modules for this purpose.
Change-Id: I415fd65d125d91bd054b748651773e2079d9fe50
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
-rwxr-xr-x | buildkernel.sh | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/buildkernel.sh b/buildkernel.sh index 3e2dc59..33a19e5 100755 --- a/buildkernel.sh +++ b/buildkernel.sh @@ -32,7 +32,7 @@ export MODULES_STAGING_DIR=$(readlink -m ${COMMON_OUT_DIR}/staging) export KERNEL_PREBUILT_DIR=$(readlink -m ${KERNEL_DIR}/../ship_prebuilt) export MODULES_PRIVATE_DIR=$(readlink -m ${COMMON_OUT_DIR}/private) export DIST_DIR=$(readlink -m ${DIST_DIR:-${COMMON_OUT_DIR}/dist}) -export UNSTRIPPED_DIR=${DIST_DIR}/unstripped +export UNSTRIPPED_DIR=${ROOT_DIR}/${KERNEL_MODULES_OUT}/unstripped export CLANG_TRIPLE CROSS_COMPILE CROSS_COMPILE_ARM32 ARCH SUBARCH #Setting up for build @@ -330,6 +330,29 @@ copy_from_prebuilt() } +save_unstripped_modules() +{ + echo "======================" + echo "Creating a copy of unstripped modules" + rm -rf ${UNSTRIPPED_DIR} + mkdir -p ${UNSTRIPPED_DIR} + + set -x + + (cd ${OUT_DIR} && \ + ${MAKE_PATH}make O=${OUT_DIR} ${CC_ARG} INSTALL_MOD_PATH=${UNSTRIPPED_DIR} ${MAKE_ARGS} modules_install) + + MODULES=$(find ${UNSTRIPPED_DIR} -type f -name "*.ko") + for MODULE in ${MODULES}; do + cp -p ${MODULE} ${UNSTRIPPED_DIR} + done + + # Remove the /lib/modules/$(uname -r) hierarchy + rm -rf ${UNSTRIPPED_DIR}/lib + + set +x +} + #script starts executing here if [ -n "${CC}" ]; then CC_ARG="CC=${CC}" @@ -360,6 +383,7 @@ else modules_install copy_all_to_prebuilt ${KERNEL_BINS} archive_kernel_modules + save_unstripped_modules fi exit 0 |