-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmk_uboot_image
executable file
·53 lines (45 loc) · 1.21 KB
/
mk_uboot_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
#!/bin/bash
SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $SCRIPTDIR/chip_nand_scripts_common
# build the bootloader image
prepare_uboot() {
local paddeduboot=$1
local uboot=$2
local eraseblocksize=$3
local ebsize=$4
echo dd if=$uboot of=$paddeduboot bs=$eraseblocksize conv=sync
dd if=$uboot of=$paddeduboot bs=$eraseblocksize conv=sync
}
usage() {
echo -e "\n\
usage: $(basename $0) [options] INPUTFILE\n\
\n
options:\n\
-N FILENAME - read nand configuration from FILENAME\n\
-d OUTPUTDIR - write file to OUTPUTDIR (default: .)\n\
-o OUTPUTFILE - write to OUTPUTFILE (default: uboot-<NAND_EBSIZE>.bin)n\
-h, --help - show this help\n\
\n"
exit 1
}
while getopts ":N:d:o:" o; do
case "${o}" in
N)
read_nand_config "${OPTARG}"
;;
o)
outputfile=${OPTARG}
;;
d)
outputdir=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
outputdir="${outputdir:-.}"
outputfile="${outputfile:-$outputdir/uboot-$NAND_EBSIZE.bin}"
inputfile="$1"
prepare_uboot "${outputfile}" "${inputfile}" $NAND_ERASE_BLOCK_SIZE $NAND_EBSIZE