CRC32結果位於:0x5f000
CRC32計算長度:0x5f004~0x60000
Environment Variables:0x5f004~0x60000
計算方式如下:
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <fcntl.h> #include <unistd.h> static char buf[4096] = {0}; unsigned int crc32b(unsigned char *buf, int len) { int i = 0, j = 0; unsigned int byte = 0, crc = 0, mask = 0; crc = 0xffffffff; for (i=0; i<len; i++) { byte = buf[i]; crc = crc ^ byte; for (j = 7; j >= 0; j--) { mask = -(crc & 1); crc = (crc >> 1) ^ (0xedb88320 & mask); } } return ~crc; } int main(int argc, char **argv) { int len = 0, fd = -1; fd = open("mtdblock0_env_offset", O_RDONLY); len = read(fd, buf, sizeof(buf)); close(fd); printf("0x%x\n", crc32b(buf, 0x1000 - 4)); return 0; }