forked from tomuta/debian-mini-odroid-c1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux.mak
57 lines (45 loc) · 1.45 KB
/
linux.mak
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
include common.mk
export ARCH := $(LINUX_ARCH)
export CROSS_COMPILE := $(LINUX_TC_PREFIX)
export PATH := $(shell pwd)/$(LINUX_TC_PATH):$(PATH)
.PHONY: all
all: build
.PHONY: clean
clean:
if test -d "$(LINUX_SRC)"; then $(MAKE) -C $(LINUX_SRC) clean ; fi
rm -rf $(wildcard $(BOOT_DIR) $(BOOT_DIR).tmp $(MODS_DIR) $(MODS_DIR).tmp)
.PHONY: distclean
distclean:
rm -rf $(wildcard $(LINUX_TC_DIR) $(LINUX_SRC) $(BOOT_DIR) $(MODS_DIR) $(MODS_DIR).tmp)
$(LINUX_TC_DIR): $(LINUX_TOOLCHAIN)
mkdir -p $@
tar xf $(LINUX_TOOLCHAIN) --strip-components=1 -C $@
$(LINUX_TOOLCHAIN):
wget -O $@ $(LINUX_TOOLCHAIN_URL)
touch $@
.PHONY: build
build: $(BOOT_DIR) $(MODS_DIR)
$(BOOT_DIR): $(LINUX_IMAGE_BIN)
if test -d "[email protected]"; then rm -rf "[email protected]" ; fi
if test -d "$@"; then rm -rf "$@" ; fi
mkdir -p "[email protected]"
cp -p $(LINUX_IMAGE_BIN) "[email protected]"
cp -p $(LINUX_DTS_PATH)/$(LINUX_DTB_FILE) "[email protected]"
mv "[email protected]" $@
touch $@
$(LINUX_IMAGE_BIN): $(LINUX_TC_DIR) $(LINUX_SRC)
$(MAKE) -C $(LINUX_SRC) $(LINUX_CONFIG)
$(MAKE) -C $(LINUX_SRC) $(LINUX_IMAGE_FILE)
$(MAKE) -C $(LINUX_SRC) dtbs
$(MAKE) -C $(LINUX_SRC) modules
touch $@
$(MODS_DIR): $(LINUX_IMAGE_BIN)
if test -d "[email protected]"; then rm -rf "[email protected]" ; fi
if test -d "$@"; then rm -rf "$@" ; fi
mkdir -p "[email protected]"
$(MAKE) -C $(LINUX_SRC) modules
$(MAKE) -C $(LINUX_SRC) INSTALL_MOD_PATH=$(abspath $(MODS_DIR).tmp) modules_install
mv "[email protected]" $@
touch $@
$(LINUX_SRC):
git clone --depth=1 $(LINUX_REPO) -b $(LINUX_BRANCH) $@