Nethence Documentation Lab Webmail Your IP BBDock  


Those documents are obsolete, please use the Nethence Documentation instead.

HomeUnixWindowsOracleObsoleteHardwareDIYMechanicsScriptsConfigsPrivate

Custom Linux kernel configuration (2.6)
 
Introduction
Although 'oldconfig' or 'silentoldconfig' are supposed to be used to upgrade the kernel by skipping the existing settings, I simply use those targets to deal with driver dependencies, as I edit the ‘.config’ file directly.
 
Base configuration
cd /usr/src/linux/
make distclean
ls -l *.config*
ls -al *config*
make defconfig
mv -f .config .config.defconfig.dist
 
# AMD64/EM64T 64-bit
sed '/^CONFIG_GENERIC_CPU/d' .config.defconfig.dist > .config
make silentoldconfig
 
# AMD 32-bit
#cat >> .config <<EOF9
#CONFIG_MK8=y
#CONFIG_HIGHMEM64G=y
#EOF9
#make silentoldconfig
 
# File systems, NFS, Samba client, network bridging
# Note. ACL and SECURITY are already enabled for EXT3.
# Note. BSD_DISKLABEL is already enabled.
# Note. FUSE_FS for NTFS-3G
cat >> .config <<EOF9
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_FUSE_FS=y
CONFIG_UFS_FS=y
 
CONFIG_NFSD=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
 
CONFIG_CIFS=y
CONFIG_BRIDGE=y
EOF9
make silentoldconfig
#grep BSD_DISKLABEL .config
 
Hardware specific
See Hardware specific Linux kernel configurations
 
XEN domain 0 kernel
 
#
# XEN domain 0
#
 
# Note. Those are built-in as modules for the XEN Python scripts to work.
cat >> .config <<EOF9
CONFIG_DUMMY=m
CONFIG_TUN=m
CONFIG_BONDING=m
EOF9
make silentoldconfig
 
cat >> .config <<EOF9
CONFIG_PARAVIRT_GUEST=y
CONFIG_XEN=y
CONFIG_XEN_DOM0=y
CONFIG_XEN_NETDEV_BACKEND=y
CONFIG_XEN_BLKDEV_BACKEND=y
CONFIG_XEN_BLKDEV_TAP=y
CONFIG_XEN_GNTDEV=y
CONFIG_XEN_PLATFORM_PCI=y
EOF9
make silentoldconfig
 
Compilation and installation
Eventually add some tag to the kernel name which prints with uname,
mv Makefile Makefile.dist
sed 's/^EXTRAVERSION = \(.*\)$/EXTRAVERSION = \1.custom/' Makefile.dist > Makefile
#sed 's/^EXTRAVERSION = \(.*\)$/EXTRAVERSION = \1.xen/' Makefile.dist > Makefile
and proceed with the compilation,
# Note. -j twice the number of cores
(( jobs = `grep ^processor /proc/cpuinfo | wc -l` * 2 ))
echo jobs: $jobs
time nice make -j$jobs
unset jobs
 
version=`grep version .config | awk '{print $NF}'`
echo version: $version
# Note. I am assuming the EXTRAVERSION has been added.
ls -lkd /lib/modules/$version.custom/
rm -rf /lib/modules/$version.custom/
#ls -lkd /lib/modules/$version.xen/
#rm -rf /lib/modules/$version.xen/
unset version
make modules_install
cp -f arch/x86_64/boot/bzImage /boot/vmlinuz.custom
#cp -f arch/x86_64/boot/bzImage /boot/vmlinuz.xen
 
Boot loader
# Note. There is no seperate /boot partition.
grub-install --no-floppy /dev/sda
cd /boot/grub/
mv -f grub.cfg grub.cfg.old.`date +%s`
cat > grub.cfg <<EOF9
# Note. acpi_enforce_resources=lax for the IT87 sensor not to conflict with
# ACPI. acpi=off works too.
# lala=lala as a workaround against a bug in the very early versions of Grub2
# (1.98). The first kernel argument used to be omitted.

set default=XEN
set timeout=3

menuentry Linux {
insmod ext2
set root=(hd0,1)
linux /boot/vmlinuz lala=lala root=/dev/sda1 ro acpi_enforce_resources=lax
}

menuentry Linux.custom {
insmod ext2
set root=(hd0,1)
linux /boot/vmlinuz.custom lala=lala root=/dev/sda1 ro acpi_enforce_resources=lax
}

# Note. Change dom0_mem accordingly.
menuentry XEN {
insmod ext2
set root=(hd0,1)
multiboot /boot/xen.gz lala=lala dom0_mem=1024M
module /boot/vmlinuz.xen lala=lala root=/dev/sda1 ro nomodeset noreboot
acpi_enforce_resources=lax
}
EOF9
 
Ready to go
sync
shutdown -r now
 
References
Greg Kroah-Hartman, Linux Kernel in a Nutshell, O'Reilly Media, 2007
 

Last update: Nov 21, 2012