+int
+mtd_update(const char *trxfile, const char *mtd)
+{
+ if (mtd_erase("rootfs") != 0) {
+ fprintf(stderr, "Could not erase rootfs\n");
+ exit(1);
+ }
+ if (mtd_write(trxfile, mtd) != 0) {
+ fprintf(stderr, "Could not update %s with %s\n", mtd, trxfile);
+ exit(1);
+ }
+ return 0;
+}
+