From 628b5aed9bfaa2b67fdcb78c041c36dd58e06074 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Wed, 9 Mar 2022 14:50:34 +0000 Subject: [PATCH] add first version of config generator --- m1-config-options | 34 ------------------ patch_kernel_config.pl | 80 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 34 deletions(-) delete mode 100644 m1-config-options create mode 100644 patch_kernel_config.pl diff --git a/m1-config-options b/m1-config-options deleted file mode 100644 index 12fd991..0000000 --- a/m1-config-options +++ /dev/null @@ -1,34 +0,0 @@ -CONFIG_APPLE_ADMAC=y -CONFIG_APPLE_AIC=y -CONFIG_APPLE_DART=y -CONFIG_APPLE_MAILBOX=y -CONFIG_APPLE_PMGR_PWRSTATE=y -CONFIG_APPLE_RTKIT=y -CONFIG_APPLE_SART=y -CONFIG_APPLE_WATCHDOG=y -CONFIG_ARCH_APPLE=y -CONFIG_BRCMFMAC=m -CONFIG_BRCMFMAC_PCIE=y -CONFIG_CFG80211_WEXT=y -CONFIG_COMMON_CLK_APPLE_NCO=y -CONFIG_DRM_SIMPLEDRM=y -CONFIG_FW_LOADER_USER_HELPER=n -CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n -CONFIG_HID_APPLE=y -CONFIG_HID_MAGICMOUSE=y -CONFIG_I2C_APPLE=y -CONFIG_MMC_SDHCI_PCI=y -CONFIG_NLMON=m -CONFIG_NVME_APPLE=y -CONFIG_PCIE_APPLE=y -CONFIG_PCIE_APPLE_MSI_DOORBELL_ADDR=0xfffff000 -CONFIG_PINCTRL_APPLE_GPIO=y -CONFIG_SND_SIMPLE_CARD=y -CONFIG_SND_SOC_APPLE_MCA=y -CONFIG_SND_SOC_CS42L42=y -CONFIG_SND_SOC_TAS2770=m -CONFIG_SPI_APPLE=y -CONFIG_SPI_HID_APPLE_CORE=y -CONFIG_SPI_HID_APPLE_OF=y -CONFIG_USB_DWC3=y -CONFIG_USB_DWC3_PCI=y diff --git a/patch_kernel_config.pl b/patch_kernel_config.pl new file mode 100644 index 0000000..2238073 --- /dev/null +++ b/patch_kernel_config.pl @@ -0,0 +1,80 @@ +#!/usr/bin/perl + +use strict; +use warnings FATAL => 'all'; + +# This was taken from the linux-image-5.16.0-3-arm64-unsigned +# Than it was copied as .config in the asahi tree +# Than make olddefconfig was executed twice +my @lines = `cat config-round2`; +chomp @lines; + +my %asahi_options = ( + 'CONFIG_APPLE_ADMAC' => 'y', + 'CONFIG_APPLE_AIC' => 'y', + 'CONFIG_APPLE_DART' => 'y', + 'CONFIG_APPLE_MAILBOX' => 'y', + 'CONFIG_APPLE_PLATFORMS' => 'y', + 'CONFIG_APPLE_PMGR_PWRSTATE' => 'y', + 'CONFIG_APPLE_RTKIT' => 'y', + 'CONFIG_APPLE_SART' => 'y', + 'CONFIG_APPLE_SMC' => 'y', + 'CONFIG_APPLE_SMC_RTKIT' => 'y', + 'CONFIG_APPLE_WATCHDOG' => 'y', + 'CONFIG_ARCH_APPLE' => 'y', + 'CONFIG_ARM_APPLE_SOC_CPUFREQ' => 'y', + 'CONFIG_BRCMFMAC' => 'm', + 'CONFIG_BRCMFMAC_PCIE' => 'y', + 'CONFIG_CFG80211_WEXT' => 'y', + 'CONFIG_CHARGER_MACSMC' => 'y', + 'CONFIG_COMMON_CLK_APPLE_NCO' => 'y', + 'CONFIG_DRM' => 'y', + 'CONFIG_DRM_SIMPLEDRM' => 'm', + 'CONFIG_FW_LOADER_USER_HELPER' => 'n', + 'CONFIG_FW_LOADER_USER_HELPER_FALLBACK' => 'n', + 'CONFIG_GPIO_MACSMC' => 'y', + 'CONFIG_HID_APPLE' => 'y', + 'CONFIG_HID_MAGICMOUSE' => 'y', + 'CONFIG_I2C_APPLE' => 'y', + 'CONFIG_MFD_APPLE_SPMI_PMU' => 'y', + 'CONFIG_MMC_SDHCI_PCI' => 'y', + 'CONFIG_NLMON' => 'm', + 'CONFIG_NVMEM_SPMI_MFD' => 'y', + 'CONFIG_NVME_APPLE' => 'y', + 'CONFIG_PCIE_APPLE' => 'y', + 'CONFIG_PINCTRL_APPLE_GPIO' => 'y', + 'CONFIG_POWER_RESET_MACSMC' => 'y', + 'CONFIG_RTC_DRV_MACSMC' => 'y', + 'CONFIG_SND_SIMPLE_CARD' => 'y', + 'CONFIG_SND_SOC_APPLE_MCA' => 'y', + 'CONFIG_SND_SOC_APPLE_SILICON' => 'y', + 'CONFIG_SND_SOC_CS42L42' => 'y', + 'CONFIG_SND_SOC_TAS2770' => 'm', + 'CONFIG_SPI_APPLE' => 'y', + 'CONFIG_SPI_HID_APPLE_CORE' => 'y', + 'CONFIG_SPI_HID_APPLE_OF' => 'y', + 'CONFIG_SPMI_APPLE' => 'y', + 'CONFIG_USB_DWC3' => 'y', + 'CONFIG_USB_DWC3_PCI' => 'y', +); + +my %debian_options; + +for (@lines) { + if (/(^CONFIG_[^=]+)=(.*)/) { + $debian_options{$1} = $2; + } +} + +for my $o (keys %asahi_options) { + if (not exists $debian_options{$o}) { + print "$o missing, adding\n"; + $debian_options{$o} = $asahi_options{$o}; + } +} + +open(CONFIG, '>', 'config') || die; +for (keys %debian_options) { + print CONFIG $_ . '=' . $debian_options{$_} . "\n"; +} +close CONFIG; -- 2.39.5