generic: rtl8366: make rtl8366_set_vlan static
[openwrt.git] / target / linux / mpc83xx / files / scripts / mkits.sh
1 #!/bin/bash
2 #
3 # Licensed under the terms of the GNU GPL License version 2 or later.
4 #
5 # Author: Peter Tyser <ptyser@xes-inc.com>
6 #
7 # U-Boot firmware supports the booting of images in the Flattened Image
8 # Tree (FIT) format. The FIT format uses a device tree structure to
9 # describe a kernel image, device tree blob, ramdisk, etc. This script
10 # creates an Image Tree Source (.its file) which can be passed to the
11 # 'mkimage' utility to generate an Image Tree Blob (.itb file). The .itb
12 # file can then be booted by U-Boot (or other bootloaders which support
13 # FIT images). See doc/uImage.FIT/howto.txt in U-Boot source code for
14 # additional information on FIT images.
15 #
16
17 usage() {
18 echo "Usage: `basename $0` -A arch -C comp -a addr -e entry" \
19 "-v version -k kernel [-d dtb] -o its_file"
20 echo -e "\t-A ==> set architecture to 'arch'"
21 echo -e "\t-C ==> set compression type 'comp'"
22 echo -e "\t-a ==> set load address to 'addr' (hex)"
23 echo -e "\t-e ==> set entry point to 'entry' (hex)"
24 echo -e "\t-v ==> set kernel version to 'version'"
25 echo -e "\t-k ==> include kernel image 'kernel'"
26 echo -e "\t-d ==> include Device Tree Blob 'dtb'"
27 echo -e "\t-o ==> create output file 'its_file'"
28 exit 1
29 }
30
31 while getopts ":A:C:a:d:e:k:o:v:" OPTION
32 do
33 case $OPTION in
34 A ) ARCH=$OPTARG;;
35 C ) COMPRESS=$OPTARG;;
36 a ) LOAD_ADDR=$OPTARG;;
37 d ) DTB=$OPTARG;;
38 e ) ENTRY_ADDR=$OPTARG;;
39 k ) KERNEL=$OPTARG;;
40 o ) OUTPUT=$OPTARG;;
41 v ) VERSION=$OPTARG;;
42 * ) echo "Invalid option passed to '$0' (options:$@)"
43 usage;;
44 esac
45 done
46
47 # Make sure user entered all required parameters
48 if [ -z "${ARCH}" ] || [ -z "${COMPRESS}" ] || [ -z "${LOAD_ADDR}" ] || \
49 [ -z "${ENTRY_ADDR}" ] || [ -z "${VERSION}" ] || [ -z "${KERNEL}" ] || \
50 [ -z "${OUTPUT}" ]; then
51 usage
52 fi
53
54 # Create a default, fully populated DTS file
55 DATA="/dts-v1/;
56
57 / {
58 description = \"Linux kernel ${VERSION}\";
59 #address-cells = <1>;
60
61 images {
62 kernel@1 {
63 description = \"Linux Kernel ${VERSION}\";
64 data = /incbin/(\"${KERNEL}\");
65 type = \"kernel\";
66 arch = \"${ARCH}\";
67 os = \"linux\";
68 compression = \"${COMPRESS}\";
69 load = <${LOAD_ADDR}>;
70 entry = <${ENTRY_ADDR}>;
71 hash@1 {
72 algo = \"crc32\";
73 };
74 hash@2 {
75 algo = \"sha1\";
76 };
77 };
78
79 fdt@1 { /* start fdt */
80 description = \"Flattened Device Tree blob\";
81 data = /incbin/(\"${DTB}\");
82 type = \"flat_dt\";
83 arch = \"${ARCH}\";
84 compression = \"none\";
85 hash@1 {
86 algo = \"crc32\";
87 };
88 hash@2 {
89 algo = \"sha1\";
90 };
91 }; /* end fdt */
92 };
93
94 configurations {
95 default = \"config@1\";
96 config@1 {
97 description = \"Default Linux kernel\";
98 kernel = \"kernel@1\";
99 fdt = \"fdt@1\";
100 };
101 };
102 };"
103
104 # Conditionally strip fdt information out of tree
105 if [ -z "${DTB}" ]; then
106 DATA=`echo "$DATA" | sed '/start fdt/,/end fdt/d'`
107 DATA=`echo "$DATA" | sed '/fdt/d'`
108 fi
109
110 # Write .its file to disk
111 echo "$DATA" > ${OUTPUT}
This page took 0.050759 seconds and 5 git commands to generate.