Files
qdl/program.h
Bjorn Andersson 60db50966d qdl: Extend read/write support to accept GPT partition names
While already powerful, it's quite often one wants to read and write
some specific GPT partition, and manually resolving the sectors and
plugging these into either a XML file or the command line is tedious and
error prone.

Allow partition names in the address specifier of the "read" and "write"
command line actions, and when these are used read the GPTs across all
physical partitions to resolve the physical partition, start sector and
sector count for the operation.

This allow us to do things like:

  qdl prog_firehose.elf write abl_a abl2esp.elf write abl_b abl2esp.elf

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2025-09-09 16:18:12 -05:00

46 lines
1.2 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef __PROGRAM_H__
#define __PROGRAM_H__
#include <sys/types.h>
#include <stdbool.h>
#include <stdint.h>
#include "qdl.h"
struct program {
unsigned int pages_per_block;
unsigned int sector_size;
unsigned int file_offset;
const char *filename;
const char *label;
unsigned int num_sectors;
int partition;
bool sparse;
const char *start_sector;
unsigned int last_sector;
bool is_nand;
bool is_erase;
unsigned int sparse_chunk_type;
uint32_t sparse_fill_value;
off_t sparse_offset;
const char *gpt_partition;
struct program *next;
};
int program_load(const char *program_file, bool is_nand);
int program_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program, int fd),
const char *incdir, bool allow_missing);
int erase_execute(struct qdl_device *qdl, int (*apply)(struct qdl_device *qdl, struct program *program));
int program_find_bootable_partition(bool *multiple_found);
int program_is_sec_partition_flashed(void);
int program_cmd_add(const char *address, const char *filename);
int program_resolve_gpt_deferrals(struct qdl_device *qdl);
void free_programs(void);
#endif