diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/cbfstool/cbfs-mkpayload.c | 57 | ||||
-rw-r--r-- | util/cbfstool/cbfs_image.c | 10 |
2 files changed, 8 insertions, 59 deletions
diff --git a/util/cbfstool/cbfs-mkpayload.c b/util/cbfstool/cbfs-mkpayload.c index e9bcfbaceb..9a356e8b3f 100644 --- a/util/cbfstool/cbfs-mkpayload.c +++ b/util/cbfstool/cbfs-mkpayload.c @@ -55,9 +55,7 @@ int parse_elf_to_payload(const struct buffer *input, struct buffer *output, { Elf64_Phdr *phdr; Elf64_Ehdr ehdr; - Elf64_Shdr *shdr; char *header; - char *strtab; int headers; int segments = 1; int isize = 0, osize = 0; @@ -70,39 +68,15 @@ int parse_elf_to_payload(const struct buffer *input, struct buffer *output, if (!compress) return -1; - if (elf_headers(input, &ehdr, &phdr, &shdr) < 0) + if (elf_headers(input, &ehdr, &phdr, NULL) < 0) return -1; DEBUG("start: parse_elf_to_payload\n"); headers = ehdr.e_phnum; header = input->data; - strtab = &header[shdr[ehdr.e_shstrndx].sh_offset]; - - /* Count the number of headers - look for the .notes.pinfo - * section */ - - for (i = 0; i < ehdr.e_shnum; i++) { - char *name; - - if (i == ehdr.e_shstrndx) - continue; - - if (shdr[i].sh_size == 0) - continue; - - name = (char *)(strtab + shdr[i].sh_name); - - if (!strcmp(name, ".note.pinfo")) { - segments++; - isize += (unsigned int)shdr[i].sh_size; - } - } - - /* Now, regular headers - we only care about PT_LOAD headers, - * because that's what we're actually going to load - */ - + /* Count the number of segment headers - we only care about PT_LOAD + headers, because that's what we're actually going to load */ for (i = 0; i < headers; i++) { if (phdr[i].p_type != PT_LOAD) continue; @@ -144,30 +118,6 @@ int parse_elf_to_payload(const struct buffer *input, struct buffer *output, */ segments = 0; - for (i = 0; i < ehdr.e_shnum; i++) { - char *name; - if (i == ehdr.e_shstrndx) - continue; - - if (shdr[i].sh_size == 0) - continue; - name = (char *)(strtab + shdr[i].sh_name); - if (!strcmp(name, ".note.pinfo")) { - segs[segments].type = PAYLOAD_SEGMENT_PARAMS; - segs[segments].load_addr = 0; - segs[segments].len = (unsigned int)shdr[i].sh_size; - segs[segments].offset = doffset; - - memcpy((unsigned long *)(output->data + doffset), - &header[shdr[i].sh_offset], shdr[i].sh_size); - - doffset += segs[segments].len; - osize += segs[segments].len; - - segments++; - } - } - for (i = 0; i < headers; i++) { if (phdr[i].p_type != PT_LOAD) continue; @@ -223,7 +173,6 @@ int parse_elf_to_payload(const struct buffer *input, struct buffer *output, out: if (segs) free(segs); - if (shdr) free(shdr); if (phdr) free(phdr); return ret; } diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 1fde8cdfad..740a3b2a1e 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -864,7 +864,7 @@ static int cbfs_payload_decompress(struct cbfs_payload_segment *segments, if (segments[i].type == PAYLOAD_SEGMENT_BSS || segments[i].type == PAYLOAD_SEGMENT_ENTRY) { continue; - } else if (segments[i].type == PAYLOAD_SEGMENT_PARAMS) { + } else if (segments[i].type == PAYLOAD_SEGMENT_DEPRECATED_PARAMS) { memcpy(out_ptr, in_ptr, segments[i].len); segments[i].offset = new_offset; new_offset += segments[i].len; @@ -1090,7 +1090,7 @@ static int cbfs_payload_make_elf(struct buffer *buff, uint32_t arch, segments++; } else if (payload_type == PAYLOAD_SEGMENT_BSS) { segments++; - } else if (payload_type == PAYLOAD_SEGMENT_PARAMS) { + } else if (payload_type == PAYLOAD_SEGMENT_DEPRECATED_PARAMS) { segments++; } else if (payload_type == PAYLOAD_SEGMENT_ENTRY) { /* The last segment in a payload is always ENTRY as @@ -1162,7 +1162,7 @@ static int cbfs_payload_make_elf(struct buffer *buff, uint32_t arch, shdr.sh_size = segs[i].len; name = strdup(".bss"); buffer_splice(&tbuff, buff, 0, 0); - } else if (segs[i].type == PAYLOAD_SEGMENT_PARAMS) { + } else if (segs[i].type == PAYLOAD_SEGMENT_DEPRECATED_PARAMS) { shdr.sh_type = SHT_NOTE; shdr.sh_flags = 0; shdr.sh_size = segs[i].len; @@ -1398,8 +1398,8 @@ static int cbfs_print_decoded_payload_segment_info( seg->load_addr, seg->len); break; - case PAYLOAD_SEGMENT_PARAMS: - fprintf(fp, " parameters\n"); + case PAYLOAD_SEGMENT_DEPRECATED_PARAMS: + fprintf(fp, " parameters (deprecated)\n"); break; default: |