4 determine_config_file() {
5 if [ "${CMD_KERNEL_CONFIG}" != "" ]
7 KERNEL_CONFIG="${CMD_KERNEL_CONFIG}"
8 elif [ -f "/etc/kernels/kernel-config-${ARCH}-${KV}" ]
10 KERNEL_CONFIG="/etc/kernels/kernel-config-${ARCH}-${KV}"
11 elif [ -f "${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" ]
13 KERNEL_CONFIG="${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}"
14 elif [ "${DEFAULT_KERNEL_CONFIG}" != "" -a -f "${DEFAULT_KERNEL_CONFIG}" ]
16 KERNEL_CONFIG="${DEFAULT_KERNEL_CONFIG}"
17 elif [ -f "${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" ]
19 KERNEL_CONFIG="${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}"
20 elif [ -f "${GK_SHARE}/arch/${ARCH}/kernel-config" ]
22 KERNEL_CONFIG="${GK_SHARE}/arch/${ARCH}/kernel-config"
24 gen_die 'Error: No kernel .config specified, or file not found!'
30 cd "${KERNEL_DIR}" || gen_die 'Could not switch to the kernel directory!'
32 # Backup current kernel .config
33 if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_DIR}/.config" ]
35 print_info 1 "config: Using config from ${KERNEL_CONFIG}"
36 if [ -f "${KERNEL_DIR}/.config" ]
38 NOW=`date +--%Y-%m-%d--%H-%M-%S`
39 cp "${KERNEL_DIR}/.config" "${KERNEL_DIR}/.config${NOW}.bak" \
40 || gen_die "Could not backup kernel config (${KERNEL_DIR}/.config)"
41 print_info 1 " Previous config backed up to .config${NOW}.bak"
47 print_info 1 'kernel: >> Running mrproper...'
48 compile_generic mrproper kernel
50 print_info 1 "config: --no-mrproper is enabled; not running 'make mrproper'."
53 # If we're not cleaning a la mrproper, then we don't want to try to overwrite the configs
54 # or we might remove configurations someone is trying to test.
55 if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_DIR}/.config" ]
57 cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die 'Could not copy configuration file!'
60 if isTrue "${OLDCONFIG}"
62 print_info 1 ' >> Running oldconfig...'
63 yes '' 2>/dev/null | compile_generic oldconfig kernel 2>/dev/null
65 print_info 1 "config: --oldconfig is disabled; not running 'make oldconfig'."
69 print_info 1 'kernel: >> Cleaning...'
70 compile_generic clean kernel
72 print_info 1 "config: --no-clean is enabled; not running 'make clean'."
75 if isTrue ${MENUCONFIG}
77 print_info 1 'config: >> Invoking menuconfig...'
78 compile_generic menuconfig runtask
79 [ "$?" ] || gen_die 'Error: menuconfig failed!'
80 elif isTrue ${CMD_GCONFIG}
82 print_info 1 'config: >> Invoking gconfig...'
83 compile_generic gconfig kernel
84 [ "$?" ] || gen_die 'Error: gconfig failed!'
89 if isTrue ${CMD_XCONFIG}
91 print_info 1 'config: >> Invoking xconfig...'
92 compile_generic xconfig kernel
93 [ "$?" ] || gen_die 'Error: xconfig failed!'
96 # Force this on if we are using --genzimage
97 if isTrue ${CMD_GENZIMAGE}
99 # Make sure Ext2 support is on...
100 sed -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g' \
101 -i ${KERNEL_DIR}/.config
104 # Make sure lvm modules are on if --lvm
107 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
108 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_SNAPSHOT is.*/CONFIG_DM_SNAPSHOT=m/g'
109 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_DM_MIRROR is.*/CONFIG_DM_MIRROR=m/g'
112 # Make sure dmraid modules are on if --dmraid
113 if isTrue ${CMD_DMRAID}
115 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_BLK_DEV_DM is.*/CONFIG_BLK_DEV_DM=m/g'
118 # Make sure iSCSI modules are enabled in the kernel, if --iscsi
119 # CONFIG_SCSI_ISCSI_ATTRS
121 if isTrue ${CMD_ISCSI}
123 sed -i ${KERNEL_DIR}/.config -e 's/\# CONFIG_ISCSI_TCP is not set/CONFIG_ISCSI_TCP=m/g'
124 sed -i ${KERNEL_DIR}/.config -e 's/\# CONFIG_SCSI_ISCSI_ATTRS is not set/CONFIG_SCSI_ISCSI_ATTRS=m/g'
126 sed -i ${KERNEL_DIR}/.config -e 's/CONFIG_ISCSI_TCP=y/CONFIG_ISCSI_TCP=m/g'
127 sed -i ${KERNEL_DIR}/.config -e 's/CONFIG_SCSI_ISCSI_ATTRS=y/CONFIG_SCSI_ISCSI_ATTRS=m/g'
132 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'