last minute bugfixes
authorMike Baker <mbm@openwrt.org>
Fri, 4 Mar 2005 07:59:08 +0000 (07:59 +0000)
committerMike Baker <mbm@openwrt.org>
Fri, 4 Mar 2005 07:59:08 +0000 (07:59 +0000)
SVN-Revision: 305

openwrt/package/openwrt/jffs2root.c
openwrt/package/openwrt/mtd.c
openwrt/package/openwrt/openwrt.mk
openwrt/target/default/target_skeleton/etc/preinit
openwrt/target/jffs2/jffs2root.mk

index 2ff37fdad3b99973a0617158bbf32f981f46c0d8..77519a4a6fd4a5d50e4edbe4311544412f1b1739 100644 (file)
@@ -84,11 +84,13 @@ int main(int argc, char **argv)
     if (argc > 1 && !strcmp(argv[1],"--move")) {
       if (ptr->offsets[1] >= ptr->len) {
         printf("Partition already moved outside trx\n");
+#if 0
       } else if (ptr->offsets[1] & 0x0001ffff) {
         printf("Partition does not start on a block boundary\n");
+#endif
       } else {
        init_crc32();
-       bzero((void *)((int)ptr + ptr->len), (size_t)(len - ptr->len));
+       //bzero((void *)((int)ptr + ptr->len), (size_t)(len - ptr->len));
         ptr->len = ptr->offsets[1];
         ptr->crc32 = crc32buf((void *) &(ptr->flag_version), ptr->len - offsetof(struct trx_header, flag_version));
        msync(ptr,len,MS_SYNC|MS_INVALIDATE);
index ff104c6575e441edd3882e01e9dac01767e87876..296bf4b63af25514786c53019873505462681969 100644 (file)
@@ -140,11 +140,7 @@ mtd_erase(const char *mtd)
                 mtdEraseInfo.start < mtdInfo.size;
                 mtdEraseInfo.start += mtdInfo.erasesize) {
                
-               if(ioctl(fd, MEMUNLOCK, &mtdEraseInfo)) {
-                       fprintf(stderr, "Could not unlock MTD device: %s\n", mtd);
-                       close(fd);
-                       exit(1);
-               }
+               ioctl(fd, MEMUNLOCK, &mtdEraseInfo);
                if(ioctl(fd, MEMERASE, &mtdEraseInfo)) {
                        fprintf(stderr, "Could not erase MTD device: %s\n", mtd);
                        close(fd);
index 765f511d65d383601fb05b2c27ae38417e6cf6df..bc6e97e602032ee3dd7ba5ad1c566e102d1d74ff 100644 (file)
@@ -112,7 +112,7 @@ openwrt-mtd-clean:
 OPENWRT_JFFS2ROOT_SOURCE=package/openwrt/jffs2root.c
 OPENWRT_JFFS2ROOT_TARGET_BINARY:=sbin/jffs2root
 
-$(TARGET_DIR)/$(OPENWRT_JFFS2ROOT_TARGET_BINARY): 
+$(TARGET_DIR)/$(OPENWRT_JFFS2ROOT_TARGET_BINARY): openwrt
                $(TARGET_CC) -o $(TARGET_DIR)/$(OPENWRT_JFFS2ROOT_TARGET_BINARY) $(OPENWRT_JFFS2ROOT_SOURCE)
 
 openwrt-jffs2root: $(TARGET_DIR)/$(OPENWRT_JFFS2ROOT_TARGET_BINARY)
@@ -160,7 +160,7 @@ SSTRIP=$(OPENWRT_SSTRIP_TARGET)
 
 linksys:       linksys-shared linksys-nvram linksys-wlconf
 
-openwrt:       linksys openwrt-mtd openwrt-trx openwrt-addpattern openwrt-jffs2root openwrt-sstrip
+openwrt:       linksys openwrt-mtd openwrt-trx openwrt-addpattern openwrt-sstrip
 
 openwrt-dirclean: linksys-shared-dirclean linksys-nvram-dirclean linksys-wlconf-dirclean
 
index 01df2058313bba8130a9da91fb7538d6df18507e..6507d2319c7f76d9b8fd90410928688ae2896672 100755 (executable)
@@ -8,8 +8,15 @@ if [ $(cat /proc/sys/reset) = 1 ] ; then
   while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done &
 else
   mount | grep jffs2 >&-
-  if [ $? = 0 ] && [ $(cat /proc/mtd | wc -l) = 6 ] ; then
-    jffs2root --move && reboot 
+  if [ $? = 0 ] ; then 
+    mtd unlock rootfs
+    [ $(cat /proc/mtd | wc -l) = 6 ] && {
+      echo 5 > /proc/sys/diag
+      mtd unlock OpenWrt
+      mtd erase OpenWrt
+      jffs2root --move
+    }
+    mount -o remount,rw /dev/root /
   else
     mtd unlock mtd4
     mount -t jffs2 /dev/mtdblock/4 /jffs
index 5e9380821b8e1a548001b070a61718c086565086..5a0259b27c2c5c8d9a02dee5a262499328a25740 100644 (file)
@@ -44,11 +44,11 @@ jffs2root-dirclean:
        rm -rf $(MTD_DIR)
 
 ifeq ($(strip $(BR2_TARGET_ROOTFS_JFFS2)),y)
-TARGETS+=openwrt-image
+TARGETS+=openwrt-jffs2root openwrt-image
 ROOTFS=jffs2
 JFFS2FLAGS=-a $(JFFS2_BLOCK_SIZE)
 
-openwrt-image: openwrt
+openwrt-image: openwrt
        @make jffs2root openwrt-code.bin TAG=W54G \
        EXTRAVERSION=$(EXTRAVERSION)-JFFS2-4M JFFS2_BLOCK_SIZE=0x10000
        @make jffs2root openwrt-code.bin TAG=W54S \