Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | # SPDX-FileCopyrightText: Andrei Gherzan <andrei.gherzan@huawei.com> |
| 4 | # |
| 5 | # SPDX-License-Identifier: MIT |
| 6 | |
| 7 | set -ex |
| 8 | |
| 9 | # shellcheck disable=SC1091 |
| 10 | . /utils.sh |
| 11 | |
| 12 | META_RASPBERRYPI_PATH="/work" |
| 13 | |
| 14 | [ -n "$BASE_REF" ] || |
| 15 | error "Target branch is needed. Make sure that is set in BASE_REF." |
| 16 | [ -d "$META_RASPBERRYPI_PATH/.git" ] || |
| 17 | error "Can't find a git checkout under $META_RASPBERRYPI_PATH ." |
| 18 | [ -n "$MACHINE" ] || |
| 19 | error "Machine to be used for build not provided." |
| 20 | [ -n "$IMAGE" ] || |
| 21 | error "Image to build not provided." |
| 22 | |
| 23 | TEMP_DIR="$(mktemp -d)" |
| 24 | cd "$TEMP_DIR" |
| 25 | |
| 26 | REPOS=" \ |
| 27 | git://git.yoctoproject.org/poky.git \ |
| 28 | " |
| 29 | for repo in $REPOS; do |
| 30 | log "Cloning $repo on branch $BASE_REF..." |
| 31 | git clone --depth 1 --branch "$BASE_REF" "$repo" |
| 32 | done |
| 33 | |
| 34 | # shellcheck disable=SC1091,SC2240 |
| 35 | . ./poky/oe-init-build-env build |
| 36 | |
| 37 | # Build configuration |
| 38 | printf "\n# ------ ci ------\n" >> conf/local.conf |
| 39 | [ -z "$SSTATE_DIR" ] || echo SSTATE_DIR = \""$SSTATE_DIR"\" >> conf/local.conf |
| 40 | [ -z "$DL_DIR" ] || echo DL_DIR = \""$DL_DIR"\" >> conf/local.conf |
| 41 | [ -z "$DISTRO" ] || echo DISTRO = \""$DISTRO"\" >> conf/local.conf |
| 42 | cat <<EOCONF >>conf/local.conf |
| 43 | BB_NUMBER_THREADS = "6" |
| 44 | PARALLEL_MAKE = "-j 6" |
| 45 | DISTRO_FEATURES:append = " systemd" |
| 46 | VIRTUAL-RUNTIME_init_manager = "systemd" |
| 47 | DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" |
| 48 | VIRTUAL-RUNTIME_initscripts = "systemd-compat-units" |
| 49 | EOCONF |
| 50 | |
| 51 | # Add the BSP layer |
| 52 | bitbake-layers add-layer "$META_RASPBERRYPI_PATH" |
| 53 | |
| 54 | # Log configs for debugging purposes |
| 55 | for f in 'conf/local.conf' 'conf/bblayers.conf'; do |
| 56 | printf "\n------ %s ------\n" "$f" |
| 57 | cat "$f" |
| 58 | done |
| 59 | |
| 60 | # Fire! |
| 61 | MACHINE="$MACHINE" bitbake "$IMAGE" |