blob: 25a46a08a92de6158405a6d4ffd471351e314f04 (
plain)
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
|
#!/usr/bin/env bash
usage()
{
echo "Usage: $0 [BuildArch] [UbuntuCodeName]"
echo "BuildArch can be: arm, arm-softfp, arm64"
echo "UbuntuCodeName - optional, Code name for Ubuntu, can be: trusty(default), vivid, wily. If BuildArch is arm-softfp, UbuntuCodeName is ignored."
exit 1
}
__UbuntuCodeName=trusty
__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
__InitialDir=$PWD
__BuildArch=arm
__UbuntuArch=armhf
__UbuntuRepo="http://ports.ubuntu.com/"
__UbuntuPackagesBase="build-essential libunwind8-dev gettext symlinks liblttng-ust-dev libicu-dev"
__UbuntuPackages="$__UbuntuPackagesBase"
__MachineTriple=arm-linux-gnueabihf
__UnprocessedBuildArgs=
for i in "$@"
do
lowerI="$(echo $i | awk '{print tolower($0)}')"
case $lowerI in
-?|-h|--help)
usage
exit 1
;;
arm)
__BuildArch=arm
__UbuntuArch=armhf
__UbuntuPackages="$__UbuntuPackagesBase lldb-3.6-dev"
__MachineTriple=arm-linux-gnueabihf
;;
arm64)
__BuildArch=arm64
__UbuntuArch=arm64
__UbuntuPackages="$__UbuntuPackagesBase"
__MachineTriple=aarch64-linux-gnu
;;
arm-softfp)
__BuildArch=arm-softfp
__UbuntuArch=armel
__UbuntuRepo="http://ftp.debian.org/debian/"
__UbuntuPackages="$__UbuntuPackagesBase lldb-3.6-dev"
__MachineTriple=arm-linux-gnueabi
__UbuntuCodeName=jessie
;;
vivid)
if [ __UbuntuCodeName != "jessie" ]; then
__UbuntuCodeName=vivid
fi
;;
wily)
if [ __UbuntuCodeName != "jessie" ]; then
__UbuntuCodeName=wily
fi
;;
*)
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
;;
esac
done
__RootfsDir="$__CrossDir/rootfs/$__BuildArch"
if [[ -n "$ROOTFS_DIR" ]]; then
__RootfsDir=$ROOTFS_DIR
fi
umount $__RootfsDir/*
rm -rf $__RootfsDir
qemu-debootstrap --arch $__UbuntuArch $__UbuntuCodeName $__RootfsDir $__UbuntuRepo
cp $__CrossDir/$__BuildArch/sources.list.$__UbuntuCodeName $__RootfsDir/etc/apt/sources.list
chroot $__RootfsDir apt-get update
chroot $__RootfsDir apt-get -f -y install
chroot $__RootfsDir apt-get -y install $__UbuntuPackages
chroot $__RootfsDir symlinks -cr /usr
umount $__RootfsDir/*
|