Skip to content

Commit f9f72a9

Browse files
committed
github: dry run test with VIP table generation
Run QDL in dry-run mode for a synthetic FLAT build reference with VIP table generation. The FLAT build contains: - patch0.xml - patch1.xml - rawprogram0.xml - rawprogram1.xml All binaries that these XML files point to are filled with zeros, generated during github action execution. Ensure the table is generated correctly by comparing calculated and expected SHA256 hashes of DigestToSign.bin file. Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
1 parent ad123a9 commit f9f72a9

File tree

7 files changed

+149
-0
lines changed

7 files changed

+149
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
4+
create_file_with_size() {
5+
filename="$1"
6+
size_kbytes="$2"
7+
8+
dd if=/dev/zero of="$filename" bs=1024 count="$size_kbytes" status=none
9+
}
10+
11+
create_file_with_size prog_firehose_ddr.elf 20
12+
create_file_with_size efi.bin 524288
13+
create_file_with_size gpt_backup0.bin 20
14+
create_file_with_size gpt_backup1.bin 20
15+
create_file_with_size gpt_main0.bin 24
16+
create_file_with_size gpt_main1.bin 24
17+
create_file_with_size rootfs.img 512000
18+
create_file_with_size xbl_config.elf 320
19+
create_file_with_size xbl.elf 800

.github/dry-run-test/patch0.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" ?>
2+
<patches>
3+
<!--NOTE: This is an ** Autogenerated file **-->
4+
<!--NOTE: Patching is in little endian format, i.e. 0xAABBCCDD will look like DD CC BB AA in the file or on disk-->
5+
<!--NOTE: This file is used by Trace32 - So make sure to add decimals, i.e. 0x10-10=0, *but* 0x10-10.=6.-->
6+
<patch start_sector="2" byte_offset="168" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="gpt_main0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update last partition 2 'rootfs' with actual size in Primary Header."/>
7+
<patch start_sector="2" byte_offset="168" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update last partition 2 'rootfs' with actual size in Primary Header."/>
8+
<patch start_sector="0" byte_offset="168" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="gpt_backup0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update last partition 2 'rootfs' with actual size in Backup Header."/>
9+
<patch start_sector="NUM_DISK_SECTORS-5." byte_offset="168" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update last partition 2 'rootfs' with actual size in Backup Header."/>
10+
<patch start_sector="1" byte_offset="48" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="gpt_main0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with LastUseableLBA."/>
11+
<patch start_sector="1" byte_offset="48" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with LastUseableLBA."/>
12+
<patch start_sector="4" byte_offset="48" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="gpt_backup0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with LastUseableLBA."/>
13+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="48" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with LastUseableLBA."/>
14+
<patch start_sector="1" byte_offset="32" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-1." filename="gpt_main0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with BackupGPT Header Location."/>
15+
<patch start_sector="1" byte_offset="32" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-1." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with BackupGPT Header Location."/>
16+
<patch start_sector="4" byte_offset="24" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-1." filename="gpt_backup0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CurrentLBA."/>
17+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="24" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-1." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CurrentLBA."/>
18+
<patch start_sector="4" byte_offset="72" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-5." filename="gpt_backup0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with Partition Array Location."/>
19+
<patch start_sector="NUM_DISK_SECTORS-1" byte_offset="72" physical_partition_number="0" size_in_bytes="8" value="NUM_DISK_SECTORS-5." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with Partition Array Location."/>
20+
<patch start_sector="1" byte_offset="88" physical_partition_number="0" size_in_bytes="4" value="CRC32(2,4096)" filename="gpt_main0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with CRC of Partition Array."/>
21+
<patch start_sector="1" byte_offset="88" physical_partition_number="0" size_in_bytes="4" value="CRC32(2,4096)" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with CRC of Partition Array."/>
22+
<patch start_sector="4" byte_offset="88" physical_partition_number="0" size_in_bytes="4" value="CRC32(0,4096)" filename="gpt_backup0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CRC of Partition Array."/>
23+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="88" physical_partition_number="0" size_in_bytes="4" value="CRC32(NUM_DISK_SECTORS-5.,4096)" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CRC of Partition Array."/>
24+
<patch start_sector="1" byte_offset="16" physical_partition_number="0" size_in_bytes="4" value="0" filename="gpt_main0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Zero Out Header CRC in Primary Header."/>
25+
<patch start_sector="1" byte_offset="16" physical_partition_number="0" size_in_bytes="4" value="CRC32(1,92)" filename="gpt_main0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with CRC of Primary Header."/>
26+
<patch start_sector="1" byte_offset="16" physical_partition_number="0" size_in_bytes="4" value="0" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Zero Out Header CRC in Primary Header."/>
27+
<patch start_sector="1" byte_offset="16" physical_partition_number="0" size_in_bytes="4" value="CRC32(1,92)" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with CRC of Primary Header."/>
28+
<patch start_sector="4" byte_offset="16" physical_partition_number="0" size_in_bytes="4" value="0" filename="gpt_backup0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Zero Out Header CRC in Backup Header."/>
29+
<patch start_sector="4" byte_offset="16" physical_partition_number="0" size_in_bytes="4" value="CRC32(4,92)" filename="gpt_backup0.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CRC of Backup Header."/>
30+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="16" physical_partition_number="0" size_in_bytes="4" value="0" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Zero Out Header CRC in Backup Header."/>
31+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="16" physical_partition_number="0" size_in_bytes="4" value="CRC32(NUM_DISK_SECTORS-1.,92)" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CRC of Backup Header."/>
32+
</patches>

.github/dry-run-test/patch1.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" ?>
2+
<patches>
3+
<!--NOTE: This is an ** Autogenerated file **-->
4+
<!--NOTE: Patching is in little endian format, i.e. 0xAABBCCDD will look like DD CC BB AA in the file or on disk-->
5+
<!--NOTE: This file is used by Trace32 - So make sure to add decimals, i.e. 0x10-10=0, *but* 0x10-10.=6.-->
6+
<patch start_sector="2" byte_offset="552" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="gpt_main1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update last partition 5 'last_parti' with actual size in Primary Header."/>
7+
<patch start_sector="2" byte_offset="552" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update last partition 5 'last_parti' with actual size in Primary Header."/>
8+
<patch start_sector="0" byte_offset="552" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="gpt_backup1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update last partition 5 'last_parti' with actual size in Backup Header."/>
9+
<patch start_sector="NUM_DISK_SECTORS-5." byte_offset="552" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update last partition 5 'last_parti' with actual size in Backup Header."/>
10+
<patch start_sector="1" byte_offset="48" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="gpt_main1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with LastUseableLBA."/>
11+
<patch start_sector="1" byte_offset="48" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with LastUseableLBA."/>
12+
<patch start_sector="4" byte_offset="48" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="gpt_backup1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with LastUseableLBA."/>
13+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="48" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-6." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with LastUseableLBA."/>
14+
<patch start_sector="1" byte_offset="32" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-1." filename="gpt_main1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with BackupGPT Header Location."/>
15+
<patch start_sector="1" byte_offset="32" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-1." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with BackupGPT Header Location."/>
16+
<patch start_sector="4" byte_offset="24" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-1." filename="gpt_backup1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CurrentLBA."/>
17+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="24" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-1." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CurrentLBA."/>
18+
<patch start_sector="4" byte_offset="72" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-5." filename="gpt_backup1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with Partition Array Location."/>
19+
<patch start_sector="NUM_DISK_SECTORS-1" byte_offset="72" physical_partition_number="1" size_in_bytes="8" value="NUM_DISK_SECTORS-5." filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with Partition Array Location."/>
20+
<patch start_sector="1" byte_offset="88" physical_partition_number="1" size_in_bytes="4" value="CRC32(2,4096)" filename="gpt_main1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with CRC of Partition Array."/>
21+
<patch start_sector="1" byte_offset="88" physical_partition_number="1" size_in_bytes="4" value="CRC32(2,4096)" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with CRC of Partition Array."/>
22+
<patch start_sector="4" byte_offset="88" physical_partition_number="1" size_in_bytes="4" value="CRC32(0,4096)" filename="gpt_backup1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CRC of Partition Array."/>
23+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="88" physical_partition_number="1" size_in_bytes="4" value="CRC32(NUM_DISK_SECTORS-5.,4096)" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CRC of Partition Array."/>
24+
<patch start_sector="1" byte_offset="16" physical_partition_number="1" size_in_bytes="4" value="0" filename="gpt_main1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Zero Out Header CRC in Primary Header."/>
25+
<patch start_sector="1" byte_offset="16" physical_partition_number="1" size_in_bytes="4" value="CRC32(1,92)" filename="gpt_main1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with CRC of Primary Header."/>
26+
<patch start_sector="1" byte_offset="16" physical_partition_number="1" size_in_bytes="4" value="0" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Zero Out Header CRC in Primary Header."/>
27+
<patch start_sector="1" byte_offset="16" physical_partition_number="1" size_in_bytes="4" value="CRC32(1,92)" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Primary Header with CRC of Primary Header."/>
28+
<patch start_sector="4" byte_offset="16" physical_partition_number="1" size_in_bytes="4" value="0" filename="gpt_backup1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Zero Out Header CRC in Backup Header."/>
29+
<patch start_sector="4" byte_offset="16" physical_partition_number="1" size_in_bytes="4" value="CRC32(4,92)" filename="gpt_backup1.bin" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CRC of Backup Header."/>
30+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="16" physical_partition_number="1" size_in_bytes="4" value="0" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Zero Out Header CRC in Backup Header."/>
31+
<patch start_sector="NUM_DISK_SECTORS-1." byte_offset="16" physical_partition_number="1" size_in_bytes="4" value="CRC32(NUM_DISK_SECTORS-1.,92)" filename="DISK" SECTOR_SIZE_IN_BYTES="4096" what="Update Backup Header with CRC of Backup Header."/>
32+
</patches>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" ?>
2+
<data>
3+
<!--NOTE: This is an ** Autogenerated file **-->
4+
<!--NOTE: Sector size is 4096bytes-->
5+
<program start_sector="6" size_in_KB="524288.0" physical_partition_number="0" partofsingleimage="false" file_sector_offset="0" num_partition_sectors="131072" readbackverify="false" filename="efi.bin" sparse="false" start_byte_hex="0x6000" SECTOR_SIZE_IN_BYTES="4096" label="efi"/>
6+
<program start_sector="131078" size_in_KB="0" physical_partition_number="0" partofsingleimage="false" file_sector_offset="0" num_partition_sectors="0" readbackverify="false" filename="rootfs.img" sparse="false" start_byte_hex="0x20006000" SECTOR_SIZE_IN_BYTES="4096" label="rootfs"/>
7+
<program start_sector="0" size_in_KB="24.0" physical_partition_number="0" partofsingleimage="true" file_sector_offset="0" num_partition_sectors="6" readbackverify="false" filename="gpt_main0.bin" sparse="false" start_byte_hex="0x0" SECTOR_SIZE_IN_BYTES="4096" label="PrimaryGPT"/>
8+
<program start_sector="NUM_DISK_SECTORS-5." size_in_KB="20.0" physical_partition_number="0" partofsingleimage="true" file_sector_offset="0" num_partition_sectors="5" readbackverify="false" filename="gpt_backup0.bin" sparse="false" start_byte_hex="(4096*NUM_DISK_SECTORS)-20480." SECTOR_SIZE_IN_BYTES="4096" label="BackupGPT"/>
9+
</data>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
<data>
3+
<!--NOTE: This is an ** Autogenerated file **-->
4+
<!--NOTE: Sector size is 4096bytes-->
5+
<program start_sector="6" size_in_KB="3604.0" physical_partition_number="1" partofsingleimage="false" file_sector_offset="0" num_partition_sectors="901" readbackverify="false" filename="xbl.elf" sparse="false" start_byte_hex="0x6000" SECTOR_SIZE_IN_BYTES="4096" label="xbl_a"/>
6+
<program start_sector="907" size_in_KB="512.0" physical_partition_number="1" partofsingleimage="false" file_sector_offset="0" num_partition_sectors="128" readbackverify="false" filename="xbl_config.elf" sparse="false" start_byte_hex="0x38b000" SECTOR_SIZE_IN_BYTES="4096" label="xbl_config_a"/>
7+
<program start_sector="1035" size_in_KB="3604.0" physical_partition_number="1" partofsingleimage="false" file_sector_offset="0" num_partition_sectors="901" readbackverify="false" filename="" sparse="false" start_byte_hex="0x40b000" SECTOR_SIZE_IN_BYTES="4096" label="xbl_b"/>
8+
<program start_sector="1936" size_in_KB="512.0" physical_partition_number="1" partofsingleimage="false" file_sector_offset="0" num_partition_sectors="128" readbackverify="false" filename="" sparse="false" start_byte_hex="0x790000" SECTOR_SIZE_IN_BYTES="4096" label="xbl_config_b"/>
9+
<program start_sector="2064" size_in_KB="0" physical_partition_number="1" partofsingleimage="false" file_sector_offset="0" num_partition_sectors="0" readbackverify="false" filename="" sparse="false" start_byte_hex="0x810000" SECTOR_SIZE_IN_BYTES="4096" label="last_parti"/>
10+
<program start_sector="0" size_in_KB="24.0" physical_partition_number="1" partofsingleimage="true" file_sector_offset="0" num_partition_sectors="6" readbackverify="false" filename="gpt_main1.bin" sparse="false" start_byte_hex="0x0" SECTOR_SIZE_IN_BYTES="4096" label="PrimaryGPT"/>
11+
<program start_sector="NUM_DISK_SECTORS-5." size_in_KB="20.0" physical_partition_number="1" partofsingleimage="true" file_sector_offset="0" num_partition_sectors="5" readbackverify="false" filename="gpt_backup1.bin" sparse="false" start_byte_hex="(4096*NUM_DISK_SECTORS)-20480." SECTOR_SIZE_IN_BYTES="4096" label="BackupGPT"/>
12+
</data>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
4+
SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
5+
REP_ROOT=$SCRIPT_PATH/../..
6+
VIP_PATH=${SCRIPT_PATH}/vip
7+
EXPECTED_DIGEST="4e13981189ede380172369aa0a4847ca3c9a4e2795733bca90ec1b1e713972ea"
8+
9+
mkdir -p ${VIP_PATH}
10+
${REP_ROOT}/qdl --debug --dry-run --create-digests=${VIP_PATH} prog_firehose_ddr.elf rawprogram*.xml patch*.xml
11+
12+
if command -v sha256sum >/dev/null 2>&1; then
13+
shacmd="sha256sum"
14+
elif command -v shasum >/dev/null 2>&1; then
15+
shacmd="shasum -a 256"
16+
else
17+
echo "No SHA-256 checksum tool found (need 'sha256sum' or 'shasum')"
18+
exit 1
19+
fi
20+
21+
actual_digest=`${shacmd} "${VIP_PATH}/DigestsToSign.bin" | cut -d ' ' -f1`
22+
if [ "$actual_digest" = "${EXPECTED_DIGEST}" ]; then
23+
echo "VIP tables are generated successfully and validated"
24+
exit 0
25+
else
26+
echo "Expected SHA256 digest of DigestsToSign.bin file is ${EXPECTED_DIGEST}"
27+
echo "Calculated SHA256 digest of DigestsToSign.bin file is $actual_digest"
28+
echo "VIP table folder contents:"
29+
ls -la ${VIP_PATH}
30+
exit 1
31+
fi

.github/workflows/build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ jobs:
2727
- name: Build
2828
run: make
2929

30+
- name: Dry run test with VIP generation
31+
shell: bash
32+
run: |
33+
cd .github/dry-run-test
34+
./generate_flat_build.sh
35+
./run_and_validate_vip.sh
36+
3037
- name: Package
3138
run: |
3239
mkdir dist
@@ -62,6 +69,13 @@ jobs:
6269
- name: Build
6370
run: make
6471

72+
- name: Dry run test with VIP generation
73+
shell: bash
74+
run: |
75+
cd .github/dry-run-test
76+
./generate_flat_build.sh
77+
./run_and_validate_vip.sh
78+
6579
- name: Package
6680
run: |
6781
set -x

0 commit comments

Comments
 (0)