summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFigue2019-10-27 17:48:06 +0100
committerFigue2019-10-27 17:48:06 +0100
commitd2c902090951fb6537615a15183c1f9a0f318be2 (patch)
tree5c514fb637846a75bae2b56bd352c8456427bf0c
downloadaur-d2c902090951fb6537615a15183c1f9a0f318be2.tar.gz
First commit: 4.19.79-rt28-xanmod
-rw-r--r--.SRCINFO48
-rw-r--r--0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch102
-rw-r--r--60-linux.hook12
-rw-r--r--90-linux.hook11
-rw-r--r--PKGBUILD292
-rwxr-xr-xchoose-gcc-optimization.sh110
-rw-r--r--linux-xanmod-rt.preset14
-rw-r--r--linux.install13
8 files changed, 602 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..ce1fc0c34500
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,48 @@
+pkgbase = linux-xanmod-rt
+ pkgver = 4.19.79
+ pkgrel = 1
+ url = http://www.xanmod.org/
+ arch = x86_64
+ license = GPL2
+ makedepends = xmlto
+ makedepends = kmod
+ makedepends = inetutils
+ makedepends = bc
+ makedepends = libelf
+ makedepends = git
+ makedepends = python-sphinx
+ makedepends = python-sphinx_rtd_theme
+ makedepends = graphviz
+ makedepends = imagemagick
+ makedepends = cpio
+ options = !strip
+ source = https://github.com/xanmod/linux/archive/4.19.79-rt28-xanmod.tar.gz
+ source = 60-linux.hook
+ source = 90-linux.hook
+ source = linux-xanmod-rt.preset
+ source = choose-gcc-optimization.sh
+ source = 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
+ sha256sums = 26347912717a1e2eb470b1aa6a5d128b17422787fe5a0f0b07eed5dcb7ed2b29
+ sha256sums = ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21
+ sha256sums = c043f3033bb781e2688794a59f6d1f7ed49ef9b13eb77ff9a425df33a244a636
+ sha256sums = ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65
+ sha256sums = 8b2629f6340d4807c113cd9fa308f50f0a8d85df5698bef083e151f06d58f748
+ sha256sums = 112b16c247dae8ff44066fd0268012f9c623d5da349ebd66896e54257b3404a5
+
+pkgname = linux-xanmod-rt
+ pkgdesc = The Linux kernel and modules with Xanmod patches
+ install = linux.install
+ depends = coreutils
+ depends = linux-firmware
+ depends = kmod
+ depends = mkinitcpio
+ optdepends = crda: to set the correct wireless channels of your country
+ provides = linux
+ provides = linux-xanmod
+ backup = etc/mkinitcpio.d/linux-xanmod-rt.preset
+
+pkgname = linux-xanmod-rt-headers
+ pkgdesc = Header files and scripts for building modules for Xanmod Linux kernel
+ provides = linux-headers
+ provides = linux-xanmod-headers
+
diff --git a/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch b/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
new file mode 100644
index 000000000000..fdcc8faea235
--- /dev/null
+++ b/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
@@ -0,0 +1,102 @@
+From 1ce3e84fdf0b56f477d30acdc8797dedd7330e37 Mon Sep 17 00:00:00 2001
+From: Serge Hallyn <serge.hallyn@canonical.com>
+Date: Fri, 31 May 2013 19:12:12 +0100
+Subject: [PATCH 1/2] add sysctl to disallow unprivileged CLONE_NEWUSER by
+ default
+
+Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
+[bwh: Remove unneeded binary sysctl bits]
+Signed-off-by: Daniel Micay <danielmicay@gmail.com>
+---
+ kernel/fork.c | 15 +++++++++++++++
+ kernel/sysctl.c | 12 ++++++++++++
+ kernel/user_namespace.c | 3 +++
+ 3 files changed, 30 insertions(+)
+
+diff --git a/kernel/fork.c b/kernel/fork.c
+index f0b58479534f..8b2d927125c5 100644
+--- a/kernel/fork.c
++++ b/kernel/fork.c
+@@ -103,6 +103,11 @@
+
+ #define CREATE_TRACE_POINTS
+ #include <trace/events/task.h>
++#ifdef CONFIG_USER_NS
++extern int unprivileged_userns_clone;
++#else
++#define unprivileged_userns_clone 0
++#endif
+
+ /*
+ * Minimum number of threads to boot the kernel
+@@ -1649,6 +1654,10 @@ static __latent_entropy struct task_struct *copy_process(
+ if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS))
+ return ERR_PTR(-EINVAL);
+
++ if ((clone_flags & CLONE_NEWUSER) && !unprivileged_userns_clone)
++ if (!capable(CAP_SYS_ADMIN))
++ return ERR_PTR(-EPERM);
++
+ /*
+ * Thread groups must share signals as well, and detached threads
+ * can only be started up within the thread group.
+@@ -2467,6 +2476,12 @@ int ksys_unshare(unsigned long unshare_flags)
+ if (unshare_flags & CLONE_NEWNS)
+ unshare_flags |= CLONE_FS;
+
++ if ((unshare_flags & CLONE_NEWUSER) && !unprivileged_userns_clone) {
++ err = -EPERM;
++ if (!capable(CAP_SYS_ADMIN))
++ goto bad_unshare_out;
++ }
++
+ err = check_unshare_flags(unshare_flags);
+ if (err)
+ goto bad_unshare_out;
+diff --git a/kernel/sysctl.c b/kernel/sysctl.c
+index cc02050fd0c4..ce2ad2b92897 100644
+--- a/kernel/sysctl.c
++++ b/kernel/sysctl.c
+@@ -105,6 +105,9 @@ extern int core_uses_pid;
+ extern char core_pattern[];
+ extern unsigned int core_pipe_limit;
+ #endif
++#ifdef CONFIG_USER_NS
++extern int unprivileged_userns_clone;
++#endif
+ extern int pid_max;
+ extern int pid_max_min, pid_max_max;
+ extern int percpu_pagelist_fraction;
+@@ -514,6 +517,15 @@ static struct ctl_table kern_table[] = {
+ .proc_handler = proc_dointvec,
+ },
+ #endif
++#ifdef CONFIG_USER_NS
++ {
++ .procname = "unprivileged_userns_clone",
++ .data = &unprivileged_userns_clone,
++ .maxlen = sizeof(int),
++ .mode = 0644,
++ .proc_handler = proc_dointvec,
++ },
++#endif
+ #ifdef CONFIG_PROC_SYSCTL
+ {
+ .procname = "tainted",
+diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
+index 923414a246e9..6b9dbc257e34 100644
+--- a/kernel/user_namespace.c
++++ b/kernel/user_namespace.c
+@@ -26,6 +26,9 @@
+ #include <linux/bsearch.h>
+ #include <linux/sort.h>
+
++/* sysctl */
++int unprivileged_userns_clone;
++
+ static struct kmem_cache *user_ns_cachep __read_mostly;
+ static DEFINE_MUTEX(userns_state_mutex);
+
+--
+2.19.1
+
diff --git a/60-linux.hook b/60-linux.hook
new file mode 100644
index 000000000000..b33873c854fb
--- /dev/null
+++ b/60-linux.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Type = File
+Operation = Install
+Operation = Upgrade
+Operation = Remove
+Target = usr/lib/modules/%KERNVER%/*
+Target = usr/lib/modules/%EXTRAMODULES%/*
+
+[Action]
+Description = Updating %PKGBASE% module dependencies...
+When = PostTransaction
+Exec = /usr/bin/depmod %KERNVER%
diff --git a/90-linux.hook b/90-linux.hook
new file mode 100644
index 000000000000..fca45abe1a62
--- /dev/null
+++ b/90-linux.hook
@@ -0,0 +1,11 @@
+[Trigger]
+Type = File
+Operation = Install
+Operation = Upgrade
+Target = usr/lib/modules/%KERNVER%/vmlinuz
+Target = usr/lib/initcpio/*
+
+[Action]
+Description = Updating %PKGBASE% initcpios...
+When = PostTransaction
+Exec = /usr/bin/mkinitcpio -p %PKGBASE%
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..47469cb3d5db
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,292 @@
+# Maintainer: Joan Figueras <ffigue at gmail dot com>
+# Contributor: Torge Matthies <openglfreak at googlemail dot com>
+# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
+# Contributor: Yoshi2889 <rick.2889 at gmail dot com>
+# Contributor: Tobias Powalowski <tpowa@archlinux.org>
+# Contributor: Thomas Baechler <thomas@archlinux.org>
+
+##
+## The following variables can be customized at build time. Use env or export to change at your wish
+##
+## Example: env _microarchitecture=25 use_numa=n use_tracers=n use_pds=n makepkg -sc
+##
+## Look inside 'choose-gcc-optimization.sh' to choose your microarchitecture
+## Valid numbers between: 0 to 25
+## Default is: 0 => generic
+## Good option if your package is for one machine: 25 => native
+if [ -z ${_microarchitecture+x} ]; then
+ _microarchitecture=0
+fi
+##
+## Disable NUMA since most users do not have multiple processors. Breaks CUDA/NvEnc.
+## Archlinux and Xanmod enable it by default.
+## Set variable "use_numa" to: n to disable (possibly increase performance)
+## y to enable (stock default)
+if [ -z ${use_numa+x} ]; then
+ use_numa=y
+fi
+##
+## For performance you can disable FUNCTION_TRACER/GRAPH_TRACER. Limits debugging and analyzing of the kernel.
+## Stock Archlinux and Xanmod have this enabled.
+## Set variable "use_tracers" to: n to disable (possibly increase performance)
+## y to enable (stock default)
+if [ -z ${use_tracers+x} ]; then
+ use_tracers=y
+fi
+##
+## Enable PDS CPU scheduler by default https://gitlab.com/alfredchen/linux-pds
+## Set variable "use_pds" to: n to disable (stock Xanmod)
+## y to enable
+if [ -z ${use_pds+x} ]; then
+ use_pds=n
+fi
+
+pkgbase=linux-xanmod-rt
+_srcname=linux
+pkgver=4.19.79
+xanmod=28
+pkgrel=1
+arch=(x86_64)
+url="http://www.xanmod.org/"
+license=(GPL2)
+makedepends=(
+ xmlto kmod inetutils bc libelf git python-sphinx python-sphinx_rtd_theme
+ graphviz imagemagick cpio
+)
+options=('!strip')
+_srcname="linux-${pkgver}-rt${xanmod}-xanmod"
+
+source=(https://github.com/xanmod/linux/archive/${pkgver}-rt${xanmod}-xanmod.tar.gz
+ 60-linux.hook # pacman hook for depmod
+ 90-linux.hook # pacman hook for initramfs regeneration
+ ${pkgbase}.preset # standard config files for mkinitcpio ramdisk
+ choose-gcc-optimization.sh
+ 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch # Grabbed from linux-ck package
+)
+
+sha256sums=('26347912717a1e2eb470b1aa6a5d128b17422787fe5a0f0b07eed5dcb7ed2b29'
+ 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
+ 'c043f3033bb781e2688794a59f6d1f7ed49ef9b13eb77ff9a425df33a244a636'
+ 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65'
+ '8b2629f6340d4807c113cd9fa308f50f0a8d85df5698bef083e151f06d58f748'
+ '112b16c247dae8ff44066fd0268012f9c623d5da349ebd66896e54257b3404a5')
+
+_kernelname=${pkgbase#linux}
+
+prepare() {
+ cd $_srcname
+
+ # Workaround GCC 9 build, source: https://www.linuxquestions.org/questions/slackware-14/make-linux-4-19-42-error-4175653720/
+ export LANG=en_US.UTF-8
+
+ msg2 "Setting version..."
+ scripts/setlocalversion --save-scmversion
+ echo "-$pkgrel" > localversion.10-pkgrel
+ echo "$_kernelname" > localversion.20-pkgname
+
+ # Archlinux patches
+ local src
+ for src in "${source[@]}"; do
+ src="${src%%::*}"
+ src="${src##*/}"
+ [[ $src = *.patch ]] || continue
+ msg2 "Applying patch $src..."
+ patch -Np1 < "../$src"
+ done
+
+ # CONFIG_STACK_VALIDATION gives better stack traces. Also is enabled in all official kernel packages by Archlinux team
+ scripts/config --enable CONFIG_STACK_VALIDATION
+
+ # Enable IKCONFIG following Arch's philosophy
+ scripts/config --enable CONFIG_IKCONFIG \
+ --enable CONFIG_IKCONFIG_PROC
+
+ # User set. See at the top of this file
+ if [ "$use_tracers" = "n" ]; then
+ msg2 "Disabling FUNCTION_TRACER/GRAPH_TRACER..."
+ scripts/config --disable CONFIG_FUNCTION_TRACER \
+ --disable CONFIG_STACK_TRACER
+ fi
+
+ if [ "$use_numa" = "n" ]; then
+ msg2 "Disabling NUMA..."
+ scripts/config --disable CONFIG_NUMA
+ fi
+
+ if [ "$use_pds" = "y" ]; then
+ msg2 "Enabling PDS CPU scheduler by default..."
+ scripts/config --enable CONFIG_SCHED_PDS
+ fi
+
+ # Let's user choose microarchitecture optimization in GCC
+ ${srcdir}/choose-gcc-optimization.sh $_microarchitecture
+
+ # This is intended for the people that want to build this package with their own config
+ # Put the file "myconfig" at the package folder to use this feature
+ if [ -f "${startdir}/myconfig" ]; then
+ msg2 "Using user CUSTOM config..."
+ cp -f "${startdir}"/myconfig .config
+ fi
+
+ make olddefconfig
+
+ make -s kernelrelease > ../version
+ msg2 "Prepared %s version %s" "$pkgbase" "$(<../version)"
+}
+
+build() {
+ cd $_srcname
+ make bzImage modules
+}
+
+_package() {
+ pkgdesc="The Linux kernel and modules with Xanmod patches"
+ depends=(coreutils linux-firmware kmod mkinitcpio)
+ optdepends=('crda: to set the correct wireless channels of your country')
+ provides=('linux' 'linux-xanmod')
+ #replaces=('linux-xanmod-git')
+ #conflicts=('linux-xanmod-git')
+ backup=("etc/mkinitcpio.d/$pkgbase.preset")
+ install=linux.install
+
+ local kernver="$(<version)"
+ local modulesdir="$pkgdir/usr/lib/modules/$kernver"
+
+ cd $_srcname
+
+ msg2 "Installing boot image..."
+ # systemd expects to find the kernel here to allow hibernation
+ # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
+ install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
+ install -Dm644 "$modulesdir/vmlinuz" "$pkgdir/boot/vmlinuz-$pkgbase"
+
+ msg2 "Installing modules..."
+ make INSTALL_MOD_PATH="$pkgdir/usr" modules_install
+
+ # a place for external modules,
+ # with version file for building modules and running depmod from hook
+ local extramodules="extramodules$_kernelname"
+ local extradir="$pkgdir/usr/lib/modules/$extramodules"
+ install -Dt "$extradir" -m644 ../version
+ ln -sr "$extradir" "$modulesdir/extramodules"
+
+ # remove build and source links
+ rm "$modulesdir"/{source,build}
+
+ msg2 "Installing hooks..."
+ # sed expression for following substitutions
+ local subst="
+ s|%PKGBASE%|$pkgbase|g
+ s|%KERNVER%|$kernver|g
+ s|%EXTRAMODULES%|$extramodules|g
+ "
+
+ # hack to allow specifying an initially nonexisting install file
+ sed "$subst" "$startdir/$install" > "$startdir/$install.pkg"
+ true && install=$install.pkg
+
+ # fill in mkinitcpio preset and pacman hooks
+ sed "$subst" ../$pkgbase.preset | install -Dm644 /dev/stdin \
+ "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
+ sed "$subst" ../60-linux.hook | install -Dm644 /dev/stdin \
+ "$pkgdir/usr/share/libalpm/hooks/60-$pkgbase.hook"
+ sed "$subst" ../90-linux.hook | install -Dm644 /dev/stdin \
+ "$pkgdir/usr/share/libalpm/hooks/90-$pkgbase.hook"
+
+ msg2 "Fixing permissions..."
+ chmod -Rc u=rwX,go=rX "$pkgdir"
+}
+
+_package-headers() {
+ pkgdesc="Header files and scripts for building modules for Xanmod Linux kernel"
+ provides=('linux-headers' 'linux-xanmod-headers')
+ #replaces=('linux-xanmod-git-headers')
+ #conflicts=('linux-xanmod-git-headers')
+
+ local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
+
+ cd $_srcname
+
+ msg2 "Installing build files..."
+ install -Dt "$builddir" -m644 Makefile .config Module.symvers System.map vmlinux
+ install -Dt "$builddir/kernel" -m644 kernel/Makefile
+ install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
+ cp -t "$builddir" -a scripts
+
+ # add objtool for external module building and enabled VALIDATION_STACK option
+ install -Dt "$builddir/tools/objtool" tools/objtool/objtool
+
+ # add xfs and shmem for aufs building
+ mkdir -p "$builddir"/{fs/xfs,mm}
+
+ # ???
+ mkdir "$builddir/.tmp_versions"
+
+ msg2 "Installing headers..."
+ cp -t "$builddir" -a include
+ cp -t "$builddir/arch/x86" -a arch/x86/include
+ install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
+
+ install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
+ install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
+
+ # http://bugs.archlinux.org/task/13146
+ install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
+
+ # http://bugs.archlinux.org/task/20402
+ install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
+ install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
+ install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
+
+ msg2 "Installing KConfig files..."
+ find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
+
+ msg2 "Removing unneeded architectures..."
+ local arch
+ for arch in "$builddir"/arch/*/; do
+ [[ $arch = */x86/ ]] && continue
+ echo "Removing $(basename "$arch")"
+ rm -r "$arch"
+ done
+
+ msg2 "Removing documentation..."
+ rm -r "$builddir/Documentation"
+
+ msg2 "Removing broken symlinks..."
+ find -L "$builddir" -type l -printf 'Removing %P\n' -delete
+
+ msg2 "Removing loose objects..."
+ find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
+
+ msg2 "Stripping build tools..."
+ local file
+ while read -rd '' file; do
+ case "$(file -bi "$file")" in
+ application/x-sharedlib\;*) # Libraries (.so)
+ strip -v $STRIP_SHARED "$file" ;;
+ application/x-archive\;*) # Libraries (.a)
+ strip -v $STRIP_STATIC "$file" ;;
+ application/x-executable\;*) # Binaries
+ strip -v $STRIP_BINARIES "$file" ;;
+ application/x-pie-executable\;*) # Relocatable binaries
+ strip -v $STRIP_SHARED "$file" ;;
+ esac
+ done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
+
+ msg2 "Adding symlink..."
+ mkdir -p "$pkgdir/usr/src"
+ ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase-$pkgver"
+
+ msg2 "Fixing permissions..."
+ chmod -Rc u=rwX,go=rX "$pkgdir"
+}
+
+pkgname=("${pkgbase}" "${pkgbase}-headers")
+for _p in "${pkgname[@]}"; do
+ eval "package_$_p() {
+ $(declare -f "_package${_p#$pkgbase}")
+ _package${_p#$pkgbase}
+ }"
+done
+
+# vim:set ts=8 sts=2 sw=2 et:
diff --git a/choose-gcc-optimization.sh b/choose-gcc-optimization.sh
new file mode 100755
index 000000000000..f5d6af8110ec
--- /dev/null
+++ b/choose-gcc-optimization.sh
@@ -0,0 +1,110 @@
+#!/usr/bin/env bash
+
+. /usr/share/makepkg/util/message.sh
+colorize
+
+Detect_CPU=$(gcc -c -Q -march=native --help=target | grep march | awk '{print $2}')
+
+msg "Detected CPU architecture: $Detect_CPU"
+
+cat << EOF
+
+ Available CPU microarchitectures:
+
+ 1) AMD K6/K6-II/K6-III
+ 2) AMD Athlon/Duron/K7
+ 3) AMD Opteron/Athlon64/Hammer/K8
+ 4) AMD Opteron/Athlon64/Hammer/K8 with SSE3
+ 5) AMD 61xx/7x50/PhenomX3/X4/II/K10
+ 6) AMD Family 10h (Barcelona)
+ 7) AMD Family 14h (Bobcat)
+ 8) AMD Family 16h (Jaguar)
+ 9) AMD Family 15h (Bulldozer)
+ 10) AMD Family 15h (Piledriver)
+ 11) AMD Family 15h (Steamroller)
+ 12) AMD Family 15h (Excavator)
+ 13) AMD Family 17h (Zen)
+ 14) Transmeta Crusoe
+ 15) Transmeta Efficeon
+ 16) IDT Winchip C6
+ 17) Winchip-2/Winchip-2A/Winchip-3
+ 18) AMD Elan
+ 19) Geode GX1 (Cyrix MediaGX)
+ 20) AMD Geode GX and LX
+ 21) Cyrix III or C3
+ 22) VIA C3 "Nehemiah"
+ 23) VIA C7
+ 24) Intel Pentium 4, Pentium D and older Nocona/Dempsey Xeon CPUs with Intel 64bit
+ 25) Intel Atom
+ 26) Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx)
+ 27) Intel 1st Gen Core i3/i5/i7-family (Nehalem)
+ 28) Intel 1.5 Gen Core i3/i5/i7-family (Westmere)
+ 29) Intel Silvermont
+ 30) Intel 2nd Gen Core i3/i5/i7-family (Sandybridge)
+ 31) Intel 3rd Gen Core i3/i5/i7-family (Ivybridge)
+ 32) Intel 4th Gen Core i3/i5/i7-family (Haswell)
+ 33) Intel 5th Gen Core i3/i5/i7-family (Broadwell)
+ 34) Intel 6th Gen Core i3/i5/i7-family (Skylake)
+ 35) Intel 6th Gen Core i7/i9-family (Skylake X)
+ 36) Intel 8th Gen Core i3/i5/i7-family (Cannon Lake)
+ 37) Intel 8th Gen Core i7/i9-family (Ice Lake)
+
+ 38) Native optimizations autodetected by GCC
+
+ 0) Generic (default)
+
+EOF
+
+sleep 1
+answer=$1
+
+case $answer in
+ 1) Microarchitecture=CONFIG_MK6 ;;
+ 2) Microarchitecture=CONFIG_MK7 ;;
+ 3) Microarchitecture=CONFIG_MK8 ;;
+ 4) Microarchitecture=CONFIG_MK8SSE3 ;;
+ 5) Microarchitecture=CONFIG_MK10 ;;
+ 6) Microarchitecture=CONFIG_MBARCELONA ;;
+ 7) Microarchitecture=CONFIG_MBOBCAT ;;
+ 8) Microarchitecture=CONFIG_MJAGUAR ;;
+ 9) Microarchitecture=CONFIG_MBULLDOZER ;;
+ 10) Microarchitecture=CONFIG_MPILEDRIVER ;;
+ 11) Microarchitecture=CONFIG_MSTEAMROLLER ;;
+ 12) Microarchitecture=CONFIG_MEXCAVATOR ;;
+ 13) Microarchitecture=CONFIG_MZEN ;;
+ 14) Microarchitecture=CONFIG_MCRUSOE ;;
+ 15) Microarchitecture=CONFIG_MEFFICEON ;;
+ 16) Microarchitecture=CONFIG_MWINCHIPC6 ;;
+ 17) Microarchitecture=CONFIG_MWINCHIP3D ;;
+ 18) Microarchitecture=CONFIG_MELAN ;;
+ 19) Microarchitecture=CONFIG_MGEODEGX1 ;;
+ 20) Microarchitecture=CONFIG_MGEODE_LX ;;
+ 21) Microarchitecture=CONFIG_MCYRIXIII ;;
+ 22) Microarchitecture=CONFIG_MVIAC3_2 ;;
+ 23) Microarchitecture=CONFIG_MVIAC7 ;;
+ 24) Microarchitecture=CONFIG_MPSC ;;
+ 25) Microarchitecture=CONFIG_MATOM ;;
+ 26) Microarchitecture=CONFIG_MCORE2 ;;
+ 27) Microarchitecture=CONFIG_MNEHALEM ;;
+ 28) Microarchitecture=CONFIG_MWESTMERE ;;
+ 29) Microarchitecture=CONFIG_MSILVERMONT ;;
+ 30) Microarchitecture=CONFIG_MSANDYBRIDGE ;;
+ 31) Microarchitecture=CONFIG_MIVYBRIDGE ;;
+ 32) Microarchitecture=CONFIG_MHASWELL ;;
+ 33) Microarchitecture=CONFIG_MBROADWELL ;;
+ 34) Microarchitecture=CONFIG_MSKYLAKE ;;
+ 35) Microarchitecture=CONFIG_MSKYLAKEX ;;
+ 36) Microarchitecture=CONFIG_MCANNONLAKE ;;
+ 37) Microarchitecture=CONFIG_MICELAKE ;;
+ 38) Microarchitecture=CONFIG_MNATIVE ;;
+ *) default=CONFIG_GENERIC_CPU ;;
+esac
+
+warning "According to PKGBUILD variable _microarchitecture, your choice is $answer"
+msg "Building this package for microarchitecture: $Microarchitecture$default"
+sleep 5
+
+sed -e 's|^CONFIG_GENERIC_CPU=y|# CONFIG_GENERIC_CPU is not set|g' -i .config
+sed -e "s|^# $Microarchitecture is not set|$Microarchitecture=y|g" -i .config
+
+echo
diff --git a/linux-xanmod-rt.preset b/linux-xanmod-rt.preset
new file mode 100644
index 000000000000..66709a8c1537
--- /dev/null
+++ b/linux-xanmod-rt.preset
@@ -0,0 +1,14 @@
+# mkinitcpio preset file for the '%PKGBASE%' package
+
+ALL_config="/etc/mkinitcpio.conf"
+ALL_kver="/boot/vmlinuz-%PKGBASE%"
+
+PRESETS=('default' 'fallback')
+
+#default_config="/etc/mkinitcpio.conf"
+default_image="/boot/initramfs-%PKGBASE%.img"
+#default_options=""
+
+#fallback_config="/etc/mkinitcpio.conf"
+fallback_image="/boot/initramfs-%PKGBASE%-fallback.img"
+fallback_options="-S autodetect"
diff --git a/linux.install b/linux.install
new file mode 100644
index 000000000000..372c56d9fd04
--- /dev/null
+++ b/linux.install
@@ -0,0 +1,13 @@
+# arg 1: the new package version
+# arg 2: the old package version
+
+post_upgrade() {
+ if findmnt --fstab -uno SOURCE /boot &>/dev/null && ! mountpoint -q /boot; then
+ echo "WARNING: /boot appears to be a separate partition but is not mounted."
+ fi
+}
+
+post_remove() {
+ rm -f boot/initramfs-%PKGBASE%.img
+ rm -f boot/initramfs-%PKGBASE%-fallback.img
+}