-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_uhdr.sh
executable file
·81 lines (64 loc) · 1.16 KB
/
add_uhdr.sh
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# $1: image name
# $2: source image
# $3: output image
# $4: arm or riscv
# $5: load address (optional)
# $6: execute address (optional)
# $7: vmlinux used type=kernel
NAME="$1"
SRC="$2"
OUTPUT="$3"
ARCH="$4"
LADDR=$5
RADDR=$6
type=$7
####################
# check if mkimage is available?
# MKIMAGE path could be defined externally (in Yocto - by NATIVE_*)
if [ ! -f "$MKIMAGE" ]; then
MKIMAGE=./tools/mkimage
fi
TYPE=quickboot
function usage()
{
echo "Usage:"
echo "$0 image_name source_image output_image [load_addr] [exec_addr]"
}
#NAME=uboot
#SRC=u-boot.bin
#OUTPUT=u-boot.img
#LADDR=0x08100000
#RADDR=$LADDR
##################
# Check arguments
if [ -z "$NAME" ];then
echo "Missed arg1: name"
usage
exit 1
fi
if [ -z "$SRC" ];then
echo "Missed arg2: source image"
usage
exit 1
fi
if [ -z "$OUTPUT" ];then
echo "Missed arg3: output image"
usage
exit 1
fi
if [ -z "$LADDR" ];then
LADDR=0
fi
if [ -z "$RADDR" ];then
RADDR=0
fi
if [ ! -f "$SRC" ];then
echo "Not found source image: $SRC"
exit 1
fi
if [ ! -z "$type" ];then
TYPE=$7
fi
$MKIMAGE -A $ARCH -O linux -T $TYPE -C none -a $LADDR -e $RADDR -n $NAME -d $SRC $OUTPUT
ls -l $OUTPUT