Files

66 lines
1.9 KiB
Bash
Raw Permalink Normal View History

2023-06-20 10:56:40 +05:30
#!/usr/bin/bash
2025-03-18 18:31:56 -07:00
set -e
2026-04-13 16:03:55 -07:00
KERNEL_VERSION=6.19.12-200.fc43
2024-04-06 20:45:11 -07:00
cd "$sourcedir"
koji download-build --quiet --arch=src "kernel-$KERNEL_VERSION"
2023-11-21 14:02:11 -08:00
rpmdev-extract -q "kernel-$KERNEL_VERSION.src.rpm"
mv -n "kernel-$KERNEL_VERSION.src"/* .
rm -r "kernel-$KERNEL_VERSION.src.rpm" "kernel-$KERNEL_VERSION.src"
2023-06-22 15:27:40 +05:30
# Set buildid to .t2
2023-11-21 14:02:11 -08:00
sed -i 's/# define buildid .local/%define buildid .t2/g' "kernel.spec"
2023-06-22 15:27:40 +05:30
# Bump release
2025-03-20 20:34:17 -07:00
sed -i 's/%define specrelease 200/%define specrelease 210/g' "kernel.spec"
2024-06-17 21:41:11 -07:00
# Disable debug kernels
sed -i "/%define with_debug /c %define with_debug 0" "kernel.spec"
2023-06-22 15:27:40 +05:30
2023-11-21 14:02:11 -08:00
# Add our patches
sed -i "/Patch1:/a Patch2: t2linux-combined.patch" "kernel.spec"
2023-12-01 23:53:58 -08:00
sed -i "/ApplyOptionalPatch patch-%{patchversion}-redhat.patch/a ApplyOptionalPatch t2linux-combined.patch" "kernel.spec"
2023-06-22 15:27:40 +05:30
2023-11-21 14:02:11 -08:00
cat "linux-t2-patches/extra_config" > "kernel-local"
2025-03-18 18:31:56 -07:00
cat << 'EOF' > "kernel-local"
CONFIG_SPI_HID_APPLE_OF=y
CONFIG_HID_DOCKCHANNEL=y
CONFIG_APPLE_DOCKCHANNEL=y
CONFIG_APPLE_RTKIT_HELPER=m
2025-03-20 20:34:17 -07:00
CONFIG_DRM_APPLETBDRM=m
CONFIG_HID_APPLETB_BL=m
CONFIG_HID_APPLETB_KBD=m
2025-03-18 18:31:56 -07:00
CONFIG_APFS_FS=y
CONFIG_INPUT_SPARSEKMAP=y
EOF
2024-10-20 15:53:52 -07:00
2025-03-18 18:31:56 -07:00
function write_kconfig_to_file {
2024-10-20 15:53:52 -07:00
config_opt=$(echo "$1" | cut -d'=' -f1)
2025-03-18 18:31:56 -07:00
if [[ "$config_opt" =~ '# '(.+)' is not set' ]]; then
config_opt="${BASH_REMATCH[1]}"
fi
sed -i "/# $config_opt is not set/d" "$2"
sed -i "/$config_opt=/d" "$2"
echo "$1" >> "$2"
2024-10-20 15:53:52 -07:00
}
2025-03-18 18:31:56 -07:00
function set_kconfig_x86_64 {
for file in \
"kernel-x86_64-fedora.config" \
"kernel-x86_64-rt-debug-fedora.config" \
"kernel-x86_64-rt-fedora.config" \
"kernel-x86_64-debug-fedora.config"
do
write_kconfig_to_file "$1" "$file"
done
}
set_kconfig_x86_64 'CONFIG_APPLE_BCE=m'
set_kconfig_x86_64 'CONFIG_MODULE_FORCE_UNLOAD=y'
2026-04-13 16:04:59 -07:00
set_kconfig_x86_64 'CONFIG_CMDLINE="intel_iommu=on iommu=pt pm_async=off"'
2025-03-18 18:31:56 -07:00
set_kconfig_x86_64 'CONFIG_CMDLINE_BOOL=y'
set_kconfig_x86_64 '# CONFIG_CMDLINE_OVERRIDE is not set'
2024-10-20 15:53:52 -07:00
2023-11-21 14:02:11 -08:00
cat "linux-t2-patches"/*.patch > "t2linux-combined.patch"