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 | |
| 32 | osmo-clean-workspace.sh |
| 33 | |
| 34 | mkdir "$deps" || true |
| 35 | |
Harald Welte | e7bccba | 2020-12-17 13:39:55 +0100 | [diff] [blame] | 36 | # we assume that PATH includes the path to the respective toolchain |
| 37 | |
| 38 | # firmware build |
| 39 | FW_DIRS="firmware/ice40-riscv/e1-tracer firmware/ice40-riscv/icE1usb" |
| 40 | for d in $FW_DIRS; do |
| 41 | echo |
| 42 | echo "=============== $d FIRMWARE ==============" |
| 43 | make -C $d clean all |
| 44 | done |
| 45 | |
| 46 | # The argument '--publish' is used to trigger publication/upload of firmware |
| 47 | if [ "x$publish" = "x--publish" ]; then |
| 48 | |
| 49 | echo |
| 50 | echo "=============== UPLOAD FIRMWARE ==============" |
| 51 | |
| 52 | cat > "/build/known_hosts" <<EOF |
| 53 | [rita.osmocom.org]:48 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDgQ9HntlpWNmh953a2Gc8NysKE4orOatVT1wQkyzhARnfYUerRuwyNr1GqMyBKdSI9amYVBXJIOUFcpV81niA7zQRUs66bpIMkE9/rHxBd81SkorEPOIS84W4vm3SZtuNqa+fADcqe88Hcb0ZdTzjKILuwi19gzrQyME2knHY71EOETe9Yow5RD2hTIpB5ecNxI0LUKDq+Ii8HfBvndPBIr0BWYDugckQ3Bocf+yn/tn2/GZieFEyFpBGF/MnLbAAfUKIdeyFRX7ufaiWWz5yKAfEhtziqdAGZaXNaLG6gkpy3EixOAy6ZXuTAk3b3Y0FUmDjhOHllbPmTOcKMry9 |
| 54 | [rita.osmocom.org]:48 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPdWn1kEousXuKsZ+qJEZTt/NSeASxCrUfNDW3LWtH+d8Ust7ZuKp/vuyG+5pe5pwpPOgFu7TjN+0lVjYJVXH54= |
| 55 | [rita.osmocom.org]:48 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8iivY70EiR5NiGChV39gRLjNpC8lvu1ZdHtdMw2zuX |
| 56 | EOF |
| 57 | SSH_COMMAND="ssh -o 'UserKnownHostsFile=/build/known_hosts' -p 48" |
| 58 | 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] | 59 | 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] | 60 | 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] | 61 | 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] | 62 | fi |
| 63 | |
| 64 | # manuals build + optional publication |
| 65 | if [ "$WITH_MANUALS" = "1" ]; then |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 66 | osmo-build-dep.sh osmo-gsm-manuals |
Harald Welte | e7bccba | 2020-12-17 13:39:55 +0100 | [diff] [blame] | 67 | make -C doc/manuals clean all |
| 68 | if [ "$PUBLISH" = "1" ]; then |
| 69 | make -C doc/manuals publish |
| 70 | fi |
| 71 | fi |
| 72 | |
| 73 | # gateware build |
| 74 | if [ "$WITH_GATEWARE" = "1" ]; then |
| 75 | GATE_VARS="IGNORE_TIMING=1 SINGLE_CHANNEL=1" |
| 76 | GATE_DIRS="gateware/e1-tracer gateware/icE1usb" |
| 77 | for d in $GATE_DIRS; do |
| 78 | echo |
| 79 | echo "=============== $d GATEWARE ==============" |
| 80 | make -C $d clean |
| 81 | make -C $d ${GATE_VARS} |
| 82 | done |
| 83 | fi |
Harald Welte | a624ef8 | 2020-12-17 17:17:12 +0100 | [diff] [blame] | 84 | |
| 85 | osmo-clean-workspace.sh |