-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
75 lines (54 loc) · 2.27 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
.PHONY: all clean help
.PHONY: u-boot kernel kernel-menuconfig kernel-help
.PHONY: linux pack
# ############################################################
# Cross Compiler
# ############################################################
C_COMPILE=arm-linux-gnueabi-
# ############################################################
# Directorys and Files
# ############################################################
CURDIR=$(shell pwd)
K_DIR=$(CURDIR)/linux-sunxi
K_DOT_CONFIG=$(K_DIR)/.config
OUTPUT_DIR=$(CURDIR)/output
K_OUT_DIR=$(OUTPUT_DIR)/kernel
# ############################################################
# Kernel Config
# ############################################################
T_ARCH=arm
K_CONFIG=sun8iw6p1smp_bpi_defconfig
# ############################################################
# Makefile env
# ############################################################
J=$(shell expr `grep ^processor /proc/cpuinfo | wc -l`)
ifeq ($(J),0)
J=1
endif
# ############################################################
# Makefile toplevel options
# ############################################################
all:kernel
clean: kernel-clean
rm -rf ${OUTPUT_DIR}
# ############################################################
# Build Kernel
# ############################################################
kernel-clean:
$(MAKE) -C linux-sunxi/arch/arm/mach-sunxi/pm/standby ARCH=${T_ARCH} CROSS_COMPILE=${C_COMPILE} clean
$(MAKE) -C ${K_DIR} ARCH=${T_ARCH} CROSS_COMPILE=${C_COMPILE} distclean
rm -rf ${K_OUT_DIR}
$(K_OUT_DIR) :
mkdir -p $@
kernel-help:
$(MAKE) -C ${K_DIR} ARCH=${T_ARCH} CROSS_COMPILE=${C_COMPILE} help
$(K_DOT_CONFIG):
$(MAKE) -C ${K_DIR} ARCH=${T_ARCH} CROSS_COMPILE=${C_COMPILE} ${K_CONFIG}
kernel-menuconfig: $(K_DOT_CONFIG)
$(MAKE) -C ${K_DIR} ARCH=${T_ARCH} CROSS_COMPILE=${C_COMPILE} menuconfig
cp linux-sunxi/.config linux-sunxi/arch/arm/configs/${K_CONFIG}
kernel: $(K_DOT_CONFIG) $(K_OUT_DIR)
$(MAKE) -C ${K_DIR} ARCH=${T_ARCH} CROSS_COMPILE=${C_COMPILE} uImage modules -j$J
cp ${K_DIR}/arch/arm/boot/uImage ${K_OUT_DIR}
$(MAKE) -C ${K_DIR} ARCH=${T_ARCH} CROSS_COMPILE=${C_COMPILE} INSTALL_MOD_PATH=${K_OUT_DIR} modules_install firmware_install
$(MAKE) -C ${K_DIR} ARCH=${T_ARCH} CROSS_COMPILE=${C_COMPILE} INSTALL_HDR_PATH=${K_OUT_DIR}/usr headers_install