PKGBUILDs/core/linux-aarch64-rc/generate_chromebook_its.sh
Alexandru M Stan 5784aa4823 core/linux-aarch64-rc to 5.12.rc3-3
Changed logic for gathering dtb list to just use a wildcard for boards
that we're interested in.

Changed generate_chromebook_its.sh logic to just take in scattered dtb
files.

Compressed all input files that go into the .its
Here are some comparisons:
	none: 37M
	lz4: 17M < chosen in this commit
	lzma: ~10M but boots 1 second slower

Since it's compressed the .its now had to include external compatible
properties, used `fdtget .dtb / compatible`.
2021-03-17 17:40:23 -06:00

67 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
image=$1
arch=$2
compression=$3
read -a dtb_list
cat <<-ITS_HEADER_END
/dts-v1/;
/ {
description = "Chrome OS kernel image with one or more FDT blobs";
images {
kernel@1{
description = "kernel";
data = /incbin/("${image}");
type = "kernel_noload";
arch = "${arch}";
os = "linux";
compression = "${compression}";
load = <0>;
entry = <0>;
};
ITS_HEADER_END
for i in ${!dtb_list[@]}; do
dtb=${dtb_list[${i}]}
cat <<-FDT_END
fdt@$(expr ${i} + 1){
description = "$(basename ${dtb})";
data = /incbin/("${dtb}");
type = "flat_dt";
arch = "${arch}";
compression = "${compression}";
hash@1{
algo = "sha1";
};
};
FDT_END
done
cat <<-ITS_MIDDLE_END
};
configurations {
default = "conf@1";
ITS_MIDDLE_END
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
cat <<-ITS_CONF_END
conf@$(expr ${i} + 1){
kernel = "kernel@1";
fdt = "fdt@$(expr ${i} + 1)";
compatible = ${compat_line%,};
};
ITS_CONF_END
done
cat <<-ITS_FOOTER_END
};
};
ITS_FOOTER_END