summaryrefslogtreecommitdiff
path: root/utils/tests/mkdtboimg_testdata.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/tests/mkdtboimg_testdata.sh')
-rwxr-xr-xutils/tests/mkdtboimg_testdata.sh108
1 files changed, 108 insertions, 0 deletions
diff --git a/utils/tests/mkdtboimg_testdata.sh b/utils/tests/mkdtboimg_testdata.sh
new file mode 100755
index 0000000..50cafe2
--- /dev/null
+++ b/utils/tests/mkdtboimg_testdata.sh
@@ -0,0 +1,108 @@
+#! /bin/bash
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SRCDIR="data"
+DTS_LIST="
+ board1v1.dts
+ board1v1_1.dts
+ board2v1.dts
+"
+DTB_LIST=(
+ "board1v1.dts.dtb"
+ "board1v1_1.dts.dtb"
+ "board2v1.dts.dtb"
+ "board1v1.dts.dtb"
+)
+CONFIG="${SRCDIR}/mkdtimg.cfg"
+PYCONFIG="${SRCDIR}/mkdtboimg.cfg"
+
+ALIGN=4
+
+OUTDIR="out"
+MKDTIMG_OUT="${OUTDIR}/mkdtimg_out"
+MKDTIMG_DUMP="${MKDTIMG_OUT}"/dump.dtb
+
+MKDTBOIMG_OUT="${OUTDIR}/mkdtboimg_out"
+MKDTBOIMG_OUTCREATE="${MKDTBOIMG_OUT}/create"
+MKDTBOIMG_OUTCFG="${MKDTBOIMG_OUT}/cfg_create"
+MKDTBOIMG_CREATEDUMP="${MKDTBOIMG_OUTCREATE}"/dump.dtb
+MKDTBOIMG_CFGDUMP="${MKDTBOIMG_OUTCFG}"/dump.dtb
+
+mkdir -p "$MKDTIMG_OUT"
+mkdir -p "$MKDTBOIMG_OUTCREATE"
+mkdir -p "$MKDTBOIMG_OUTCFG"
+
+for dts in ${DTS_LIST}; do
+ echo "Building $dts..."
+ src_dts="${SRCDIR}/${dts}"
+ out_dtb="${OUTDIR}/${dts}.dtb"
+ dtc -O dtb -@ -qq -a "$ALIGN" -o "$out_dtb" "$src_dts"
+done
+
+echo "Creating dtbo image with mkdtbimg"
+mkdtimg create ${MKDTIMG_OUT}/create.img --page_size=4096 --id=0x100 \
+ --rev=0x100 --custom0=0xabc "${OUTDIR}/board1v1.dts.dtb" "${OUTDIR}/board1v1_1.dts.dtb" \
+ --id=0xddccbbaa --rev=0x01000100 "${OUTDIR}/board2v1.dts.dtb" --id=0x200 \
+ --rev=0x201 "${OUTDIR}/board1v1.dts.dtb" --custom0=0xdef > /dev/null
+
+echo "Creating dtbo image with mkdtboimg"
+../src/mkdtboimg.py create ${MKDTBOIMG_OUTCREATE}/create.img --page_size=4096 \
+ --id=0x100 --rev=0x100 --custom0=0xabc "${OUTDIR}/board1v1.dts.dtb" \
+ "${OUTDIR}/board1v1_1.dts.dtb" --id=0xddccbbaa --rev=0x01000100 \
+ "${OUTDIR}/board2v1.dts.dtb" --id=0x200 --rev=0x201 \
+ "${OUTDIR}/board1v1.dts.dtb" --custom0=0xdef > /dev/null
+
+echo "Creating dtbo image with ${PYCONFIG} config file"
+../src/mkdtboimg.py cfg_create ${MKDTBOIMG_OUTCFG}/create.img ${PYCONFIG} --dtb-dir "${OUTDIR}"
+
+echo "Dumping fragments from mkdtimg tool image"
+mkdtimg dump ${MKDTIMG_OUT}/create.img -b "${MKDTIMG_DUMP}"| grep -v 'FDT' > ${MKDTIMG_OUT}/create.dump
+
+echo "Dumping fragments from mkdtboimg.py tool for image generated with 'create'"
+../src/mkdtboimg.py dump ${MKDTBOIMG_OUTCREATE}/create.img --output ${MKDTBOIMG_OUTCREATE}/create.dump -b "${MKDTBOIMG_CREATEDUMP}"
+
+echo "Dumping fragments from mkdtboimg.py tool for image generated with 'cfg_create'"
+../src/mkdtboimg.py dump ${MKDTBOIMG_OUTCFG}/create.img --output ${MKDTBOIMG_OUTCFG}/create.dump -b "${MKDTBOIMG_CFGDUMP}"
+
+echo "======================================================================================"
+echo "Testing differences between image created by 'create' for 'mkdtimg' and 'mkdtboimg.py'"
+echo "======================================================================================"
+for x in `ls -1 ${MKDTIMG_DUMP}.*`
+do
+ file=`basename $x`
+ if [ ! -e ${MKDTBOIMG_OUTCREATE}/$file ]
+ then
+ continue
+ fi
+ echo "diff $x vs ${MKDTBOIMG_OUTCREATE}/$file"
+ diff $x ${MKDTBOIMG_OUTCREATE}/$file
+done
+echo "diff ${MKDTIMG_OUT}/create.dump vs ${MKDTBOIMG_OUTCREATE}/create.dump";
+diff ${MKDTIMG_OUT}/create.dump ${MKDTBOIMG_OUTCREATE}/create.dump
+echo "=========================================================================================="
+echo "Testing differences between image created by 'cfg_create' for 'mkdtimg' and 'mkdtboimg.py'"
+echo "=========================================================================================="
+for x in `ls -1 ${MKDTIMG_DUMP}.*`
+do
+ file=`basename $x`
+ if [ ! -e ${MKDTBOIMG_OUTCFG}/$file ]
+ then
+ continue
+ fi
+ echo "diff $x vs ${MKDTBOIMG_OUTCFG}/$file"
+ diff $x ${MKDTBOIMG_OUTCFG}/$file
+done
+echo "diff ${MKDTIMG_OUT}/create.dump vs ${MKDTBOIMG_OUTCFG}/create.dump";
+diff ${MKDTIMG_OUT}/create.dump ${MKDTBOIMG_OUTCFG}/create.dump