#!/bin/bash
PATH="${PATH}:/sbin:/usr/sbin"
-GK_V='3.4.10_pre2'
+GK_V='3.4.10'
# Set the default for TMPDIR. May be modified by genkernel.conf or the
# --tempdir command line option.
;;
esac
+# Pull in our configuration
source ${CMD_GK_CONFIG:-/etc/genkernel.conf} || small_die "Could not read /etc/genkernel.conf"
# Start sourcing other scripts
source ${GK_SHARE}/gen_determineargs.sh || gen_die "Could not read ${GK_SHARE}/gen_determineargs.sh"
source ${GK_SHARE}/gen_compile.sh || gen_die "Could not read ${GK_SHARE}/gen_compile.sh"
source ${GK_SHARE}/gen_configkernel.sh || gen_die "Could not read ${GK_SHARE}/gen_configkernel.sh"
-source ${GK_SHARE}/gen_initrd.sh || gen_die "Could not read ${GK_SHARE}/gen_initrd.sh"
source ${GK_SHARE}/gen_initramfs.sh || gen_die "Could not read ${GK_SHARE}/gen_initramfs.sh"
source ${GK_SHARE}/gen_moddeps.sh || gen_die "Could not read ${GK_SHARE}/gen_moddeps.sh"
source ${GK_SHARE}/gen_package.sh || gen_die "Could not read ${GK_SHARE}/gen_package.sh"
-source ${GK_SHARE}/gen_bootloader.sh || gen_die "Could not read ${GK_SHARE}/gen_bootloader.sh"
TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
trap trap_cleanup SIGHUP SIGQUIT SIGINT SIGTERM SIGKILL
BUILD_KERNEL=0
-BUILD_INITRD=0
+BUILD_RAMDISK=0
BUILD_MODULES=0
# Parse all command line options...
done
# Check if no action is specified...
-if [ "${BUILD_KERNEL}" -eq '0' -a "${BUILD_INITRD}" -eq '0' ]
+if [ "${BUILD_KERNEL}" -eq '0' -a "${BUILD_RAMDISK}" -eq '0' ]
then
usage
exit 1
# 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"
+source ${GK_SHARE}/arch/${ARCH}/modules_load || gen_die "Could not read ${GK_SHARE}/arch/${ARCH}/modules_load"
# Merge modules_load from config
for group_modules in ${!AMODULES_*}; do
determine_real_args
+set_kernel_arch
+
[ ! -f "${TEMP}" ] && mkdir -p "${TEMP}"
setup_cache_dir
+check_distfiles
dump_debugcache
NORMAL=${BOLD} print_info 1 "Linux Kernel ${BOLD}${KV}${NORMAL} for ${BOLD}${ARCH}${NORMAL}..."
-if [ "${BUILD_INITRD}" -ne '0' ]
+if [ "${BUILD_RAMDISK}" -ne '0' ]
then
if ! has_loop
then
# Configure kernel
config_kernel
- # Make deps
- compile_dep
-
- # Make prepare [2.6]
+ # Make prepare
if [ "${ARCH_HAVENOPREPARE}" = '' ]
then
- [ "${VER}" -gt '2' ] || [ "${VER}" -eq '2' -a "${PAT}" -ge '6' ] && compile_generic prepare kernel
+ compile_generic prepare kernel
fi
# KV may have changed due to the configuration
get_KV
- # Compile kernel; If using --genzimage, or building a mips kernel, skip
- # compile until after initrd/initramfs is done
- [ "${ENABLE_PEGASOS_HACKS}" != 'yes' -a ${BUILD_INITRAMFS} -eq '0' ] && compile_kernel
+ compile_kernel
# Compile modules
if [ ${BUILD_MODULES} -eq '1' -a ${BUILD_STATIC} -eq '0' ]
[ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels
cp "${KERNEL_DIR}/.config" "/etc/kernels/kernel-config-${ARCH}-${KV}"
fi
- if [ "${KERNCACHE}" != "" ]
- then
- if [ "${ENABLE_PEGASOS_HACKS}" != 'yes' -a ${BUILD_INITRAMFS} -eq 0 ]
- then
- gen_kerncache
- fi
- fi
fi
if ! isTrue "${CMD_NOINSTALL}"
print_info 1 "" 1 0
fi
-if [ "${BUILD_INITRD}" -eq '1' ]
+if [ "${BUILD_RAMDISK}" -eq '1' ]
then
[ "${DISKLABEL}" -eq '1' ] && compile_e2fsprogs
- if [ "${KERN_24}" != '1' ]
+ if [ "${BUSYBOX}" -eq '1' ]
then
- if [ "${BUSYBOX}" -eq '1' ]
- then
# Compile Busybox
compile_busybox
- fi
-
- # Compile initramfs
- create_initramfs
- else
- # Create initrd
- compile_busybox
- create_initrd
fi
+
+ # Compile initramfs
+ create_initramfs
else
print_info 1 'initrd: Not building since only the kernel was requested...'
fi
-# Pegasos fix
-if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' -o ${BUILD_INITRAMFS} -eq 1 ]
+if isTrue "${INTEGRATED_INITRAMFS}" #|| [ ${BUILD_KERNEL} -eq '1' -a "${KERNCACHE_IS_VALID}" == "0" ]
then
- # Compile kernel, intergrating the initrd into it for Pegasos & mips
+ # We build the kernel a second time to include the initramfs
compile_kernel
-
- # We skipped the kernel build and kerncache generation
- # So do it here
- [ "${KERNCACHE}" != "" ] && gen_kerncache
fi
+[ "${KERNCACHE}" != "" ] && gen_kerncache
[ "${MINKERNPACKAGE}" != '' ] && gen_minkernpackage
[ "${MODULESPACKAGE}" != '' ] && gen_modulespackage
if [ "${BUILD_KERNEL}" -eq '1' ]
then
- set_bootloader
print_info 1 ''
print_info 1 "Kernel compiled successfully!"
print_info 1 ''
print_info 1 'Required Kernel Parameters:'
- if [ "${BUILD_INITRD}" -eq '0' ]
+ if [ "${BUILD_RAMDISK}" -eq '0' ]
then
print_info 1 ' root=/dev/$ROOT'
print_info 1 ' [ And "vga=0x317 splash=verbose" if you use a framebuffer ]'
print_info 1 ''
print_info 1 ' Where $ROOT is the device node for your root partition as the'
print_info 1 ' one specified in /etc/fstab'
- elif [ "${KERN_24}" != '1' ]
- then
+ else
print_info 1 ' real_root=/dev/$ROOT'
print_info 1 ''
print_info 1 ' Where $ROOT is the device node for your root partition as the'
print_info 1 "If you require Genkernel's hardware detection features; you MUST"
print_info 1 'tell your bootloader to use the provided INITRAMFS file. Otherwise;'
print_info 1 'substitute the root argument for the real_root argument if you are'
- print_info 1 'not planning to use the initrd...'
- else
- print_info 1 ' root=/dev/ram0 real_root=/dev/$ROOT init=/linuxrc'
- [ "${INITRD_SIZE}" -ge 4096 ] && print_info 1 " ramdisk_size=${INITRD_SIZE}"
- print_info 1 ''
- print_info 1 ' Where $ROOT is the device node for your root partition as the'
- print_info 1 ' one specified in /etc/fstab'
- print_info 1 ''
- print_info 1 "If you require Genkernel's hardware detection features; you MUST"
- print_info 1 'tell your bootloader to use the provided INITRD file. Otherwise;'
- print_info 1 'substitute the root argument for the real_root argument if you are'
- print_info 1 'not planning to use the initrd...'
+ print_info 1 'not planning to use the initramfs...'
fi
fi
-if [ "${BUILD_INITRD}" -eq '1' ]
+if [ "${BUILD_RAMDISK}" -eq '1' ]
then
echo
print_info 1 'WARNING... WARNING... WARNING...'