size_t read;
fseek(binfile, compute_start, SEEK_SET);
-
+
/* read block of 1024 bytes */
while (binfile && !feof(binfile) && !ferror(binfile) && (compute_len >= sizeof(readbuf))) {
read = fread(readbuf, sizeof(uint8_t), sizeof(readbuf), binfile);
printf("Data alignment to %dk with 'deadc0de' appended\n", flash_bs/1024);
fseek(binfile, rootfsoff + rootfslen - fwaddr, SEEK_SET);
fwrite(&deadcode, sizeof(uint32_t), 1, binfile);
-
+
/* Flush the binfile buffer so that when we read from file, it contains
* everything in the buffer
*/
* needs to be rootfs + deadcode
*/
rootfscrc = compute_crc32(rootfscrc, binfile, kerneloff - fwaddr, rootfslen + sizeof(deadcode));
-
+
/* Close the files */
fclose(kernelfile);
fclose(rootfsfile);
uint32_t flashstart, fwoffset, loadaddr, entry;
uint32_t fwaddr, flash_bs;
int tagidfound = 0;
-
+
kernel = rootfs = bin = boardid = chipid = magic2 = ver = rsignature = layoutver = NULL;
entry = 0;
fprintf(stderr, "You need to specify the kernel entry (-e)\n");
return 1;
}
-
+
/* Fallback to defaults */
fwaddr = flashstart + fwoffset;
-
+
if (!magic2) {
magic2 = malloc(sizeof(char) * 14);
if (!magic2) {
}
strcpy(ver, IMAGETAG_VER);
}
-
+
return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry, ver, magic2, flash_bs, rsignature, layoutver);
}