diff --git a/utils/sbtools/sbtoelf.c b/utils/sbtools/sbtoelf.c
index 87017ab..023964f 100644
--- a/utils/sbtools/sbtoelf.c
+++ b/utils/sbtools/sbtoelf.c
@@ -89,6 +89,18 @@ static uint8_t instruction_checksum(struct sb_instruction_header_t *hdr)
static void elf_write(void *user, uint32_t addr, const void *buf, size_t count)
{
FILE *f = user;
+ /* if seeking paste end of file, write constant 0xff otherwise the system
+ * might write random bytes and it's not good to reproduce problems */
+ #if 1
+ fseek(f, 0, SEEK_END);
+ size_t pos = ftell(f);
+ if(pos < addr)
+ {
+ uint8_t zero = 0xff;
+ while(pos++ < addr)
+ fwrite(&zero, 1, 1, f);
+ }
+ #endif
fseek(f, addr, SEEK_SET);
fwrite(buf, count, 1, f);
}
@@ -481,6 +493,15 @@ static void extract(unsigned long filesize)
}
}
+ if(getenv("SB_REAL_KEY") != 0)
+ {
+ struct crypto_key_t k;
+ char *env = getenv("SB_REAL_KEY");
+ if(!parse_key(&env, &k) || *env)
+ bug("Invalid SB_REAL_KEY");
+ memcpy(real_key, k.u.key, 16);
+ }
+
color(RED);
printf(" Summary:\n");
color(GREEN);
@@ -751,6 +772,9 @@ int main(int argc, char **argv)
add_keys(&g_zero_key, 1);
break;
}
+ case 'r':
+ g_raw_mode = true;
+ break;
case 'a':
{
struct crypto_key_t key;