Исправление создания шаблона настроек ядра.

Добавлена --safemode, menuconfig заменен на nconfig
master
Mike Khiretskiy 9 years ago
parent 0bff32e72e
commit b39c69bdc9

@ -15,7 +15,7 @@
PATH=/lib/rc/bin:$PATH
CL_KERNEL_VERSION=0.1
CL_KERNEL_VERSION=0.1_alpha1
DESCRIPTION="Create kernel utility"
DEFAULT_KERNEL_DIRECTORY=/usr/src/linux
SRC_DIRECTORY=/usr/src
@ -55,11 +55,13 @@ Version: $CL_KERNEL_VERSION
${DESCRIPTION}
--kver [VERSION] Specify kernel version
--kver-old [VERSION] Specify kernel version for new options
--skip-build Do not build kernel after configuration
--march [ARCH] Kernel architecture
--convert Migrate .config in kernel directory to templates
--kver [VERSION] specify kernel version
--kver-old [VERSION] specify kernel version for new options
--convert migrate .config in kernel directory to templates
--skip-build do not build kernel after configuration
--march [ARCH] kernel architecture
--safemode create additional initrd with all modules (only for calculate-sources)
--help display this help and exit
EOF
}
@ -72,6 +74,7 @@ rearrange_params() {
--long march: \
--long convert \
--long skip-build \
--long safemode \
-- "$@")
if (( $? != 0 )); then
usage
@ -94,6 +97,9 @@ do_args() {
KVER_OLD="$2"
shift
;;
--safemode)
SAFEMODE=1
;;
--march)
MARCH="$2"
if [[ ${MARCH} != "x86" ]] && [[ ${MARCH} != "x86_64" ]]
@ -169,6 +175,10 @@ discard_option_n() {
grep -v "=n$"
}
removed_options_new() {
diff -u $orig_file $new_file | grep "^+# CON" | sed 's/^.//' | sed -r 's/# (CONFIG[^ ]+).*$/\1=n/' | sort
}
diff_template_body() {
local orig_file=$1
local new_file=$2
@ -177,6 +187,8 @@ diff_template_body() {
removed_options $orig_file $new_file | exclude_options ${grep_opts[*]} | remove_syntax | discard_option_n || true
grep_opts_remove=( $(removed_options $orig_file $new_file | grep_patterns) )
added_options $orig_file $new_file | exclude_options ${grep_opts_remove[*]} || true
grep_opts_remove_new=( $(removed_options $orig_file $new_file | options_name | grep_patterns) )
removed_options_new $orig_file $new_file | exclude_options ${grep_opts_remove_new[*]} | remove_syntax || true
}
diff_template_head() {
@ -197,7 +209,7 @@ create_template() {
local base_config=$3
local new_config=$4
diff_template_head ${category_pn} ${pv}
diff_template_body ${base_config} ${new_config}
diff_template_body ${base_config} ${new_config} | sort
}
create_kernel_config() {
@ -273,6 +285,8 @@ then
KVER=$(basename "$(readlink $KERNEL_DIR)" | sed 's/linux-//')
fi
[[ -n $SAFEMODE ]] && [[ $KVER =~ -calculate ]] || eerror "--safemode available for calculate-sources only"
if ! [[ -d $LOCAL_TEMPLATES_DIR ]]
then
(mkdir -p $LOCAL_TEMPLATES_DIR ;
@ -326,9 +340,9 @@ fi
eend
###########################
# Execute menuconfig
# Execute nconfig
###########################
(cd $KERNEL_DIR; [[ -n ${KERNEL_OLD_DIR} ]] && make oldconfig; make -s menuconfig) || true
(cd $KERNEL_DIR; [[ -n ${KERNEL_OLD_DIR} ]] && make oldconfig; make -s nconfig) || true
###########################
# Creating template
@ -369,7 +383,7 @@ then
cd $KERNEL_DIR
(source_makeconf && make $MAKEOPTS && make $MAKEOPTS modules && make $MAKEOPTS install && make $MAKEOPTS modules_install)
grep -q "CONFIG_BLK_DEV_INITRD=y" ${NEW_CONFIG} && dracut -fH --kver $KVER /boot/initramfs-${KVER}.img
if [[ $KVER =~ calculate ]]
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

Loading…
Cancel
Save