-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
113 lines (84 loc) · 2.79 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
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
SHELL=/bin/bash
all: buildroot reveng fmk-build /usr/local/bin/binwalk
@echo "build complete"
#FMK prerequisites
PREREQS=zlib1g-dev liblzma-dev
#??
PREREQS+=libncurses5-dev
#binwalk
PREREQS+=libqt4-opengl python-opengl python-qt4 python-numpy python-scipy python-pip
CHECK_PREREQ = if ! (dpkg -l $(1) | grep '^ii' > /dev/null) then \
STATUS=1; \
MISSING_PACKAGES="$${MISSING_PACKAGES} $(1)"; \
fi
.check-prereqs:
mkdir -p dl
declare -a MISSING_PACKAGES; \
for PREREQ in $(PREREQS) ; do \
$(call CHECK_PREREQ,$$PREREQ); \
done; \
if [ "$${MISSING_PACKAGES}" ] ; then \
echo ; \
echo run this command to install system prerequisites: ; \
echo sudo apt-get install $${MISSING_PACKAGES} ; \
echo ; \
fi ; \
exit $$STATUS
touch $@
# --- buildroot ---
dl/buildroot-2013.05.tar.bz2: | .check-prereqs
( cd dl && \
wget http://buildroot.uclibc.org/downloads/buildroot-2013.05.tar.bz2 )
[ "$$(md5sum dl/buildroot-2013.05.tar.bz2)" == "881219ff40e966ef431c717cddbc464f dl/buildroot-2013.05.tar.bz2" ]
buildroot-2013.05: dl/buildroot-2013.05.tar.bz2
tar -xf $^
buildroot-2013.05/.config: config.buildroot | buildroot-2013.05
cp config.buildroot $@
buildroot-2013.05/.built: buildroot-2013.05/.config
make -C buildroot-2013.05
touch $@
.PHONY+=buildroot
buildroot: buildroot-2013.05/.built
buildroot-dirclean:
rm -rf buildroot-2013.05/
# --- reveng ---
dl/reveng-1.1.2.tar.xz: | .check-prereqs
( cd dl && \
wget http://downloads.sourceforge.net/project/reveng/1.1.2/reveng-1.1.2.tar.xz )
[ "$$(md5sum dl/reveng-1.1.2.tar.xz)" = "a2a6d1fd09d5666ba7270bccef79c4fa dl/reveng-1.1.2.tar.xz" ]
reveng-1.1.2: | dl/reveng-1.1.2.tar.xz
tar -xf $|
if [ "$$(uname -m)" = x86_64 ] ; then (cd $@ ; \
patch ) < reveng-x86_64.patch ; fi
reveng-1.1.2/reveng: | reveng-1.1.2
make -C $|
.PHONY+=reveng
reveng: reveng-1.1.2/reveng
reveng-dirclean:
-rm -rf reveng-1.1.2
# --- firmware modification kit ---
dl/fmk_099.tar.gz: | .check-prereqs
( cd dl && \
wget https://firmware-mod-kit.googlecode.com/files/fmk_099.tar.gz )
[ "$$(md5sum dl/fmk_099.tar.gz)" = "91bd2cb3803880368af369d07271b5b9 dl/fmk_099.tar.gz" ]
fmk: dl/fmk_099.tar.gz
tar -xf dl/fmk_099.tar.gz
fmk/.built: | fmk
(cd fmk/src ; \
./configure )
make -C fmk/src
touch $@
.PHONY+=fmk-build
fmk-build: fmk/.built
# --- binwalk ---
binwalk: | .check-prereqs
git clone https://github.com/devttys0/binwalk.git
/usr/local/bin/binwalk: binwalk
(cd binwalk; sudo python setup.py install)
patch -p2 < binwalk-upgrade.patch
# --- general ---
.PHONY+=dir-clean
dir-clean: reveng-dirclean buildroot-dirclean fmk-dirclean
# --- prerequisites ---
.PHONY+=prereqs
prereqs: fmk-prereqs