General NAS-Central Forums

Welcome to the NAS community
It is currently Thu Dec 14, 2017 5:13 pm

All times are UTC




Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next
Author Message
PostPosted: Thu Aug 06, 2015 9:55 pm 
Offline

Joined: Thu Jul 09, 2015 9:33 pm
Posts: 61
Yes, normal access... unless by a bug from Windows 7, can't Disconnect the old Mapping Drive
Quote:
Family(\\Cloudbox) (Z:)


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 9:58 pm 
Offline

Joined: Thu Jul 09, 2015 9:33 pm
Posts: 61
I guess I should try to send the ubootenv file again... with the 1-0. What do you think?


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 9:59 pm 
Offline

Joined: Thu Jul 09, 2015 9:33 pm
Posts: 61
Looking into the code I found this:

Code:
ERROR: There is a global environment variable with the same name.
Loading file "/boot/uImage" from ide device 0:5 (gpt5
)
7183376 bytes read


What it means?


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 10:04 pm 
Offline

Joined: Wed Mar 18, 2009 11:13 pm
Posts: 775
That error is caused because we have set the root_part variable manually. It will go away if we don't do that.

yes I suggest you do that upload the ubootenv file 1-0 again.
Then reboot and interrupt with u-boot console
But before giving the nexus_boot command I suggest you read in u_boot console again the variables
Code:
ext2get ide 0:${nexus_nv_part} /ubootenv boot_count saved_entry


If that still gives a wrong value we can try this in u-boot console to set the right value
Code:
ide reset
ext2set ide 0:${nexus_nv_part} /ubootenv saved_entry 1


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 10:13 pm 
Offline

Joined: Thu Jul 09, 2015 9:33 pm
Posts: 61
Errors...

Code:
provided by fvdw
waiting for u-boot..
starting u-boot net console click on window and press enter


Marvell>> ext2get ide 0:${nexus_nv_part} /ubootenv boot_count saved_entry
ext2get ide 0:${nexus_nv_part} /ubootenv boot_count saved_entry
** Bad partition 3 **
Marvell>> ide reset
ide reset

Reset IDE:
Marvell Serial ATA Adapter

Marvell Serial ATA Adapter
Integrated Sata device found
[0 0 0]: Enable DMA mode (5)
  Device 0 @ 0 0:
Model: ST2000DM001-1CH164                       Firm: CC44     Ser#:             Z2F0VEJ3
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1907729.0 MB = 1863.0 GB (3907029168 x 512)
PCIe SATA:ffffffff

Marvell>> ext2get ide 0:${nexus_nv_part} /ubootenv boot_count saved_entry
ext2get ide 0:${nexus_nv_part} /ubootenv boot_count saved_entry

** bad crc : env data may be corrupted
Marvell>> cat ubootenv
cat ubootenv
Unknown command 'cat' - try 'help'
Marvell>>


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 10:22 pm 
Offline

Joined: Wed Mar 18, 2009 11:13 pm
Posts: 775
so editing that file it does not like and it is not classified as corrupt
Then put back the original 0-0 file
and do in u-boot console this to try to set the right value
Code:
ide reset
ext2set ide 0:${nexus_nv_part} /ubootenv saved_entry 1


After setting it in u-boot try to read it agin to see if it hen returns the corrected value


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 10:38 pm 
Offline

Joined: Wed Mar 18, 2009 11:13 pm
Posts: 775
it seems that the first characters in the file are a crc checksum and a termination character, if we modify the file with an editor we must also adapt that checksum. Hopefully that ext2set command will do that for us..

this is the relevant part in ext2set code were CRC check is done
Code:
   filePos=0;
   if (ext2fs_read_pos(buffer, 0, filelen) != filelen) {
      printf("\n** Unable to read \"%s\" from %s %d:%d **\n", filename, argv[1], dev, part);
      ext2fs_close();
      if(buffer){
         free (buffer);
      }
      return(1);
   }

env=(env_t*)buffer;
   readCrc = env->crc;
   sizeCrc = 0;
   for(i=offsetof(env_t, data); ((i+1)<filelen) && ((buffer[i]!='\0') || (buffer[i+1]!='\0')); i++)
      ;

   if((i+1)==(filelen) && ((buffer[i]!='\0') || (buffer[i+1]!='\0'))){
      /*error : did not find termination char*/
      printf("\n** Unable to locate env termination char\n");
      ext2fs_close();
      if(buffer){
         free (buffer);
      }
      return(1);
   }else{
      sizeCrc = (i+2) * sizeof(char) - offsetof(env_t, data);
   }
   /*calculate crc*/
   calculatedCrc = crc32(0, (unsigned char*)(env->data), sizeCrc);

   /*compare crc*/
   if(calculatedCrc != readCrc){
      /*bad crc*/
      printf("\n** bad crc : env data may be corrupted\n");
      ext2fs_close();
      if(buffer){
         free (buffer);
      }
      return(1);
   }


Last edited by fvdw on Fri Aug 07, 2015 9:14 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 10:57 pm 
Offline

Joined: Thu Jul 09, 2015 9:33 pm
Posts: 61
I guess I can't copy it back...

Code:
Marvell>> ext2set ide 0:${nexus_nv_part} /ubootenv saved_entry 1
ext2set ide 0:${nexus_nv_part} /ubootenv saved_entry 1

** bad crc : env data may be corrupted
Marvell>>


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 10:59 pm 
Offline

Joined: Thu Jul 09, 2015 9:33 pm
Posts: 61
Do you still have the original file, I guess I lost it, because I can't find it in my PC.


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 11:14 pm 
Offline

Joined: Wed Mar 18, 2009 11:13 pm
Posts: 775
I will post on plugout, if we cannot write to that one we need to find a way to edit the file properly, the cloudbox u-boot code should give enough info to do that


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 11:21 pm 
Offline

Joined: Wed Mar 18, 2009 11:13 pm
Posts: 775
I don't have to post it it is already there as you posted it yourself

http://plugout.net/viewtopic.php?f=28&t ... 310#p19303


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 11:23 pm 
Offline

Joined: Wed Mar 18, 2009 11:13 pm
Posts: 775
dmiyabara wrote:
I guess I can't copy it back...

Code:
Marvell>> ext2set ide 0:${nexus_nv_part} /ubootenv saved_entry 1
ext2set ide 0:${nexus_nv_part} /ubootenv saved_entry 1

** bad crc : env data may be corrupted
Marvell>>


To write to it you must first put back the original file (do not use a modified one)


Top
 Profile  
 
PostPosted: Fri Aug 07, 2015 12:08 am 
Offline

Joined: Thu Jul 09, 2015 9:33 pm
Posts: 61
Tried other commands...

Code:
Marvell>> ${bootcmd}
${bootcmd}
## Error: "nexus_boot;" not defined
Marvell>>


Top
 Profile  
 
PostPosted: Fri Aug 07, 2015 9:35 am 
Offline

Joined: Wed Mar 18, 2009 11:13 pm
Posts: 775
I am trying to understand how the crc check works

First we need to know what env_t type is as it is used in the code
This is defined as follow:
Code:
#define ENV_SIZE (CFG_ENV_SIZE - ENV_HEADER_SIZE)

typedef   struct environment_s {
   unsigned long   crc;      /* CRC32 over data bytes   */
#ifdef CFG_REDUNDAND_ENVIRONMENT
   unsigned char   flags;      /* active/obsolete flags   */
#endif
   unsigned char   data[ENV_SIZE]; /* Environment data      */
} env_t;

So the first 8 bytes of such variabele(=length ulong) contains crc, Assuming we have not a redundant environment, the rest of that array contains the data
This seems also to be the setup of the ubootenv file, a crc then the data over which the crc is calculated and two termination characters (\0\0)

In ext2get function the sequence is as follows to read the content of this file and check crc.

1. it reads the content of the file (filelen is the length of the file opened)
Code:
   filePos=0;
   if (ext2fs_read_pos(buffer, 0, filelen) != filelen) {
      printf("\n** Unable to read \"%s\" from %s %d:%d **\n", filename, argv[1], dev, part);
      ext2fs_close();
      if(buffer){
         free (buffer);
      }
      return(1);
   }

2. then it puts what it has read in variabele env (this defined as env_t type) and it sets readCrc to the value found in the first 8 bytes as env->crc is stored in first 8 bytes and sets sizeCRC to 0.
SizeCrc seems to be the length of the data over which the crc must be calculated. So as next step it determines that length.
Code:
   env=(env_t*)buffer;
   readCrc = env->crc;
   sizeCrc = 0;

3. Then it seems to determine the length of data string to calculate the crc itself for comparison
Code:
   for(i=offsetof(env_t, data); ((i+1)<filelen) && ((buffer[i]!='\0') || (buffer[i+1]!='\0')); i++)
      ;

   if((i+1)==(filelen) && ((buffer[i]!='\0') || (buffer[i+1]!='\0'))){
      /*error : did not find termination char*/
      printf("\n** Unable to locate env termination char\n");
      ext2fs_close();
      if(buffer){
         free (buffer);
      }
      return(1);
   }else{
      sizeCrc = (i+2) * sizeof(char) - offsetof(env_t, data);


3. Then it calculates the crc form the data string
Code:
   /*calculate crc*/
   calculatedCrc = crc32(0, (unsigned char*)(env->data), sizeCrc);

4. and compares it with what it found in the bigenning of the file
Code:
   if(calculatedCrc != readCrc){
      /*bad crc*/
      printf("\n** bad crc : env data may be corrupted\n");
      ext2fs_close();
      if(buffer){
         free (buffer);
      }
      return(1);


What puzzles me is that in the ubootenv file you have sent the crc seems to be only 4 bytes long..???
to be continued, I have vistors right now, will be back later.
If we find out how this works then we can recreate the ubootenv file in the correct way.


Top
 Profile  
 
PostPosted: Fri Aug 07, 2015 11:02 am 
Offline

Joined: Thu Jul 09, 2015 9:33 pm
Posts: 61
That's right, when I changed the ubootenv file with this command, I don't know why my backup files have changed as well. I don't copied the file ubootenv over the ubootenv.old.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group