Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions config/sources/families/uefi-x86.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,58 @@ declare -g LINUXFAMILY="x86"
declare -g ARCH="amd64"
# shellcheck source=config/sources/families/include/uefi_common.inc
source "${BASH_SOURCE%/*}/include/uefi_common.inc"

case "${BRANCH}" in

current | edge)
display_alert "extra .config for Apple T2-based x86 machines" "x86: BRANCH=${BRANCH}" "info"

# Extra .config stuff for the Applet T2 stuff in this kernel
function custom_kernel_config__applet2() {
# From https://github.com/t2linux/linux-t2-patches/blob/6.18/extra_config ignore DRM_KUNIT_TEST
opts_y+=(
BT_HCIUART_BCM
STAGING
)
opts_m+=(
APPLE_BCE
APPLE_GMUX
BRCMFMAC
BT_BCM
BT_HCIBCM4377
BT_HCIUART
HID_APPLETB_BL
HID_APPLETB_KBD
HID_APPLE
HID_MAGICMOUSE
DRM_APPLETBDRM
HID_SENSOR_ALS
SENSORS_APPLESMC
SND_PCM
APFS_FS
)
}

# Auto-grab patches from t2linux github if not already present
if [[ ! -d "${SRC}/patch/kernel/${KERNELPATCHDIR}" ]]; then
# Grab from github .tar.gz and extract there; patches are in the root of the archive
GH_URL="https://github.com/t2linux/linux-t2-patches/archive/refs/heads/${KERNEL_MAJOR_MINOR}.tar.gz"
display_alert "Fetching Apple T2 patches from" "GH_URL=${GH_URL}" "info"
mkdir -pv "${SRC}/patch/kernel/${KERNELPATCHDIR}"
curl -L "${GH_URL}" | tar -xz --strip-components=1 -C "${SRC}/patch/kernel/${KERNELPATCHDIR}"
tree "${SRC}/patch/kernel/${KERNELPATCHDIR}"
# remove any non-patch files and directories
# remove .github and .gitignore
rm -rf "${SRC}/patch/kernel/${KERNELPATCHDIR}/.github" "${SRC}/patch/kernel/${KERNELPATCHDIR}/.gitignore"
find "${SRC}/patch/kernel/${KERNELPATCHDIR}" -type f ! -name "*.patch" -delete
display_alert "Apple T2 patches downloaded to" "DIR=${SRC}/patch/kernel/${KERNELPATCHDIR}; go run rewrite-kernel-patches" "info"
exit 0
else
Comment on lines +47 to +61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Remove the unconditional exit 0.

This file is sourced during the build; hitting exit 0 aborts the whole build process the first time the patch directory is missing, so no images ever get produced. Please drop the exit (or turn it into logic that returns to the caller without killing the build) so the workflow can continue after fetching the patches.

Apply this diff:

-			display_alert "Apple T2 patches downloaded to" "DIR=${SRC}/patch/kernel/${KERNELPATCHDIR}; go run rewrite-kernel-patches" "info"
-			exit 0
+			display_alert "Apple T2 patches downloaded to" "DIR=${SRC}/patch/kernel/${KERNELPATCHDIR}; go run rewrite-kernel-patches" "info"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Auto-grab patches from t2linux github if not already present
if [[ ! -d "${SRC}/patch/kernel/${KERNELPATCHDIR}" ]]; then
# Grab from github .tar.gz and extract there; patches are in the root of the archive
GH_URL="https://github.com/t2linux/linux-t2-patches/archive/refs/heads/${KERNEL_MAJOR_MINOR}.tar.gz"
display_alert "Fetching Apple T2 patches from" "GH_URL=${GH_URL}" "info"
mkdir -pv "${SRC}/patch/kernel/${KERNELPATCHDIR}"
curl -L "${GH_URL}" | tar -xz --strip-components=1 -C "${SRC}/patch/kernel/${KERNELPATCHDIR}"
tree "${SRC}/patch/kernel/${KERNELPATCHDIR}"
# remove any non-patch files and directories
# remove .github and .gitignore
rm -rf "${SRC}/patch/kernel/${KERNELPATCHDIR}/.github" "${SRC}/patch/kernel/${KERNELPATCHDIR}/.gitignore"
find "${SRC}/patch/kernel/${KERNELPATCHDIR}" -type f ! -name "*.patch" -delete
display_alert "Apple T2 patches downloaded to" "DIR=${SRC}/patch/kernel/${KERNELPATCHDIR}; go run rewrite-kernel-patches" "info"
exit 0
else
# Auto-grab patches from t2linux github if not already present
if [[ ! -d "${SRC}/patch/kernel/${KERNELPATCHDIR}" ]]; then
# Grab from github .tar.gz and extract there; patches are in the root of the archive
GH_URL="https://github.com/t2linux/linux-t2-patches/archive/refs/heads/${KERNEL_MAJOR_MINOR}.tar.gz"
display_alert "Fetching Apple T2 patches from" "GH_URL=${GH_URL}" "info"
mkdir -pv "${SRC}/patch/kernel/${KERNELPATCHDIR}"
curl -L "${GH_URL}" | tar -xz --strip-components=1 -C "${SRC}/patch/kernel/${KERNELPATCHDIR}"
tree "${SRC}/patch/kernel/${KERNELPATCHDIR}"
# remove any non-patch files and directories
# remove .github and .gitignore
rm -rf "${SRC}/patch/kernel/${KERNELPATCHDIR}/.github" "${SRC}/patch/kernel/${KERNELPATCHDIR}/.gitignore"
find "${SRC}/patch/kernel/${KERNELPATCHDIR}" -type f ! -name "*.patch" -delete
display_alert "Apple T2 patches downloaded to" "DIR=${SRC}/patch/kernel/${KERNELPATCHDIR}; go run rewrite-kernel-patches" "info"
else
🤖 Prompt for AI Agents
In config/sources/families/uefi-x86.conf around lines 47 to 61, the
unconditional "exit 0" after downloading patches aborts the entire build when
this file is sourced; remove that unconditional exit and instead return to the
caller so the build can continue. Replace "exit 0" with "return 0" (or remove it
entirely) and if this file may be executed directly add a safe guard like "if [[
"${BASH_SOURCE[0]}" != "${0}" ]]; then return 0; else exit 0; fi" so sourcing
returns without killing the process while direct execution still exits.

display_alert "Apple T2 patches already present in" "DIR=${SRC}/patch/kernel/${KERNELPATCHDIR}" "info"
fi

;;

esac

enable_extension "grub"
Loading