-
Notifications
You must be signed in to change notification settings - Fork 0
/
cross.sh
executable file
·57 lines (49 loc) · 1.46 KB
/
cross.sh
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
#!/bin/bash -xe
# bbb|rpi4
BOARD="${1:-bbb}"
case $OSTYPE in
linux*)
DEVARCH=linux_x86_64-1.4.3
;;
darwin*)
DEVARCH=darwin_arm-1.4.3
;;
esac
case $BOARD in
bbb)
TARGARCH=armv7_nerves_linux_gnueabihf
CCEXE=armv7-nerves-linux-gnueabihf
export TOOLCHAIN="$HOME/.nerves/artifacts/nerves_toolchain_$TARGARCH-$DEVARCH"
export CC="$TOOLCHAIN/bin/$CCEXE-cc"
export GOOS=linux
export GOARCH=arm
export GOARM=7
export CGO_ENABLED=1
;;
rpi4)
TARGARCH=aarch64_nerves_linux_gnu
CCEXE=aarch64-nerves-linux-gnu
export TOOLCHAIN="$HOME/.nerves/artifacts/nerves_toolchain_$TARGARCH-$DEVARCH"
export CC="$TOOLCHAIN/bin/$CCEXE-cc"
export GOOS=linux
export GOARCH=arm64
export CGO_ENABLED=1
;;
esac
MOD="github.com/YeicoLabs/laurelview"
CMD=$MOD/cmd
FDST=nfw/rootfs_overlay/lvbin
mkdir -p $FDST
BDST=build/$BOARD
mkdir -p $BDST
[ ! -d $TOOLCHAIN ] && (cd nfw; MIX_TARGET=$BOARD mix deps.get)
go build -ldflags="-extld=$CC" -o $BDST/lvdpm $CMD/lvdpm
go build -ldflags="-extld=$CC" -o $BDST/lvnbe $CMD/lvnbe
go build -ldflags="-extld=$CC" -o $BDST/lvnup $CMD/lvnup
go build -ldflags="-extld=$CC" -o $BDST/lvnss $CMD/lvnss
echo "LV_NUP_ENDPOINT=127.0.0.1:80" > $BDST/lvnup.env
echo "LV_DPM_ENDPOINT=127.0.0.1:81" > $BDST/lvdpm.env
echo "LV_NBE_ENDPOINT=0.0.0.0:80" > $BDST/lvnbe.env
echo "LV_NBE_DEBUG=127.0.0.1:82" >> $BDST/lvnbe.env
echo "LV_NBE_DATABASE=/data/lvnbe.db3" >> $BDST/lvnbe.env
cp $BDST/* $FDST