2023-02-06 05:56:31 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
|
2022-04-13 00:08:29 +01:00
|
|
|
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
|
2021-06-10 11:26:46 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
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.
2024-02-16 11:58:27 +00:00
|
|
|
extract="linux-4.14.336/scripts linux-4.14.336/include linux-4.14.336/arch/x86/include linux-4.14.336/arch/x86/entry"
|
2022-10-10 12:22:31 +01:00
|
|
|
|
2021-06-10 11:26:46 +01:00
|
|
|
src_prepare() {
|
|
|
|
default
|
|
|
|
|
|
|
|
# Buggy headers/don't know how to account for
|
|
|
|
rm include/uapi/linux/pktcdvd.h \
|
|
|
|
include/uapi/linux/hw_breakpoint.h \
|
|
|
|
include/uapi/linux/eventpoll.h \
|
|
|
|
include/uapi/linux/atmdev.h \
|
|
|
|
include/uapi/asm-generic/fcntl.h \
|
|
|
|
arch/x86/include/uapi/asm/mman.h \
|
|
|
|
arch/x86/include/uapi/asm/auxvec.h
|
|
|
|
}
|
|
|
|
|
|
|
|
src_compile() {
|
|
|
|
gcc -o scripts/unifdef scripts/unifdef.c
|
|
|
|
}
|
|
|
|
|
|
|
|
src_install() {
|
2023-07-13 16:53:05 +01:00
|
|
|
base_dir="${PWD}"
|
2021-06-10 11:26:46 +01:00
|
|
|
# We "compile" the headers here because it is easier
|
|
|
|
for d in include/uapi arch/x86/include/uapi; do
|
|
|
|
cd "${d}"
|
2022-01-14 10:53:30 +00:00
|
|
|
find . -type d -exec mkdir "${DESTDIR}${PREFIX}/include/{}" -p \;
|
2021-06-10 11:26:46 +01:00
|
|
|
headers="$(find . -type f -name "*.h")"
|
|
|
|
cd "${base_dir}"
|
|
|
|
for h in ${headers}; do
|
2023-11-28 00:48:44 +00:00
|
|
|
path="$(dirname "${h}")"
|
|
|
|
scripts/headers_install.sh "${DESTDIR}${PREFIX}/include/${path}" "${d}/${path}" "$(basename "${h}")"
|
2021-06-10 11:26:46 +01:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
# Pick-and-choose asm-generic headers
|
2023-02-06 05:56:31 +00:00
|
|
|
for i in types ioctl termios termbits ioctls sockios socket param; do
|
2022-01-14 10:53:30 +00:00
|
|
|
cp "${DESTDIR}${PREFIX}/include/asm-generic/${i}.h" "${DESTDIR}${PREFIX}/include/asm/${i}.h"
|
2021-07-26 06:19:07 +01:00
|
|
|
done
|
2021-06-10 11:26:46 +01:00
|
|
|
|
|
|
|
# Generate asm/unistd_32.h
|
|
|
|
bash arch/x86/entry/syscalls/syscallhdr.sh \
|
|
|
|
arch/x86/entry/syscalls/syscall_32.tbl \
|
2022-01-14 10:53:30 +00:00
|
|
|
"${DESTDIR}${PREFIX}/include/asm/unistd_32.h" i386
|
2021-06-10 11:26:46 +01:00
|
|
|
|
|
|
|
# Generate linux/version.h
|
|
|
|
# Rules are from makefile
|
2023-11-28 00:48:44 +00:00
|
|
|
VERSION=4
|
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.
2024-02-16 11:58:27 +00:00
|
|
|
PATCHLEVEL=14
|
|
|
|
SUBLEVEL=336
|
2022-05-09 19:55:26 +01:00
|
|
|
VERSION_CODE="$((VERSION * 65536 + PATCHLEVEL * 256 + SUBLEVEL))"
|
2021-06-10 11:26:46 +01:00
|
|
|
echo '#define LINUX_VERSION_CODE '"${VERSION_CODE}" \
|
2022-01-14 10:53:30 +00:00
|
|
|
> "${DESTDIR}${PREFIX}/include/linux/version.h"
|
2021-06-10 11:26:46 +01:00
|
|
|
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))' \
|
2022-01-14 10:53:30 +00:00
|
|
|
>> "${DESTDIR}${PREFIX}/include/linux/version.h"
|
2021-08-04 03:46:00 +01:00
|
|
|
|
|
|
|
# Clear up storage space
|
|
|
|
cd ../..
|
|
|
|
rm -rf build src
|
2021-06-10 11:26:46 +01:00
|
|
|
}
|