]> cvs.zerfleddert.de Git - m1-debian/blame - patch_kernel_config.pl
get rid of debug_info kernel package; fix clang detection for amd64
[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 = (
6f3d83e0 13 'CONFIG_ANDROID_BINDER_IPC' => 'y',
17c0aef4 14 'CONFIG_APPLE_ADMAC' => 'y',
628b5aed 15 'CONFIG_APPLE_AIC' => 'y',
17c0aef4 16 'CONFIG_APPLE_DART' => 'y',
6f3d83e0
TG
17 'CONFIG_APPLE_DOCKCHANNEL' => 'm',
18 'CONFIG_APPLE_M1_CPU_PMU' => 'y',
628b5aed
TG
19 'CONFIG_APPLE_MAILBOX' => 'y',
20 'CONFIG_APPLE_PLATFORMS' => 'y',
21 'CONFIG_APPLE_PMGR_PWRSTATE' => 'y',
22 'CONFIG_APPLE_RTKIT' => 'y',
17c0aef4 23 'CONFIG_APPLE_SART' => 'y',
628b5aed
TG
24 'CONFIG_APPLE_SMC' => 'y',
25 'CONFIG_APPLE_SMC_RTKIT' => 'y',
26 'CONFIG_APPLE_WATCHDOG' => 'y',
27 'CONFIG_ARCH_APPLE' => 'y',
6f3d83e0
TG
28 'CONFIG_ARM64_16K_PAGES' => 'y',
29 'CONFIG_ARM64_4K_PAGES' => 'n',
17c0aef4 30 'CONFIG_ARM_APPLE_SOC_CPUFREQ' => 'y',
6f3d83e0
TG
31 'CONFIG_BACKLIGHT_CLASS_DEVICE' => 'y',
32 'CONFIG_BACKLIGHT_GPIO' => 'm',
628b5aed
TG
33 'CONFIG_BRCMFMAC' => 'm',
34 'CONFIG_BRCMFMAC_PCIE' => 'y',
6f3d83e0 35 'CONFIG_BT_HCIBCM4377' => 'm',
628b5aed 36 'CONFIG_CFG80211_WEXT' => 'y',
17c0aef4
TG
37 'CONFIG_CHARGER_MACSMC' => 'y',
38 'CONFIG_COMMON_CLK_APPLE_NCO' => 'y',
6f3d83e0 39 'CONFIG_CONSTRUCTORS' => 'y',
edb13c7c 40 'CONFIG_DEBUG_INFO' => 'n',
6f3d83e0 41 'CONFIG_DEBUG_INFO_BTF' => 'n',
e7515ac0 42 'CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT' => 'n',
628b5aed 43 'CONFIG_DRM' => 'y',
6f3d83e0
TG
44 'CONFIG_DRM_APPLE' => 'y',
45 'CONFIG_DRM_ASAHI' => 'y',
4abf6f9d 46 'CONFIG_DRM_SIMPLEDRM' => 'y',
6f3d83e0
TG
47 'CONFIG_DRM_SIMPLEDRM_BACKLIGHT' => 'n',
48 'CONFIG_FB_EFI' => 'y',
628b5aed
TG
49 'CONFIG_FW_LOADER_USER_HELPER' => 'n',
50 'CONFIG_FW_LOADER_USER_HELPER_FALLBACK' => 'n',
6f3d83e0 51 'CONFIG_GENERIC_PHY' => 'y',
628b5aed 52 'CONFIG_GPIO_MACSMC' => 'y',
17c0aef4 53 'CONFIG_HID_APPLE' => 'y',
6f3d83e0 54 'CONFIG_HID_DOCKCHANNEL' => 'm',
17c0aef4
TG
55 'CONFIG_HID_MAGICMOUSE' => 'y',
56 'CONFIG_I2C_APPLE' => 'y',
57 'CONFIG_MFD_APPLE_SPMI_PMU' => 'y',
a4466ace 58 'CONFIG_MMC_SDHCI_PCI' => 'm',
6f3d83e0 59 'CONFIG_MODVERSIONS' => 'n',
628b5aed 60 'CONFIG_NLMON' => 'm',
17c0aef4
TG
61 'CONFIG_NVMEM_SPMI_MFD' => 'y',
62 'CONFIG_NVME_APPLE' => 'y',
6f3d83e0
TG
63 'CONFIG_OF_DYNAMIC' => 'y',
64 'CONFIG_OF_OVERLAY' => 'y',
17c0aef4 65 'CONFIG_PCIE_APPLE' => 'y',
6f3d83e0 66 'CONFIG_PHY_APPLE_ATC' => 'm',
17c0aef4
TG
67 'CONFIG_PINCTRL_APPLE_GPIO' => 'y',
68 'CONFIG_POWER_RESET_MACSMC' => 'y',
6f3d83e0 69 'CONFIG_PWM_APPLE' => 'm',
17c0aef4 70 'CONFIG_RTC_DRV_MACSMC' => 'y',
6f3d83e0 71 'CONFIG_RUST' => 'y',
a4466ace
TG
72 'CONFIG_SND_SIMPLE_CARD' => 'm',
73 'CONFIG_SND_SOC_APPLE_MCA' => 'm',
74 'CONFIG_SND_SOC_CS42L42' => 'm',
6f3d83e0
TG
75 'CONFIG_SND_SOC_CS42L83' => 'm',
76 'CONFIG_SND_SOC_CS42L84' => 'm',
628b5aed 77 'CONFIG_SND_SOC_TAS2770' => 'm',
6f3d83e0 78 'CONFIG_SND_SOC_TAS2780' => 'm',
17c0aef4
TG
79 'CONFIG_SPI_APPLE' => 'y',
80 'CONFIG_SPI_HID_APPLE_CORE' => 'y',
81 'CONFIG_SPI_HID_APPLE_OF' => 'y',
82 'CONFIG_SPMI_APPLE' => 'y',
6f3d83e0 83 'CONFIG_TYPEC_TPS6598X' => 'm',
a4466ace
TG
84 'CONFIG_USB_DWC3' => 'm',
85 'CONFIG_USB_DWC3_PCI' => 'm',
97b242e0 86 'CONFIG_USB_XHCI_PCI_ASMEDIA' => 'y',
628b5aed
TG
87);
88
89my %debian_options;
90
91for (@lines) {
92 if (/(^CONFIG_[^=]+)=(.*)/) {
93 $debian_options{$1} = $2;
94 }
95}
96
97for my $o (keys %asahi_options) {
03e35824 98 if ((not exists $debian_options{$o}) && $asahi_options{$o} ne 'n') {
628b5aed
TG
99 print "$o missing, adding\n";
100 $debian_options{$o} = $asahi_options{$o};
03e35824
TG
101 } elsif ((exists $debian_options{$o}) && ($asahi_options{$o} eq 'n')) {
102 print "$o present, removing\n";
103 delete $debian_options{$o};
104 } elsif ((exists $asahi_options{$o} && exists $debian_options{$o}) && ($debian_options{$o} ne $asahi_options{$o})) {
a4466ace
TG
105 print "$o different, changing\n";
106 $debian_options{$o} = $asahi_options{$o};
628b5aed
TG
107 }
108}
109
a4466ace 110open(CONFIG, '>', $outputfile) || die;
6f3d83e0 111for (sort keys %debian_options) {
628b5aed
TG
112 print CONFIG $_ . '=' . $debian_options{$_} . "\n";
113}
114close CONFIG;
Impressum, Datenschutz