kernel/kernel.sh
2024-03-19 15:06:34 +01:00

1390 lines
55 KiB
Bash

#!/bin/bash
UPDATED="2024-03-19"
DISABLE=1 # disable some options
ENABLE=1 # enable some options
SECURED=1 # enable/disable security
UARCH=1 # apply more uarch patch
FKH=0 # apply fast kernel headers patch
CLANG=1 # use Clang compiler (if not, use GCC)
O3=1 # use -O3 vs -O2 (optimisation)
ARCH="x86-64-v4" # target architecture (uarch patch)
CONFIGCLOUD=1 # enable cloud 'from' config
CONFIGOLD=1 # enable old def config
CONFIGMOD=0 # enable all mod config
SCRATCH=0 # perform from scratch (remove preexisting content)
UNCOMPRESS=1 # perform uncompress if already exist
CLEANUP=1 # perform folder cleanup
TESTING=0 # add testing options
#
# Sources:
# https://github.com/sn99/Optimizing-linux#compiling-your-kernel
# https://wiki.gentoo.org/wiki/Kernel/Optimization
#
# config-cloud-amd64:
# https://packages.debian.org/source/sid/linux
# linux-image-6.7.9-cloud-amd64-unsigned
# Go down to download section, select amd64 and download deb.
# Open .deb with archiver, browse to boot folder and grab 'config-6.7.9-cloud-amd64'.
#
# more-uarches-for-kernel.patch:
# https://github.com/graysky2/kernel_compiler_patch
# more-uarches-for-kernel.patch : more-uarches-for-kernel-6.8-rc4+.patch
#
#
# fast-kernel-headers.patch
# https://lore.kernel.org/lkml/20240131145008.1345531-2-max.kellermann@ionos.com/#r
# fast-kernel-headers.patch : [PATCH 01/28] include: add missing includes
#
# Prerequisites:
# sudo apt install build-essential fakeroot dpkg-dev perl libssl-dev bc gnupg dirmngr libncurses-dev libelf-dev flex bison lsb-release rsync dwarves clang llvm lld debhelper
#
#
# In case of usage of uninstall.sh, you must reinstall 'linux-libc-dev' with the version of used kernel
#
#
# To make a diff of different .config file:
# diff --side-by-side --suppress-common-lines --ignore-tab-expansion --ignore-trailing-space --ignore-space-change --ignore-blank-lines --text CONFIG1 CONFIG2
#
doBuildSystem() {
echo "v$UPDATED"
}
# Display introduction
doIntro() {
echo
if [ $TESTING == 1 ]; then
echo "Debian Kernel Builder: $HOSTNAME [TEST]"
else
echo "Debian Kernel Builder: $HOSTNAME"
fi
doBuildSystem
echo
}
# Show date/time header
doHeader() {
NOW=$(date +"%Y/%m/%d %H:%M:%S")
echo "- $NOW"
echo ""
}
if [ "$(id -u)" != "0" ]; then
doIntro
doHeader
echo
echo "This script must be run as root" 1>&2
echo
exit 1
fi
LOGNAME=kernel
LOGEXT=log
LOGFILE=""
NPROC=$(nproc)
HOSTNAME=$(hostname)
SELF=$(realpath $0)
SCRIPT=$(basename $SELF)
CWD=$(dirname $SELF)
CURRENT=$CWD
BRANCH=$1
BRANCH="${BRANCH:=help}"
VERSION=$2
VERSION="${VERSION:=help}"
STEPS=$3
STEPS="${STEPS:=help}"
WORKDIR=""
cd $CURRENT
# Force sync & flush
doSync() {
sync
echo 3 >/proc/sys/vm/drop_caches
}
# Display header infos
doHead() {
doIntro
doHeader
}
# Display help
doHelp() {
doIntro
doHeader
if [ $BRANCH != "help" ]; then
echo ">>> Unspecified, unknown or invalid option specified !"
echo
fi
echo "Usage: $SCRIPT 'branch' 'version'"
echo
echo "branch : Main branch (eg. 6.x)"
echo "version: Full version tag (eg. 6.6.1)"
echo
}
# Display step infos
doEchoStep() {
NOW=$(date +"%Y/%m/%d %H:%M:%S")
echo "### $NOW - $1"
}
# Scratch
doScratch() {
if [ $SCRATCH == 1 ]; then
if [ -d $WORKDIR ]; then
doEchoStep "Scratch: remove existing content"
rm -rf $WORKDIR
else
doEchoStep "Scratch: existing previous content not found"
fi
fi
}
# Download
doDownload() {
if [[ -d $WORKDIR && -f $WORKDIR/linux-$VERSION.tar.xz ]]; then
doEchoStep "$BRANCH/$VERSION already present (don't download)"
else
mkdir -p $WORKDIR
cd $WORKDIR
doEchoStep "Download branch '$BRANCH' version '$VERSION'"
wget --compression=auto --show-progress --no-verbose --inet4-only https://cdn.kernel.org/pub/linux/kernel/v$BRANCH/linux-$VERSION.tar.sign
wget --compression=auto --show-progress --no-verbose --inet4-only https://cdn.kernel.org/pub/linux/kernel/v$BRANCH/linux-$VERSION.tar.xz
doSync
result=$?
if [ ! result==0 ]; then
echo ">>> Error in download !"
exit 1
fi
fi
}
# Uncompress
doPerformUncompress() {
cd $WORKDIR
doEchoStep "Uncompress"
rm -rf linux-$VERSION
tar -xaf linux-$VERSION.tar.xz
result=$?
if [ ! result==0 ]; then
echo ">>> Error in uncompress !"
exit 1
fi
}
doUncompress() {
if [ -d $WORKDIR ]; then
if [ $UNCOMPRESS == 1 ]; then
doPerformUncompress
else
doEchoStep "$BRANCH/$VERSION already present (don't uncompress)"
fi
else
doPerformUncompress
fi
doSync
}
# Clean folder
doCleanup() {
if [ $CLEANUP == 1 ]; then
cd $WORKDIR
doEchoStep "Cleanup"
if [ "$CLANG" == "1" ]; then
make -j${NPROC} LLVM=1 CC="ccache clang" distclean
else
make -j${NPROC} CC="ccache gcc" distclean
fi
result=$?
if [ ! result==0 ]; then
echo ">>> Error in cleanup !"
exit 1
fi
fi
}
# Copy .config from cloud kernel
doConfigCloud() {
if [ $CONFIGCLOUD == 1 ]; then
cd $WORKDIR
doEchoStep "Copy cloud kernel .config"
if [ -f .config ]; then
cp .config .config.cloud.before
fi
cp $CURRENT/config-cloud-amd64 .config
result=$?
if [ ! result==0 ]; then
echo ">>> Error in cloud kernel .config copy!"
exit 1
fi
cp .config .config.cloud.after
fi
}
# Generate .config from old kernel
doOldOne() {
if [ $CONFIGOLD == 1 ]; then
cd $WORKDIR
doEchoStep "Generate config from old kernel .config"
if [ -f .config ]; then
cp .config .config.old.before
fi
if [ "$CLANG" == "1" ]; then
make -j${NPROC} LLVM=1 CC="ccache clang" olddefconfig
else
make -j${NPROC} CC="ccache gcc" olddefconfig
fi
result=$?
if [ ! result==0 ]; then
echo ">>> Error in generate .config !"
exit 1
fi
cp .config .config.old.after
fi
}
# Define all modules not included in kernel
doAllMods() {
if [ $CONFIGMOD == 1 ]; then
cd $WORKDIR
doEchoStep "Set all modules to be 'module'"
if [ -f .config ]; then
cp .config .config.mod.before
fi
if [ "$CLANG" == "1" ]; then
make -j${NPROC} LLVM=1 CC="ccache clang" allmodconfig
else
make -j${NPROC} CC="ccache gcc" allmodconfig
fi
result=$?
if [ ! result==0 ]; then
echo ">>> Error in set all modules not in kernel !"
exit 1
fi
cp .config .config.mod.after
fi
}
# Define permissions (user/group) to first user created (default 1000)
doPermissions() {
cd $WORKDIR
doEchoStep "Define user/group"
chown -R 1000:1000 $CURRENT/$BRANCH/$VERSION/.
result=$?
if [ ! result==0 ]; then
echo ">>> Error in chown !"
exit 1
fi
doSync
}
# Strip signature
doStripSig() {
cd $WORKDIR
doEchoStep "Remove signature/keys"
if [ -f .config ]; then
cp .config .config.stripsig.before
fi
./scripts/config --disable MODULE_SIG_ALL
./scripts/config --set-str CONFIG_MODULE_SIG_KEY ""
./scripts/config --set-str CONFIG_SYSTEM_TRUSTED_KEY ""
./scripts/config --set-str CONFIG_SYSTEM_REVOCATION_KEYS ""
result=$?
if [ ! result==0 ]; then
echo ">>> Error in chown !"
exit 1
fi
cp .config .config.stripsig.after
}
# Strip debug informations
doStripDebug() {
cd $WORKDIR
doEchoStep "Remove debug informations"
if [ -f .config ]; then
cp .config .config.stripdebug.before
fi
./scripts/config --disable DEBUG_INFO
./scripts/config --enable DEBUG_INFO_NONE
result=$?
if [ ! result==0 ]; then
echo ">>> Error in chown !"
exit 1
fi
cp .config .config.stripdebug.after
}
# Apply more uarch patch
doMoreUarch() {
if [ $UARCH == 1 ]; then
cd $WORKDIR
doEchoStep "Apply 'uarches' patch"
if [ -f .config ]; then
cp .config .config.uarches.before
fi
patch -p1 <../../../more-uarches-for-kernel.patch
result=$?
if [ ! result==0 ]; then
echo ">>> Error in 'uarches' !"
exit 1
fi
cp .config .config.uarches.after
fi
}
# Apply Fast Kernel Header patch
doFastKernelHeaders() {
if [ $FKH == 1 ]; then
cd $WORKDIR
doEchoStep "Apply 'fask kernel headers' patch"
if [ -f .config ]; then
cp .config .config.fastkernelheaders.before
fi
patch -p1 <../../../fast-kernel-headers.patch
result=$?
if [ ! result==0 ]; then
echo ">>> Error in 'fask kernel headers' !"
exit 1
fi
cp .config .config.fastkernelheaders.after
fi
}
# Generate defaults options for this kernel
doDefaultsDisable() {
if [ $DISABLE == 1 ]; then
doEchoStep "Options: disable"
if [ -f .config ]; then
cp .config .config.disable.before
fi
./scripts/config --disable CONFIG_WERROR
./scripts/config --disable CONFIG_ACCESSIBILITY
./scripts/config --disable CONFIG_ACORN_PARTITION
./scripts/config --disable CONFIG_ACPI_DEBUG
./scripts/config --disable CONFIG_ACPI_DEBUGGER
./scripts/config --disable CONFIG_ACPI_EC_DEBUGFS
./scripts/config --disable CONFIG_ACRN_GUEST
./scripts/config --disable CONFIG_AF_RXRPC
./scripts/config --disable CONFIG_AIX_PARTITION
./scripts/config --disable CONFIG_AMD_IOMMU
./scripts/config --disable CONFIG_AMIGA_PARTITION
./scripts/config --disable CONFIG_APPLE_DART
./scripts/config --disable CONFIG_APPLE_PROPERTIES
./scripts/config --disable CONFIG_ARCH_MEMORY_PROBE
./scripts/config --disable CONFIG_ARM_INTEGRATOR_LM
./scripts/config --disable CONFIG_ARM_SCMI_PROTOCOL
./scripts/config --disable CONFIG_ARM_SCPI_PROTOCOL
./scripts/config --disable CONFIG_ARM_SMMU
./scripts/config --disable CONFIG_ATA_OVER_ETH
./scripts/config --disable CONFIG_ATARI_PARTITION
./scripts/config --disable CONFIG_ATM_DRIVERS
./scripts/config --disable CONFIG_BFQ_CGROUP_DEBUG
./scripts/config --disable CONFIG_BLK_CGROUP_IOLATENCY
./scripts/config --disable CONFIG_BLK_DEBUG_FS
./scripts/config --disable CONFIG_BLK_DEV_BSGLIB
./scripts/config --disable CONFIG_BLK_DEV_INTEGRITY
./scripts/config --disable CONFIG_BLK_DEV_THROTTLING_LOW
./scripts/config --disable CONFIG_BLK_DEV_ZONED
./scripts/config --disable CONFIG_BSD_DISKLABEL
./scripts/config --disable CONFIG_BT
./scripts/config --disable CONFIG_BTRFS_ASSERT
./scripts/config --disable CONFIG_BTRFS_DEBUG
./scripts/config --disable CONFIG_BTRFS_FS
./scripts/config --disable CONFIG_BTRFS_FS_CHECK_INTEGRITY
./scripts/config --disable CONFIG_BTRFS_FS_REF_VERIFY
./scripts/config --disable CONFIG_BTRFS_FS_RUN_SANITY_TESTS
./scripts/config --disable CONFIG_CACHEFILES_DEBUG
./scripts/config --disable CONFIG_CACHEFILES_ONDEMAND
./scripts/config --disable CONFIG_CAIF
./scripts/config --disable CONFIG_CAN
./scripts/config --disable CONFIG_CDROM_PKTCDVD
./scripts/config --disable CONFIG_CEPH_LIB
./scripts/config --disable CONFIG_CFG80211
./scripts/config --disable CONFIG_CGROUP_DEBUG
./scripts/config --disable CONFIG_CIFS_DEBUG
./scripts/config --disable CONFIG_CMA
./scripts/config --disable CONFIG_CMA_DEBUG
./scripts/config --disable CONFIG_CMA_DEBUGFS
./scripts/config --disable CONFIG_CMA_SYSFS
./scripts/config --disable CONFIG_COMPAT_VDSO
./scripts/config --disable CONFIG_COMPILE_TEST
./scripts/config --disable CONFIG_CPA_DEBUG
./scripts/config --disable CONFIG_CPU_SRSO
./scripts/config --disable CONFIG_CPU_SUP_AMD
./scripts/config --disable CONFIG_CPU_SUP_CENTAUR
./scripts/config --disable CONFIG_CPU_SUP_HYGON
./scripts/config --disable CONFIG_CPU_SUP_ZHAOXIN
./scripts/config --disable CONFIG_CRASH_DUMP
./scripts/config --disable CONFIG_DAMON
./scripts/config --disable CONFIG_DEBUG_BOOT_PARAMS
./scripts/config --disable CONFIG_DEBUG_CGROUP_REF
./scripts/config --disable CONFIG_DEBUG_CREDENTIALS
./scripts/config --disable CONFIG_DEBUG_DEVRES
./scripts/config --disable CONFIG_DEBUG_DRIVER
./scripts/config --disable CONFIG_DEBUG_ENTRY
./scripts/config --disable CONFIG_DEBUG_KERNEL
./scripts/config --disable CONFIG_DEBUG_KOBJECT
./scripts/config --disable CONFIG_DEBUG_KOBJECT_RELEASE
./scripts/config --disable CONFIG_DEBUG_LIST
./scripts/config --disable CONFIG_DEBUG_MAPLE_TREE
./scripts/config --disable CONFIG_DEBUG_MISC
./scripts/config --disable CONFIG_DEBUG_NMI_SELFTEST
./scripts/config --disable CONFIG_DEBUG_NOTIFIERS
./scripts/config --disable CONFIG_DEBUG_PERF_USE_VMALLOC
./scripts/config --disable CONFIG_DEBUG_PLIST
./scripts/config --disable CONFIG_DEBUG_PREEMPT
./scripts/config --disable CONFIG_DEBUG_RSEQ
./scripts/config --disable CONFIG_DEBUG_SG
./scripts/config --disable CONFIG_DEBUG_SHIRQ
./scripts/config --disable CONFIG_DEBUG_TEST_DRIVER_REMOVE
./scripts/config --disable CONFIG_DEBUG_TIMEKEEPING
./scripts/config --disable CONFIG_DEBUG_TLBFLUSH
./scripts/config --disable CONFIG_DEBUG_WQ_FORCE_RR_CPU
./scripts/config --disable CONFIG_DRM_AMDGPU
./scripts/config --disable CONFIG_DRM_HDLCD
./scripts/config --disable CONFIG_DRM_KOMEDA
./scripts/config --disable CONFIG_DRM_LEGACY
./scripts/config --disable CONFIG_DRM_MALI_DISPLAY
./scripts/config --disable CONFIG_DRM_RADEON
./scripts/config --disable CONFIG_DVB_DUMMY_FE
./scripts/config --disable CONFIG_DVB_MMAP
./scripts/config --disable CONFIG_EARLY_PRINTK
./scripts/config --disable CONFIG_EDD
./scripts/config --disable CONFIG_EFI_FAKE_MEMMAP
./scripts/config --disable CONFIG_EFI_PGT_DUMP
./scripts/config --disable CONFIG_EISA
./scripts/config --disable CONFIG_EXT3_FS
./scripts/config --disable CONFIG_EXT4_DEBUG
./scripts/config --disable CONFIG_EXT4_KUNIT_TESTS
./scripts/config --disable CONFIG_F2FS_FS
./scripts/config --disable CONFIG_FAT_KUNIT_TEST
./scripts/config --disable CONFIG_FAULT_INJECTION
./scripts/config --disable CONFIG_FDDI
./scripts/config --disable CONFIG_FIREWIRE
./scripts/config --disable CONFIG_FIREWIRE_NOSY
./scripts/config --disable CONFIG_FS_DAX
./scripts/config --disable CONFIG_FSCACHE_DEBUG
./scripts/config --disable CONFIG_FTRACE
./scripts/config --disable CONFIG_FUJITSU_ES
./scripts/config --disable CONFIG_FUNCTION_ERROR_INJECTION
./scripts/config --disable CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT
./scripts/config --disable CONFIG_GCOV_KERNEL
./scripts/config --disable CONFIG_GENERIC_IRQ_DEBUGFS
./scripts/config --disable CONFIG_GFS2_FS
./scripts/config --disable CONFIG_GNSS
./scripts/config --disable CONFIG_GOOGLE_FIRMWARE
./scripts/config --disable CONFIG_HAMRADIO
./scripts/config --disable CONFIG_HIBERNATION
./scripts/config --disable CONFIG_HIPPI
./scripts/config --disable CONFIG_HOTPLUG_PCI
./scripts/config --disable CONFIG_HYPERV_NET
./scripts/config --disable CONFIG_HYPERV_TESTING
./scripts/config --disable CONFIG_IOSF_MBI
./scripts/config --disable CONFIG_IOSF_MBI_DEBUG
./scripts/config --disable CONFIG_IRQ_TIME_ACCOUNTING
./scripts/config --disable CONFIG_ISA_BUS
./scripts/config --disable CONFIG_ISDN
./scripts/config --disable CONFIG_JBD2_DEBUG
./scripts/config --disable CONFIG_JFS_FS
./scripts/config --disable CONFIG_KARMA_PARTITION
./scripts/config --disable CONFIG_KCOV
./scripts/config --disable CONFIG_KEXEC_BZIMAGE_VERIFY_SIG
./scripts/config --disable CONFIG_KEXEC_SIG
./scripts/config --disable CONFIG_KEXEC_SIG_FORCE
./scripts/config --disable CONFIG_KVM_XEN
./scripts/config --disable CONFIG_LDM_PARTITION
./scripts/config --disable CONFIG_LIB80211_DEBUG
./scripts/config --disable CONFIG_LOCK_EVENT_COUNTS
./scripts/config --disable CONFIG_LRU_GEN_STATS
./scripts/config --disable CONFIG_MAC_PARTITION
./scripts/config --disable CONFIG_MAC80211
./scripts/config --disable CONFIG_MACINTOSH_DRIVERS
./scripts/config --disable CONFIG_MEDIA_CONTROLLER_DVB
./scripts/config --disable CONFIG_MEMORY_FAILURE
./scripts/config --disable CONFIG_MEMTEST
./scripts/config --disable CONFIG_MICROCODE_LATE_LOADING
./scripts/config --disable CONFIG_MINIX_SUBPARTITION
./scripts/config --disable CONFIG_MODIFY_LDT_SYSCALL
./scripts/config --disable CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
./scripts/config --disable CONFIG_MODULE_DEBUG
./scripts/config --disable CONFIG_MODULE_FORCE_UNLOAD
./scripts/config --disable CONFIG_MODULE_SIG
./scripts/config --disable CONFIG_MODULE_SRCVERSION_ALL
./scripts/config --disable CONFIG_MODULE_UNLOAD_TAINT_TRACKING
./scripts/config --disable CONFIG_MODVERSIONS
./scripts/config --disable CONFIG_NET_9P
./scripts/config --disable CONFIG_NET_SB1000
./scripts/config --disable CONFIG_NETDEVSIM
./scripts/config --disable CONFIG_NFC
./scripts/config --disable CONFIG_NILFS2_FS
./scripts/config --disable CONFIG_NO_HZ
./scripts/config --disable CONFIG_NTFS_DEBUG
./scripts/config --disable CONFIG_NTFS3_64BIT_CLUSTER
./scripts/config --disable CONFIG_OCFS2_FS
./scripts/config --disable CONFIG_OSF_PARTITION
./scripts/config --disable CONFIG_PAGE_POOL_STATS
./scripts/config --disable CONFIG_PARAVIRT_DEBUG
./scripts/config --disable CONFIG_PARAVIRT_TIME_ACCOUNTING
./scripts/config --disable CONFIG_PARPORT
./scripts/config --disable CONFIG_PCCARD
./scripts/config --disable CONFIG_PCI_CNB20LE_QUIRK
./scripts/config --disable CONFIG_PCI_DEBUG
./scripts/config --disable CONFIG_PCI_EPF_TEST
./scripts/config --disable CONFIG_PCI_P2PDMA
./scripts/config --disable CONFIG_PCI_PF_STUB
./scripts/config --disable CONFIG_PCI_STUB
./scripts/config --disable CONFIG_PCIE_ECRC
./scripts/config --disable CONFIG_PCIEAER_INJECT
./scripts/config --disable CONFIG_PERF_EVENTS_AMD_UNCORE
./scripts/config --disable CONFIG_PM_DEBUG
./scripts/config --disable CONFIG_PPS
./scripts/config --disable CONFIG_PROVE_RCU_LIST
./scripts/config --disable CONFIG_PROVIDE_OHCI1394_DMA_INIT
./scripts/config --disable CONFIG_PSE_CONTROLLER
./scripts/config --disable CONFIG_PUNIT_ATOM_DEBUG
./scripts/config --disable CONFIG_QCOM_IPA
./scripts/config --disable CONFIG_QFMT_V1
./scripts/config --disable CONFIG_QFMT_V2
./scripts/config --disable CONFIG_QUOTA_DEBUG
./scripts/config --disable CONFIG_RADIO_ADAPTERS
./scripts/config --disable CONFIG_RAPIDIO
./scripts/config --disable CONFIG_RCU_CPU_STALL_CPUTIME
./scripts/config --disable CONFIG_RCU_EQS_DEBUG
./scripts/config --disable CONFIG_RCU_STRICT_GRACE_PERIOD
./scripts/config --disable CONFIG_RCU_TRACE
./scripts/config --disable CONFIG_READ_ONLY_THP_FOR_FS
./scripts/config --disable CONFIG_REISERFS_FS
./scripts/config --disable CONFIG_RFKILL
./scripts/config --disable CONFIG_SAMPLES
./scripts/config --disable CONFIG_SECCOMP_CACHE_DEBUG
./scripts/config --disable CONFIG_SGI_PARTITION
./scripts/config --disable CONFIG_SMS_SIANO_DEBUGFS
./scripts/config --disable CONFIG_SOLARIS_X86_PARTITION
./scripts/config --disable CONFIG_STRICT_SIGALTSTACK_SIZE
./scripts/config --disable CONFIG_SUN_PARTITION
./scripts/config --disable CONFIG_SYSV68_PARTITION
./scripts/config --disable CONFIG_TEST_ASYNC_DRIVER_PROBE
./scripts/config --disable CONFIG_TIME_KUNIT_TEST
./scripts/config --disable CONFIG_ULTRIX_PARTITION
./scripts/config --disable CONFIG_UNIXWARE_DISKLABEL
./scripts/config --disable CONFIG_USB4_NET
./scripts/config --disable CONFIG_USELIB
./scripts/config --disable CONFIG_VMXNET3
./scripts/config --disable CONFIG_WAN
./scripts/config --disable CONFIG_WARN_ABI_ERRORS
./scripts/config --disable CONFIG_WARN_ALL_UNSEEDED_RANDOM
./scripts/config --disable CONFIG_WARN_MISSING_DOCUMENTS
./scripts/config --disable CONFIG_WLAN
./scripts/config --disable CONFIG_WQ_POWER_EFFICIENT_DEFAULT
./scripts/config --disable CONFIG_WWAN
./scripts/config --disable CONFIG_X86_16BIT
./scripts/config --disable CONFIG_X86_5LEVEL
./scripts/config --disable CONFIG_X86_AMD_PLATFORM_DEVICE
./scripts/config --disable CONFIG_X86_AMD_PSTATE
./scripts/config --disable CONFIG_X86_AMD_PSTATE_UT
./scripts/config --disable CONFIG_X86_CHECK_BIOS_CORRUPTION
./scripts/config --disable CONFIG_X86_DEBUG_FPU
./scripts/config --disable CONFIG_X86_EXTENDED_PLATFORM
./scripts/config --disable CONFIG_X86_GOLDFISH
./scripts/config --disable CONFIG_X86_INTEL_LPSS
./scripts/config --disable CONFIG_X86_INTEL_MID
./scripts/config --disable CONFIG_X86_IOPL_IOPERM
./scripts/config --disable CONFIG_X86_MCE_INJECT
./scripts/config --disable CONFIG_X86_MCELOG_LEGACY
./scripts/config --disable CONFIG_X86_MPPARSE
./scripts/config --disable CONFIG_X86_P4_CLOCKMOD
./scripts/config --disable CONFIG_X86_POWERNOW_K8
./scripts/config --disable CONFIG_X86_SPEEDSTEP_CENTRINO
./scripts/config --disable CONFIG_XEN
./scripts/config --disable CONFIG_XFS_ASSERT_FATAL
./scripts/config --disable CONFIG_XFS_DEBUG
./scripts/config --disable CONFIG_XFS_ONLINE_REPAIR
./scripts/config --disable CONFIG_XFS_ONLINE_SCRUB
./scripts/config --disable CONFIG_XFS_ONLINE_SCRUB_STATS
./scripts/config --disable CONFIG_XFS_QUOTA
./scripts/config --disable CONFIG_XFS_RT
./scripts/config --disable CONFIG_XFS_SUPPORT_ASCII_CI
./scripts/config --disable CONFIG_XFS_SUPPORT_V4
./scripts/config --disable USB_NET_DRIVER
./scripts/config --disable WIRELESS
./scripts/config --disable CONFIG_KERNEL_GZIP
./scripts/config --disable CONFIG_KERNEL_BZIP2
./scripts/config --disable CONFIG_KERNEL_LZMA
./scripts/config --disable CONFIG_KERNEL_LZO
./scripts/config --disable CONFIG_KERNEL_LZ4
./scripts/config --disable CONFIG_KERNEL_ZSTD
./scripts/config --disable CONFIG_NET_VENDOR_AMAZON
./scripts/config --disable CONFIG_NET_VENDOR_ASIX
./scripts/config --disable CONFIG_NET_VENDOR_CORTINA
./scripts/config --disable CONFIG_NET_VENDOR_DAVICOM
./scripts/config --disable CONFIG_NET_VENDOR_ENGLEDER
./scripts/config --disable CONFIG_NET_VENDOR_FUNGIBLE
./scripts/config --disable CONFIG_NET_VENDOR_GOOGLE
./scripts/config --disable CONFIG_GVE
./scripts/config --disable CONFIG_NET_VENDOR_LITEX
./scripts/config --disable CONFIG_NET_VENDOR_MELLANOX
./scripts/config --disable CONFIG_MLX4_EN
./scripts/config --disable CONFIG_MLX4_DEBUG
./scripts/config --disable CONFIG_MLX4_CORE_GEN2
./scripts/config --disable CONFIG_MLX5_CORE
./scripts/config --disable CONFIG_MLXFW
./scripts/config --disable CONFIG_NET_VENDOR_MICROSEMI
./scripts/config --disable CONFIG_NET_VENDOR_MICROSOFT
./scripts/config --disable CONFIG_MICROSOFT_MANA
./scripts/config --disable CONFIG_NET_VENDOR_NI
./scripts/config --disable CONFIG_NET_VENDOR_PENSANDO
./scripts/config --disable CONFIG_NET_VENDOR_SOCIONEXT
./scripts/config --disable CONFIG_NET_VENDOR_VERTEXCOM
./scripts/config --disable CONFIG_NET_VENDOR_WANGXUN
./scripts/config --disable CONFIG_NET_VENDOR_XILINX
./scripts/config --disable CONFIG_INFINIBAND
./scripts/config --disable CONFIG_COMEDI
./scripts/config --disable CONFIG_SURFACE_PLATFORMS
./scripts/config --disable CONFIG_SOUNDWIRE
./scripts/config --disable CONFIG_PREEMPT_VOLUNTARY
./scripts/config --disable CONFIG_HZ_250
./scripts/config --disable CONFIG_HZ_300
./scripts/config --disable CONFIG_HZ_1000
./scripts/config --disable CONFIG_VIRT_CPU_ACCOUNTING_GEN
./scripts/config --disable CONFIG_TASKSTATS
./scripts/config --disable CONFIG_PSI
./scripts/config --disable CONFIG_SCHED_MC
./scripts/config --disable CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS
./scripts/config --disable CONFIG_INIT_ON_ALLOC_DEFAULT_ON
./scripts/config --disable CONFIG_LIST_HARDENED
./scripts/config --disable CONFIG_BUG_ON_DATA_CORRUPTION
./scripts/config --disable CONFIG_CALL_THUNKS_DEBUG
./scripts/config --disable CONFIG_KPROBES
./scripts/config --disable CONFIG_SLUB_DEBUG
./scripts/config --disable CONFIG_RCU_NOCB_CPU
./scripts/config --disable CONFIG_RCU_BOOST
./scripts/config --disable CONFIG_PCSPKR_PLATFORM
./scripts/config --disable CONFIG_KEXEC
./scripts/config --disable CONFIG_KEXEC_FILE
./scripts/config --disable CONFIG_DEBUG_FS_ALLOW_ALL
./scripts/config --disable CONFIG_DEBUG_FS
./scripts/config --disable CONFIG_DEVMEM
./scripts/config --disable CONFIG_X86_SGX
./scripts/config --disable CONFIG_INTEL_TDX_HOST
./scripts/config --disable CONFIG_X86_UMIP
./scripts/config --disable CONFIG_X86_USER_SHADOW_STACK
./scripts/config --disable CONFIG_X86_SGX_KVM
./scripts/config --disable CONFIG_PRINTK
./scripts/config --disable CONFIG_BUG
cp .config .config.disable.after
fi
}
doDefaultsEnable() {
if [ $ENABLE == 1 ]; then
doEchoStep "Options: enable"
if [ -f .config ]; then
cp .config .config.enable.before
fi
if [ "$CLANG" == "1" ]; then
./scripts/config --enable CONFIG_HAS_LTO_CLANG
./scripts/config --enable CONFIG_ARCH_SUPPORTS_CFI_CLANG
./scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN
./scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG
./scripts/config --enable CONFIG_LTO_CLANG_THIN
./scripts/config --enable CONFIG_LTO_CLANG_FULL
fi
./scripts/config --enable CONFIG_ADDRESS_MASKING
./scripts/config --enable CONFIG_AF_KCM
./scripts/config --enable CONFIG_ARCH_CPUIDLE_HALTPOLL
./scripts/config --enable CONFIG_BINFMT_MISC
./scripts/config --enable CONFIG_BINFMT_SCRIPT
./scripts/config --enable CONFIG_BLK_CGROUP
./scripts/config --enable CONFIG_BLK_DEV
./scripts/config --enable CONFIG_BLK_DEV_INITRD
./scripts/config --enable CONFIG_BLK_WBT
./scripts/config --enable CONFIG_BOOT_CONFIG
./scripts/config --enable CONFIG_BSD_PROCESS_ACCT
./scripts/config --enable CONFIG_CALL_DEPTH_TRACKING
./scripts/config --enable CONFIG_CGROUP_CPUACCT
./scripts/config --enable CONFIG_CGROUP_DEVICE
./scripts/config --enable CONFIG_CGROUP_MISC
./scripts/config --enable CONFIG_CGROUP_NET_CLASSID
./scripts/config --enable CONFIG_CGROUP_NET_PRIO
./scripts/config --enable CONFIG_CGROUP_PIDS
./scripts/config --enable CONFIG_CGROUP_RDMA
./scripts/config --enable CONFIG_CGROUP_SCHED
./scripts/config --enable CONFIG_CGROUPS
./scripts/config --enable CONFIG_CIFS
./scripts/config --enable CONFIG_CIFS_ALLOW_INSECURE_LEGACY
./scripts/config --enable CONFIG_CIFS_DFS_UPCALL
./scripts/config --enable CONFIG_CIFS_STATS2
./scripts/config --enable CONFIG_CIFS_SWN_UPCALL
./scripts/config --enable CONFIG_COMPAT_32BIT_TIME
./scripts/config --enable CONFIG_CONFIGFS_FS
./scripts/config --enable CONFIG_CPU_FREQ
./scripts/config --enable CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
./scripts/config --enable CONFIG_CPU_FREQ_GOV_CONSERVATIVE
./scripts/config --enable CONFIG_CPU_FREQ_GOV_ONDEMAND
./scripts/config --enable CONFIG_CPU_FREQ_GOV_PERFORMANCE
./scripts/config --enable CONFIG_CPU_FREQ_GOV_POWERSAVE
./scripts/config --enable CONFIG_CPU_FREQ_GOV_USERSPACE
./scripts/config --enable CONFIG_CPU_IBPB_ENTRY
./scripts/config --enable CONFIG_CPU_UNRET_ENTRY
./scripts/config --enable CONFIG_DEVTMPFS
./scripts/config --enable CONFIG_DRM_VIRTIO_GPU
./scripts/config --enable CONFIG_DRM_VIRTIO_GPU_KMS
./scripts/config --enable CONFIG_EFI
./scripts/config --enable CONFIG_EFI_BOOTLOADER_CONTROL
./scripts/config --enable CONFIG_EFI_MIXED
./scripts/config --enable CONFIG_EFI_PARTITION
./scripts/config --enable CONFIG_EFI_VARS_PSTORE
./scripts/config --enable CONFIG_EFIVAR_FS
./scripts/config --enable CONFIG_ETHERNET
./scripts/config --enable CONFIG_ETHTOOL_NETLINK
./scripts/config --enable CONFIG_EXT2_FS
./scripts/config --enable CONFIG_EXT4_FS
./scripts/config --enable CONFIG_EXT4_USE_FOR_EXT2
./scripts/config --enable CONFIG_FANOTIFY
./scripts/config --enable CONFIG_FORTIFY_SOURCE
./scripts/config --enable CONFIG_HANGCHECK_TIMER
./scripts/config --enable CONFIG_HARDENED_USERCOPY
./scripts/config --enable CONFIG_HIGH_RES_TIMERS
./scripts/config --enable CONFIG_HYPERVISOR_GUEST
./scripts/config --enable CONFIG_IA32_EMULATION
./scripts/config --enable CONFIG_IKCONFIG
./scripts/config --enable CONFIG_IKCONFIG_PROC
./scripts/config --enable CONFIG_IKHEADERS
./scripts/config --enable CONFIG_INET
./scripts/config --enable CONFIG_INET_AH
./scripts/config --enable CONFIG_INET_ESP
./scripts/config --enable CONFIG_INET_IPCOMP
./scripts/config --enable CONFIG_INET_RAW_DIAG
./scripts/config --enable CONFIG_INET_UDP_DIAG
./scripts/config --enable CONFIG_INET6_AH
./scripts/config --enable CONFIG_INET6_ESP
./scripts/config --enable CONFIG_INET6_IPCOMP
./scripts/config --enable CONFIG_INTEL_HFI_THERMAL
./scripts/config --enable CONFIG_INTEL_IDLE
./scripts/config --enable CONFIG_INTEL_POWERCLAMP
./scripts/config --enable CONFIG_INTEL_RST
./scripts/config --enable CONFIG_IOMMU_SUPPORT
./scripts/config --enable CONFIG_IOSCHED_BFQ
./scripts/config --enable CONFIG_IP_NF_ARPTABLES
./scripts/config --enable CONFIG_IP_NF_IPTABLES
./scripts/config --enable CONFIG_IP6_NF_IPTABLES
./scripts/config --enable CONFIG_IPV6_VTI
./scripts/config --enable CONFIG_JUMP_LABEL
./scripts/config --enable CONFIG_KERNEL_XZ
./scripts/config --enable CONFIG_KVM
./scripts/config --enable CONFIG_KVM_INTEL
./scripts/config --enable CONFIG_LOCALVERSION_AUTO
./scripts/config --enable CONFIG_LRU_GEN
./scripts/config --enable CONFIG_LRU_GEN_ENABLED
./scripts/config --enable CONFIG_MEDIA_SUBDRV_AUTOSELECT
./scripts/config --enable CONFIG_MEDIA_SUPPORT
./scripts/config --enable CONFIG_MEDIA_SUPPORT_FILTER
./scripts/config --enable CONFIG_MEMCG
./scripts/config --enable CONFIG_MODULE_COMPRESS_NONE
./scripts/config --enable CONFIG_MODULE_FORCE_LOAD
./scripts/config --enable CONFIG_MODULE_UNLOAD
./scripts/config --enable CONFIG_MODULES
./scripts/config --enable CONFIG_MQ_IOSCHED_DEADLINE
./scripts/config --enable CONFIG_MQ_IOSCHED_KYBER
./scripts/config --enable CONFIG_MSDOS_PARTITION
./scripts/config --enable CONFIG_NET
./scripts/config --enable CONFIG_NET_CLS_CGROUP
./scripts/config --enable CONFIG_NET_CLS_FLOWER
./scripts/config --enable CONFIG_NET_CLS_FW
./scripts/config --enable CONFIG_NET_CLS_ROUTE4
./scripts/config --enable CONFIG_NET_CORE
./scripts/config --enable CONFIG_NET_FOU
./scripts/config --enable CONFIG_NET_FOU_IP_TUNNELS
./scripts/config --enable CONFIG_NET_IPVTI
./scripts/config --enable CONFIG_NET_SCH_CBS
./scripts/config --enable CONFIG_NET_SCH_ETF
./scripts/config --enable CONFIG_NET_SCH_GRED
./scripts/config --enable CONFIG_NET_SCH_HFSC
./scripts/config --enable CONFIG_NET_SCH_HHF
./scripts/config --enable CONFIG_NET_SCH_HTB
./scripts/config --enable CONFIG_NET_SCH_PRIO
./scripts/config --enable CONFIG_NET_SCH_RED
./scripts/config --enable CONFIG_NET_SCH_SFB
./scripts/config --enable CONFIG_NET_SCH_SFQ
./scripts/config --enable CONFIG_NET_SCH_TAPRIO
./scripts/config --enable CONFIG_NET_SCH_TBF
./scripts/config --enable CONFIG_NET_SCH_TEQL
./scripts/config --enable CONFIG_NET_SCHED
./scripts/config --enable CONFIG_NETDEVICES
./scripts/config --enable CONFIG_NETFILTER
./scripts/config --enable CONFIG_NETFILTER_XTABLES
./scripts/config --enable CONFIG_NETLINK_DIAG
./scripts/config --enable CONFIG_NETWORK_FILESYSTEMS
./scripts/config --enable CONFIG_NF_SOCKET_IPV4
./scripts/config --enable CONFIG_NF_SOCKET_IPV6
./scripts/config --enable CONFIG_NF_TABLES
./scripts/config --enable CONFIG_PACKET
./scripts/config --enable CONFIG_PACKET_DIAG
./scripts/config --enable CONFIG_PAGE_REPORTING
./scripts/config --enable CONFIG_PAGE_TABLE_ISOLATION
./scripts/config --enable CONFIG_PARAVIRT
./scripts/config --enable CONFIG_PARTITION_ADVANCED
./scripts/config --enable CONFIG_PCI
./scripts/config --enable CONFIG_PCI_IOV
./scripts/config --enable CONFIG_PCI_PASID
./scripts/config --enable CONFIG_PCI_PRI
./scripts/config --enable CONFIG_PCIE_BUS_PERFORMANCE
./scripts/config --enable CONFIG_PCIEASPM
./scripts/config --enable CONFIG_PM_AUTOSLEEP
./scripts/config --enable CONFIG_PNP
./scripts/config --enable CONFIG_PROC_KCORE
./scripts/config --enable CONFIG_PSAMPLE
./scripts/config --enable CONFIG_PVH
./scripts/config --enable CONFIG_PVPANIC
./scripts/config --enable CONFIG_RCU_EXPERT
./scripts/config --enable CONFIG_RETHUNK
./scripts/config --enable CONFIG_SCHED_AUTOGROUP
./scripts/config --enable CONFIG_SHUFFLE_PAGE_ALLOCATOR
./scripts/config --enable CONFIG_SMB_SERVER
./scripts/config --enable CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN
./scripts/config --enable CONFIG_SYN_COOKIES
./scripts/config --enable CONFIG_SYSFB_SIMPLEFB
./scripts/config --enable CONFIG_SYSVIPC
./scripts/config --enable CONFIG_TCP_CONG_ADVANCED
./scripts/config --enable CONFIG_TCP_CONG_BBR
./scripts/config --enable CONFIG_TMPFS
./scripts/config --enable CONFIG_TRANSPARENT_HUGEPAGE
./scripts/config --enable CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS
./scripts/config --enable CONFIG_UNIX
./scripts/config --enable CONFIG_VGA_ARB
./scripts/config --enable CONFIG_VHOST_NET
./scripts/config --enable CONFIG_VIRT_DRIVERS
./scripts/config --enable CONFIG_VIRTIO_BLK
./scripts/config --enable CONFIG_VIRTIO_CONSOLE
./scripts/config --enable CONFIG_VIRTIO_IOMMU
./scripts/config --enable CONFIG_VIRTUALIZATION
./scripts/config --enable CONFIG_VMGENID
./scripts/config --enable CONFIG_WATCH_QUEUE
./scripts/config --enable CONFIG_X86_ACPI_CPUFREQ
./scripts/config --enable CONFIG_X86_CPUID
./scripts/config --enable CONFIG_X86_INTEL_PSTATE
./scripts/config --enable CONFIG_X86_INTEL_TSX_MODE_AUTO
./scripts/config --enable CONFIG_X86_MSR
./scripts/config --enable CONFIG_X86_PKG_TEMP_THERMAL
./scripts/config --enable CONFIG_X86_PLATFORM_DEVICES
./scripts/config --enable CONFIG_X86_PMEM_LEGACY
./scripts/config --enable CONFIG_X86_X32_ABI
./scripts/config --enable CONFIG_ZRAM
./scripts/config --enable DEFAULT_BBR
./scripts/config --enable FAIR_GROUP_SCHED
./scripts/config --enable VIRTIO_MENU
./scripts/config --enable ZRAM_DEF_COMP_ZSTD
./scripts/config --enable CONFIG_ATA
./scripts/config --enable CONFIG_ATA_SFF
./scripts/config --enable CONFIG_ATA_BMDMA
./scripts/config --enable CONFIG_ATA_ACPI
./scripts/config --enable CONFIG_SATA_AHCI
./scripts/config --enable CONFIG_SCSI
./scripts/config --enable CONFIG_SCSI_PROC_FS
./scripts/config --enable CONFIG_BLK_DEV_SD
./scripts/config --enable CONFIG_CHR_DEV_SG
./scripts/config --enable CONFIG_SCSI_SAS_ATA
./scripts/config --enable CONFIG_SCSI_VIRTIO
./scripts/config --enable CONFIG_VFIO_VIRQFD
./scripts/config --enable CONFIG_VIRTIO_PCI
./scripts/config --enable CONFIG_VIRTIO_PCI_LEGACY
./scripts/config --enable CONFIG_VIRTIO_PMEM
./scripts/config --enable CONFIG_VIRTIO_BALLOON
./scripts/config --enable CONFIG_VIRTIO_MEM
./scripts/config --enable CONFIG_VIRTIO_INPUT
./scripts/config --enable CONFIG_VIRTIO_MMIO
./scripts/config --enable CONFIG_INTEL_IOMMU
./scripts/config --enable CONFIG_INTEL_IOMMU_SVM
./scripts/config --enable CONFIG_INTEL_IOMMU_DEFAULT_ON
./scripts/config --enable CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
./scripts/config --enable CONFIG_IRQ_REMAP
./scripts/config --enable CONFIG_HYPERV_IOMMU
./scripts/config --enable CONFIG_SCHED_CORE
./scripts/config --enable CONFIG_X86_X2APIC
./scripts/config --enable CONFIG_X86_CPU_RESCTRL
./scripts/config --enable CONFIG_PARAVIRT_SPINLOCKS
./scripts/config --enable CONFIG_PROCESSOR_SELECT
./scripts/config --enable CONFIG_CPU_SUP_INTEL
./scripts/config --enable CONFIG_X86_KERNEL_IBT
./scripts/config --enable CONFIG_KVM_PROVE_MMU
./scripts/config --enable CONFIG_TRIM_UNUSED_KSYMS
./scripts/config --enable CONFIG_IXGBEVF
./scripts/config --enable CONFIG_VFIO
./scripts/config --enable CONFIG_CRYPTO_PCRYPT
./scripts/config --enable CONFIG_CRYPTO_CRYPTD
./scripts/config --enable CONFIG_CRYPTO_LZO
./scripts/config --enable CONFIG_CRYPTO_LZ4
./scripts/config --enable CONFIG_CRYPTO_ZSTD
./scripts/config --enable CONFIG_HZ_100
./scripts/config --enable CONFIG_PREEMPT_NONE
./scripts/config --enable CONFIG_INTEL_TDX_HOST
./scripts/config --enable CONFIG_ZSWAP
./scripts/config --enable CONFIG_ZSWAP_DEFAULT_ON
./scripts/config --enable CONFIG_TRANSPARENT_HUGEPAGE_MADVISE
./scripts/config --enable CONFIG_BTRFS_FS_POSIX_ACL
./scripts/config --enable CONFIG_XFS_POSIX_ACL
./scripts/config --enable CONFIG_CEPH_FS_POSIX_ACL
./scripts/config --enable CONFIG_EROFS_FS_POSIX_ACL
./scripts/config --enable CONFIG_NFS_V3_ACL
./scripts/config --enable CONFIG_NFSD_V3_ACL
./scripts/config --enable CONFIG_NTFS3_FS_POSIX_ACL
./scripts/config --enable CONFIG_TMPFS_POSIX_ACL
./scripts/config --enable CONFIG_EXT4_FS_POSIX_ACL
./scripts/config --enable CONFIG_FS_POSIX_ACL
./scripts/config --enable CONFIG_EXT2_FS_POSIX_ACL
./scripts/config --enable CONFIG_REISERFS_FS_POSIX_ACL
./scripts/config --enable CONFIG_JFS_POSIX_ACL
./scripts/config --enable CONFIG_F2FS_FS_POSIX_ACL
./scripts/config --enable CONFIG_JFFS2_FS_POSIX_ACL
./scripts/config --enable CONFIG_NFSD_V2_ACL
./scripts/config --enable CONFIG_9P_FS_POSIX_ACL
./scripts/config --enable CONFIG_EROFS_FS_XATTR
./scripts/config --enable CONFIG_EVM_ADD_XATTRS
./scripts/config --enable CONFIG_SQUASHFS_XATTR
./scripts/config --enable CONFIG_CIFS_XATTR
./scripts/config --enable CONFIG_TMPFS_XATTR
./scripts/config --enable CONFIG_EXT2_FS_XATTR
./scripts/config --enable CONFIG_EXT4_FS_XATTR
./scripts/config --enable CONFIG_REISERFS_FS_XATTR
./scripts/config --enable CONFIG_F2FS_FS_XATTR
./scripts/config --enable CONFIG_JFFS2_FS_XATTR
./scripts/config --enable CONFIG_UBIFS_FS_XATTR
./scripts/config --enable CONFIG_EXT4_FS_SECURITY
./scripts/config --enable CONFIG_EXT2_FS_SECURITY
./scripts/config --enable CONFIG_REISERFS_FS_SECURITY
./scripts/config --enable CONFIG_JFS_SECURITY
./scripts/config --enable CONFIG_F2FS_FS_SECURITY
./scripts/config --enable CONFIG_JFFS2_FS_SECURITY
./scripts/config --enable CONFIG_UBIFS_FS_SECURITY
./scripts/config --enable CONFIG_EROFS_FS_SECURITY
./scripts/config --enable CONFIG_SECURITYFS
./scripts/config --enable CONFIG_KEYS_REQUEST_CACHE
./scripts/config --enable CONFIG_IMA_READ_POLICY
./scripts/config --enable CONFIG_CRYPTO_ECDH
./scripts/config --enable CONFIG_CRYPTO_ECRDSA
./scripts/config --enable CONFIG_CRYPTO_SM2
./scripts/config --enable CONFIG_CRYPTO_CURVE25519
./scripts/config --enable CONFIG_CRYPTO_AES_TI
./scripts/config --enable CONFIG_CRYPTO_ARIA
./scripts/config --enable CONFIG_CRYPTO_BLOWFISH
./scripts/config --enable CONFIG_CRYPTO_CAMELLIA
./scripts/config --enable CONFIG_CRYPTO_CAST5
./scripts/config --enable CONFIG_CRYPTO_CAST6
./scripts/config --enable CONFIG_CRYPTO_DES
./scripts/config --enable CONFIG_CRYPTO_FCRYPT
./scripts/config --enable CONFIG_CRYPTO_SERPENT
./scripts/config --enable CONFIG_CRYPTO_SM4_GENERIC
./scripts/config --enable CONFIG_CRYPTO_TWOFISH
./scripts/config --enable CONFIG_CRYPTO_ADIANTUM
./scripts/config --enable CONFIG_CRYPTO_CHACHA20
./scripts/config --enable CONFIG_CRYPTO_CFB
./scripts/config --enable CONFIG_CRYPTO_CTS
./scripts/config --enable CONFIG_CRYPTO_HCTR2
./scripts/config --enable CONFIG_CRYPTO_KEYWRAP
./scripts/config --enable CONFIG_CRYPTO_LRW
./scripts/config --enable CONFIG_CRYPTO_OFB
./scripts/config --enable CONFIG_CRYPTO_PCBC
./scripts/config --enable CONFIG_CRYPTO_XTS
./scripts/config --enable CONFIG_CRYPTO_AEGIS128
./scripts/config --enable CONFIG_CRYPTO_CHACHA20POLY1305
./scripts/config --enable CONFIG_CRYPTO_ESSIV
./scripts/config --enable CONFIG_CRYPTO_BLAKE2B
./scripts/config --enable CONFIG_CRYPTO_MD4
./scripts/config --enable CONFIG_CRYPTO_MICHAEL_MIC
./scripts/config --enable CONFIG_CRYPTO_POLY1305
./scripts/config --enable CONFIG_CRYPTO_RMD160
./scripts/config --enable CONFIG_CRYPTO_SM3_GENERIC
./scripts/config --enable CONFIG_CRYPTO_STREEBOG
./scripts/config --enable CONFIG_CRYPTO_VMAC
./scripts/config --enable CONFIG_CRYPTO_WP512
./scripts/config --enable CONFIG_CRYPTO_XCBC
./scripts/config --enable CONFIG_CRYPTO_XXHASH
./scripts/config --enable CONFIG_CRYPTO_CRC32
./scripts/config --enable CONFIG_CRYPTO_LZ4HC
./scripts/config --enable CONFIG_CRYPTO_ANSI_CPRNG
./scripts/config --enable CONFIG_CRYPTO_USER_API_HASH
./scripts/config --enable CONFIG_CRYPTO_USER_API_SKCIPHER
./scripts/config --enable CONFIG_CRYPTO_USER_API_RNG
./scripts/config --enable CONFIG_CRYPTO_USER_API_AEAD
./scripts/config --enable CONFIG_CRYPTO_AES_NI_INTEL
./scripts/config --enable CONFIG_CRYPTO_SHA1_SSSE3
./scripts/config --enable CONFIG_CRYPTO_SHA256_SSSE3
./scripts/config --enable CONFIG_CRYPTO_SHA512_SSSE3
./scripts/config --enable CONFIG_CRYPTO_CRC32C_INTEL
./scripts/config --enable CONFIG_CRYPTO_CRC32_PCLMUL
./scripts/config --enable CONFIG_CRYPTO_LIB_CHACHA
./scripts/config --enable CONFIG_CRYPTO_LIB_CURVE25519
./scripts/config --enable CONFIG_CRYPTO_LIB_POLY1305
./scripts/config --enable CONFIG_CORDIC
./scripts/config --enable CONFIG_CRC7
./scripts/config --enable CONFIG_CRC8
./scripts/config --enable CRYPTO_LIB_CHACHA20POLY1305
./scripts/config --enable CONFIG_CRC4
./scripts/config --enable CONFIG_NO_HZ_IDLE
./scripts/config --enable CONFIG_PERF_EVENTS_INTEL_UNCORE
./scripts/config --enable CONFIG_PERF_EVENTS_INTEL_RAPL
./scripts/config --enable CONFIG_PERF_EVENTS_INTEL_CSTATE
./scripts/config --enable CONFIG_X86_CPA_STATISTICS
./scripts/config --enable CONFIG_LEGACY_VSYSCALL_XONLY
./scripts/config --enable CONFIG_ACPI_FPDT
./scripts/config --enable CONFIG_ACPI_BGRT
./scripts/config --enable CONFIG_ACPI_NFIT
./scripts/config --enable CONFIG_ACPI_DPTF
./scripts/config --enable CONFIG_ACPI_FFH
./scripts/config --enable CONFIG_ACPI_PFRUT
./scripts/config --enable CONFIG_DEVTMPFS_MOUNT
./scripts/config --enable CONFIG_FW_LOADER_COMPRESS_ZSTD
./scripts/config --enable CONFIG_FW_CFG_SYSFS
./scripts/config --enable CONFIG_EFI_COCO_SECRET
./scripts/config --enable CONFIG_VIRTIO_NET
./scripts/config --enable CONFIG_MEDIA_PLATFORM_SUPPORT
./scripts/config --enable CONFIG_FB_VESA
./scripts/config --enable CONFIG_FB_NVIDIA
./scripts/config --enable CONFIG_FB_RIVA
./scripts/config --enable CONFIG_FB_SIMPLE
./scripts/config --enable CONFIG_DMADEVICES
./scripts/config --enable CONFIG_INTEL_IDMA64
./scripts/config --enable CONFIG_INTEL_IDXD
./scripts/config --enable CONFIG_INTEL_IOATDMA
./scripts/config --enable CONFIG_VFIO_PCI_VGA
./scripts/config --enable CONFIG_NFS_FS
./scripts/config --enable CONFIG_BPF
./scripts/config --enable CONFIG_BPF_JIT
./scripts/config --enable CONFIG_BPF_SYSCALL
./scripts/config --enable CONFIG_NET_CLS_BPF
./scripts/config --enable CONFIG_BPF_JIT_ALWAYS_ON
./scripts/config --enable CONFIG_NET_ACT_BPF
./scripts/config --enable CONFIG_HAVE_BPF_JIT
./scripts/config --enable CONFIG_BPF_EVENTS
./scripts/config --enable CONFIG_RCU_LAZY
./scripts/config --enable CONFIG_X86_VSYSCALL_EMULATION
./scripts/config --enable CONFIG_ZSWAP_EXCLUSIVE_LOADS_DEFAULT_ON
./scripts/config --enable CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD
./scripts/config --enable ZRAM_MEMORY_TRACKING
./scripts/config --enable CONFIG_ZRAM_MULTI_COMP
./scripts/config --enable CONFIG_KEXEC
./scripts/config --enable CONFIG_CRASH_CORE
./scripts/config --enable CONFIG_CRASH_DUMP
./scripts/config --enable CONFIG_KEXEC_CORE
./scripts/config --enable CONFIG_HAVE_IMA_KEXEC
./scripts/config --enable CONFIG_KEXEC_FILE
./scripts/config --enable CONFIG_X86_5LEVEL
./scripts/config --enable CONFIG_ARCH_SELECTS_KEXEC_FILE
./scripts/config --enable CONFIG_CALL_PADDING
./scripts/config --enable CONFIG_HAVE_ARCH_NODE_DEV_GROUP
./scripts/config --enable CONFIG_WATCHDOG_CORE
./scripts/config --enable CONFIG_DEVMEM
./scripts/config --enable CONFIG_STRICT_DEVMEM
./scripts/config --enable CONFIG_IO_STRICT_DEVMEM
./scripts/config --enable CONFIG_IPV6
./scripts/config --enable CONFIG_KSM
./scripts/config --enable CONFIG_KALLSYMS
./scripts/config --enable CONFIG_KALLSYMS_ALL
./scripts/config --enable CONFIG_COMPILE_TEST
case ${ARCH} in
"x86-64-v2")
./scripts/config --enable CONFIG_GENERIC_CPU2
;;
"x86-64-v3")
./scripts/config --enable CONFIG_GENERIC_CPU3
;;
"x86-64-v4")
./scripts/config --enable CONFIG_GENERIC_CPU4
;;
esac
cp .config .config.enable.after
fi
}
doDefaultMitigations() {
if [ -f .config ]; then
cp .config .config.mitigations.before
fi
if [ $SECURED == 0 ]; then
doEchoStep "Options: secured OFF"
./scripts/config --disable CONFIG_SPECULATION_MITIGATIONS
./scripts/config --disable CONFIG_RETPOLINE
./scripts/config --disable CONFIG_CPU_IBRS_ENTRY
./scripts/config --disable CONFIG_SLS
./scripts/config --disable CONFIG_GDS_FORCE_MITIGATION
else
doEchoStep "Options: secured ON"
./scripts/config --enable CONFIG_SPECULATION_MITIGATIONS
./scripts/config --enable CONFIG_RETPOLINE
./scripts/config --enable CONFIG_CPU_IBRS_ENTRY
./scripts/config --enable CONFIG_SLS
./scripts/config --enable CONFIG_GDS_FORCE_MITIGATION
fi
cp .config .config.mitigations.after
}
doDefaultsTesting() {
if [ $TESTING == 1 ]; then
doEchoStep "Options: testings activated..."
if [ -f .config ]; then
cp .config .config.testing.before
fi
./scripts/config --set-str CONFIG_LOCALVERSION '-zogg-test'
cp .config .config.testing.after
fi
}
doDefaults() {
cd $WORKDIR
if [ -f .config ]; then
cp .config .config.default.before
fi
doMoreUarch
doFastKernelHeaders
doEchoStep "Define options"
if [ "$CLANG" == "1" ]; then
./scripts/config --set-str CONFIG_LOCALVERSION '-clang'
else
./scripts/config --set-str CONFIG_LOCALVERSION '-gcc'
fi
doDefaultsDisable
doDefaultsEnable
doDefaultMitigations
doDefaultsTesting
cp .config .config.default.after
}
# Edit .config
doEditSettings() {
cd $WORKDIR
doEchoStep "Settings tuning !"
if [ -f .config ]; then
cp .config .config.edit.before
fi
if [ "$CLANG" == "1" ]; then
make -j${NPROC} LLVM=1 CC="ccache clang" menuconfig
else
make -j${NPROC} CC="ccache gcc" menuconfig
fi
result=$?
if [ ! result==0 ]; then
echo ">>> Error in settings edit !"
exit 1
fi
cp .config .config.edit.after
}
doGenerateUninstall() {
# remove old files
READY=$CURRENT/build/$BRANCH/$VERSION/ready
mkdir -p $READY
rm -rf $READY/*.*
if ls $WORKDIR/../*.deb 1>/dev/null 2>&1; then
# find .deb packages and generate
# uninstall commands
# package name
PACKAGES=
TAG="_$VERSION-1_amd64.deb"
search_dir=$WORKDIR/../
for entry in "$search_dir"/*.deb; do
name="${entry##*/}"
pname=${name//$TAG/}
if [ ! "$pname" == "linux-libc-dev" ]; then
PACKAGES="$PACKAGES $pname"
fi
echo "$name" >>$READY/packages.log
done
# move files to destination folder
mv -f $WORKDIR/../*.deb $READY/
# prepare uninstall script
cat <<-EOF >${READY}/uninstall.sh
#!/bin/bash
# ${UPDATED}
apt remove --purge ${PACKAGES}
sudo sync
exit 0
EOF
# generate install script
cat <<-EOF >${READY}/install.sh
#!/bin/bash
# ${UPDATED}
echo 'blacklist pcspkr' > /etc/modprobe.d/pcspkr.conf
sudo dpkg -i *.deb
sudo sync
exit 0
EOF
# Set execution attribute
chmod +x $READY/*.sh
else
echo ">>> No packages have been created!"
exit 1
fi
# setup execution rights on packages
chown -R root:root $READY/.
}
# Print compilation end informations
doEnding() {
clear
doHead
doEchoStep "Generated packages :"
echo
cat $CURRENT/build/$BRANCH/$VERSION/ready/packages.log
echo
echo "In folder: $CURRENT/build/$BRANCH/$VERSION/ready"
doSync
}
# Perform effective compilation
doCompile() {
cd $WORKDIR
doStripSig
doStripDebug
if [ $O3 == 1 ]; then
GCCO="3"
else
GCCO="2"
fi
doEchoStep "Compilation time... Be patient!"
# export MAKEFLAGS="-j$((NPROC + 1)) -l${NPROC} -Werror=maybe-uninitialized -Werror=nonnull -Wno-maybe-uninitialized -Wno-uninitialized -Wno-free-nonheap-object -Wno-nonnull"
export MAKEFLAGS="-j$((NPROC + 1)) -l${NPROC} -Wno-error"
export CFLAGS="-march=${ARCH} -O${GCCO} -flto -pipe -msse -msse2 -msse3 -mmmx"
export CXXFLAGS="${CFLAGS}"
export KCFLAGS="-march=${ARCH} -O${GCCO}"
export KCPPFLAGS="${KCFLAGS}"
set CONFIG_SITE=/etc/dpkg-cross/cross-config.amd64
set DEB_BUILD_OPTIONS=nocheck
doEchoStep "MAKEFLAGS: $MAKEFLAGS"
doEchoStep "CFLAGS: $CFLAGS"
doEchoStep "CXXFLAGS: $CXXFLAGS"
doEchoStep "KCFLAGS: $KCFLAGS"
doEchoStep "KCPPFLAGS: $KCPPFLAGS"
doEchoStep "make bindeb-pkg"
if [ "$CLANG" == "1" ]; then
make \
-j${NPROC} \
LLVM=1 LLVM_IAS=1 \
CC='ccache clang' \
HOSTCC='ccache clang' \
bindeb-pkg \
LOCALVERSION=-"$(dpkg --print-architecture)" \
KDEB_PKGVERSION="$(make kernelversion)-1"
else
make \
-j${NPROC} \
CC='ccache gcc' \
bindeb-pkg \
LOCALVERSION=-"$(dpkg --print-architecture)" \
KDEB_PKGVERSION="$(make kernelversion)-1"
fi
result=$?
doEchoStep "make bindeb-pkg: $result"
if [ ! result==0 ]; then
echo ">>> Error in 'make bindeb-pkg' !"
exit 1
fi
doGenerateUninstall
doEnding
doSync
}
# Proceed for Kernel build
doKernel() {
WORKDIR=$CURRENT/build/$BRANCH/$VERSION
doScratch
if [ ! -d $WORKDIR ]; then
mkdir -p $WORKDIR
fi
LOGFILE=$WORKDIR/$LOGNAME.$LOGEXT
if [ -f $LOGFILE ]; then
rm -rf $LOGFILE
fi
touch $LOGFILE
if [ "$STEPS" != "compile" ]; then
doDownload > >(tee -a $LOGFILE) 2>&1
doUncompress > >(tee -a $LOGFILE) 2>&1
fi
WORKDIR=$WORKDIR/linux-$VERSION
doCleanup > >(tee -a $LOGFILE) 2>&1
doConfigCloud > >(tee -a $LOGFILE) 2>&1
doOldOne > >(tee -a $LOGFILE) 2>&1
doAllMods > >(tee -a $LOGFILE) 2>&1
doDefaults > >(tee -a $LOGFILE) 2>&1
doPermissions > >(tee -a $LOGFILE) 2>&1
doEditSettings
while true; do
read -p "Do you wish to run compile? " yn
case $yn in
[Yy]*)
doCompile > >(tee -a $LOGFILE) 2>&1
break
;;
[Nn]*) exit ;;
*) echo "Please answer yes or no." ;;
esac
done
}
# Entrypoint of operations
if [[ -z $BRANCH || "$BRANCH" == "help" || -z $VERSION || "$VERSION" == "help" ]]; then
doHelp
exit 1
else
clear
doHead
doKernel
fi
exit 0