-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
76 lines (64 loc) · 2.13 KB
/
Makefile
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
MODULE_NAME = ili9488
PWD = $(shell pwd)
MACH ?= udoo-bolt
DTC ?= dtc
DTC_FLAGS ?=
DTS_FNAME = $(MODULE_NAME).dts
DTS_TEMP_FNAME = .$(MODULE_NAME).dtb.dts.tmp
DTB_PRE_TEMP_FNAME = .$(MODULE_NAME).dtb.d.pre.tmp
DTB_FNAME = $(MODULE_NAME).dtb
ASL ?= iasl
ASL_FLAGS ?=
ASL_FNAME = $(MODULE_NAME).asl
AML_FNAME = $(MODULE_NAME).aml
DEVICE_ENUMERATION_TYPE ?= ACPI
ifeq ($(DEVICE_ENUMERATION_TYPE),ACPI)
CFLAGS_$(MODULE_NAME).o += -DACPI_DEVICE_ENUM=1
else
CFLAGS_$(MODULE_NAME).o += -DDT_DEVICE_ENUM=1
endif
ifneq ($(KERNELRELEASE),)
obj-m := $(MODULE_NAME).o
else
KSRC ?= $(PWD)
endif
# Bootlin Explanation
# The module Makefile is initially interpreted with KERNELRELEASE undefined, so
# it calls the kernel Makefile, passing the module directory in the M variable
# The kernel Makefile knows how to compile a module, and thanks to the M
# variable, knows where the Makefile for our module is. This module Makefile is
# then interpreted with KERNELRELEASE defined, so the kernel sees the obj-m
# definition.
all:
$(MAKE) -C $(KSRC) M=$$PWD
aml:
$(ASL) $(PWD)/acpi-tables/$(MACH)/$(ASL_FNAME)
mv $(PWD)/acpi-tables/$(MACH)/$(AML_FNAME) $(PWD)/$(AML_FNAME)
dtb:
$(CPP) -E -Wp,-MMD,$(PWD)/$(DTB_PRE_TEMP_FNAME) \
-undef -D__DTS__ -x assembler-with-cpp -nostdinc \
-I$(KSRC)/include \
-I$(KSRC)/arch/$(ARCH)/boot/dts \
-I$(KSRC)/scripts/dtc/include-prefixes \
-o $(PWD)/$(DTS_TEMP_FNAME) \
$(PWD)/devicetrees/$(MACH)/$(DTS_FNAME)
$(DTC) -o $(PWD)/$(DTB_FNAME) -O dtb -b 0 \
-i$(KSRC)/include \
-i$(KSRC)/arch/$(ARCH)/boot/dts \
-i$(KSRC)/scripts/dtc/include-prefixes \
-Wno-interrupt_provider -Wno-unit_address_vs_reg -Wno-avoid_unnecessary_addr_size \
-Wno-alias_paths -Wno-graph_child_address -Wno-simple_bus_reg -Wno-unique_unit_address \
$(DTC_FLAGS) $(PWD)/$(DTS_TEMP_FNAME)
$(RM) $(PWD)/$(DTS_TEMP_FNAME)
$(RM) $(PWD)/$(DTB_PRE_TEMP_FNAME)
clean:
$(RM) $(PWD)/*.o
$(RM) $(PWD)/*.ko
$(RM) $(PWD)/*.order
$(RM) $(PWD)/*.symvers
$(RM) $(PWD)/*.mod*
$(RM) $(PWD)/.mod*
$(RM) $(PWD)/.Mod*
$(RM) $(PWD)/.$(MODULE_NAME)*
$(RM) $(PWD)/*.dtb
$(RM) $(PWD)/*.aml