Skip to content

Commit f3ae7e2

Browse files
committed
github: dry run test with VIP table generation
Run QDL in dry-run mode for a reference synthetic FLAT build with VIP table generation. Check if table is generated correctly. Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
1 parent ad123a9 commit f3ae7e2

File tree

6 files changed

+148
-0
lines changed

6 files changed

+148
-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>

.github/workflows/build.yml

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

30+
- name: Dry run test with VIP generation
31+
shell: bash
32+
run: |
33+
pushd . > /dev/null
34+
cd .github/dry-run-test
35+
./generate_flat_build.sh
36+
mkdir -p vip
37+
../../qdl --debug --dry-run --create-digests=./vip prog_firehose_ddr.elf rawprogram*.xml patch*.xml
38+
actual_digest=$(sha256sum "./vip/DigestsToSign.bin" | cut -d ' ' -f1)
39+
expected_digest="4e13981189ede380172369aa0a4847ca3c9a4e2795733bca90ec1b1e713972ea"
40+
popd > /dev/null
41+
if [ "$actual_digest" = "$expected_digest" ]; then
42+
echo "VIP tables are generated successfully and validated"
43+
exit 0
44+
else
45+
echo "Expected SHA256 digest of DigestsToSign.bin file is $expected_digest"
46+
echo "Calculated SHA256 digest of DigestsToSign.bin file is $actual_digest"
47+
echo "VIP table folder contents:"
48+
ls -la .github/dry-run-test/vip
49+
exit 1
50+
fi
51+
3052
- name: Package
3153
run: |
3254
mkdir dist
@@ -62,6 +84,28 @@ jobs:
6284
- name: Build
6385
run: make
6486

87+
- name: Dry run test with VIP generation
88+
shell: bash
89+
run: |
90+
pushd . > /dev/null
91+
cd .github/dry-run-test
92+
./generate_flat_build.sh
93+
mkdir -p vip
94+
../../qdl --debug --dry-run --create-digests=./vip prog_firehose_ddr.elf rawprogram*.xml patch*.xml
95+
actual_digest=$(shasum -a 256 "./vip/DigestsToSign.bin" | cut -d ' ' -f1)
96+
expected_digest="4e13981189ede380172369aa0a4847ca3c9a4e2795733bca90ec1b1e713972ea"
97+
popd > /dev/null
98+
if [ "$actual_digest" = "$expected_digest" ]; then
99+
echo "VIP tables are generated successfully and validated"
100+
exit 0
101+
else
102+
echo "Expected SHA256 digest of DigestsToSign.bin file is $expected_digest"
103+
echo "Calculated SHA256 digest of DigestsToSign.bin file is $actual_digest"
104+
echo "VIP table folder contents:"
105+
ls -la .github/dry-run-test/vip
106+
exit 1
107+
fi
108+
65109
- name: Package
66110
run: |
67111
set -x

0 commit comments

Comments
 (0)