29 #ifdef POK_NEEDS_PARTITIONS
49 static pok_ret_t pok_loader_elf_load (
char* file,
60 if (elf_header->
e_ident[0] != 0x7f ||
61 elf_header->
e_ident[1] !=
'E' ||
62 elf_header->
e_ident[2] !=
'L' ||
68 *entry = (
void*)elf_header->
e_entry;
72 for (i = 0; i < elf_header->
e_phnum; ++i)
74 dest = (
char *)elf_phdr[i].p_vaddr + offset;
76 memcpy (dest, elf_phdr[i].p_offset + file, elf_phdr[i].p_filesz);
77 memset (dest + elf_phdr[i].p_filesz, 0, elf_phdr[i].p_memsz - elf_phdr[i].p_filesz);
89 void* elf_entry =
NULL;
90 extern char __archive2_begin;
99 size += part_sizes[t];
103 if (pok_partitions[part_id].size < part_sizes[part_id])
105 #ifdef POK_NEEDS_ERROR_HANDLING
106 pok_partition_error (part_id, POK_ERROR_KIND_PARTITION_CONFIGURATION);
108 #ifdef POK_NEEDS_DEBUG
115 printf(
"Declared size for partition %d : %d\n", part_id, pok_partitions[part_id].size);
116 printf(
"Real size for partition %d : %d\n", part_id, part_sizes[part_id]);
117 pok_fatal (
"Partition size is not correct\n");
125 pok_loader_elf_load ((&__archive2_begin) + size , offset, &elf_entry);