3 determine_config_file() {
4 if [ "${CMD_KERNEL_CONFIG}" != "" ]
6 KERNEL_CONFIG="${CMD_KERNEL_CONFIG}"
7 elif [ -f "/etc/kernels/kernel-config-${ARCH}-${KV}" ]
9 KERNEL_CONFIG="/etc/kernels/kernel-config-${ARCH}-${KV}"
10 elif [ -f "${GK_SHARE}/${ARCH}/kernel-config-${KV}" ]
12 KERNEL_CONFIG="${GK_SHARE}/${ARCH}/kernel-config-${KV}"
13 elif [ "${DEFAULT_KERNEL_CONFIG}" != "" -a -f "${DEFAULT_KERNEL_CONFIG}" ]
15 KERNEL_CONFIG="${DEFAULT_KERNEL_CONFIG}"
16 elif [ -f "${GK_SHARE}/${ARCH}/kernel-config-${VER}.${PAT}" ]
18 KERNEL_CONFIG="${GK_SHARE}/${ARCH}/kernel-config-${VER}.${PAT}"
19 elif [ -f "${GK_SHARE}/${ARCH}/kernel-config" ]
21 KERNEL_CONFIG="${GK_SHARE}/${ARCH}/kernel-config"
23 gen_die 'Error: No kernel .config specified, or file not found!'
29 cd "${KERNEL_DIR}" || gen_die 'Could not switch to the kernel directory!'
31 isTrue "${CLEAN}" && cp "${KERNEL_DIR}/.config" "${KERNEL_DIR}/.config.bak" > /dev/null 2>&1
34 print_info 1 'kernel: >> Running mrproper...'
35 compile_generic mrproper kernel
38 # If we're not cleaning, then we don't want to try to overwrite the configs there
39 # or we might remove configurations someone is trying to test.
43 print_info 1 "config: Using config from ${KERNEL_CONFIG}"
44 print_info 1 ' Previous config backed up to .config.bak'
45 cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die 'Could not copy configuration file!'
47 if isTrue "${CLEAN}" || isTrue "${OLDCONFIG}"
49 if ! isTrue "${CLEAN}"
51 print_info 1 'config: >> Running oldconfig...'
53 print_info 1 ' >> Running oldconfig...'
55 yes '' 2>/dev/null | compile_generic oldconfig kernel 2>/dev/null # Nullify to stop broken pipe messages
59 print_info 1 'kernel: >> Cleaning...'
60 compile_generic clean kernel
62 print_info 1 "config: --no-clean is enabled; leaving the .config alone."
65 if isTrue ${MENUCONFIG}
67 print_info 1 'config: >> Invoking menuconfig...'
68 compile_generic menuconfig runtask
69 [ "$?" ] || gen_die 'Error: menuconfig failed!'
70 elif isTrue ${CMD_GCONFIG}
72 if [ "${VER}" == '2' ] && [ "${PAT}" -lt '6' ]
74 print_warning 1 'config: gconfig is not available in 2.4 series kernels. Running xconfig'
75 print_warning 1 ' instead...'
80 print_info 1 'config: >> Invoking gconfig...'
81 compile_generic gconfig kernel
82 [ "$?" ] || gen_die 'Error: gconfig failed!'
88 if isTrue ${CMD_XCONFIG}
90 print_info 1 'config: >> Invoking xconfig...'
91 compile_generic xconfig kernel
92 [ "$?" ] || gen_die 'Error: xconfig failed!'
95 # Force this on if we are a 2.4 kernel or less
96 # This is required for initrd support
97 # Initramfs doesn't require this
98 # TODO: force on with --genzimage
99 if [ "${KERN_24}" -eq '1' ]
101 # Make sure Ext2 support is on...
102 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g'
105 # Make sure lvm modules are on if --lvm/--lvm
108 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
109 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_SNAPSHOT is.*/CONFIG_DM_SNAPSHOT=m/g'
110 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_MIRROR is.*/CONFIG_DM_MIRROR=m/g'
113 # Make sure dmraid modules are on if --dmraid
114 if isTrue ${CMD_DMRAID}
116 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
121 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'
124 # This check isn't complete: SOFTWARE_SUSPEND has extra deps on some systems such as CPU hotplug
125 # if isTrue ${CMD_SUSPEND}
127 # sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_SOFTWARE_SUSPEND is.*/CONFIG_SOFTWARE_SUSPEND=y/g'