-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmk_uboot_env_image
executable file
·57 lines (49 loc) · 1.43 KB
/
mk_uboot_env_image
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
55
56
57
#!/bin/bash
SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $SCRIPTDIR/chip_nand_scripts_common
require mkenvimage "Please install from http://git.denx.de/u-boot.git"
usage() {
echo -e "\n\
usage: $(basename $0) [options] INPUTFILE\n\
\n
options:\n\
-N FILENAME - read nand configuration from FILENAME\n\
-S ENV_SIZE - create environment of ENV_SIZE bytes (default: NAND_ERASE_BLOCK_SIZE)\n\
-d OUTPUTDIR - write file to OUTPUTDIR (default: .)\n\
-o OUTPUTFILE - write to OUTPUTFILE (default: uboot-env-<NAND_EBSIZE>.bin)n\
-h, --help - show this help\n\
\n"
exit 1
}
while getopts ":N:d:o:S:" o; do
case "${o}" in
N)
read_nand_config "${OPTARG}"
;;
S)
size="${OPTARG}"
;;
o)
outputfile=${OPTARG}
;;
d)
outputdir=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
size=${size:-NAND_ERASE_BLOCK_SIZE}
size=${size?Specify either NAND type or environment size}
hexsize=`printf %x $size`
outputdir="${outputdir:-.}"
outputfile="${outputfile:-$outputdir/uboot-env-$hexsize.bin}"
input="${1?No input file given}"
if [ ! -f "${input}" ]; then
echo "$(basename 0): ERROR: input file \"${input}\" does not exist"
exit 1
fi
echo mkenvimage -s $size -o $outputfile $input
mkenvimage -s $size -o $outputfile $input