Changeset 28df043 in freewrt for target/linux/package/base-files


Ignore:
Timestamp:
Jun 10, 2006, 3:22:48 PM (20 years ago)
Author:
Waldemar Brodkorb <wbx@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
a5bb8b8
Parents:
e59ae5b
Message:

enable automatic reboot after jffs2move, from OpenWrt ticketsystem, thx consulting@…, rename OpenWrt partition to data, add mini-fo as default kernel module

git-svn-id: svn://www.freewrt.org/trunk/freewrt@34 afb5a338-a214-0410-bd46-81f09a774fd1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • target/linux/package/base-files/src/jffs2root.c

    re59ae5b r28df043  
    3232
    3333#include <sys/ioctl.h>
     34#include <sys/syscall.h>
    3435#include <linux/mtd/mtd.h>
     36#include <linux/reboot.h>
    3537
    3638#define FILENAME "/dev/mtdblock/1"
     
    7880        struct trx_header *ptr;
    7981        char *buf;
     82        int reboot;
     83
     84        reboot = 0;
    8085       
    8186        if (((fd = open(FILENAME, O_RDWR))      < 0)
     
    106111                        ptr->crc32 = crc32buf((void *) &(ptr->flag_version), ptr->len - offsetof(struct trx_header, flag_version));
    107112                        msync(ptr,sizeof(struct trx_header),MS_SYNC|MS_INVALIDATE);
    108                         printf("Partition moved; please reboot\n");
     113                        if (argc > 2 && !strcmp(argv[2],"--reboot")) {
     114                                reboot=1;
     115                                printf("Partition moved.\n");
     116                        } else {
     117                                printf("Partition moved; please reboot\n");
     118                        }
    109119                }
    110120        } else if (argc > 1 && !strcmp(argv[1], "--clean")) {
     
    130140
    131141        munmap((void *) ptr, len);
     142        if (reboot) {
     143                fflush(stdout);
     144                syscall(SYS_reboot,LINUX_REBOOT_MAGIC1,LINUX_REBOOT_MAGIC2,LINUX_REBOOT_CMD_RESTART,NULL);
     145        }
    132146        return 0;
    133147}
Note: See TracChangeset for help on using the changeset viewer.