From 8fae847587ecb0a3baf2852045ba23280352f0b3 Mon Sep 17 00:00:00 2001 From: kraoc Date: Mon, 11 Mar 2024 20:52:03 +0100 Subject: [PATCH] kernel 6.8 --- README.md | 17 +++++--- kernel.sh | 67 ++++++++++++++++++++++++------- more-uarches-for-kernel.patch | 75 +++++++++++++++++------------------ 3 files changed, 99 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 6ed6757..f08ef53 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,15 @@ sudo bash kernel.sh [branch] [version] [compile] Exemple : ```bash -sudo bash kernel.sh 6.x 6.6.10 +sudo bash kernel.sh 6.x 6.8 ``` ## Résultats -- linux-headers-6.6.10-zogg-amd64_6.6.10-1_amd64.deb : 8.4 Mo -- linux-image-6.6.10-zogg-amd64_6.6.10-1_amd64.deb : 20 Mo -- linux-image-6.6.10-zogg-amd64-dbg_6.6.10-1_amd64.deb : 151 Mo -- linux-libc-dev_6.6.10-1_amd64.deb : 1.3 Mo +- linux-headers-6.8.0-zogg-amd64_6.8.0-1_amd64.deb : 8.6 Mo +- linux-image-6.8.0-zogg-amd64-dbg_6.8.0-1_amd64.deb : 181 Mo +- linux-image-6.8.0-zogg-amd64_6.8.0-1_amd64.deb : 21 Mo +- linux-libc-dev_6.8.0-1_amd64.deb : 1.3 Mo ## TODO @@ -40,11 +40,16 @@ sudo bash kernel.sh 6.x 6.6.10 ## CHANGELOG +### 2024-03-11 + +- Mise à jour Kernel 6.8 +- Mise à jour de la configuration du patch 'more uarch' (6.8-rc4+) + ### 2024-03-02 - Modularisation des options par variable de conditionnement - Ajout du 'Fast Kernel Headers' (désactivé pour le moment) -- Ajustment des options permettant l'instalaltion de pilote Nvidia +- Ajustment des options permettant l'installation de pilote Nvidia - IPv6 remis (sinon certains conteneurs déconnent) ### 2024-02-23 diff --git a/kernel.sh b/kernel.sh index 2596976..23e34d6 100644 --- a/kernel.sh +++ b/kernel.sh @@ -1,19 +1,21 @@ #!/bin/bash -UPDATED="2024-03-02" +UPDATED="2024-03-11" 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=0 # add testing options -UNCOMPRESS=1 # perform uncompress if already exist -CLEANUP=1 # perform folder cleanup CLANG=0 # 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: @@ -30,7 +32,7 @@ CONFIGMOD=0 # enable all mod config # more-uarches-for-kernel.patch: # https://github.com/graysky2/kernel_compiler_patch -# more-uarches-for-kernel.patch : more-uarches-for-kernel-6.1.79-6.8-rc3.patch +# more-uarches-for-kernel.patch : more-uarches-for-kernel-6.8-rc4+.patch # # @@ -138,17 +140,29 @@ doEchoStep() { 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 ]; then + 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 --inet4-only https://cdn.kernel.org/pub/linux/kernel/v$BRANCH/linux-$VERSION.tar.sign - wget --inet4-only https://cdn.kernel.org/pub/linux/kernel/v$BRANCH/linux-$VERSION.tar.xz + 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=$? @@ -367,6 +381,7 @@ doDefaultsDisable() { 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 @@ -680,6 +695,8 @@ doDefaultsDisable() { ./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 @@ -875,7 +892,6 @@ doDefaultsEnable() { ./scripts/config --enable FAIR_GROUP_SCHED ./scripts/config --enable VIRTIO_MENU ./scripts/config --enable ZRAM_DEF_COMP_ZSTD - ./scripts/config --enable CONFIG_WERROR ./scripts/config --enable CONFIG_ATA ./scripts/config --enable CONFIG_ATA_SFF ./scripts/config --enable CONFIG_ATA_BMDMA @@ -1076,6 +1092,7 @@ doDefaultsEnable() { ./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_COMPILE_TEST case ${ARCH} in @@ -1245,15 +1262,28 @@ doCompile() { 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 CFLAGS="-march=${ARCH} -O2 -flto -pipe" - export CXXFLAGS="-march=${ARCH} -O2 -flto -pipe" - export KCFLAGS=" -march=${ARCH} -O2" - export KCPPFLAGS=" -march=${ARCH} -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 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 \ @@ -1289,8 +1319,15 @@ doCompile() { doKernel() { WORKDIR=$CURRENT/$BRANCH/$VERSION + doScratch + if [ ! -d $WORKDIR ]; then + mkdir -p $WORKDIR + fi + LOGFILE=$WORKDIR/$LOGNAME.$LOGEXT - rm -rf $LOGFILE + if [ -f $LOGFILE ]; then + rm -rf $LOGFILE + fi touch $LOGFILE if [ "$STEPS" != "compile" ]; then diff --git a/more-uarches-for-kernel.patch b/more-uarches-for-kernel.patch index 596cade..75c48bf 100644 --- a/more-uarches-for-kernel.patch +++ b/more-uarches-for-kernel.patch @@ -101,18 +101,18 @@ REFERENCES 4. https://github.com/graysky2/kernel_gcc_patch/issues/15 5. http://www.linuxforge.net/docs/linux/linux-gcc.php --- - arch/x86/Kconfig.cpu | 427 ++++++++++++++++++++++++++++++-- + arch/x86/Kconfig.cpu | 424 ++++++++++++++++++++++++++++++-- arch/x86/Makefile | 44 +++- arch/x86/include/asm/vermagic.h | 74 ++++++ - 3 files changed, 528 insertions(+), 17 deletions(-) + 3 files changed, 526 insertions(+), 16 deletions(-) diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu -index 87396575c..5ac6e8463 100644 +index 2a7279d80460a..6924a0f5f1c26 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu @@ -157,7 +157,7 @@ config MPENTIUM4 - - + + config MK6 - bool "K6/K6-II/K6-III" + bool "AMD K6/K6-II/K6-III" @@ -121,7 +121,7 @@ index 87396575c..5ac6e8463 100644 Select this for an AMD K6-family processor. Enables use of @@ -165,7 +165,7 @@ config MK6 flags to GCC. - + config MK7 - bool "Athlon/Duron/K7" + bool "AMD Athlon/Duron/K7" @@ -130,7 +130,7 @@ index 87396575c..5ac6e8463 100644 Select this for an AMD Athlon K7-family processor. Enables use of @@ -173,12 +173,106 @@ config MK7 flags to GCC. - + config MK8 - bool "Opteron/Athlon64/Hammer/K8" + bool "AMD Opteron/Athlon64/Hammer/K8" @@ -138,7 +138,7 @@ index 87396575c..5ac6e8463 100644 Select this for an AMD Opteron or Athlon64 Hammer-family processor. Enables use of some extended instructions, and passes appropriate optimization flags to GCC. - + +config MK8SSE3 + bool "AMD Opteron/Athlon64/Hammer/K8 with SSE3" + help @@ -238,17 +238,17 @@ index 87396575c..5ac6e8463 100644 depends on X86_32 @@ -270,7 +364,7 @@ config MPSC in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one. - + config MCORE2 - bool "Core 2/newer Xeon" + bool "Intel Core 2" help - + Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and @@ -278,6 +372,8 @@ config MCORE2 family in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo) - + + Enables -march=core2 + config MATOM @@ -257,7 +257,7 @@ index 87396575c..5ac6e8463 100644 @@ -287,6 +383,212 @@ config MATOM accordingly optimized code. Use a recent GCC with specific Atom support in order to fully benefit from selecting this option. - + +config MNEHALEM + bool "Intel Nehalem" + select X86_P6_NOP @@ -470,7 +470,7 @@ index 87396575c..5ac6e8463 100644 @@ -294,6 +596,50 @@ config GENERIC_CPU Generic x86-64 CPU. Run equally well on all x86-64 CPUs. - + +config GENERIC_CPU2 + bool "Generic-x86-64-v2" + depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000) @@ -516,7 +516,7 @@ index 87396575c..5ac6e8463 100644 + Enables -march=native + endchoice - + config X86_GENERIC @@ -318,9 +664,17 @@ config X86_INTERNODE_CACHE_SHIFT config X86_L1_CACHE_SHIFT @@ -535,17 +535,17 @@ index 87396575c..5ac6e8463 100644 - default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX + default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII \ + || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX - + config X86_F00F_BUG def_bool y @@ -332,15 +686,27 @@ config X86_INVD_BUG - + config X86_ALIGNMENT_16 def_bool y - depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC || M586 || M486SX || M486 || MVIAC3_2 || MGEODEGX1 + depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC \ + || M586 || M486SX || M486 || MVIAC3_2 || MGEODEGX1 - + config X86_INTEL_USERCOPY def_bool y - depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2 @@ -554,7 +554,7 @@ index 87396575c..5ac6e8463 100644 + || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX \ + || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS \ + || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MNATIVE_INTEL - + config X86_USE_PPRO_CHECKSUM def_bool y - depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM @@ -566,10 +566,10 @@ index 87396575c..5ac6e8463 100644 + || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE \ + || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE \ + || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MNATIVE_INTEL || MNATIVE_AMD - + # # P6_NOPs are a relatively minor optimization that require a family >= -@@ -356,32 +722,63 @@ config X86_USE_PPRO_CHECKSUM +@@ -356,11 +722,22 @@ config X86_USE_PPRO_CHECKSUM config X86_P6_NOP def_bool y depends on X86_64 @@ -579,7 +579,7 @@ index 87396575c..5ac6e8463 100644 + || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE \ + || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS \ + || MNATIVE_INTEL) - + config X86_TSC def_bool y - depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MATOM) || X86_64 @@ -591,10 +591,14 @@ index 87396575c..5ac6e8463 100644 + || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE \ + || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS \ + || MNATIVE_INTEL || MNATIVE_AMD) || X86_64 - + + config X86_HAVE_PAE + def_bool y +@@ -368,18 +745,37 @@ config X86_HAVE_PAE + config X86_CMPXCHG64 def_bool y -- depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586TSC || M586MMX || MATOM || MGEODE_LX || MGEODEGX1 || MK6 || MK7 || MK8 +- depends on X86_HAVE_PAE || M586TSC || M586MMX || MK6 || MK7 + depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 \ + || M586TSC || M586MMX || MATOM || MGEODE_LX || MGEODEGX1 || MK6 || MK7 || MK8 || MK8SSE3 || MK10 \ + || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN \ @@ -602,7 +606,7 @@ index 87396575c..5ac6e8463 100644 + || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE \ + || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE \ + || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MNATIVE_INTEL || MNATIVE_AMD - + # this should be set for all -march=.. options where the compiler # generates cmov. config X86_CMOV @@ -615,7 +619,7 @@ index 87396575c..5ac6e8463 100644 + || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX \ + || MCANNONLAKE || MICELAKE || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS \ + || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MNATIVE_INTEL || MNATIVE_AMD) - + config X86_MINIMUM_CPU_FAMILY int default "64" if X86_64 @@ -630,17 +634,9 @@ index 87396575c..5ac6e8463 100644 + || MNATIVE_INTEL || MNATIVE_AMD) default "5" if X86_32 && X86_CMPXCHG64 default "4" - - config X86_DEBUGCTLMSR - def_bool y -- depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486SX || M486) && !UML -+ depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 \ -+ || M486SX || M486) && !UML - - config IA32_FEAT_CTL - def_bool y + diff --git a/arch/x86/Makefile b/arch/x86/Makefile -index 1a068de12..23b2ec69d 100644 +index da8f3caf27815..c873d10df15d0 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -152,8 +152,48 @@ else @@ -693,9 +689,9 @@ index 1a068de12..23b2ec69d 100644 + cflags-$(CONFIG_GENERIC_CPU4) += -march=x86-64-v4 cflags-$(CONFIG_GENERIC_CPU) += -mtune=generic KBUILD_CFLAGS += $(cflags-y) - + diff --git a/arch/x86/include/asm/vermagic.h b/arch/x86/include/asm/vermagic.h -index 75884d2cd..02c1386eb 100644 +index 75884d2cdec37..02c1386eb653e 100644 --- a/arch/x86/include/asm/vermagic.h +++ b/arch/x86/include/asm/vermagic.h @@ -17,6 +17,54 @@ @@ -786,5 +782,6 @@ index 75884d2cd..02c1386eb 100644 #elif defined CONFIG_MELAN #define MODULE_PROC_FAMILY "ELAN " #elif defined CONFIG_MCRUSOE --- -2.43.0.232.ge79552d197 +-- +2.43.2 +