2
2
3
3
usage ()
4
4
{
5
- echo " Usage: $0 [BuildArch] [LinuxCodeName ] [lldbx.y] [--skipunmount] --rootfsdir <directory>]"
5
+ echo " Usage: $0 [BuildArch] [CodeName ] [lldbx.y] [--skipunmount] --rootfsdir <directory>]"
6
6
echo " BuildArch can be: arm(default), armel, arm64, x86"
7
- echo " LinuxCodeName - optional, Code name for Linux, can be: trusty, xenial(default), zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
8
- echo " lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine"
7
+ echo " CodeName - optional, Code name for Linux, can be: trusty, xenial(default), zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
8
+ echo " for FreeBSD can be: freebsd11 or freebsd12."
9
+ echo " lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FReeBSD"
9
10
echo " --skipunmount - optional, will skip the unmount of rootfs folder."
10
11
exit 1
11
12
}
12
13
13
- __LinuxCodeName =xenial
14
+ __CodeName =xenial
14
15
__CrossDir=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd )
15
16
__InitialDir=$PWD
16
17
__BuildArch=arm
@@ -53,6 +54,15 @@ __AlpinePackages+=" krb5-dev"
53
54
__AlpinePackages+=" openssl-dev"
54
55
__AlpinePackages+=" zlib-dev"
55
56
57
+ __FreeBSDBase=" 12.1-RELEASE"
58
+ __FreeBSDPkg=" 1.10.5"
59
+ __FreeBSDPackages=" libunwind"
60
+ __FreeBSDPackages+=" icu"
61
+ __FreeBSDPackages+=" libinotify"
62
+ __FreeBSDPackages+=" lttng-ust"
63
+ __FreeBSDPackages+=" llvm-90"
64
+ __FreeBSDPackages+=" krb5"
65
+
56
66
__UnprocessedBuildArgs=
57
67
while : ; do
58
68
if [ $# -le 0 ]; then
@@ -81,7 +91,7 @@ while :; do
81
91
__BuildArch=armel
82
92
__UbuntuArch=armel
83
93
__UbuntuRepo=" http://ftp.debian.org/debian/"
84
- __LinuxCodeName =jessie
94
+ __CodeName =jessie
85
95
;;
86
96
x86)
87
97
__BuildArch=x86
@@ -110,36 +120,36 @@ while :; do
110
120
unset __LLDB_Package
111
121
;;
112
122
trusty) # Ubuntu 14.04
113
- if [ " $__LinuxCodeName " != " jessie" ]; then
114
- __LinuxCodeName =trusty
123
+ if [ " $__CodeName " != " jessie" ]; then
124
+ __CodeName =trusty
115
125
fi
116
126
;;
117
127
xenial) # Ubuntu 16.04
118
- if [ " $__LinuxCodeName " != " jessie" ]; then
119
- __LinuxCodeName =xenial
128
+ if [ " $__CodeName " != " jessie" ]; then
129
+ __CodeName =xenial
120
130
fi
121
131
;;
122
132
zesty) # Ubuntu 17.04
123
- if [ " $__LinuxCodeName " != " jessie" ]; then
124
- __LinuxCodeName =zesty
133
+ if [ " $__CodeName " != " jessie" ]; then
134
+ __CodeName =zesty
125
135
fi
126
136
;;
127
137
bionic) # Ubuntu 18.04
128
- if [ " $__LinuxCodeName " != " jessie" ]; then
129
- __LinuxCodeName =bionic
138
+ if [ " $__CodeName " != " jessie" ]; then
139
+ __CodeName =bionic
130
140
fi
131
141
;;
132
142
jessie) # Debian 8
133
- __LinuxCodeName =jessie
143
+ __CodeName =jessie
134
144
__UbuntuRepo=" http://ftp.debian.org/debian/"
135
145
;;
136
146
stretch) # Debian 9
137
- __LinuxCodeName =stretch
147
+ __CodeName =stretch
138
148
__UbuntuRepo=" http://ftp.debian.org/debian/"
139
149
__LLDB_Package=" liblldb-6.0-dev"
140
150
;;
141
151
buster) # Debian 10
142
- __LinuxCodeName =buster
152
+ __CodeName =buster
143
153
__UbuntuRepo=" http://ftp.debian.org/debian/"
144
154
__LLDB_Package=" liblldb-6.0-dev"
145
155
;;
@@ -149,14 +159,22 @@ while :; do
149
159
usage;
150
160
exit 1;
151
161
fi
152
- __LinuxCodeName =
162
+ __CodeName =
153
163
__UbuntuRepo=
154
164
__Tizen=tizen
155
165
;;
156
166
alpine)
157
- __LinuxCodeName =alpine
167
+ __CodeName =alpine
158
168
__UbuntuRepo=
159
169
;;
170
+ freebsd11)
171
+ __FreeBSDBase=" 11.3-RELEASE"
172
+ ;&
173
+ freebsd12)
174
+ __CodeName=freebsd
175
+ __BuildArch=x64
176
+ __SkipUnmount=1
177
+ ;;
160
178
--skipunmount)
161
179
__SkipUnmount=1
162
180
;;
@@ -192,7 +210,7 @@ if [ -d "$__RootfsDir" ]; then
192
210
rm -rf $__RootfsDir
193
211
fi
194
212
195
- if [[ " $__LinuxCodeName " == " alpine" ]]; then
213
+ if [[ " $__CodeName " == " alpine" ]]; then
196
214
__ApkToolsVersion=2.9.1
197
215
__AlpineVersion=3.9
198
216
__ApkToolsDir=$( mktemp -d)
@@ -218,9 +236,24 @@ if [[ "$__LinuxCodeName" == "alpine" ]]; then
218
236
add $__AlpinePackagesEdgeTesting
219
237
220
238
rm -r $__ApkToolsDir
221
- elif [[ -n $__LinuxCodeName ]]; then
222
- qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo
223
- cp $__CrossDir /$__BuildArch /sources.list.$__LinuxCodeName $__RootfsDir /etc/apt/sources.list
239
+ elif [[ " $__CodeName " == " freebsd" ]]; then
240
+ mkdir -p $__RootfsDir /usr/local/etc
241
+ wget -O - https://download.freebsd.org/ftp/releases/amd64/${__FreeBSDBase} /base.txz | tar -C $__RootfsDir -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version
242
+ # For now, ask for 11 ABI even on 12. This can be revisited later.
243
+ echo " ABI = \" FreeBSD:11:amd64\" ; FINGERPRINTS = \" ${__RootfsDir} /usr/share/keys\" ; REPOS_DIR = [\" ${__RootfsDir} /etc/pkg\" ]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > ${__RootfsDir} /usr/local/etc/pkg.conf
244
+ echo " FreeBSD: { url: " pkg+http://pkg.FreeBSD.org/\$ {ABI}/quarterly" , mirror_type: \" srv\" , signature_type: \" fingerprints\" , fingerprints: \" ${__RootfsDir} /usr/share/keys/pkg\" , enabled: yes }" > ${__RootfsDir} /etc/pkg/FreeBSD.conf
245
+ mkdir -p $__RootfsDir /tmp
246
+ # get and build package manager
247
+ wget -O - https://github.com/freebsd/pkg/archive/${__FreeBSDPkg} .tar.gz | tar -C $__RootfsDir /tmp -zxf -
248
+ cd $__RootfsDir /tmp/pkg-${__FreeBSDPkg}
249
+ ./autogen.sh && ./configure --prefix=$__RootfsDir /host && make install
250
+ rm -rf $__RootfsDir /tmp/pkg-${__FreeBSDPkg}
251
+ # install packages we need.
252
+ $__RootfsDir /host/sbin/pkg -r $__RootfsDir -C $__RootfsDir /usr/local/etc/pkg.conf update
253
+ $__RootfsDir /host/sbin/pkg -r $__RootfsDir -C $__RootfsDir /usr/local/etc/pkg.conf install --yes $__FreeBSDPackages
254
+ elif [[ -n $__CodeName ]]; then
255
+ qemu-debootstrap --arch $__UbuntuArch $__CodeName $__RootfsDir $__UbuntuRepo
256
+ cp $__CrossDir /$__BuildArch /sources.list.$__CodeName $__RootfsDir /etc/apt/sources.list
224
257
chroot $__RootfsDir apt-get update
225
258
chroot $__RootfsDir apt-get -f -y install
226
259
chroot $__RootfsDir apt-get -y install $__UbuntuPackages
@@ -230,7 +263,7 @@ elif [[ -n $__LinuxCodeName ]]; then
230
263
umount $__RootfsDir /*
231
264
fi
232
265
233
- if [[ " $__BuildArch " == " arm" && " $__LinuxCodeName " == " trusty" ]]; then
266
+ if [[ " $__BuildArch " == " arm" && " $__CodeName " == " trusty" ]]; then
234
267
pushd $__RootfsDir
235
268
patch -p1 < $__CrossDir /$__BuildArch /trusty.patch
236
269
patch -p1 < $__CrossDir /$__BuildArch /trusty-lttng-2.4.patch
0 commit comments