-#ifdef target_brcm
-static int
-image_check_brcm(int imagefd, const char *mtd)
-{
- struct trx_header *trx = (struct trx_header *) buf;
- int fd;
-
- if (strcmp(mtd, "linux") != 0)
- return 1;
-
- buflen = read(imagefd, buf, 32);
- if (buflen < 32) {
- fprintf(stdout, "Could not get image header, file too small (%ld bytes)\n", buflen);
- return 0;
- }
-
- if (trx->magic != TRX_MAGIC || 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"
- "Please specify the correct file or use -f to force.\n");
- }
- return 0;
- }
-
- /* check if image fits to mtd device */
- fd = mtd_check_open(mtd);
- if(fd < 0) {
- fprintf(stderr, "Could not open mtd device: %s\n", mtd);
- exit(1);
- }
-
- if(mtdsize < trx->len) {
- fprintf(stderr, "Image too big for partition: %s\n", mtd);
- close(fd);
- return 0;
- }
-
- close(fd);
- return 1;
-}
-#endif /* target_brcm */
-