mirror of https://github.com/wolfSSL/wolfBoot.git
review comments
parent
d49e507926
commit
16e5b94e9d
|
@ -168,7 +168,7 @@ typedef struct elf64_program_header {
|
|||
typedef int (*elf_mmu_map_cb)(uint64_t, uint64_t, uint32_t);
|
||||
int elf_load_image_mmu(uint8_t *image, uintptr_t *entry, elf_mmu_map_cb mmu_cb);
|
||||
int elf_load_image(uint8_t *image, uintptr_t *entry, int is_ext);
|
||||
int elf_hdr_pht_combined_size(const unsigned char *ehdr);
|
||||
int64_t elf_hdr_pht_combined_size(const unsigned char* ehdr);
|
||||
int elf_open(const unsigned char *ehdr, int *is_elf32);
|
||||
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ static int check_scatter_format(const unsigned char* ehdr, int is_elf32)
|
|||
|
||||
/* Returns the combined size of the elf header and program header table. This
|
||||
* assumes the program header table immediately follows the elf header. */
|
||||
int elf_hdr_pht_combined_size(const unsigned char* ehdr)
|
||||
int64_t elf_hdr_pht_combined_size(const unsigned char* ehdr)
|
||||
{
|
||||
int sz = 0;
|
||||
int is_elf32;
|
||||
|
|
|
@ -1631,7 +1631,7 @@ int wolfBoot_check_flash_image_elf(uint8_t part, unsigned long* entry_out)
|
|||
eh->entry, (unsigned long)entry_off, entry_count);
|
||||
}
|
||||
|
||||
elf_hdr_sz = elf_hdr_pht_combined_size(elf_h);
|
||||
elf_hdr_sz = (size_t)elf_hdr_pht_combined_size(elf_h);
|
||||
wolfBoot_printf("ELF: [CHECK] Header size: %zu bytes\n", elf_hdr_sz);
|
||||
|
||||
/* Hash the elf header and program header in the image, assuming the PHT
|
||||
|
|
|
@ -43,6 +43,9 @@ HSM=""
|
|||
ELF=""
|
||||
OPERATIONS=()
|
||||
|
||||
# Important Constants
|
||||
PFLASH1_RANGE="0xA0300000-0xA0500000"
|
||||
|
||||
# Structure to hold command options
|
||||
declare -A KEYGEN_OPTS=(
|
||||
[sign_algo]="$DEFAULT_SIGN_ALGO"
|
||||
|
@ -208,7 +211,7 @@ do_sign() {
|
|||
if [[ "${SIGN_OPTS[file_ext]}" == ".elf" ]]; then
|
||||
local temp_file="${bin_path}.squashed"
|
||||
echo "Preprocessing ELF file with $SQUASHELF"
|
||||
"$SQUASHELF" -v --nosht -r 0xA0300000-0xA0500000 "$bin_path" "$temp_file"
|
||||
"$SQUASHELF" -v --nosht -r "$PFLASH1_RANGE" "$bin_path" "$temp_file"
|
||||
echo "Replacing original ELF with squashed version"
|
||||
cp "$temp_file" "$bin_path"
|
||||
rm "$temp_file"
|
||||
|
@ -241,11 +244,15 @@ do_gen_target() {
|
|||
local wolfboot_partition_swap_address
|
||||
|
||||
if [[ -n "${TARGET_OPTS[use_elf_format]}" ]]; then
|
||||
# These addresses and values must match those defined in the test-app
|
||||
# linker file
|
||||
wolfboot_partition_size=0xC0000
|
||||
wolfboot_partition_boot_address=0xA047C000
|
||||
wolfboot_partition_update_address=0xA053C000
|
||||
wolfboot_partition_swap_address=0xA05FC000
|
||||
else
|
||||
# These addresses and values must match those defined in the test-app
|
||||
# linker file
|
||||
wolfboot_partition_size=0x17C000
|
||||
wolfboot_partition_boot_address=0xA0300000
|
||||
wolfboot_partition_update_address=0xA047C000
|
||||
|
|
|
@ -60,10 +60,3 @@ squashelf [options] <input.elf> <output.elf>
|
|||
```bash
|
||||
squashelf --help
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
`squashelf` depends on `libelf`. You can typically install the development package for `libelf` using your system's package manager.
|
||||
|
||||
* **Debian/Ubuntu:** `sudo apt-get install libelf-dev`
|
||||
|
||||
|
|
|
@ -107,20 +107,8 @@ static int parseRange(const char* rangeStr, AddressRange* range)
|
|||
char* minStr = copyStr;
|
||||
char* maxStr = dashPos + 1;
|
||||
|
||||
/* Check for hex or decimal format and convert */
|
||||
if (strncmp(minStr, "0x", 2) == 0 || strncmp(minStr, "0X", 2) == 0) {
|
||||
range->min = strtoull(minStr, NULL, 16);
|
||||
}
|
||||
else {
|
||||
range->min = strtoull(minStr, NULL, 10);
|
||||
}
|
||||
|
||||
if (strncmp(maxStr, "0x", 2) == 0 || strncmp(maxStr, "0X", 2) == 0) {
|
||||
range->max = strtoull(maxStr, NULL, 16);
|
||||
}
|
||||
else {
|
||||
range->max = strtoull(maxStr, NULL, 10);
|
||||
}
|
||||
range->min = strtoull(minStr, NULL, 0);
|
||||
range->max = strtoull(maxStr, NULL, 0);
|
||||
|
||||
free(copyStr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue