X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/28188a9b0c88b7c94f07a78ba4cc8dbdb3e3bf5a..25ea0c2afb9795e9ba7a5446af302e522c3b606f:/package/openwrt/mtd.c?ds=inline diff --git a/package/openwrt/mtd.c b/package/openwrt/mtd.c index a0eeb79b4..f0c127b72 100644 --- a/package/openwrt/mtd.c +++ b/package/openwrt/mtd.c @@ -19,6 +19,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ + * + * code is based on linux-mtd example code */ #include @@ -237,7 +239,6 @@ void usage(void) " erase erase all data on device\n" " write write imagefile to device\n" "Following options are available:\n" - " -u unlock device before accessing it\n" " -r reboot after successful command\n" " -e erase before executing the command\n\n" "Example: To write linux.trx to mtd4 labeled as linux and reboot afterwards\n" @@ -257,19 +258,9 @@ int main (int argc, char **argv) erase[0] = NULL; boot = 0; - unlock = 0; - printf("mtd: Modify data within a Memory Technology Device.\n" - "Copyright (C) 2005 Waldemar Brodkorb ,\n" - " Felix Fietkau \n" - "Documented by Mike Strates [dumpedcore] \n" - "mtd has ABSOLUTELY NO WARRANTY and is licensed under the GNU GPL.\n\n"); - - while ((ch = getopt(argc, argv, "ure:")) != -1) + while ((ch = getopt(argc, argv, "re:")) != -1) switch (ch) { - case 'u': - unlock = 1; - break; case 'r': boot = 1; break; @@ -314,12 +305,10 @@ int main (int argc, char **argv) i++; } - if (unlock) - mtd_unlock(device); + mtd_unlock(device); switch (cmd) { case CMD_UNLOCK: - mtd_unlock(device); break; case CMD_ERASE: mtd_erase(device); @@ -330,7 +319,7 @@ int main (int argc, char **argv) } if (boot) - reboot(0); + kill(1, 15); // send SIGTERM to init for reboot return 0; }