Modularisation, complément et tests en cours des options (Nvidia)

This commit is contained in:
Olivier 2024-03-02 13:24:31 +01:00
parent 8740df74a9
commit 9ae1445690
4 changed files with 5774 additions and 797 deletions

View File

@ -11,7 +11,7 @@ Récupération, décompression des sources du Kernel linux sur kernel.org, optim
## Usage
```
```bash
sudo bash kernel.sh [branch] [version] [compile]
```
@ -21,7 +21,7 @@ sudo bash kernel.sh [branch] [version] [compile]
Exemple :
```
```bash
sudo bash kernel.sh 6.x 6.6.10
```
@ -40,6 +40,13 @@ sudo bash kernel.sh 6.x 6.6.10
## CHANGELOG
### 2024-03-02
- Modularisation des options par variable de conditionnement
- Ajout du 'Fast Kernel Headers' (désactivé pour le moment)
- Ajustements des options (tests en cours)
- Objectif: permettre l'installation de pilote Nvidia
### 2024-02-23
- Correction de problèmes de configuration produisant un kernel défaillant

4838
fast-kernel-headers.patch Normal file

File diff suppressed because it is too large Load Diff

330
kernel.sh
View File

@ -1,8 +1,18 @@
#!/bin/bash
UPDATED="2024-02-23"
UPDATED="2024-03-02"
TESTING=0
CLANG=0
DISABLE=1 # disable some options
ENABLE=1 # enable some options
MITIGATIONS=0 # enable/disable all mitigations
UARCH=1 # apply more uarch patch
FKH=0 # apply fast kernel headers patch
TESTING=1 # add testing options
CLEANUP=1 # perform folder cleanup
CLANG=0 # use Clang compiler (if not, use GCC)
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
#
# Sources:
@ -22,11 +32,20 @@ CLANG=0
# more-uarches-for-kernel.patch : more-uarches-for-kernel-6.1.79-6.8-rc3.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
#
doBuildSystem() {
echo "v$UPDATED"
}
@ -59,13 +78,10 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
KERNEL=/opt/kernel
WORK=/opt/work
BACKUPS=/opt/backups
LOGNAME=kernel
LOGEXT=log
LOGFILE=""
NPROC=$(nproc)
HOSTNAME=$(hostname)
SELF=$(realpath $0)
SCRIPT=$(basename $SELF)
@ -88,6 +104,7 @@ doSync() {
echo 3 >/proc/sys/vm/drop_caches
}
# Display header infos
doHead() {
doIntro
doHeader
@ -109,6 +126,7 @@ doHelp() {
echo
}
# Display step infos
doEchoStep() {
NOW=$(date +"%Y/%m/%d %H:%M:%S")
echo "### $NOW - $1"
@ -147,74 +165,92 @@ doUncompress() {
echo ">>> Error in uncompress !"
exit 1
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" mrproper
make -j${NPROC} LLVM=1 CC="ccache clang" mrproper
else
make -j$(nproc) CC="ccache gcc" mrproper
make -j${NPROC} CC="ccache gcc" mrproper
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.1.cloudconfig
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
make -j${NPROC} LLVM=1 CC="ccache clang" olddefconfig
else
make -j$(nproc) CC="ccache gcc" olddefconfig
make -j${NPROC} CC="ccache gcc" olddefconfig
fi
result=$?
if [ ! result==0 ]; then
echo ">>> Error in generate .config !"
exit 1
fi
cp .config .config.2.olddefconfig
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 [ "$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.3.allmodconfig
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)
@ -228,6 +264,7 @@ doPermissions() {
echo ">>> Error in chown !"
exit 1
fi
doSync
}
@ -236,6 +273,9 @@ 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 ""
@ -245,7 +285,7 @@ doStripSig() {
echo ">>> Error in chown !"
exit 1
fi
cp .config .config.7.stripsigskeys
cp .config .config.stripsig.after
}
# Strip debug informations
@ -253,6 +293,9 @@ 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=$?
@ -260,12 +303,54 @@ doStripDebug() {
echo ">>> Error in chown !"
exit 1
fi
cp .config .config.8.stripdebug
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_ACCESSIBILITY
./scripts/config --disable CONFIG_ACORN_PARTITION
./scripts/config --disable CONFIG_ACPI_DEBUG
@ -359,10 +444,8 @@ doDefaultsDisable() {
./scripts/config --disable CONFIG_EARLY_PRINTK
./scripts/config --disable CONFIG_EDD
./scripts/config --disable CONFIG_EFI_FAKE_MEMMAP
./scripts/config --disable CONFIG_EFI_MIXED
./scripts/config --disable CONFIG_EFI_PGT_DUMP
./scripts/config --disable CONFIG_EISA
./scripts/config --disable CONFIG_EXT2_FS
./scripts/config --disable CONFIG_EXT3_FS
./scripts/config --disable CONFIG_EXT4_DEBUG
./scripts/config --disable CONFIG_EXT4_KUNIT_TESTS
@ -380,7 +463,6 @@ doDefaultsDisable() {
./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_GENERIC_IRQ_DEBUGFS
./scripts/config --disable CONFIG_GFS2_FS
./scripts/config --disable CONFIG_GNSS
./scripts/config --disable CONFIG_GOOGLE_FIRMWARE
@ -402,7 +484,6 @@ doDefaultsDisable() {
./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_PROVE_MMU
./scripts/config --disable CONFIG_KVM_XEN
./scripts/config --disable CONFIG_LDM_PARTITION
./scripts/config --disable CONFIG_LIB80211_DEBUG
@ -419,7 +500,6 @@ doDefaultsDisable() {
./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_LOAD
./scripts/config --disable CONFIG_MODULE_FORCE_UNLOAD
./scripts/config --disable CONFIG_MODULE_SIG
./scripts/config --disable CONFIG_MODULE_SRCVERSION_ALL
@ -478,7 +558,6 @@ doDefaultsDisable() {
./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_TIME_KUNIT_TEST
./scripts/config --disable CONFIG_ULTRIX_PARTITION
./scripts/config --disable CONFIG_UNIXWARE_DISKLABEL
./scripts/config --disable CONFIG_USB4_NET
@ -497,7 +576,6 @@ doDefaultsDisable() {
./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_CPU_RESCTRL
./scripts/config --disable CONFIG_X86_DEBUG_FPU
./scripts/config --disable CONFIG_X86_EXTENDED_PLATFORM
./scripts/config --disable CONFIG_X86_GOLDFISH
@ -510,8 +588,6 @@ doDefaultsDisable() {
./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_X86_VSYSCALL_EMULATION
./scripts/config --disable CONFIG_X86_X2APIC
./scripts/config --disable CONFIG_XEN
./scripts/config --disable CONFIG_XFS_ASSERT_FATAL
./scripts/config --disable CONFIG_XFS_DEBUG
@ -524,7 +600,6 @@ doDefaultsDisable() {
./scripts/config --disable CONFIG_XFS_SUPPORT_V4
./scripts/config --disable USB_NET_DRIVER
./scripts/config --disable WIRELESS
./scripts/config --disable CONFIG_MODULE_SIG
./scripts/config --disable CONFIG_KERNEL_GZIP
./scripts/config --disable CONFIG_KERNEL_BZIP2
./scripts/config --disable CONFIG_KERNEL_LZMA
@ -555,48 +630,53 @@ doDefaultsDisable() {
./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_WLAN
./scripts/config --disable CONFIG_PPS
./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_DEBUG_KERNEL
./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_CPU_IBRS_ENTRY
./scripts/config --disable CONFIG_GDS_FORCE_MITIGATION
./scripts/config --disable CONFIG_SPECULATION_MITIGATIONS
./scripts/config --disable CONFIG_VIRT_CPU_ACCOUNTING_GEN
./scripts/config --disable CONFIG_IRQ_TIME_ACCOUNTING
./scripts/config --disable CONFIG_TASKSTATS
./scripts/config --disable CONFIG_PSI
./scripts/config --disable CONFIG_RCU_NOCB_CPU
./scripts/config --disable CONFIG_KALLSYMS
./scripts/config --disable CONFIG_KALLSYMS_ALL
./scripts/config --disable CONFIG_SCHED_MC
./scripts/config --disable CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS
./scripts/config --disable CONFIG_SPECULATION_MITIGATIONS
./scripts/config --disable CONFIG_PAGE_TABLE_ISOLATION
./scripts/config --disable CONFIG_RETPOLINE
./scripts/config --disable CONFIG_CPU_IBRS_ENTRY
./scripts/config --disable CONFIG_GDS_FORCE_MITIGATION
./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_IPV6
./scripts/config --disable WIRELESS
./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
cp .config .config.disable.after
fi
}
doDefaultsEnable() {
if [ $ENABLE == 1 ]; then
doEchoStep "Options: enable"
if [ -f .config ]; then
cp .config .config.enable.before
fi
./scripts/config --enable CONFIG_ADDRESS_MASKING
./scripts/config --enable CONFIG_AF_KCM
./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
@ -605,8 +685,6 @@ doDefaultsEnable() {
./scripts/config --enable CONFIG_BLK_DEV_INITRD
./scripts/config --enable CONFIG_BLK_WBT
./scripts/config --enable CONFIG_BOOT_CONFIG
./scripts/config --enable CONFIG_BPF_JIT
./scripts/config --enable CONFIG_BPF_SYSCALL
./scripts/config --enable CONFIG_BSD_PROCESS_ACCT
./scripts/config --enable CONFIG_CALL_DEPTH_TRACKING
./scripts/config --enable CONFIG_CGROUP_CPUACCT
@ -633,7 +711,6 @@ doDefaultsEnable() {
./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_IBRS_ENTRY
./scripts/config --enable CONFIG_CPU_UNRET_ENTRY
./scripts/config --enable CONFIG_DEVTMPFS
./scripts/config --enable CONFIG_DRM_VIRTIO_GPU
@ -646,13 +723,11 @@ doDefaultsEnable() {
./scripts/config --enable CONFIG_EFIVAR_FS
./scripts/config --enable CONFIG_ETHERNET
./scripts/config --enable CONFIG_ETHTOOL_NETLINK
./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_GDS_FORCE_MITIGATION
./scripts/config --enable CONFIG_HANGCHECK_TIMER
./scripts/config --enable CONFIG_HARDENED_USERCOPY
./scripts/config --enable CONFIG_HIGH_RES_TIMERS
@ -679,7 +754,6 @@ doDefaultsEnable() {
./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
./scripts/config --enable CONFIG_IPV6_VTI
./scripts/config --enable CONFIG_JUMP_LABEL
./scripts/config --enable CONFIG_KERNEL_XZ
@ -700,7 +774,6 @@ doDefaultsEnable() {
./scripts/config --enable CONFIG_MQ_IOSCHED_KYBER
./scripts/config --enable CONFIG_MSDOS_PARTITION
./scripts/config --enable CONFIG_NET
./scripts/config --enable CONFIG_NET_CLS_BPF
./scripts/config --enable CONFIG_NET_CLS_CGROUP
./scripts/config --enable CONFIG_NET_CLS_FLOWER
./scripts/config --enable CONFIG_NET_CLS_FW
@ -749,16 +822,12 @@ doDefaultsEnable() {
./scripts/config --enable CONFIG_PSAMPLE
./scripts/config --enable CONFIG_PVH
./scripts/config --enable CONFIG_PVPANIC
./scripts/config --enable CONFIG_RCU_BOOST
./scripts/config --enable CONFIG_RCU_EXPERT
./scripts/config --enable CONFIG_RETHUNK
./scripts/config --enable CONFIG_RETPOLINE
./scripts/config --enable CONFIG_SCHED_AUTOGROUP
./scripts/config --enable CONFIG_SHUFFLE_PAGE_ALLOCATOR
./scripts/config --enable CONFIG_SLS
./scripts/config --enable CONFIG_SMB_SERVER
./scripts/config --enable CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN
./scripts/config --enable CONFIG_SPECULATION_MITIGATIONS
./scripts/config --enable CONFIG_SYN_COOKIES
./scripts/config --enable CONFIG_SYSFB_SIMPLEFB
./scripts/config --enable CONFIG_SYSVIPC
@ -777,7 +846,6 @@ doDefaultsEnable() {
./scripts/config --enable CONFIG_VIRTUALIZATION
./scripts/config --enable CONFIG_VMGENID
./scripts/config --enable CONFIG_WATCH_QUEUE
./scripts/config --enable CONFIG_WLAN
./scripts/config --enable CONFIG_X86_ACPI_CPUFREQ
./scripts/config --enable CONFIG_X86_CPUID
./scripts/config --enable CONFIG_X86_INTEL_PSTATE
@ -793,8 +861,6 @@ doDefaultsEnable() {
./scripts/config --enable VIRTIO_MENU
./scripts/config --enable ZRAM_DEF_COMP_ZSTD
./scripts/config --enable CONFIG_WERROR
./scripts/config --enable CONFIG_KERNEL_XZ
./scripts/config --enable CONFIG_EXT4_FS
./scripts/config --enable CONFIG_ATA
./scripts/config --enable CONFIG_ATA_SFF
./scripts/config --enable CONFIG_ATA_BMDMA
@ -814,24 +880,18 @@ doDefaultsEnable() {
./scripts/config --enable CONFIG_VIRTIO_MEM
./scripts/config --enable CONFIG_VIRTIO_INPUT
./scripts/config --enable CONFIG_VIRTIO_MMIO
./scripts/config --enable CONFIG_IOMMU_SUPPORT
./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_VIRTIO_IOMMU
./scripts/config --enable CONFIG_COMPILE_TEST
./scripts/config --enable CONFIG_BPF_JIT_ALWAYS_ON
./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_PVH
./scripts/config --enable CONFIG_PROCESSOR_SELECT
./scripts/config --enable CONFIG_CPU_SUP_INTEL
./scripts/config --enable CONFIG_X86_5LEVEL
./scripts/config --enable CONFIG_X86_KERNEL_IBT
./scripts/config --enable CONFIG_KVM_PROVE_MMU
./scripts/config --enable CONFIG_TRIM_UNUSED_KSYMS
@ -845,7 +905,6 @@ doDefaultsEnable() {
./scripts/config --enable CONFIG_HZ_100
./scripts/config --enable CONFIG_PREEMPT_NONE
./scripts/config --enable CONFIG_INTEL_TDX_HOST
./scripts/config --enable CONFIG_MODULE_COMPRESS_NONE
./scripts/config --enable CONFIG_ZSWAP
./scripts/config --enable CONFIG_ZSWAP_DEFAULT_ON
./scripts/config --enable CONFIG_TRANSPARENT_HUGEPAGE_MADVISE
@ -946,13 +1005,10 @@ doDefaultsEnable() {
./scripts/config --enable CRYPTO_LIB_CHACHA20POLY1305
./scripts/config --enable CONFIG_CRC4
./scripts/config --enable CONFIG_NO_HZ_IDLE
./scripts/config --enable CONFIG_PSI
./scripts/config --enable CONFIG_PARAVIRT_SPINLOCKS
./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_X86_USER_SHADOW_STACK
./scripts/config --enable CONFIG_LEGACY_VSYSCALL_XONLY
./scripts/config --enable CONFIG_ACPI_FPDT
./scripts/config --enable CONFIG_ACPI_BGRT
@ -976,30 +1032,102 @@ doDefaultsEnable() {
./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
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 [ $MITIGATIONS == 0 ]; then
doEchoStep "Options: mitigations 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: mitigations 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 --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 --set-str CONFIG_LOCALVERSION '-zogg-test'
cp .config .config.testing.after
fi
}
doDefaults() {
cd $WORKDIR
doEchoStep "Apply 'uarches' patch"
patch -p1 <../../../more-uarches-for-kernel.patch
if [ -f .config ]; then
cp .config .config.default.before
fi
doMoreUarch
doFastKernelHeaders
doEchoStep "Define options"
./scripts/config --set-str CONFIG_LOCALVERSION '-zogg'
doDefaultsDisable
doDefaultsEnable
if [ $TESTING == 1 ]; then
doDefaultMitigations
doDefaultsTesting
fi
cp .config .config.5.defaulted
cp .config .config.default.after
}
# Edit .config
@ -1007,22 +1135,23 @@ 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
make -j${NPROC} LLVM=1 CC="ccache clang" menuconfig
else
make -j$(nproc) CC="ccache gcc" menuconfig
make -j${NPROC} CC="ccache gcc" menuconfig
fi
result=$?
if [ ! result==0 ]; then
echo ">>> Error in settings edit !"
exit 1
fi
cp .config .config.6.menuconfig
cp .config .config.edit.after
}
# Generate uninstall script
doGenerateUninstall() {
# remove old files
READY=$CURRENT/$BRANCH/$VERSION/ready
mkdir -p $READY
@ -1049,7 +1178,7 @@ doGenerateUninstall() {
mv -f $WORKDIR/../*.deb $READY/
# prepare uninstall script
cat <<EOF >$READY/uninstall.sh
cat <<-EOF >${READY}/uninstall.sh
#!/bin/bash
# ${UPDATED}
apt remove --purge ${PACKAGES}
@ -1058,7 +1187,7 @@ exit 0
EOF
# generate install script
cat <<EOF >$READY/install.sh
cat <<-EOF >${READY}/install.sh
#!/bin/bash
# ${UPDATED}
echo 'blacklist pcspkr' > /etc/modprobe.d/pcspkr.conf
@ -1067,6 +1196,7 @@ sudo sync
exit 0
EOF
# Set execution attribute
chmod +x $READY/*.sh
else
@ -1100,19 +1230,18 @@ doCompile() {
doStripDebug
doEchoStep "Compilation time... Be patient!"
NB_CORES=$(grep -c '^processor' /proc/cpuinfo)
export MAKEFLAGS="-j$((NB_CORES + 1)) -l${NB_CORES} -Werror=maybe-uninitialized -Werror=nonnull -Wno-maybe-uninitialized -Wno-uninitialized -Wno-free-nonheap-object -Wno-nonnull"
export CFLAGS='-march=x86-64-v4 -O2 -flto -pipe'
export CXXFLAGS='-march=x86-64-v4 -O2 -flto -pipe'
export KCFLAGS=' -march=x86-64-v4 -O2'
export KCPPFLAGS=' -march=x86-64-v4 -O2'
export MAKEFLAGS="-j$((NPROC + 1)) -l${NPROC} -Werror=maybe-uninitialized -Werror=nonnull -Wno-maybe-uninitialized -Wno-uninitialized -Wno-free-nonheap-object -Wno-nonnull"
export CFLAGS="-march=${ARCH} -O2 -flto -pipe"
export CXXFLAGS="-march=${ARCH} -O2 -flto -pipe"
export KCFLAGS=" -march=${ARCH} -O2"
export KCPPFLAGS=" -march=${ARCH} -O2"
set CONFIG_SITE=/etc/dpkg-cross/cross-config.amd64
set DEB_BUILD_OPTIONS=nocheck
doEchoStep "make bindeb-pkg"
if [ "$CLANG" == "1" ]; then
make \
-j$(nproc) \
-j${NPROC} \
LLVM=1 \
CC='ccache clang' \
bindeb-pkg \
@ -1120,7 +1249,7 @@ doCompile() {
KDEB_PKGVERSION="$(make kernelversion)-1"
else
make \
-j$(nproc) \
-j${NPROC} \
CC='ccache gcc' \
bindeb-pkg \
LOCALVERSION=-"$(dpkg --print-architecture)" \
@ -1134,9 +1263,10 @@ doCompile() {
exit 1
fi
doSync
doGenerateUninstall
doEnding
doSync
}
# Proceed for Kernel build
@ -1151,11 +1281,13 @@ doKernel() {
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
doAllMods > >(tee -a $LOGFILE) 2>&1
doDefaults > >(tee -a $LOGFILE) 2>&1
doPermissions > >(tee -a $LOGFILE) 2>&1
doEditSettings