Upgrade Linux kernel to 4.14.336

This is the last LTS version buildable using GCC 4.0.x. The next one,
version 4.19, requires at least GCC 4.6.

Fortunately, this is also the first version of the Linux kernel
without firmware blobs being included in /firmware, so the FSFLA
deblob scripts aren't needed anymore to ensure a fully auditable
kernel - the 3 remaining drivers that do include blobs masquerading
as source code are removed via a patch, avoiding all the other side
effects of the deblob scripts.
This doesn't compromise the trustworthiness of the bootstrapped
environment, since all the other drivers deblob would remove use
the firmware loader mechanism, which does nothing when the actual
firmware blobs aren't installed on the system separately. Features
dependent on firmware still won't work, but many drivers that load
firmware do so only optionally. This includes r8169, the driver for
the Realtek gigabit NICs found on many x86 motherboards.

This kernel is considerably larger than 4.9.10, and we build more
of it (including drivers that would previously get stripped away by
the deblob script, such as r8169), so to accommodate that, Fiwix
initrd size is increased by 64MiB, while lowering kexec space by
the same amount to ensure enough userspace memory available in Fiwix.
Fiwix's maximum open file count is also bumped from 1.5K to 2.5K.

The Documentation folder is deleted before build, to further save
space in the ramdisk.
This commit is contained in:
Gábor Stefanik 2024-02-16 12:58:27 +01:00
parent 32138d13b9
commit 11d3605b08
34 changed files with 10004 additions and 310 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,56 @@
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
#
# SPDX-License-Identifier: GPL-3.0-or-later
src_unpack() {
mkdir "${pkg}"
default || true # Predictable link errors - not a problem
rm "${DISTFILES}/${pkg}.tar.xz"
}
generate_autoconf_h() {
# generate include/linux/autoconf.h -- we do not have gperf rn to do it the normal way
mkdir -p include/generated
# Transform each of the CONFIG_* options that are =y into header
grep -E '=y$' .config | sed 's/=y$/ 1/' | sed 's/^/#define /' >> include/generated/autoconf.h
# Transform each of the CONFIG_* options that are unset into headers
grep -E ' is not set$' .config | sed 's/ is not set$//' | sed 's/#/#undef/' >> include/generated/autoconf.h
# Transform each of the non-boolean options into headers
grep -E '=.*$' .config | grep -v -E '=y$' | sed 's/=/ /' | sed 's/^/#define /' >> include/generated/autoconf.h
}
src_prepare() {
default
mv config .config
mkdir -p include/config
cp .config include/config/auto.conf
generate_autoconf_h
# Remove shipped files
find . -name "*_shipped*" -delete
# Remove documentation to save space
rm -rf Documentation
}
src_compile() {
cp .config include/config/auto.conf
rm include/generated/autoconf.h
generate_autoconf_h
# Allow use of patched initramfs_list.sh (which is required anyway)
make "${MAKEJOBS}" ARCH=i386 prepare
PATH="${PWD}/usr:${PATH}" make "${MAKEJOBS}" ARCH=i386
# Clear up more space
find . -name '*.o' -delete
}
src_install() {
install -D -m 644 arch/i386/boot/bzImage "${DESTDIR}/boot/vmlinuz"
install -D -m 755 usr/gen_init_cpio "${DESTDIR}${PREFIX}/bin/gen_init_cpio"
install -D -m 755 scripts/gen_initramfs_list.sh "${DESTDIR}${PREFIX}/bin/gen_initramfs_list.sh"
}

View file

@ -0,0 +1,18 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
Remove the 68() which I'm not really sure what it does but still works and
breaks our version of binutils.
--- arch/x86/boot/bioscall.S 2021-07-31 17:50:09.519480274 +1000
+++ arch/x86/boot/bioscall.S 2021-07-31 18:21:32.086972277 +1000
@@ -65,7 +65,7 @@
movw %ax, %es
/* Copy output state from stack frame */
- movw 68(%esp), %di /* Original %cx == 3rd argument */
+ movw %sp, %di /* Original %cx == 3rd argument */
andw %di, %di
jz 4f
movw %sp, %si

View file

@ -0,0 +1,60 @@
SPDX-FileCopyrightText: 2022 Sean Christopherson <seanjc@google.com>
SPDX-License-Identifier: GPL-2.0-only
Revert the following patch:
From ddfd117714014cebe7b5d008fdec8eaec620cba1 Mon Sep 17 00:00:00 2001
From: Sean Christopherson <seanjc@google.com>
Date: Wed, 30 Nov 2022 23:36:48 +0000
Subject: [PATCH] x86/virt: Force GIF=1 prior to disabling SVM (for reboot
flows)
commit 6a3236580b0b1accc3976345e723104f74f6f8e6 upstream.
Set GIF=1 prior to disabling SVM to ensure that INIT is recognized if the
kernel is disabling SVM in an emergency, e.g. if the kernel is about to
jump into a crash kernel or may reboot without doing a full CPU RESET.
If GIF is left cleared, the new kernel (or firmware) will be unabled to
awaken APs. Eat faults on STGI (due to EFER.SVME=0) as it's possible
that SVM could be disabled via NMI shootdown between reading EFER.SVME
and executing STGI.
Link: https://lore.kernel.org/all/cbcb6f35-e5d7-c1c9-4db9-fe5cc4de579a@amd.com
Cc: stable@vger.kernel.org
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20221130233650.1404148-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/include/asm/virtext.h | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
index 0116b2ee9e64f..4699acd602af4 100644
--- arch/x86/include/asm/virtext.h
+++ arch/x86/include/asm/virtext.h
@@ -114,21 +114,7 @@ static inline void cpu_svm_disable(void)
wrmsrl(MSR_VM_HSAVE_PA, 0);
rdmsrl(MSR_EFER, efer);
- if (efer & EFER_SVME) {
- /*
- * Force GIF=1 prior to disabling SVM to ensure INIT and NMI
- * aren't blocked, e.g. if a fatal error occurred between CLGI
- * and STGI. Note, STGI may #UD if SVM is disabled from NMI
- * context between reading EFER and executing STGI. In that
- * case, GIF must already be set, otherwise the NMI would have
- * been blocked, so just eat the fault.
- */
- asm_volatile_goto("1: stgi\n\t"
- _ASM_EXTABLE(1b, %l[fault])
- ::: "memory" : fault);
-fault:
- wrmsrl(MSR_EFER, efer & ~EFER_SVME);
- }
+ wrmsrl(MSR_EFER, efer & ~EFER_SVME);
}
/** Makes sure SVM is disabled, if it is supported on the CPU

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
There's something incorrect with this macro for live-bootstrap, most likely as
a result of the dodgy installation of linux-headers. However, there is no
problem with this, and it is verified that BITS_PER_LONG __BITS_PER_LONG
have functional and correct values.
--- tools/include/asm-generic/bitsperlong.h 2021-07-31 11:50:26.616768608 +1000
+++ tools/include/asm-generic/bitsperlong.h 2021-07-31 11:50:36.786847443 +1000
@@ -9,10 +9,6 @@
#define BITS_PER_LONG __WORDSIZE
#endif
-#if BITS_PER_LONG != __BITS_PER_LONG
-#error Inconsistent word size. Check asm/bitsperlong.h
-#endif
-
#ifndef BITS_PER_LONG_LONG
#define BITS_PER_LONG_LONG 64
#endif

View file

@ -0,0 +1,24 @@
SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
SPDX-License-Identifier: GPL-2.0-only
Remove BUILD_BUG_ON check as it causes a link error
--- drivers/gpu/drm/drm_edid.c.bak 2024-02-16 08:36:01.168832650 +0100
+++ drivers/gpu/drm/drm_edid.c 2024-02-16 08:36:58.148828524 +0100
@@ -2879,15 +2879,6 @@
* get the other variants by simply increasing the
* vertical front porch length.
*/
- BUILD_BUG_ON(edid_cea_modes[8].vtotal != 262 ||
- edid_cea_modes[9].vtotal != 262 ||
- edid_cea_modes[12].vtotal != 262 ||
- edid_cea_modes[13].vtotal != 262 ||
- edid_cea_modes[23].vtotal != 312 ||
- edid_cea_modes[24].vtotal != 312 ||
- edid_cea_modes[27].vtotal != 312 ||
- edid_cea_modes[28].vtotal != 312);
-
if (((vic == 8 || vic == 9 ||
vic == 12 || vic == 13) && mode->vtotal < 263) ||
((vic == 23 || vic == 24 ||

View file

@ -0,0 +1,42 @@
SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
SPDX-License-Identifier: GPL-2.0-only
Name the union in i2c_hid_desc_override, to avoid unknown field error
--- drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c.bak 2024-02-15 13:27:20.177877726 +0100
+++ drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c 2024-02-15 15:11:15.787482938 +0100
@@ -18,7 +18,7 @@
union {
struct i2c_hid_desc *i2c_hid_desc;
uint8_t *i2c_hid_desc_buffer;
- };
+ } u;
uint8_t *hid_report_desc;
unsigned int hid_report_desc_size;
uint8_t *i2c_name;
@@ -36,6 +36,7 @@
*/
static const struct i2c_hid_desc_override sipodev_desc = {
+ .u = {
.i2c_hid_desc_buffer = (uint8_t [])
{0x1e, 0x00, /* Length of descriptor */
0x00, 0x01, /* Version of descriptor */
@@ -52,6 +53,7 @@
0x06, 0x00, /* Version ID */
0x00, 0x00, 0x00, 0x00 /* Reserved */
},
+ },
.hid_report_desc = (uint8_t [])
{0x05, 0x01, /* Usage Page (Desktop), */
@@ -422,7 +424,7 @@
if (strcmp(override->i2c_name, i2c_name))
return NULL;
- return override->i2c_hid_desc;
+ return override->u.i2c_hid_desc;
}
char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name,

View file

@ -0,0 +1,17 @@
SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
SPDX-License-Identifier: GPL-2.0-only
Neuter the __i915_sw_fence_call define, which our gcc can't understand
--- drivers/gpu/drm/i915/i915_sw_fence.h.bak 2024-02-15 12:21:07.758127759 +0100
+++ drivers/gpu/drm/i915/i915_sw_fence.h 2024-02-15 12:22:04.498124232 +0100
@@ -37,7 +37,7 @@
typedef int (*i915_sw_fence_notify_t)(struct i915_sw_fence *,
enum i915_sw_fence_notify state);
-#define __i915_sw_fence_call __aligned(4)
+#define __i915_sw_fence_call /* __aligned(4) */
void __i915_sw_fence_init(struct i915_sw_fence *fence,
i915_sw_fence_notify_t fn,

View file

@ -0,0 +1,17 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
Use gen_initramfs_list.sh from outside kernel source tree.
--- scripts/gen_initramfs_list.sh 2021-10-10 20:37:12.220231015 +1100
+++ scripts/gen_initramfs_list.sh 2021-10-10 20:37:22.694296140 +1100
@@ -310,7 +310,7 @@
fi
fi
cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)"
- usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile}
+ gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile}
else
cpio_tfile=${cpio_file}
fi

View file

@ -0,0 +1,17 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
This seemingly useless statement (redefined a couple of lines later) is
not liked by our version of binutils.
--- arch/x86/kernel/vmlinux.lds.S 2021-07-31 18:45:14.787124887 +1000
+++ arch/x86/kernel/vmlinux.lds.S 2021-07-31 18:43:16.234180449 +1000
@@ -170,7 +170,6 @@
. = __vvar_beginning_hack + PAGE_SIZE;
} :data
- . = ALIGN(__vvar_page + PAGE_SIZE, PAGE_SIZE);
/* Init code and data - will be freed after init */
. = ALIGN(PAGE_SIZE);

View file

@ -0,0 +1,18 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
We do not use the _shipped version of the keymap generated using loadkeys.
For some reason the makefile needs to be patched for this to work...
--- drivers/tty/vt/Makefile 2021-07-27 21:11:24.743104498 +1000
+++ drivers/tty/vt/Makefile 2021-07-27 21:11:34.261186200 +1000
@@ -22,7 +22,7 @@
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
-# GENERATE_KEYMAP := 1
+GENERATE_KEYMAP := 1
ifdef GENERATE_KEYMAP

View file

@ -0,0 +1,34 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
Our older version of binutils doesn't play very nicely with binutils for a
couple of edgecase macros. It seems that ALTERNATIVE is one of these. As we
know what your system will be (not Xen), we can manually evaluate and write
out the ALTERNATIVEs.
--- arch/x86/entry/entry_32.S 2021-07-31 11:40:07.458032771 +1000
+++ arch/x86/entry/entry_32.S 2021-07-31 11:40:42.835298841 +1000
@@ -412,9 +412,8 @@
movl %esp, %eax
call do_fast_syscall_32
- /* XEN PV guests always use IRET path */
- ALTERNATIVE "testl %eax, %eax; jz .Lsyscall_32_done", \
- "jmp .Lsyscall_32_done", X86_FEATURE_XENPV
+ testl %eax, %eax
+ jz .Lsyscall_32_done
/* Opportunistic SYSEXIT */
TRACE_IRQS_ON /* User mode traces as IRQs on. */
--- arch/x86/entry/vdso/vdso32/system_call.S 2021-07-31 11:41:40.379731622 +1000
+++ arch/x86/entry/vdso/vdso32/system_call.S 2021-07-31 11:43:40.294633506 +1000
@@ -55,8 +55,6 @@
/* If SYSENTER (Intel) or SYSCALL32 (AMD) is available, use it. */
ALTERNATIVE_2 "", SYSENTER_SEQUENCE, X86_FEATURE_SYSENTER32, \
SYSCALL_SEQUENCE, X86_FEATURE_SYSCALL32
-#else
- ALTERNATIVE "", SYSENTER_SEQUENCE, X86_FEATURE_SEP
#endif
/* Enter using int $0x80 */

View file

@ -0,0 +1,23 @@
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-2.0-only
kconfig uses gperf, which we don't have at this stage. We manually generate
everything (in the actual script) that is actually required within kconfig,
and forgo everything that is not really required for the build.
--- Makefile 2021-07-30 21:25:43.577592065 +1000
+++ Makefile 2021-07-30 21:26:40.349015612 +1000
@@ -547,10 +547,10 @@
export KBUILD_DEFCONFIG KBUILD_KCONFIG
config: scripts_basic outputmakefile FORCE
- $(Q)$(MAKE) $(build)=scripts/kconfig $@
+ $(Q)true
%config: scripts_basic outputmakefile FORCE
- $(Q)$(MAKE) $(build)=scripts/kconfig $@
+ true
else
# ===========================================================================

View file

@ -0,0 +1,17 @@
SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
SPDX-License-Identifier: GPL-2.0-only
Remove -Wno-array-bounds which gcc-4.0.4 doesn't recognize
--- drivers/net/ethernet/broadcom/Makefile.bak 2024-02-15 17:05:34.617050047 +0100
+++ drivers/net/ethernet/broadcom/Makefile 2024-02-15 17:06:06.097047984 +0100
@@ -16,8 +16,3 @@
obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o
obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o
obj-$(CONFIG_BNXT) += bnxt/
-
-# FIXME: temporarily silence -Warray-bounds on non W=1+ builds
-ifndef KBUILD_EXTRA_WARN
-CFLAGS_tg3.o += -Wno-array-bounds
-endif

View file

@ -0,0 +1 @@
https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.336.tar.xz 0820fdb7971c6974338081c11fbf2dc869870501e7bdcac4d0ed58ba1f57b61c