Skip to content

Commit 8b9f05c

Browse files
author
Raul Hidalgo Caballero
authored
Update build-rootfs.sh
1 parent c5fe434 commit 8b9f05c

File tree

1 file changed

+47
-8
lines changed

1 file changed

+47
-8
lines changed

cross/build-rootfs.sh

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ usage()
44
{
55
echo "Usage: $0 [BuildArch] [LinuxCodeName] [lldbx.y] [--skipunmount]"
66
echo "BuildArch can be: arm(default), armel, arm64, x86"
7-
echo "LinuxCodeName - optional, Code name for Linux, can be: trusty(default), vivid, wily, xenial, zesty, bionic. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
8-
echo "lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8, lldb3.9, lldb4.0, no-lldb"
7+
echo "LinuxCodeName - optional, Code name for Linux, can be: trusty(default), vivid, wily, xenial, zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
8+
echo "lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8, lldb3.9, lldb4.0, no-lldb. Ignored for alpine"
99
echo "--skipunmount - optional, will skip the unmount of rootfs folder."
1010
exit 1
1111
}
@@ -22,21 +22,36 @@ __SkipUnmount=0
2222
# base development support
2323
__UbuntuPackages="build-essential"
2424

25+
__AlpinePackages="alpine-base"
26+
__AlpinePackages+=" build-base"
27+
__AlpinePackages+=" linux-headers"
28+
__AlpinePackages+=" lldb-dev"
29+
__AlpinePackages+=" llvm-dev"
30+
2531
# symlinks fixer
2632
__UbuntuPackages+=" symlinks"
2733

2834
# CoreCLR and CoreFX dependencies
29-
__UbuntuPackages+=" gettext"
30-
__UbuntuPackages+=" libunwind8-dev"
31-
__UbuntuPackages+=" liblttng-ust-dev"
3235
__UbuntuPackages+=" libicu-dev"
36+
__UbuntuPackages+=" liblttng-ust-dev"
37+
__UbuntuPackages+=" libunwind8-dev"
38+
39+
__AlpinePackages+=" gettext-dev"
40+
__AlpinePackages+=" icu-dev"
41+
__AlpinePackages+=" libunwind-dev"
42+
__AlpinePackages+=" lttng-ust-dev"
3343

3444
# CoreFX dependencies
3545
__UbuntuPackages+=" libcurl4-openssl-dev"
3646
__UbuntuPackages+=" libkrb5-dev"
3747
__UbuntuPackages+=" libssl-dev"
3848
__UbuntuPackages+=" zlib1g-dev"
3949

50+
__AlpinePackages+=" curl-dev"
51+
__AlpinePackages+=" krb5-dev"
52+
__AlpinePackages+=" openssl-dev"
53+
__AlpinePackages+=" zlib-dev"
54+
4055
__UnprocessedBuildArgs=
4156
for i in "$@" ; do
4257
lowerI="$(echo $i | awk '{print tolower($0)}')"
@@ -48,10 +63,14 @@ for i in "$@" ; do
4863
arm)
4964
__BuildArch=arm
5065
__UbuntuArch=armhf
66+
__AlpineArch=armhf
67+
__QEMUArch=arm
5168
;;
5269
arm64)
5370
__BuildArch=arm64
5471
__UbuntuArch=arm64
72+
__AlpineArch=aarch64
73+
__QEMUArch=aarch64
5574
;;
5675
armel)
5776
__BuildArch=armel
@@ -71,10 +90,10 @@ for i in "$@" ; do
7190
__LLDB_Package="lldb-3.8-dev"
7291
;;
7392
lldb3.9)
74-
__LLDB_Package="lldb-3.9-dev"
93+
__LLDB_Package="liblldb-3.9-dev"
7594
;;
7695
lldb4.0)
77-
__LLDB_Package="lldb-4.0-dev"
96+
__LLDB_Package="liblldb-4.0-dev"
7897
;;
7998
no-lldb)
8099
unset __LLDB_Package
@@ -118,6 +137,10 @@ for i in "$@" ; do
118137
__UbuntuRepo=
119138
__Tizen=tizen
120139
;;
140+
alpine)
141+
__LinuxCodeName=alpine
142+
__UbuntuRepo=
143+
;;
121144
--skipunmount)
122145
__SkipUnmount=1
123146
;;
@@ -145,7 +168,22 @@ if [ -d "$__RootfsDir" ]; then
145168
rm -rf $__RootfsDir
146169
fi
147170

148-
if [[ -n $__LinuxCodeName ]]; then
171+
if [[ "$__LinuxCodeName" == "alpine" ]]; then
172+
__ApkToolsVersion=2.9.1
173+
__AlpineVersion=3.7
174+
__ApkToolsDir=$(mktemp -d)
175+
wget https://github.com/alpinelinux/apk-tools/releases/download/v$__ApkToolsVersion/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -P $__ApkToolsDir
176+
tar -xf $__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -C $__ApkToolsDir
177+
mkdir -p $__RootfsDir/usr/bin
178+
cp -v /usr/bin/qemu-$__QEMUArch-static $__RootfsDir/usr/bin
179+
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
180+
-X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main \
181+
-X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community \
182+
-X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
183+
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
184+
add $__AlpinePackages
185+
rm -r $__ApkToolsDir
186+
elif [[ -n $__LinuxCodeName ]]; then
149187
qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo
150188
cp $__CrossDir/$__BuildArch/sources.list.$__LinuxCodeName $__RootfsDir/etc/apt/sources.list
151189
chroot $__RootfsDir apt-get update
@@ -160,6 +198,7 @@ if [[ -n $__LinuxCodeName ]]; then
160198
if [[ "$__BuildArch" == "arm" && "$__LinuxCodeName" == "trusty" ]]; then
161199
pushd $__RootfsDir
162200
patch -p1 < $__CrossDir/$__BuildArch/trusty.patch
201+
patch -p1 < $__CrossDir/$__BuildArch/trusty-lttng-2.4.patch
163202
popd
164203
fi
165204
elif [ "$__Tizen" == "tizen" ]; then

0 commit comments

Comments
 (0)