From d504a6b220c6f67461a5c9695f428ea12ccc50a1 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 21 Mar 2013 19:01:15 +0100 Subject: [PATCH] rknanoutils: fix boot tool Correctly descramble the first stages (0 to 2) in continuous mode. Also fix a disassembled (but unused) crc routine used in dfu mode. Change-Id: I20016d1c696a9bcb6584377ee9b55493783c7159 --- utils/rknanoutils/rkboottool/rkboottool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/rknanoutils/rkboottool/rkboottool.c b/utils/rknanoutils/rkboottool/rkboottool.c index 442046f96a..ee9b17e610 100644 --- a/utils/rknanoutils/rkboottool/rkboottool.c +++ b/utils/rknanoutils/rkboottool/rkboottool.c @@ -128,7 +128,7 @@ static uint16_t crc(uint8_t *buf, int size) { for(int bit = 128; bit; bit >>= 1) { - if(result & 0x80) + if(result & 0x8000) result = (2 * result) ^ 0x1021; else result *= 2; @@ -221,7 +221,7 @@ static int do_nanofw_image(uint8_t *buf, unsigned long size) cprintf(GREEN, " %i: ", i); print_blob_interval(&hdr->stage[i]); cprintf(OFF, "\n"); - save_blob(&hdr->stage[i], buf, size, "stage", i, NO_ENC); + save_blob(&hdr->stage[i], buf, size, "stage", i, i == 3 ? NO_ENC : CONTINOUS_ENC); } cprintf(BLUE, "Fonts\n"); for(unsigned i = 0; i < hdr->nr_fonts; i++)