#include "mtd.h"
#include "crc32.h"
-#define TRX_MAGIC 0x30524448 /* "HDR0" */
#define TRX_CRC32_DATA_OFFSET 12 /* First 12 bytes are not covered by CRC32 */
#define TRX_CRC32_DATA_SIZE 16
struct trx_header {
}
trx = ptr;
- if (trx->magic != TRX_MAGIC) {
+ if (ntohl(trx->magic) != opt_trxmagic) {
fprintf(stderr, "TRX header not found\n");
goto err;
}
}
}
- if (trx->magic != TRX_MAGIC || trx->len < sizeof(struct trx_header)) {
+ if (ntohl(trx->magic) != opt_trxmagic ||
+ trx->len < sizeof(struct trx_header)) {
if (quiet < 2) {
fprintf(stderr, "Bad trx header\n");
fprintf(stderr, "This is not the correct file format; refusing to flash.\n"
}
trx = (struct trx_header *)(first_block + offset);
- if (trx->magic != STORE32_LE(0x30524448)) {
+ if (ntohl(trx->magic) != opt_trxmagic) {
fprintf(stderr, "No trx magic found\n");
exit(1);
}