Skip to content

Commit 16b43c9

Browse files
Merge pull request #12 from lool/missing-files
Fix missing zeros_33sectors.bin
2 parents 13a7dec + d89c065 commit 16b43c9

File tree

4 files changed

+91
-5
lines changed

4 files changed

+91
-5
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616

17-
- name: Run make
17+
- name: Build all platforms and run tests
1818
run: |
19-
make
19+
sudo apt install pycodestyle
20+
make lint
21+
make all integration
2022
2123
- name: Run cargo
2224
run: |

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PLATFORMS := $(foreach platform,$(wildcard platforms/*),$(platform)/gpt)
33
BINS := gen_partition.py msp.py ptool.py
44
PREFIX ?= /usr/local
55

6-
.PHONY: all
6+
.PHONY: all check lint integration
77

88
all: $(PLATFORMS)
99

@@ -13,10 +13,16 @@ all: $(PLATFORMS)
1313
%/partitions.xml: %/partitions.conf
1414
$(TOPDIR)/gen_partition.py -i $^ -o $@
1515

16-
check:
16+
lint:
1717
# W605: invalid escape sequence
1818
pycodestyle --select=W605 *.py
1919

20+
integration: all
21+
# make sure generated output has created expected files
22+
tests/integration/check-missing-files platforms/*/*.xml
23+
24+
check: lint integration
25+
2026
install: $(BINS)
2127
install -d $(DESTDIR)$(PREFIX)/bin
2228
install -m 755 $^ $(DESTDIR)$(PREFIX)/bin

ptool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ def CreateErasingRawProgramFiles():
396396
temp.append(Comment('NOTE: This is an ** Autogenerated file **'))
397397
temp.append(Comment('NOTE: Sector size is %ibytes'%SECTOR_SIZE_IN_BYTES))
398398

399+
CreateFileOfZeros("zeros_33sectors.bin",33)
399400
UpdateRawProgram(temp,0, 0.5, i, 0, 1, "zeros_33sectors.bin", "false", "Overwrite MBR sector")
400401
UpdateRawProgram(temp,1, BackupGPTNumLBAs*SECTOR_SIZE_IN_BYTES/1024.0, i, 0, BackupGPTNumLBAs, "zeros_%dsectors.bin" % BackupGPTNumLBAs, "false", "Overwrite Primary GPT Sectors")
401402

@@ -795,7 +796,7 @@ def CreateGPTPartitionTable(PhysicalPartitionNumber,UserProvided=False):
795796
PhysicalPartitionNumber,
796797
FileOffset[z],
797798
LastLBA-FirstLBA+1-FilePartitionOffset[z], # num_partition_sectors
798-
"zeros_33sectorS.bin",
799+
"zeros_33sectors.bin",
799800
"false",
800801
PartitionLabel,
801802
PhyPartition[k][j]['readbackverify'],

tests/integration/check-missing-files

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/sh
2+
# Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
3+
# SPDX-License-Identifier: BSD-3-Clause-Clear
4+
5+
# Takes XML files as arguments, collects the filenames referenced, and checks
6+
# if any gpt_* or zeros_* file is missing
7+
8+
set -eu
9+
10+
errors=no
11+
12+
for xml in "$@"; do
13+
dir="$(dirname "${xml}")"
14+
for file in $(sed -En 's/.*filename="([^"]+)".*/\1/p' "${xml}" | sort -u); do
15+
case "${file}" in
16+
# expected files that should be generated by ptool
17+
gpt_*|zeros_*)
18+
if ! [ -r "${dir}/${file}" ]; then
19+
errors=yes
20+
echo "Missing ${file} referenced in ${xml}" >&2
21+
fi
22+
;;
23+
# known files that will be provided by the OS
24+
abl.elf) ;;
25+
aop.mbn) ;;
26+
boot.img) ;;
27+
cmnlib.mbn) ;;
28+
cmnlib64.mbn) ;;
29+
cpucp.elf) ;;
30+
devcfg_iot.mbn) ;;
31+
devcfg.mbn) ;;
32+
efi.bin) ;;
33+
DISK) ;;
34+
dtb.bin) ;;
35+
emmc_appsboot.mbn) ;;
36+
featenabler.mbn) ;;
37+
fs_image_linux.tar.gz.mbn.img) ;;
38+
hyp.mbn) ;;
39+
hypvm.mbn) ;;
40+
imagefv.elf) ;;
41+
keymaster.mbn) ;;
42+
keymaster64.mbn) ;;
43+
km4.mbn) ;;
44+
multi_image_qti.mbn) ;;
45+
multi_image.mbn) ;;
46+
pmic.elf) ;;
47+
qupv3fw.elf) ;;
48+
rootfs.img) ;;
49+
rpm.mbn) ;;
50+
sbc_1.0_8016.bin) ;;
51+
sbc_1.0_8096.bin) ;;
52+
sbl1.mbn) ;;
53+
sec.dat) ;;
54+
sed.dat) ;;
55+
shrm.elf) ;;
56+
storsec.mbn) ;;
57+
tools.fv) ;;
58+
tz.mbn) ;;
59+
uefi_sec.mbn) ;;
60+
uefi.elf) ;;
61+
xbl_config.elf) ;;
62+
xbl_feature_config.elf) ;;
63+
xbl.elf) ;;
64+
XblRamdump.elf) ;;
65+
*)
66+
echo "Unknown ${file} referenced in ${xml}" >&2
67+
errors=1
68+
;;
69+
esac
70+
done
71+
done
72+
73+
if [ "${errors}" != no ]; then
74+
exit 1
75+
fi
76+
exit 0
77+

0 commit comments

Comments
 (0)