# # SPDX-License-Identifier: GPL-2.0 # # Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com # # This file is a part of the Armbian Build Framework # https://github.com/armbian/build/ # # Important: LINUXFAMILY and ARCH are defined _before_ including the common family include declare -g UEFI_GRUB_TERMINAL="${UEFI_GRUB_TERMINAL:-gfxterm}" 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 display_alert "Apple T2 patches already present in" "DIR=${SRC}/patch/kernel/${KERNELPATCHDIR}" "info" fi ;; esac enable_extension "grub"