]> git.zerfleddert.de Git - m1-debian/blame - patch_kernel_config.pl
work on make patch kernel config work on config-6.0.0-5-arm64
[m1-debian] / patch_kernel_config.pl
CommitLineData
628b5aed
TG
1#!/usr/bin/perl
2
3use strict;
4use warnings FATAL => 'all';
5
a4466ace
TG
6my $inputfile = $ARGV[0];
7my $outputfile = $ARGV[1];
8
9my @lines = `cat $inputfile`;
628b5aed
TG
10chomp @lines;
11
12my %asahi_options = (
17c0aef4 13 'CONFIG_APPLE_ADMAC' => 'y',
628b5aed 14 'CONFIG_APPLE_AIC' => 'y',
17c0aef4 15 'CONFIG_APPLE_DART' => 'y',
628b5aed
TG
16 'CONFIG_APPLE_MAILBOX' => 'y',
17 'CONFIG_APPLE_PLATFORMS' => 'y',
18 'CONFIG_APPLE_PMGR_PWRSTATE' => 'y',
19 'CONFIG_APPLE_RTKIT' => 'y',
17c0aef4 20 'CONFIG_APPLE_SART' => 'y',
628b5aed
TG
21 'CONFIG_APPLE_SMC' => 'y',
22 'CONFIG_APPLE_SMC_RTKIT' => 'y',
23 'CONFIG_APPLE_WATCHDOG' => 'y',
24 'CONFIG_ARCH_APPLE' => 'y',
17c0aef4 25 'CONFIG_ARM_APPLE_SOC_CPUFREQ' => 'y',
628b5aed
TG
26 'CONFIG_BRCMFMAC' => 'm',
27 'CONFIG_BRCMFMAC_PCIE' => 'y',
28 'CONFIG_CFG80211_WEXT' => 'y',
17c0aef4
TG
29 'CONFIG_CHARGER_MACSMC' => 'y',
30 'CONFIG_COMMON_CLK_APPLE_NCO' => 'y',
628b5aed 31 'CONFIG_DRM' => 'y',
4abf6f9d 32 'CONFIG_DRM_SIMPLEDRM' => 'y',
628b5aed
TG
33 'CONFIG_FW_LOADER_USER_HELPER' => 'n',
34 'CONFIG_FW_LOADER_USER_HELPER_FALLBACK' => 'n',
35 'CONFIG_GPIO_MACSMC' => 'y',
17c0aef4
TG
36 'CONFIG_HID_APPLE' => 'y',
37 'CONFIG_HID_MAGICMOUSE' => 'y',
38 'CONFIG_I2C_APPLE' => 'y',
39 'CONFIG_MFD_APPLE_SPMI_PMU' => 'y',
a4466ace 40 'CONFIG_MMC_SDHCI_PCI' => 'm',
628b5aed 41 'CONFIG_NLMON' => 'm',
17c0aef4
TG
42 'CONFIG_NVMEM_SPMI_MFD' => 'y',
43 'CONFIG_NVME_APPLE' => 'y',
44 'CONFIG_PCIE_APPLE' => 'y',
45 'CONFIG_PINCTRL_APPLE_GPIO' => 'y',
46 'CONFIG_POWER_RESET_MACSMC' => 'y',
47 'CONFIG_RTC_DRV_MACSMC' => 'y',
a4466ace
TG
48 'CONFIG_SND_SIMPLE_CARD' => 'm',
49 'CONFIG_SND_SOC_APPLE_MCA' => 'm',
50 'CONFIG_SND_SOC_CS42L42' => 'm',
628b5aed 51 'CONFIG_SND_SOC_TAS2770' => 'm',
17c0aef4
TG
52 'CONFIG_SPI_APPLE' => 'y',
53 'CONFIG_SPI_HID_APPLE_CORE' => 'y',
54 'CONFIG_SPI_HID_APPLE_OF' => 'y',
55 'CONFIG_SPMI_APPLE' => 'y',
a4466ace
TG
56 'CONFIG_USB_DWC3' => 'm',
57 'CONFIG_USB_DWC3_PCI' => 'm',
17c0aef4 58 'CONFIG_FB_EFI' => 'y',
fdbce99a 59 'CONFIG_BACKLIGHT_CLASS_DEVICE' => 'y',
17c0aef4 60 'CONFIG_BACKLIGHT_GPIO' => 'm',
a4466ace 61 'CONFIG_TYPEC_TPS6598X' => 'm',
9d961f8a 62 'CONFIG_BT_HCIBCM4377' => 'm',
b1bdeb59
TG
63 'CONFIG_HID_DOCKCHANNEL' => 'm',
64 'CONFIG_APPLE_DOCKCHANNEL' => 'm',
97b242e0
TG
65 'CONFIG_SND_SOC_CS42L84' => 'm',
66 'CONFIG_SND_SOC_TAS2780' => 'm',
67 'CONFIG_USB_XHCI_PCI_ASMEDIA' => 'y',
81286cfe 68 'CONFIG_APPLE_M1_CPU_PMU' => 'y',
b3d590e6 69 'CONFIG_SND_SOC_CS42L83' => 'm',
8e451651 70 'CONFIG_DRM_APPLE' => 'y',
78f4110c 71 'CONFIG_DRM_ASAHI' => 'y',
84ff87cc
TG
72 'CONFIG_GENERIC_PHY' => 'y',
73 'CONFIG_PHY_APPLE_ATC' => 'm',
74 'CONFIG_CONSTRUCTORS' => 'y',
75 'CONFIG_RUST' => 'y',
76 'CONFIG_PWM_APPLE' => 'm',
a4466ace
TG
77 'CONFIG_DRM_SIMPLEDRM_BACKLIGHT' => 'n',
78 'CONFIG_ARM64_4K_PAGES' => 'n',
79 'CONFIG_ARM64_16K_PAGES' => 'y',
80 'CONFIG_ANDROID_BINDER_IPC' => 'y',
81 'CONFIG_MODVERSIONS' => 'n',
82 'CONFIG_DEBUG_INFO_BTF' => 'n',
628b5aed
TG
83);
84
85my %debian_options;
86
87for (@lines) {
88 if (/(^CONFIG_[^=]+)=(.*)/) {
89 $debian_options{$1} = $2;
90 }
91}
92
93for my $o (keys %asahi_options) {
03e35824 94 if ((not exists $debian_options{$o}) && $asahi_options{$o} ne 'n') {
628b5aed
TG
95 print "$o missing, adding\n";
96 $debian_options{$o} = $asahi_options{$o};
03e35824
TG
97 } elsif ((exists $debian_options{$o}) && ($asahi_options{$o} eq 'n')) {
98 print "$o present, removing\n";
99 delete $debian_options{$o};
100 } elsif ((exists $asahi_options{$o} && exists $debian_options{$o}) && ($debian_options{$o} ne $asahi_options{$o})) {
a4466ace
TG
101 print "$o different, changing\n";
102 $debian_options{$o} = $asahi_options{$o};
628b5aed
TG
103 }
104}
105
a4466ace 106open(CONFIG, '>', $outputfile) || die;
628b5aed
TG
107for (keys %debian_options) {
108 print CONFIG $_ . '=' . $debian_options{$_} . "\n";
109}
110close CONFIG;
Impressum, Datenschutz