Skip to content

Commit af6e38d

Browse files
committed
Support deleting kernel source code
1 parent 4edf462 commit af6e38d

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

compile-kernel/tools/script/armbian_compile_kernel_script.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ custom_name="-ophub"
7676
package_list="all"
7777
# Set the compression format, options: [ gzip / lzma / xz / zstd ]
7878
compress_format="xz"
79+
# Set whether to automatically delete the source code after the kernel is compiled
80+
delete_source="false"
7981

8082
# Compile toolchain download mirror, run on Armbian
8183
dev_repo="https://github.com/ophub/kernel/releases/download/dev"
@@ -104,7 +106,7 @@ init_var() {
104106
echo -e "${STEPS} Start Initializing Variables..."
105107

106108
# If it is followed by [ : ], it means that the option requires a parameter value
107-
get_all_ver="$(getopt "k:a:n:m:p:r:t:c:" "${@}")"
109+
get_all_ver="$(getopt "k:a:n:m:p:r:t:c:d:" "${@}")"
108110

109111
while [[ -n "${1}" ]]; do
110112
case "${1}" in
@@ -176,6 +178,14 @@ init_var() {
176178
error_msg "Invalid -c parameter [ ${2} ]!"
177179
fi
178180
;;
181+
-d | --DeleteSource)
182+
if [[ -n "${2}" ]]; then
183+
delete_source="${2}"
184+
shift
185+
else
186+
error_msg "Invalid -d parameter [ ${2} ]!"
187+
fi
188+
;;
179189
*)
180190
error_msg "Invalid option [ ${1} ]!"
181191
;;
@@ -502,13 +512,13 @@ compile_kernel() {
502512

503513
# Make kernel
504514
echo -e "${STEPS} Start compilation kernel [ ${local_kernel_path} ]..."
505-
make ${MAKE_SET_STRING} Image modules dtbs -j${PROCESS}
515+
make -s ${MAKE_SET_STRING} Image modules dtbs -j${PROCESS}
506516
#make ${MAKE_SET_STRING} bindeb-pkg KDEB_COMPRESS=xz KBUILD_DEBARCH=arm64 -j${PROCESS}
507517
[[ "${?}" -eq "0" ]] && echo -e "${SUCCESS} The kernel is compiled successfully."
508518

509519
# Install modules
510520
echo -e "${STEPS} Install modules ..."
511-
make ${MAKE_SET_STRING} INSTALL_MOD_PATH=${output_path}/modules modules_install
521+
make -s ${MAKE_SET_STRING} INSTALL_MOD_PATH=${output_path}/modules modules_install
512522
[[ "${?}" -eq "0" ]] && echo -e "${SUCCESS} The modules is installed successfully."
513523

514524
# Strip debug information
@@ -687,6 +697,7 @@ clean_tmp() {
687697

688698
sync && sleep 3
689699
rm -rf ${output_path}/{boot/,dtb/,modules/,header/,${kernel_version}/}
700+
[[ "${delete_source}" == "true" ]] && rm -rf ${kernel_path}/* 2>/dev/null
690701
rm -rf ${tmp_backup_path}
691702

692703
echo -e "${SUCCESS} All processes have been completed."

recompile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,12 +635,12 @@ compile_kernel() {
635635

636636
# Make kernel
637637
echo -e "${STEPS} Start compilation kernel [ ${local_kernel_path} ]..."
638-
make ${MAKE_SET_STRING} Image modules dtbs -j${PROCESS}
638+
make -s ${MAKE_SET_STRING} Image modules dtbs -j${PROCESS}
639639
[[ "${?}" -eq "0" ]] && echo -e "${SUCCESS} The kernel is compiled successfully."
640640

641641
# Install modules
642642
echo -e "${STEPS} Install modules..."
643-
make ${MAKE_SET_STRING} INSTALL_MOD_PATH=${output_path}/modules modules_install
643+
make -s ${MAKE_SET_STRING} INSTALL_MOD_PATH=${output_path}/modules modules_install
644644
[[ "${?}" -eq "0" ]] && echo -e "${SUCCESS} The modules is installed successfully."
645645

646646
# Strip debug information

0 commit comments

Comments
 (0)