nwsp2 classic gpt support

Re: nwsp2 classic gpt support

Postby minibike12 » Thu Jan 03, 2013 3:00 pm

Again, nice work!
I am a silent watcher at the moment since i can't help with this.
I am happy to hear it when there is something i can help you with.
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Thu Jan 03, 2013 3:14 pm

Mijzelf wrote:Don't think so. This is about string parsing.
I think your Lacie sources are an 'in between' version, with half implemented 64 bit support. The mixed up 'll' and 'q' prefixes also suggest that.

well it is a download from ftp server of lacie with 1.3.9 presented as GPL u-boot source. What was missing in there were the c-code and header files for efi partitions. I copied those from general u-boot source code with version from around the same date as the lacie code :whistle I know not perfect but I saw in the source code of Lacie the same file as in the general u-boot, so I gave it a shot. :mrgreen:
The code shown in the above posts about calculating the size is not from part_efi.c but from part.c but it gets its info to my opinion from part_efi.c
Maybe some mismatch happens there.

Concur. But the end of partition 8 doesn't fit in an 32 bits value, so that cannot be read well.

agree
It's the lower significant 32 bits part of the 'real' value: 1565565872 decimal = 5D50A3B0 hex.
If I add the higher significant 32 bits, this becomes 000000015D50A3B0, which is 5860533168 decimal, which boils down to 3000592982016 bytes. Know that value?

yes those are the correct values for total sectors and size in bytes. So it should be possible to read the correct value with appropriate setting for the variable.
I think the values are 32 bits values, when LBA64 disabled, so you could just change %llX in %lX, and get the right values. It is a lbaint_t type, I suppose (lba integer type)
Code: Select all
#ifdef CFG_64BIT_LBA
typedef uint64_t lbaint_t;
<snip>
#else
typedef ulong lbaint_t;
<snip>
#endif

I can try that but it is only let say..cosmetics

--edit
probably some more changes are needed in part_efi.c
Unfortunate Lacie doesn't have put the ones they used in the source code they published :dry
We need a more recent version to get that part.(1.3.9 was originally without GPT support)
But even mainline u-boot doesn't support 64bits

This is added as comment in the part-efi.c file (I downloaded the most recent one and it still has this comment)
My guess Lacie must have written an own version

Code: Select all
/*
 * Problems with CONFIG_SYS_64BIT_LBA:
 *
 * struct disk_partition.start in include/part.h is sized as ulong.
 * When CONFIG_SYS_64BIT_LBA is activated, lbaint_t changes from ulong to uint64_t.
 * For now, it is cast back to ulong at assignment.
 *
 * This limits the maximum size of addressable storage to < 2 Terra Bytes
 */


and this is somewhat further in the code
Code: Select all
int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
            disk_partition_t * info)
{
   gpt_header gpt_head;
   gpt_entry **pgpt_pte = NULL;

   /* "part" argument must be at least 1 */
   if (!dev_desc || !info || part < 1) {
      printf("%s: Invalid Argument(s)\n", __FUNCTION__);
      return -1;
   }

   /* This function validates AND fills in the GPT header and PTE */
   if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
         &(gpt_head), pgpt_pte) != 1) {
      printf("%s: *** ERROR: Invalid GPT ***\n", __FUNCTION__);
      return -1;
   }

   /* The ulong casting limits the maximum disk size to 2 TB */
   info->start = (ulong) le64_to_int((*pgpt_pte)[part - 1].starting_lba);
   /* The ending LBA is inclusive, to calculate size, add 1 to it */
   info->size = ((ulong)le64_to_int((*pgpt_pte)[part - 1].ending_lba) + 1)
           - info->start;
   info->blksz = GPT_BLOCK_SIZE;

   sprintf((char *)info->name, "%s%d", GPT_ENTRY_NAME, part);

This seems to cause the incompatibility with the LBA64 configs

attached the part_efi.c file used in the last version
part_efi.zip
You do not have the required permissions to view the files attached to this post.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Thu Jan 03, 2013 3:17 pm

minibike12 wrote:Again, nice work!
I am a silent watcher at the moment since i can't help with this.
I am happy to hear it when there is something i can help you with.


at least it means you won't have to return the disk, I will sent you a new u-boot version soon
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby minibike12 » Thu Jan 03, 2013 3:29 pm

Good news.
Are there any limitations at the moment except for the odd readings?
Or should i be possible to use it normally with 3TB of space?
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Thu Jan 03, 2013 3:35 pm

No limitations or special preparations. Just prepare the disk with gdisk.
It will show up as 3TB drive in the firmware. You will never notice the u-boot issues discussed as u-boot will find the kernel and load it. The kernel can deal with GPT partitions and disk bigger then 2.2 TB

ss1.JPG
You do not have the required permissions to view the files attached to this post.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby minibike12 » Thu Jan 03, 2013 3:48 pm

Ok nice.
Prepair disk with gdisk and UIMAGE 59?
And flash the new U-boot the same way as previous 1.3.9?
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Thu Jan 03, 2013 4:03 pm

minibike12 wrote:Ok nice.
Prepair disk with gdisk and UIMAGE 59?
And flash the new U-boot the same way as previous 1.3.9?


yes correct, remember you need a running nwsp2 with UIMAGE 59 to flash the new u-boot.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby minibike12 » Thu Jan 03, 2013 4:14 pm

Hmm ok.
Best thing to do is prepare the 3TB disk with mbr and UIMAGE 59 to boot it.
Then flash and compare Uboot, reboot.
When it works, prepare the disk with GPT and 3TB sda8.
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Thu Jan 03, 2013 5:03 pm

yes, no need to add sda8 in case of MBR so preparation could be fast

pm sent with a new u-boot binary
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby minibike12 » Fri Jan 04, 2013 12:30 pm

Hmm, problem.
I've had the 1TB in use last few days, and i wanted to start with the 3TB drive today so i went to the nas to turn it off, but i've noticed that the nwsp2 froze.
The 1TB drive is still spinning, but i can't access it in explorer, and can't access the network interface, and it does not respond to pushing on/off switch.
Maybe a bug in the Uboot? (This is the Uboot you sent me a few days ago, not the new one from yesterday).
This is the original 1TB hdd, with the original lacie firmware.

I've done a reboot, still can't access the original disk...

Edit:
After a while power-down i've fired it up again, and it came alive again (slowly though).
At least i can still access the files.
Any clue what caused this freeze?


And i started working on the 3TB drive.
Will let you know if it works correctly.


Edit 2:
Found something interesting.
Made the 3TB with mbr and partition 1 till 7 (i didn't make sda8) to flash uboot 4.
I can still access the folder "public"? (\\ipadress\public)
When i put a file there, uboot 4 for example, ssh into the drive, and use "ls /share/1000/public", it shows the uboot 4 file.
How can i use the folder when i didn't make sda8 and the folder?

Anyhow, flashed uboot4 correctly, and rebooted.
Still working.
Now repartitioning to GPT.
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

PreviousNext

Return to Development

Who is online

Users browsing this forum: mistert and 1 guest