Harald Welte | e7bccba | 2020-12-17 13:39:55 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # jenkins build helper script for osmo-e1-hardware. This is how we build on jenkins.osmocom.org |
| 3 | # |
| 4 | # environment variables: |
| 5 | # * WITH_MANUALS: build manual PDFs if set to "1" |
| 6 | # * PUBLISH: upload manuals after building if set to "1" (ignored without WITH_MANUALS = "1") |
| 7 | |
Harald Welte | 5ab3bfd | 2020-12-17 17:43:37 +0100 | [diff] [blame] | 8 | # ugly, ugly hack to work around the fact that we cannot _extend_ the path when executing |
| 9 | # a docker container. We can either override it (and loose our /opt/... toolchain paths) |
| 10 | # or we can not specify the /build_bin whcih means the osmo-build-dep.sh is not found |
| 11 | # See https://osmocom.org/issues/4911 |
| 12 | if [ -d /build_bin ]; then |
| 13 | PATH=$PATH:/build_bin |
| 14 | export PATH |
| 15 | fi |
| 16 | |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 17 | if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then |
| 18 | echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !" |
| 19 | exit 2 |
| 20 | fi |
| 21 | |
Harald Welte | e7bccba | 2020-12-17 13:39:55 +0100 | [diff] [blame] | 22 | set -e |
| 23 | |
| 24 | TOPDIR=`pwd` |
| 25 | publish="$1" |
| 26 | |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 27 | base="$PWD" |
| 28 | deps="$base/deps" |
| 29 | inst="$deps/install" |
| 30 | export deps inst |
| 31 | |
Harald Welte | 5a45005 | 2020-12-17 17:52:43 +0100 | [diff] [blame] | 32 | export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" |
| 33 | export LD_LIBRARY_PATH="$inst/lib" |
| 34 | export PATH="$inst/bin:$PATH" |
| 35 | |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 36 | osmo-clean-workspace.sh |
| 37 | |
| 38 | mkdir "$deps" || true |
| 39 | |
Harald Welte | e7bccba | 2020-12-17 13:39:55 +0100 | [diff] [blame] | 40 | # we assume that PATH includes the path to the respective toolchain |
| 41 | |
| 42 | # firmware build |
| 43 | FW_DIRS="firmware/ice40-riscv/e1-tracer firmware/ice40-riscv/icE1usb" |
| 44 | for d in $FW_DIRS; do |
| 45 | echo |
| 46 | echo "=============== $d FIRMWARE ==============" |
| 47 | make -C $d clean all |
| 48 | done |
| 49 | |
| 50 | # The argument '--publish' is used to trigger publication/upload of firmware |
| 51 | if [ "x$publish" = "x--publish" ]; then |
| 52 | |
| 53 | echo |
| 54 | echo "=============== UPLOAD FIRMWARE ==============" |
| 55 | |
| 56 | cat > "/build/known_hosts" <<EOF |
| 57 | [rita.osmocom.org]:48 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDgQ9HntlpWNmh953a2Gc8NysKE4orOatVT1wQkyzhARnfYUerRuwyNr1GqMyBKdSI9amYVBXJIOUFcpV81niA7zQRUs66bpIMkE9/rHxBd81SkorEPOIS84W4vm3SZtuNqa+fADcqe88Hcb0ZdTzjKILuwi19gzrQyME2knHY71EOETe9Yow5RD2hTIpB5ecNxI0LUKDq+Ii8HfBvndPBIr0BWYDugckQ3Bocf+yn/tn2/GZieFEyFpBGF/MnLbAAfUKIdeyFRX7ufaiWWz5yKAfEhtziqdAGZaXNaLG6gkpy3EixOAy6ZXuTAk3b3Y0FUmDjhOHllbPmTOcKMry9 |
| 58 | [rita.osmocom.org]:48 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPdWn1kEousXuKsZ+qJEZTt/NSeASxCrUfNDW3LWtH+d8Ust7ZuKp/vuyG+5pe5pwpPOgFu7TjN+0lVjYJVXH54= |
| 59 | [rita.osmocom.org]:48 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8iivY70EiR5NiGChV39gRLjNpC8lvu1ZdHtdMw2zuX |
| 60 | EOF |
| 61 | SSH_COMMAND="ssh -o 'UserKnownHostsFile=/build/known_hosts' -p 48" |
| 62 | rsync --archive --verbose --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/icE1usb/*-*-*-*.{bin,elf} binaries@rita.osmocom.org:web-files/icE1usb/firmware/all/ |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 63 | rsync --archive --copy-links --verbose --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/icE1usb/icE1usb-fw.{bin,elf} binaries@rita.osmocom.org:web-files/icE1usb/firmware/latest/ |
Harald Welte | e7bccba | 2020-12-17 13:39:55 +0100 | [diff] [blame] | 64 | rsync --archive --verbose --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/e1-tracer/*-*-*-*.{bin,elf} binaries@rita.osmocom.org:web-files/e1-tracer/firmware/all/ |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 65 | rsync --verbose --copy-links --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/e1-tracer/e1_tracer-fw.{bin,elf} binaries@rita.osmocom.org:web-files/e1-tracer/firmware/latest/ |
Harald Welte | e7bccba | 2020-12-17 13:39:55 +0100 | [diff] [blame] | 66 | fi |
| 67 | |
| 68 | # manuals build + optional publication |
| 69 | if [ "$WITH_MANUALS" = "1" ]; then |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 70 | osmo-build-dep.sh osmo-gsm-manuals |
Harald Welte | e7bccba | 2020-12-17 13:39:55 +0100 | [diff] [blame] | 71 | make -C doc/manuals clean all |
| 72 | if [ "$PUBLISH" = "1" ]; then |
| 73 | make -C doc/manuals publish |
| 74 | fi |
| 75 | fi |
| 76 | |
| 77 | # gateware build |
| 78 | if [ "$WITH_GATEWARE" = "1" ]; then |
| 79 | GATE_VARS="IGNORE_TIMING=1 SINGLE_CHANNEL=1" |
| 80 | GATE_DIRS="gateware/e1-tracer gateware/icE1usb" |
| 81 | for d in $GATE_DIRS; do |
| 82 | echo |
| 83 | echo "=============== $d GATEWARE ==============" |
| 84 | make -C $d clean |
| 85 | make -C $d ${GATE_VARS} |
| 86 | done |
| 87 | fi |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 88 | |
| 89 | osmo-clean-workspace.sh |