Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PLATFORMS := $(foreach platform,$(wildcard platforms/*),$(platform)/gpt)
BINS := gen_partition.py msp.py ptool.py
PREFIX ?= /usr/local

.PHONY: all
.PHONY: all check lint integration

all: $(PLATFORMS)

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

check:
lint:
# W605: invalid escape sequence
pycodestyle --select=W605 *.py

integration: all
# make sure generated output has created expected files
tests/integration/check-missing-files platforms/*/*.xml

check: lint integration

install: $(BINS)
install -d $(DESTDIR)$(PREFIX)/bin
install -m 755 $^ $(DESTDIR)$(PREFIX)/bin
1 change: 1 addition & 0 deletions ptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ def CreateErasingRawProgramFiles():
temp.append(Comment('NOTE: This is an ** Autogenerated file **'))
temp.append(Comment('NOTE: Sector size is %ibytes'%SECTOR_SIZE_IN_BYTES))

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

Expand Down
77 changes: 77 additions & 0 deletions tests/integration/check-missing-files
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/sh
# Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause-Clear

# Takes XML files as arguments, collects the filenames referenced, and checks
# if any gpt_* or zeros_* file is missing

set -eu

errors=no

for xml in "$@"; do
dir="$(dirname "${xml}")"
for file in $(sed -En 's/.*filename="([^"]+)".*/\1/p' "${xml}" | sort -u); do
case "${file}" in
# expected files that should be generated by ptool
gpt_*|zeros_*)
if ! [ -r "${dir}/${file}" ]; then
errors=yes
echo "Missing ${file} referenced in ${xml}" >&2
fi
;;
# known files that will be provided by the OS
abl.elf) ;;
aop.mbn) ;;
boot.img) ;;
cmnlib.mbn) ;;
cmnlib64.mbn) ;;
cpucp.elf) ;;
devcfg_iot.mbn) ;;
devcfg.mbn) ;;
efi.bin) ;;
DISK) ;;
dtb.bin) ;;
emmc_appsboot.mbn) ;;
featenabler.mbn) ;;
fs_image_linux.tar.gz.mbn.img) ;;
hyp.mbn) ;;
hypvm.mbn) ;;
imagefv.elf) ;;
keymaster.mbn) ;;
keymaster64.mbn) ;;
km4.mbn) ;;
multi_image_qti.mbn) ;;
multi_image.mbn) ;;
pmic.elf) ;;
qupv3fw.elf) ;;
rootfs.img) ;;
rpm.mbn) ;;
sbc_1.0_8016.bin) ;;
sbc_1.0_8096.bin) ;;
sbl1.mbn) ;;
sec.dat) ;;
sed.dat) ;;
shrm.elf) ;;
storsec.mbn) ;;
tools.fv) ;;
tz.mbn) ;;
uefi_sec.mbn) ;;
uefi.elf) ;;
xbl_config.elf) ;;
xbl_feature_config.elf) ;;
xbl.elf) ;;
XblRamdump.elf) ;;
*)
echo "Unknown ${file} referenced in ${xml}" >&2
errors=1
;;
esac
done
done

if [ "${errors}" != no ]; then
exit 1
fi
exit 0

Loading