#!/bin/bash # Genkernel v3 GK_V="3.0.1_beta9" TEMP="/tmp" small_die() { echo $1 exit 1 } source /etc/genkernel.conf || small_die "could not read /etc/genkernel.conf" source ${GK_BIN}/gen_funcs.sh || small_die "could not read ${GK_BIN}/gen_funcs.sh" clear_log source ${GK_BIN}/gen_cmdline.sh || gen_die "could not read ${GK_BIN}/gen_cmdline.sh" source ${GK_BIN}/gen_arch.sh || gen_die "could not read ${GK_BIN}/gen_arch.sh" source ${GK_BIN}/gen_determineargs.sh || gen_die "could not read ${GK_BIN}/gen_determineargs.sh" source ${GK_BIN}/gen_compile.sh || gen_die "could not read ${GK_BIN}/gen_compile.sh" source ${GK_BIN}/gen_configkernel.sh || gen_die "could not read ${GK_BIN}/gen_configkernel.sh" source ${GK_BIN}/gen_initrd.sh || gen_die "could not read ${GK_BIN}/gen_initrd.sh" source ${GK_BIN}/gen_moddeps.sh || gen_die "could not read ${GK_BIN}/gen_moddeps.sh" source ${GK_BIN}/gen_package.sh || gen_die "could not read ${GK_BIN}/gen_package.sh" BUILD_ALL=0 BUILD_KERNEL=0 BUILD_INITRD=0 # Parse all command line options, and load into memory parse_cmdline $* if [ "${BUILD_ALL}" -eq 0 -a "${BUILD_KERNEL}" -eq 0 -a "${BUILD_INITRD}" -eq 0 ] then usage exit 1 fi print_info 1 "GenKernel v${GK_V}" 1 0 # Set ${ARCH} get_official_arch # Read arch-specific config source ${ARCH_CONFIG} || gen_die "could not read ${ARCH_CONFIG}" source ${GK_SHARE}/${ARCH}/modules_load || gen_die "could not read ${GK_SHARE}/${ARCH}/modules_load" # Based on genkernel.conf, arch-specific configs, and commandline options, # get the real args for use. determine_real_args print_info 1 "ARCH: ${ARCH}" print_info 1 "KERNEL VER: ${KV}" if ! has_loop then print_info 1 "Your kernel does not appear to have loop device support. " print_info 1 "Please 'modprobe loop' if it is a module before running genkernel" gen_die "----Load loop support----" fi # Configure kernel config_kernel # Make deps compile_dep # Compile kernel compile_kernel # Compile modules compile_modules print_info 1 "Copying config for successful build to /etc/kernels/kernel-config-${ARCH}-${KV}" [ ! -e "/etc/kernels" ] && mkdir -p /etc/kernels cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}" # Compile dietlibc if [ "${USE_DIETLIBC}" = "1" ] then compile_dietlibc fi # Compile Busybox compile_busybox # Only compile insmod if we're installing modules onto the initrd if [ "${NOINITRDMODULES}" = "" ] then if [ "${PAT}" -gt "4" ] then # Compile module-init-tools compile_module_init_tools else compile_modutils fi fi compile_devfsd # Create initrd create_initrd if [ "${MINKERNPACKAGE}" != "" ] then gen_minkernpackage fi print_info 1 " " print_info 1 " " print_info 1 "Kernel compiled successfully!" print_info 1 "Required Kernel Params:" print_info 1 " : root=/dev/ram0 init=/linuxrc real_root=/dev/\$ROOT" print_info 1 " where \$ROOT is the devicenode for your root partition as" print_info 1 " you should have specified in /etc/fstab" print_info 1 "" print_info 1 "You MUST tell your bootloader to use the generated initrd" print_info 1 "" print_info 1 "Recommended Kernel Params:" print_info 1 " : vga=0x317 splash=verbose" print_info 1 "" print_info 1 "Do NOT report kernel bugs (configs included) as genkernel bugs." print_info 1 "Make sure you have the latest genkernel before reporting bugs" print_info 1 "" print_info 1 "For more info see /usr/share/genkernel/README"