support reboot and fast erase

This commit is contained in:
rjkm
2020-12-01 15:51:13 +01:00
parent b1b3e92a50
commit 0a9fd4c2e1
4 changed files with 228 additions and 246 deletions

View File

@@ -38,25 +38,6 @@
#include "flash.h"
#include "flash.c"
static int reboot(uint32_t off)
{
FILE *f;
uint32_t time;
if ((f = fopen ("/sys/class/rtc/rtc0/since_epoch", "r")) == NULL)
return -1;
fscanf(f, "%u", &time);
fclose(f);
if ((f = fopen ("/sys/class/rtc/rtc0/wakealarm", "r+")) == NULL)
return -1;
fprintf(f, "%u", time + off);
fclose(f);
system("/sbin/poweroff");
return 0;
}
static int update_flash(struct ddflash *ddf)
{
char *fname;