Commit c20d395d authored by Pat Wood's avatar Pat Wood
Browse files

set MBR_MAGIC to "softw411" and MBR_VERSION to 0x200 in nand-part-a20.h

A20 boot1 checks the MBR magic string but not the version, but let's
check it anyway (can always force now with the -f option if the version
isn't 0x200 on the system)
parent 3413153e
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include "types.h" #include "types.h"
#define MBR_MAGIC "" #define MBR_MAGIC "softw411"
#define MBR_VERSION 0x200
#define MAX_PART_COUNT 120 //max part count #define MAX_PART_COUNT 120 //max part count
#define MBR_COPY_NUM 4 //mbr backup count #define MBR_COPY_NUM 4 //mbr backup count
......
...@@ -122,9 +122,7 @@ MBR *_get_mbr(int fd, int mbr_num, int force) ...@@ -122,9 +122,7 @@ MBR *_get_mbr(int fd, int mbr_num, int force)
printmbrheader(mbr); printmbrheader(mbr);
if (force) { if (force) {
strncpy((char *)mbr->magic, MBR_MAGIC, 8); strncpy((char *)mbr->magic, MBR_MAGIC, 8);
#ifdef MBR_VERSION
mbr->version = MBR_VERSION; mbr->version = MBR_VERSION;
#endif
return mbr; return mbr;
} }
if(strncmp((char *)mbr->magic, MBR_MAGIC, 8)) if(strncmp((char *)mbr->magic, MBR_MAGIC, 8))
...@@ -132,13 +130,11 @@ MBR *_get_mbr(int fd, int mbr_num, int force) ...@@ -132,13 +130,11 @@ MBR *_get_mbr(int fd, int mbr_num, int force)
printf("magic %8.8s is not %8s\n", mbr->magic, MBR_MAGIC); printf("magic %8.8s is not %8s\n", mbr->magic, MBR_MAGIC);
return NULL; return NULL;
} }
#ifdef MBR_VERSION
if(mbr->version != MBR_VERSION) if(mbr->version != MBR_VERSION)
{ {
printf("version 0x%08x is not 0x%08x\n", mbr->version, MBR_VERSION); printf("version 0x%08x is not 0x%08x\n", mbr->version, MBR_VERSION);
return NULL; return NULL;
} }
#endif
if(*(__u32 *)mbr == calc_crc32((__u32 *)mbr + 1,MBR_SIZE - 4)) if(*(__u32 *)mbr == calc_crc32((__u32 *)mbr + 1,MBR_SIZE - 4))
{ {
printf("OK\n"); printf("OK\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment