forked from opennetworklinux/ONL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
154 lines (124 loc) · 5.23 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# Open Network Linux
#
############################################################
all:
@echo "targets:"
@echo ""
@echo " install-host-deps Install build dependencies into your host build machine."
@echo ""
@echo " install-ws-deps Install build dependencies into your workspace after creating it."
@echo ""
@echo " all-components Build all components in workspace before building actual images."
@echo ""
@echo " deb-clean Clean all debian log files in the components subtree."
@echo ""
############################################################
#
# These need to be initialized on the build host machine
#
############################################################
install-host-deps:
sudo apt-get install binfmt-support qemu-user-static multistrap apt-cacher-ng devscripts debhelper realpath
$(MAKE) -C tools
sudo dpkg -i tools/*.deb
@echo \`make install-host-deps\` SUCCESS
############################################################
#
# These need to be installed once in the build workspace
# after you create it.
#
############################################################
install-ws-deps: __install-ws-deps
############################################################
#
# Build each of the underlying components
#
############################################################
all-components:
export ONL=`pwd` && make -C $$ONL/builds/components
############################################################
#
# These targets will clean all debian temporary files
# in the ONL component directories.
#
############################################################
deb-clean:
find components -name "*.substvars" -delete
find components -name "*.debhelper*" -delete
find components -name "*.build" -delete
find components -name "*.changes" -delete
find components -name files -delete
find components -name "*~" -delete
############################################################
#
# No need to read further unless you run into issues
# installing the above targets.
#
# The following rules are a bit of hackery at the moment.
#
# We use the cross compiling and cross-package tools
# provided by the Emdebian repositories.
#
# Normally, we would just add the Emdebian sources and
# start installing everything, but some of the current
# package dependencies listed in Emdebian Wheezy appear
# to be broken -- the cross compiler tools provided by
# Emdebian have been recently updated with dependencies
# on libc6 and gcc-4.8 that cannot be satisfied by the
# versions provided by Debian Wheezy.
#
# This needs to get resolved, but as a stop-gap the
# previous versions of the offending packages (which
# are compatible with Debian Wheezy) are included and
# installed locally.
#
############################################################
#
# Install Emdebian keyring and repositories
#
emdebian-update:
sudo apt-get install emdebian-archive-keyring
echo 'APT::Get::AllowUnauthenticated "true";\nAPT::Get::Assume-Yes "true";' | sudo tee /etc/apt/apt.conf.d/99opennetworklinux
sudo dpkg --add-architecture powerpc
echo "deb http://emdebian.org/debian/ wheezy main" | sudo tee /etc/apt/sources.list.d/emdebian.list
sudo apt-get update
#
# Install required native packages
#
install-native-deps: emdebian-update
sudo apt-get install libedit-dev ncurses-dev gcc make xapt cdbs debhelper pkg-config devscripts bison flex texinfo wget cpio multistrap squashfs-tools zip binfmt-support autoconf automake1.9 autotools-dev libtool apt-file file genisoimage syslinux dosfstools mtools bc python-yaml mtd-utils gcc-4.7-multilib uboot-mkimage kmod
#
# Install required cross compiler packages.
# This is where it gets a little pear-shaped.
#
install-cross-deps: install-native-deps
sudo apt-get install libc6-dev-powerpc-cross
# These packages are currently incompatible between Debian/Emdebian wheezy:
sudo dpkg -i tools/bin/amd64/binutils-powerpc-linux-gnu_2.22-7.1_amd64.deb
sudo dpkg -i tools/bin/amd64/libgomp1-powerpc-cross_4.7.2-4_all.deb
sudo apt-get install gcc-4.7-powerpc-linux-gnu libc6-dev-powerpc-cross
f=$$(mktemp); wget -O $$f "https://launchpad.net/ubuntu/+source/qemu/1.4.0+dfsg-1expubuntu3/+build/4336762/+files/qemu-user-static_1.4.0%2Bdfsg-1expubuntu3_amd64.deb" && sudo dpkg -i $$f
sudo update-alternatives --install /usr/bin/powerpc-linux-gnu-gcc powerpc-linux-gnu-gcc /usr/bin/powerpc-linux-gnu-gcc-4.7 10
sudo xapt -a powerpc libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev
__install-ws-deps: install-cross-deps