2023-12-21 16:24:33 +00:00
|
|
|
# SPDX-FileCopyrightText: 2023 Eduardo Sánchez Muñoz <eduardosm-dev@e64.io>
|
2024-01-24 03:35:55 +00:00
|
|
|
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
2023-12-21 16:24:33 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
# Delete sources of packages before linux kernel
|
|
|
|
|
|
|
|
get_source_filename() {
|
|
|
|
local url="${1}"
|
|
|
|
local fname="${3}"
|
|
|
|
# Default to basename of url if not given
|
|
|
|
echo "${fname:-$(basename "${url}")}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# List all packages from linux kernel onwards
|
|
|
|
# Ideally, we would use arrays here, but they are not supported by
|
|
|
|
# the bash version we have at this point.
|
|
|
|
pkgs="$(awk '/^build:/ { print $2 }' "${SRCDIR}/manifest" | awk '/^linux-[0-9]/,EOF { print $0 }')"
|
|
|
|
|
|
|
|
# Gather source names for all packages in pkgs, which we want to keep
|
|
|
|
keep_sources=""
|
|
|
|
for pkg in ${pkgs}; do
|
|
|
|
while read line; do
|
|
|
|
keep_sources="${keep_sources} $(get_source_filename ${line})"
|
|
|
|
done < "${SRCDIR}/${pkg}/sources"
|
|
|
|
done
|
|
|
|
|
|
|
|
for source in "${DISTFILES}/"*; do
|
|
|
|
source_name="$(basename "${source}")"
|
|
|
|
for keep_source in ${keep_sources}; do
|
|
|
|
if [ "${keep_source}" = "${source_name}" ]; then
|
|
|
|
# Countinue the outer loop to skip deletion
|
|
|
|
continue 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Delete this source
|
|
|
|
rm "${source}"
|
|
|
|
done
|
|
|
|
|
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
|
|
|
if [ -e "/external/repo-preseeded/linux-4.14.336_0.tar.bz2" ]; then
|
2024-01-24 03:35:55 +00:00
|
|
|
# This is done in src_extract out of necessity usually -- I can't think of a better solution :(
|
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
|
|
|
rm -f "${DISTFILES}/linux-4.14.336.tar.xz"
|
2024-01-24 03:35:55 +00:00
|
|
|
fi
|
|
|
|
|
2023-12-21 16:24:33 +00:00
|
|
|
unset get_source_filename
|
|
|
|
unset pkgs pkg line
|
|
|
|
unset keep_sources keep_source
|
|
|
|
unset source source_name
|