summaryrefslogtreecommitdiffstats
path: root/tests/make_uboot_v2_env
blob: 93d55c30e85120dcf46b80c44a4b9ad13aa28fe6 (plain)
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
#!/bin/bash

set -e
PTXDIST_SETENV_U_BOOT_V2_ENV="${1}"
ENVTMPDIR="$(mktemp -d "${PTXDIST_TEMPDIR}/uboot_v2_env.XXXXXX")"

# IMAGEDIR is not set if we are called from "ptxdist test" directly
# since it comes from kwraper.
[ -z "${IMAGEDIR}" ] && export IMAGEDIR=${PTXDIST_PLATFORMDIR}/images

if [ ! -r ${PTXDIST_PLATFORMCONFIGDIR}/u-boot-env/config ]; then
	echo "ERROR: missing valid ${PTXDIST_PLATFORMCONFIGDIR}/u-boot-env/config" >&2
	exit 1
fi

tar -C "${PTXDIST_PLATFORMCONFIGDIR}/u-boot-env/" -c . \
	--exclude .svn \
	--exclude .pc \
	--exclude .git \
	--exclude "config.in" \
	--exclude "*/*~" \
	| tar -C "${ENVTMPDIR}" -x

ubootenv -s "${ENVTMPDIR}" "${IMAGEDIR}/u-boot-v2-environment"

# only copy the image if we are called by "ptxdist test setenv"
[ -n "${PTXDIST_SETENV_U_BOOT_V2_ENV}" ] && cp "${IMAGEDIR}/u-boot-v2-environment" "${PTXDIST_SETENV_U_BOOT_V2_ENV}"

rm -rf "${ENVTMPDIR}"