4 # Fills variable KERNEL_CONFIG
5 determine_config_file() {
6 if [ "${CMD_KERNEL_CONFIG}" != "" ]
8 KERNEL_CONFIG="${CMD_KERNEL_CONFIG}"
9 elif [ -f "/etc/kernels/kernel-config-${ARCH}-${KV}" ]
11 KERNEL_CONFIG="/etc/kernels/kernel-config-${ARCH}-${KV}"
12 elif [ -f "${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" ]
14 KERNEL_CONFIG="${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}"
15 elif [ "${DEFAULT_KERNEL_CONFIG}" != "" -a -f "${DEFAULT_KERNEL_CONFIG}" ]
17 KERNEL_CONFIG="${DEFAULT_KERNEL_CONFIG}"
18 elif [ -f "${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" ]
20 KERNEL_CONFIG="${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}"
21 elif [ -f "${GK_SHARE}/arch/${ARCH}/kernel-config" ]
23 KERNEL_CONFIG="${GK_SHARE}/arch/${ARCH}/kernel-config"
25 gen_die 'Error: No kernel .config specified, or file not found!'
31 cd "${KERNEL_DIR}" || gen_die 'Could not switch to the kernel directory!'
33 # Backup current kernel .config
34 if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_DIR}/.config" ]
36 print_info 1 "kernel: Using config from ${KERNEL_CONFIG}"
37 if [ -f "${KERNEL_DIR}/.config" ]
39 NOW=`date +--%Y-%m-%d--%H-%M-%S`
40 cp "${KERNEL_DIR}/.config" "${KERNEL_DIR}/.config${NOW}.bak" \
41 || gen_die "Could not backup kernel config (${KERNEL_DIR}/.config)"
42 print_info 1 " Previous config backed up to .config${NOW}.bak"
48 print_info 1 'kernel: >> Running mrproper...'
49 compile_generic mrproper kernel
51 print_info 1 "kernel: --mrproper is disabled; not running 'make mrproper'."
54 # If we're not cleaning a la mrproper, then we don't want to try to overwrite the configs
55 # or we might remove configurations someone is trying to test.
56 if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_DIR}/.config" ]
58 cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die 'Could not copy configuration file!'
61 if isTrue "${OLDCONFIG}"
63 print_info 1 ' >> Running oldconfig...'
64 yes '' 2>/dev/null | compile_generic oldconfig kernel 2>/dev/null
66 print_info 1 "kernel: --oldconfig is disabled; not running 'make oldconfig'."
70 print_info 1 'kernel: >> Cleaning...'
71 compile_generic clean kernel
73 print_info 1 "kernel: --clean is disabled; not running 'make clean'."
76 if isTrue ${MENUCONFIG}
78 print_info 1 'kernel: >> Invoking menuconfig...'
79 compile_generic menuconfig runtask
80 [ "$?" ] || gen_die 'Error: menuconfig failed!'
81 elif isTrue ${CMD_GCONFIG}
83 print_info 1 'kernel: >> Invoking gconfig...'
84 compile_generic gconfig kernel
85 [ "$?" ] || gen_die 'Error: gconfig failed!'
90 if isTrue ${CMD_XCONFIG}
92 print_info 1 'kernel: >> Invoking xconfig...'
93 compile_generic xconfig kernel
94 [ "$?" ] || gen_die 'Error: xconfig failed!'
97 # Force this on if we are using --genzimage
98 if isTrue ${CMD_GENZIMAGE}
100 # Make sure Ext2 support is on...
101 sed -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g' \
102 -i ${KERNEL_DIR}/.config
105 # Make sure lvm modules are on if --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'
119 # Make sure iSCSI modules are enabled in the kernel, if --iscsi
120 # CONFIG_SCSI_ISCSI_ATTRS
122 if isTrue ${CMD_ISCSI}
124 sed -i ${KERNEL_DIR}/.config -e 's/\# CONFIG_ISCSI_TCP is not set/CONFIG_ISCSI_TCP=m/g'
125 sed -i ${KERNEL_DIR}/.config -e 's/\# CONFIG_SCSI_ISCSI_ATTRS is not set/CONFIG_SCSI_ISCSI_ATTRS=m/g'
127 sed -i ${KERNEL_DIR}/.config -e 's/CONFIG_ISCSI_TCP=y/CONFIG_ISCSI_TCP=m/g'
128 sed -i ${KERNEL_DIR}/.config -e 's/CONFIG_SCSI_ISCSI_ATTRS=y/CONFIG_SCSI_ISCSI_ATTRS=m/g'
133 sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_FB_SPLASH is.*/CONFIG_FB_SPLASH=y/g'