2021-03-07 23:36:12 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-03-17 05:34:19 +00:00
|
|
|
image=$1
|
|
|
|
arch=$2
|
|
|
|
compression=$3
|
|
|
|
read -a dtb_list
|
2021-03-07 23:36:12 +00:00
|
|
|
|
|
|
|
cat <<-ITS_HEADER_END
|
|
|
|
/dts-v1/;
|
|
|
|
|
|
|
|
/ {
|
|
|
|
description = "Chrome OS kernel image with one or more FDT blobs";
|
|
|
|
images {
|
|
|
|
kernel@1{
|
|
|
|
description = "kernel";
|
2021-03-17 05:34:19 +00:00
|
|
|
data = /incbin/("${image}");
|
2021-03-07 23:36:12 +00:00
|
|
|
type = "kernel_noload";
|
2021-03-17 05:34:19 +00:00
|
|
|
arch = "${arch}";
|
2021-03-07 23:36:12 +00:00
|
|
|
os = "linux";
|
2021-03-17 05:34:19 +00:00
|
|
|
compression = "${compression}";
|
2021-03-07 23:36:12 +00:00
|
|
|
load = <0>;
|
|
|
|
entry = <0>;
|
|
|
|
};
|
|
|
|
ITS_HEADER_END
|
|
|
|
|
2021-03-17 05:34:19 +00:00
|
|
|
for i in ${!dtb_list[@]}; do
|
|
|
|
dtb=${dtb_list[${i}]}
|
2021-03-07 23:36:12 +00:00
|
|
|
cat <<-FDT_END
|
2021-03-17 05:34:19 +00:00
|
|
|
fdt@$(expr ${i} + 1){
|
|
|
|
description = "$(basename ${dtb})";
|
|
|
|
data = /incbin/("${dtb}");
|
2021-03-07 23:36:12 +00:00
|
|
|
type = "flat_dt";
|
2021-03-17 05:34:19 +00:00
|
|
|
arch = "${arch}";
|
|
|
|
compression = "${compression}";
|
2021-03-07 23:36:12 +00:00
|
|
|
hash@1{
|
|
|
|
algo = "sha1";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
FDT_END
|
|
|
|
done
|
|
|
|
|
|
|
|
cat <<-ITS_MIDDLE_END
|
|
|
|
};
|
|
|
|
configurations {
|
|
|
|
default = "conf@1";
|
|
|
|
ITS_MIDDLE_END
|
|
|
|
|
2021-03-17 05:34:19 +00:00
|
|
|
for i in "${!dtb_list[@]}"; do
|
|
|
|
compat_line=""
|
|
|
|
dtb_uncompressed=$(echo ${dtb_list[${i}]} | sed "s/\(\.dtb\).*/\1/g")
|
|
|
|
for compat in $(fdtget "${dtb_uncompressed}" / compatible); do
|
|
|
|
compat_line+="\"${compat}\","
|
|
|
|
done
|
2021-03-07 23:36:12 +00:00
|
|
|
cat <<-ITS_CONF_END
|
2021-03-17 05:34:19 +00:00
|
|
|
conf@$(expr ${i} + 1){
|
2021-03-07 23:36:12 +00:00
|
|
|
kernel = "kernel@1";
|
2021-03-17 05:34:19 +00:00
|
|
|
fdt = "fdt@$(expr ${i} + 1)";
|
|
|
|
compatible = ${compat_line%,};
|
2021-03-07 23:36:12 +00:00
|
|
|
};
|
|
|
|
ITS_CONF_END
|
|
|
|
done
|
|
|
|
|
|
|
|
cat <<-ITS_FOOTER_END
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ITS_FOOTER_END
|