-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
114 lines (89 loc) · 3.32 KB
/
Makefile
File metadata and controls
114 lines (89 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
VERSION=5.1.5
PREFIX=linux
POSTFIX=mba
UNAME=$(VERSION)-$(POSTFIX)+
KERNEL=$(PREFIX)-$(UNAME)
MODULE=/lib/modules/$(UNAME)
BCE_SOURCES=https://github.com/MCMrARM/mbp2018-bridge-drv
BCE_VERSION=master
SPI_SOURCES=https://github.com/roadrunner2/macbook12-spi-driver
SPI_VERSION=mbp15
default: build
clean:
rm -rf linux-module*
clean-all:
rm -rf linux-*
$(KERNEL):
@echo "-- Fetching Linux Kernel $(KERNEL)"
git clone --depth=1 -b v$(VERSION) git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux $(KERNEL)
(cd $(KERNEL); git checkout -b $(VERSION))
cp setup-linux-mba.config $(KERNEL)/.config
config: $(KERNEL)
(cd $(KERNEL); make menuconfig)
patch:
@echo "-- Patching Linux Kernel $(KERNEL)"
(cd $(KERNEL); git checkout -- drivers/*.c drivers/*.h)
(cd $(KERNEL); git apply ../patch-linux-nvme.diff)
(cd $(KERNEL); git apply ../patch-linux-bcm5974.diff)
(cd $(KERNEL); git apply ../patch-linux-hid.diff)
(cd $(KERNEL); git apply ../patch-linux-brcmfmac.diff)
linux-module-bce:
@echo "-- Fetching BCE Module"
git clone $(BCE_SOURCES) $@
(cd $@; git checkout $(BCE_VERSION))
linux-module-spi:
@echo "-- Fetching SPI Module"
git clone $(SPI_SOURCES) $@
(cd $@; git checkout $(SPI_VERSION))
build: $(KERNEL) patch linux-module-bce linux-module-spi
@echo "-- Compiling Linux Kernel"
(cd $(KERNEL); make)
build-module-bce: linux-module-bce
@echo "-- Compiling BCE Module"
make -C $(PWD)/$(KERNEL) M=$(PWD)/$^ modules
build-module-spi: linux-module-spi
@echo "-- Compiling SPI Module"
make -C $(PWD)/$(KERNEL) M=$(PWD)/$^ modules
install: install-kernel install-modules install-systemd
install-kernel: /boot/$(PREFIX)-$(POSTFIX) /etc/mkinitcpio.d/linux-mba.preset
@echo "-- Installing Linux kernel modules"
(cd $(KERNEL); make modules_install)
@echo "-- Installing Linux kernel image"
cp -f $(KERNEL)/arch/x86/boot/bzImage /boot/$(PREFIX)-$(POSTFIX)/vmlinuz-linux
@echo "-- Installing Linux kernel initramfs"
mkinitcpio -p linux-mba
install-modules: $(MODULE)/kernel/extra
@echo "-- Installing bce module"
cp -f linux-module-bce/bce.ko $(MODULE)/kernel/extra/
@echo "-- Installing spi modules"
cp -f linux-module-spi/apple-ibridge.ko $(MODULE)/kernel/extra/
cp -f linux-module-spi/apple-ib-tb.ko $(MODULE)/kernel/extra/
cp -f linux-module-spi/apple-ib-als.ko $(MODULE)/kernel/extra/
@echo "-- Updating Linux kernel module dependencies"
depmod -a $(UNAME)
install-systemd:
@echo "-- Installing systemd configuration"
cp -f setup-etc-modules-load.d-bce.conf \
/etc/modules-load.d/bce.conf
cp -f setup-etc-modules-load.d-spi.conf \
/etc/modules-load.d/spi.conf
cp -f setup-usr-lib-systemd-system-brcmfmac.service \
/usr/lib/systemd/system/brcmfmac.service
cp -f setup-usr-lib-udev-rules.d-91-pulseaudio-custom.rules \
/usr/lib/udev/rules.d/91-pulseaudio-custom.rules
cp -f setup-usr-share-alsa-cards-AppleT2.conf \
/usr/share/alsa/cards/AppleT2.conf
cp -f setup-usr-share-pulseaudio-alsa-mixer-profile-sets-apple-t2.conf \
/usr/share/pulseaudio/alsa-mixer/profile-sets/apple-t2.conf
systemd:
@echo "-- Updating systemd environment"
systemctl daemon-reload
systemctl start brcmfmac
systemctl enable brcmfmac
systemctl restart iwd
/boot/$(PREFIX)-$(POSTFIX):
mkdir -p $@
$(MODULE)/kernel/extra:
mkdir -p $@
/etc/mkinitcpio.d/linux-mba.preset: setup-etc-mkinitcpio.d-linux-mba.preset
cp -f $^ $@