summaryrefslogtreecommitdiff
path: root/post-build-create-image-manifest.sh
blob: 41b3506e50345458448f8bdac470864e285b1425 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

usage()
{
    cat << EOF
usage: $0 options

This script should be run at the end of a Linaro OpenEmbedded build,
to prepare the 'output' folder

OPTIONS:
   -h      Show this message
   -v      Verbose output
EOF
}


while getopts “hv” OPTION
do
	case $OPTION in
		h)
			usage
			exit
			;;
		v)
			set -x
			;;
	esac
done

if [ -n "${WORKSPACE}" ]; then
	test -d ${WORKSPACE}/out || mkdir -p ${WORKSPACE}/out
	rm -rf ${WORKSPACE}/out/*
	oe_init_build_env=`find . -maxdepth 2 -type f -name oe-init-build-env`
	source ${oe_init_build_env} build
	deploy_dir_image=`bitbake -e | grep "^DEPLOY_DIR_IMAGE="| cut -d'=' -f2 | tr -d '"'`
	license_directory=`bitbake -e | grep "^LICENSE_DIRECTORY="| cut -d'=' -f2 | tr -d '"'`
	license_manifests=`find ${license_directory} -type f -name 'license.manifest'`
	for manifest in ${license_manifests}
	do
		image_name=`dirname ${manifest}`
		image_name=`basename ${image_name}`
		cp -a ${manifest} ${WORKSPACE}/out/${image_name}.manifest
		mv ${deploy_dir_image}/${image_name}.* ${WORKSPACE}/out
	done

	# export modules archives and kernel image, if any
	for f in `find ${deploy_dir_image} -name modules-\* -o -name uImage-\* -o -name zImage-\* -o -name bzImage-\*`
	do
		if ! [ -h $f ] ; then
			cp -a $f ${WORKSPACE}/out
		fi
	done
fi