rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
common_script_read_meta_env.inc
Go to the documentation of this file.
1#!/bin/bash
2
3# this script is supposed to be executed from within 'firmware' folder
4
5if [ -z "$1" ]; then
6 echo "Read meta.env: The file path was not given as a parameter!"
7 exit -3
8fi
9
10BOARD_META_PATH=./$1
11
12
13if [ -z "${BOARD_DIR}" ]; then
14 # magical version of BOARD_DIR=$(dirname "$BOARD_META_PATH")
15 export BOARD_DIR="${BOARD_META_PATH%/*}"
16 echo "common_script_read_meta_env.inc: BOARD_DIR was empty. Setting to fallback: $BOARD_DIR"
17fi
18
19if [ ! -f ${BOARD_META_PATH} ]; then
20 echo "Read $BOARD_META_PATH: The file was not found!"
21 exit -4
22fi
23
24if [ ! -f ${BOARD_DIR}/board.mk ]; then
25 echo "WARNING! board.mk not found @ ${BOARD_DIR}..."
26fi
27
28echo "[META] Reading meta env from ${BOARD_META_PATH}"
29
30VARS=$(grep "=" "$BOARD_META_PATH")
31
32while IFS= read -r L; do
33 # get the key and delete all spaces
34 K=$(echo "$L" | cut -d '=' -f "-1" | tr -d ' ')
35 # get the value and delete any leading space
36 V=$(echo "$L" | cut -d '=' -f "2-" | awk '{$1=$1};1')
37 # put them together, closing the value in quotes
38 export $K="$V"
39done <<< "$VARS"
40
41if [ -z "$BUNDLE_NAME" ]; then
42 BUNDLE_NAME=$(echo "$BOARD_META_PATH" | sed -n 's/.*meta-info-\‍(.*\‍)\.env/\1/p')
43 if [ -z "$BUNDLE_NAME" ]; then
44 export BUNDLE_NAME="$SHORT_BOARD_NAME"
45 else
46 export BUNDLE_NAME
47 fi
48fi
49
50echo "[META] PROJECT_BOARD=${PROJECT_BOARD}"
51echo "[META] PROJECT_CPU=${PROJECT_CPU}"
52echo "[META] POST_BUILD_SCRIPT=${POST_BUILD_SCRIPT}"
53echo "[META] BOARD_DIR=${BOARD_DIR}"
54echo "[META] USE_OPENBLT=${USE_OPENBLT}"
static bool read(void *instance, uint32_t startblk, uint8_t *buffer, uint32_t)
static void echo(int value)
This is just a test function.