diff --git a/cl-kernel b/cl-kernel index 04d8feb..a05f421 100755 --- a/cl-kernel +++ b/cl-kernel @@ -34,6 +34,9 @@ CREATE_NEW=1 # собирать ядро после конфигурации # compile the kernel once configuration is complete BUILD_KERNEL=1 +# очистить исходники ядра перед сборкой +# clean the kernel sources before the compilation +CLEAN_KERNEL=1 # права на файл шаблона # template file privileges CHMOD=0644 @@ -73,6 +76,7 @@ ${DESCRIPTION} --kver-old [VERSION] specify the kernel version for new options ('list' for displaying possible values) --convert migrate .config from the kernel directory to templates -s, --skip-build do not build the kernel after configuration + --noclean do not clean the kernel sources before the compilation --march [ARCH] kernel architecture (x86 or x86_64) --safemode create an additional initrd with all modules (only for calculate-sources) --help display this help and exit @@ -89,6 +93,7 @@ rearrange_params() { --long kver-old: \ --long march: \ --long convert \ + --long noclean \ --long skip-build \ --long safemode \ -- "$@") @@ -133,6 +138,9 @@ do_args() { -s|--skip-build) BUILD_KERNEL= ;; + --noclean) + CLEAN_KERNEL= + ;; --) shift;break;; *) usage; eerror $"Unknown option: $1" @@ -609,22 +617,32 @@ STARTTIME=$(date +%s) if [[ -n ${BUILD_KERNEL} ]] then cd $KERNEL_DIR - (source_makeconf && make clean && make $MAKEOPTS && make $MAKEOPTS modules_install && make $MAKEOPTS install) + ( + source_makeconf || eerror $"Failed to import make.conf" || exit 1 + set -e + if [[ -n ${CLEAN_KERNEL} ]] + then + make clean || eerror $"Failed to clean the kernel sources" || exit 1 + fi + make $MAKEOPTS || eerror $"Failed to compile the kernel" || exit 1 + make $MAKEOPTS modules_install || eerror $"Failed to compile the kernel modules" || exit 1 + make $MAKEOPTS install || eerror $"Failed to install the kernel" || exit 1 + ) || eerror $"Failed to build kernel" # сборка initramfs # initramfs building - if [[ -n $DRACUT ]] + if [[ -n $DRACUT ]] && grep -q "CONFIG_BLK_DEV_INITRD=y" ${NEW_CONFIG} then - grep -q "CONFIG_BLK_DEV_INITRD=y" ${NEW_CONFIG} && ${DRACUT} -fH --kver $KVER /boot/initramfs-${KVER}.img + type lz4 &>/dev/null&& LZ4=--lz4 + ${DRACUT} -fH --kver $LZ4 $KVER /boot/initramfs-${KVER}.img || eerror $"Failed to create the host-only initramfs" if [[ $KVER =~ calculate ]] && [[ -n $SAFEMODE ]] then - - grep -q "CONFIG_BLK_DEV_INITRD=y" ${NEW_CONFIG} && ${DRACUT} -f --kver $KVER /boot/initramfs-${KVER/-calculate/-SafeMode-calculate}.img + ${DRACUT} -f --kver $LZ4 $KVER /boot/initramfs-${KVER/-calculate/-SafeMode-calculate}.img || eerror $"Failed to create the safemode initramfs" fi + else + # удалить старый ramfs если его поддержка выключена в ядре + # remove the old ramfs if its support disabled in the kernel configuration + rm -f /boot/initramfs-${KVER}.img /boot/initramfs-${KVER/-calculate/-SafeMode-calculate}.img fi - # удалить старый ramfs если его поддержка выключена в ядре - # remove the old ramfs if its support disabled in the kernel configuration - grep -q "CONFIG_BLK_DEV_INITRD=y" ${NEW_CONFIG} || rm -f /boot/initramfs-${KVER}.img || true - grep -q "CONFIG_BLK_DEV_INITRD=y" ${NEW_CONFIG} || rm -f /boot/initramfs-${KVER/-calculate/-SafeMode-calculate}.img || true # выполнение шаблонов для настройки загрузки системы # applying the templates for boot configuration