-
Notifications
You must be signed in to change notification settings - Fork 8
/
sdk
executable file
·140 lines (116 loc) · 4.14 KB
/
sdk
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
#!/usr/bin/env zsh
# Copyright (c) 2016-2021 Ivan J. <[email protected]>
# This file is part of arm-sdk
#
# This source code is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this source code. If not, see <http://www.gnu.org/licenses/>.
armsdk_version="1.0"
R=${ARM_SDK:-$PWD}
DEBUG=0
QUIET=0
source $R/lib/zuper/zuper
# Global vars
vars+=(armsdk_version)
vars+=(R workdir strapdir)
vars+=(os boardlib oslib blendlib)
vars+=(MAKEOPTS)
# Global arrs
arrs+=(extra_packages)
# Global maps
maps+=(board_map os_map blend_map)
source $R/config
source $R/lib/helpers
# Conclude zuper initialization
source $R/lib/zuper/zuper.init
load() {
fn load "$@"
os="$1"
dev="$2"
blend="$3"
req=(os dev)
ckreq || return 1
## initialize binfmt_misc if not already, needed to run qemu
if [[ -f /etc/init.d/binfmt-support ]]; then
sudo /etc/init.d/binfmt-support restart
elif [[ -f /etc/init.d/qemu-binfmt ]]; then
sudo /etc/init.d/qemu-binfmt restart
else
[[ -d /proc/sys/fs/binfmt_misc ]] \
|| sudo modprobe binfmt_misc
[[ -f /proc/sys/fs/binfmt_misc/register ]] \
|| sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
fi
board_map=(
"beagleboneblack" "$R/boards/beaglebone-black.sh"
"chromeacer" "$R/boards/chromebook-acer.sh"
"chromeveyron" "$R/boards/chromebook-veyron.sh"
"n900" "$R/boards/nokia-n900.sh"
"n950" "$R/boards/nokia-n950.sh"
"n9" "$R/boards/nokia-n9.sh"
"droid3" "$R/boards/droid3.sh"
"droid4" "$R/boards/droid4.sh"
"bionic" "$R/boards/bionic.sh"
"odroidxu" "$R/boards/odroid-xu.sh"
"odroidxu4" "$R/boards/odroid-xu4.sh"
"ouya" "$R/boards/ouya.sh"
"pocophone-f1" "$R/boards/pocophone-f1.sh"
"raspi1" "$R/boards/raspberry-pi1.sh"
"raspi2" "$R/boards/raspberry-pi2.sh"
"raspi3" "$R/boards/raspberry-pi3.sh"
"raspi4" "$R/boards/raspberry-pi4.sh"
"rock64" "$R/boards/rock64.sh"
"pinephone-dontbeevil" "$R/boards/pinephone-dontbeevil.sh"
"pinephone" "$R/boards/pinephone.sh"
"pinetab" "$R/boards/pinetab.sh"
"sunxi" "$R/boards/sunxi.sh"
"turbox-twister" "$R/boards/turbox-twister.sh"
)
os_map=(
"devuan" "$R/lib/libdevuansdk/libdevuansdk"
"alpine" "$R/lib/libalpine/libalpine"
)
blend_map=(
"decode" "../decode.blend"
"maemo" "../maemo.blend"
"cobox" "../cobox.blend"
)
boardlib="${board_map[$dev]}"
[[ -f $boardlib ]] || { die "no valid boards specified"; return 1 }
source $boardlib ## XXX: remove this line
oslib="${os_map[$os]}"
[[ -f $oslib ]] || { die "no valid distro specified"; return 1 }
source $oslib
blendlib="${blend_map[$blend]}"
[[ -f $blendlib ]] || { act "no blend specified" }
source $boardlib && act "$device_name build script loaded"
[[ -f $blendlib ]] && {
source $blendlib || zerr
act "$(basename $blend) blend loaded"
export BLEND=1
}
workdir="$R/tmp/${os}-${arch}-build"
strapdir="$workdir/bootstrap"
mkdir -p $strapdir
case "$arch" in
armhf) export compiler="$armhftc";;
armel) export compiler="$armeltc";;
arm64) export compiler="$arm64tc";;
*) die "invalid architecture in board script"; exit 1;;
esac
export LANG=C
export LC_ALL=C
source $R/lib/zuper/zuper.init
}
TRAPZERR() { zerr; return $? }
notice "arm-sdk loaded"
export PROMPT="%F{yellow}%(?..%? )%{$reset_color%}armsdk@%{$fg[red]%}%m %{$reset_color%} %{$fg[blue]%}%#%{$fg_bold[blue]%}%{$reset_color%} "