-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.kernel
98 lines (78 loc) · 3.45 KB
/
Makefile.kernel
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
# Kernel relatd stuff
uboot-git-repo="git://git.xilinx.com/u-boot-xlnx.git"
GIT_PROJECTS += uboot
uboot-rebuild:
rm -f $(RESOURCES_DIR)/u-boot.elf
cd $(SOURCES_DIR)/uboot-git && $(MAKE) clean
$(MAKE) uboot-build
uboot-build: uboot $(RESOURCES_DIR)/u-boot.elf $(RESOURCES_DIR)/uEnv.txt
$(RESOURCES_DIR)/uEnv.txt: $(DATA_DIR)/uEnv.txt
cp $< $@
UBOOT_CONFIG = zynq_zc70x_config
# UBOOT_CONFIG = zynq_zc70x_tsi_config
$(RESOURCES_DIR)/u-boot.elf: | uboot gnu-tools $(RESOURCES_DIR)
@echo "Building U-Boot"
$(call remote-maybe, \
$(MAKE) -C $(SOURCES_DIR)/uboot-git $(UBOOT_CONFIG) CROSS_COMPILE="$(GNU_TOOLS_PREFIX)" && \
$(MAKE) -C $(SOURCES_DIR)/uboot-git CROSS_COMPILE="$(GNU_TOOLS_PREFIX)")
cp $(SOURCES_DIR)/uboot-git/u-boot $(RESOURCES_DIR)/u-boot.elf
## The xilinx commit that works
# linux-git-repo=git://github.com/Xilinx/linux-xlnx.git
# linux-git-commit=3f7c2d54957e950b3a36a251578185bfd374562c
linux-git-repo=http://github.com/fakedrake/linux-thinksilicon
linux-git-checkout=thinksilicon
# Comment this out if you intend to push stuff
# linux-git-clone-opts = --depth=20
GIT_PROJECTS += linux
KERNEL_CONFIG = thinksilicon_zynq_defconfig
# KERNEL_CONFIG=thinksilicon_android_defconfig
# DTS_TREE=$(SOURCES_DIR)/linux-git/arch/arm/boot/dts/zynq-zc702-android-hdmi-tsi.dts
DTS_TREE=$(SOURCES_DIR)/linux-git/arch/arm/boot/dts/zynq-zc702-tsi.dts
# DTS_TREE=$(SOURCES_DIR)/linux-git/arch/arm/boot/dts/thinksilicon-board.dts
DTB_TREE=$(RESOURCES_DIR)/devicetree.dtb
show-linux-vars::
@echo "KERNEL_CONFIG = $(KERNEL_CONFIG)"
@echo "DTS_TREE = $(DTB_TREE)"
@echo "DTB_TREE = $(DTB_TREE)"
linux-build: $(RESOURCES_DIR)/uImage $(DTB_TREE) $(RESOURCES_DIR)/u-boot.elf | linux
@echo "Linux: $<"
linux-rebuild:
$(MAKE) linux-clean
$(MAKE) linux-build
$(MAKE) nfsroot
linux-clean:
rm -rf $(RESOURCES_DIR)/*Image $(DTB_TREE) $(SOURCES_DIR)/linux-git/arch/arm/boot/*Image
linux-clean-deep: linux-clean
$(call remote-maybe, $(MAKE) -C $(SOURCES_DIR)/linux-git clean)
$(DTS_TREE): | linux
$(DTB_TREE): $(DTS_TREE)
@echo "Device tree: $(DTS_TREE) -> $(DTB_TREE)"
$(SOURCES_DIR)/linux-git/scripts/dtc/dtc -I dts -O dtb -o $(DTB_TREE) $(DTS_TREE)
show-dts-filename:
@echo $(DTS_TREE)
show-dts: $(DTB_TREE)
$(call remote-maybe, $(SOURCES_DIR)/linux-git/scripts/dtc/dtc -I dtb -O dts $(DTB_TREE))
linux-version:
$(MAKE) ARCH=arm CROSS_COMPILE=$(GNU_TOOLS_PREFIX) kernelrelease -C $(SOURCES_DIR)/linux-git
# This means either uImage or zImage or whatever.
$(RESOURCES_DIR)/%Image: $(SOURCES_DIR)/linux-git/arch/arm/boot/%Image
cp $< $@
LINUX_MAKE_OPTS=-C $(SOURCES_DIR)/linux-git \
INSTALL_MOD_PATH=$(FILESYSTEM_ROOT) \
ARCH=arm \
CROSS_COMPILE=$(GNU_TOOLS_PREFIX) \
LOADADDR=0x8000
$(SOURCES_DIR)/linux-git/arch/arm/boot/%Image: | $(RESOURCES_DIR)/u-boot.elf linux gnu-tools $(RESOURCES_DIR)
@echo "Building Linux..."
$(call remote-maybe, \
$(MAKE) $(LINUX_MAKE_OPTS) $(KERNEL_CONFIG) && \
$(MAKE) $(LINUX_MAKE_OPTS) $*Image && \
$(MAKE) $(LINUX_MAKE_OPTS) modules && \
$(MAKE) $(LINUX_MAKE_OPTS) modules_install)
# Edit the current config with menuconfig.
linux-menuconfig:
@echo "Will backup and overwrite $(KERNEL_CONFIG)"
$(call remote-maybe, \
$(MAKE) ARCH=arm CROSS_COMPILE=$(GNU_TOOLS_PREFIX) menuconfig -C $(SOURCES_DIR)/linux-git && \
mv $(SOURCES_DIR)/linux-git/arch/arm/configs/$(KERNEL_CONFIG) $(SOURCES_DIR)/linux-git/arch/arm/configs/$(KERNEL_CONFIG).$$(date +%s) && \
cp $(SOURCES_DIR)/linux-git/.config $(SOURCES_DIR)/linux-git/arch/arm/configs/$(KERNEL_CONFIG))