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