nwsp2 classic gpt support

Re: nwsp2 classic gpt support

Postby fvdw » Mon Dec 31, 2012 10:47 am

I think the LBA setting is the problem, I found this in the source code

Code: Select all
- LBA48 Support
      CONFIG_LBA48

      Set this to enable support for disks larger than 137GB
      Also look at CFG_64BIT_LBA ,CFG_64BIT_VSPRINTF and CFG_64BIT_STRTOUL
      Whithout these , LBA48 support uses 32bit variables and will 'only'
      support disks up to 2.1TB.

      CFG_64BIT_LBA:
         When enabled, makes the IDE subsystem use 64bit sector addresses.
         Default is 32bit.

Currently only CONFIG_LBA48 is set
seems it needs CFG_64BIT_LBA as well to be able to read sector addresses of disk bigger then 2.1 TB
I am not sure if both must be used or either one of them
this is the relevant part in part.c (I know we getting in detail here, but maybe Mijzelf can advise)
Code: Select all
#ifdef CONFIG_LBA48
      if (dev_desc->lba48)
         printf ("            Supports 48-bit addressing\n");
#endif
#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
      printf ("            Capacity: %ld.%ld MB = %ld.%ld GB (%qd x %ld)\n",
         mb_quot, mb_rem,
         gb_quot, gb_rem,
         lba,
         dev_desc->blksz);
#else
      printf ("            Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)\n",
         mb_quot, mb_rem,
         gb_quot, gb_rem,
         (ulong)lba,
         dev_desc->blksz);
#endif

So that will need a new compile of u-boot

If this is true you can test by making sda8 2 TB only in GPT partition table.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby minibike12 » Mon Dec 31, 2012 11:59 am

According to your code it indeed won't support >2.1TB partitions.
I will try again with a smaller sda8 partition to test it.

I've made my partitions with gparted.
But fdisk only showed one partition?

I will try again with gdisk with an 2tb partition first.
If this works i will change it to an 3tb partition.
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Mon Dec 31, 2012 12:10 pm

okido

ps no need I think to format sda8 for trial purpose, can save you some time

lets hope I can remember how I compiled u-boot in summer. I have the files and notes
First step will be reproduce the u-boot compiled in july, if thats the same then next step to add the new config

--edit good news I could reproduce the compiled u-boot from juli, so the setup is ok

This afternoon and evening I will be busy with something else, to be continued...
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby minibike12 » Mon Dec 31, 2012 1:41 pm

Great work!

I've been busy with family last days, and same for today.

But i have a lot of free time coming days, so i can test a lot then.

Maybe it will be good for you to wait with buying a 3TB hdd until it works correctly here, since they are not cheap.
Would be a shame if we both have a 3TB hdd we can't use in the end (don't think this will happen though, we should be able to fix it).

I will repartition the whole disk tomorrow with gdisk just to be sure and start with an 2TB partition.
Will let you know as soon as i know more.
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby Mijzelf » Mon Dec 31, 2012 4:54 pm

minibike12 wrote:I've made my partitions with gparted.
But fdisk only showed one partition?
That's normal. It's called a 'protective MBR'. When a GPT partition table is made, also an MBR partition table is made, containing 1 big partition covering the whole disk (or 2TiB if the disk is bigger). This to protect the disk against non-GPT aware tools/OSses which might think the disk is empty.


@fvdw: Does this u-boot support Clunc? It would be nice to see the boot messages. AFAIK u-boot doesn't need to support >2TiB addressing. It only needs to load the kernel from partition 6. Both partition 6 and the partition table are well below any critical address, so there should be no problem here.
Remember that the old u-boot worked fine on that disk.
Mijzelf
 
Posts: 255
Joined: Wed Nov 21, 2012 9:12 am

Re: nwsp2 classic gpt support

Postby fvdw » Mon Dec 31, 2012 6:20 pm

Mijzelf wrote:@fvdw: Does this u-boot support Clunc? It would be nice to see the boot messages. AFAIK u-boot doesn't need to support >2TiB addressing. It only needs to load the kernel from partition 6. Both partition 6 and the partition table are well below any critical address, so there should be no problem here.
Remember that the old u-boot worked fine on that disk.


Yes it supports clunc, that is how I looked if it reported the new version. I get the Marvell >> prompt and can list environment variables etc etc, but to start it loading the kernel is not straight forward. Giving the boot or bootm command returns "bad magic" that also happens with the old u-boot some more must be given to make it load the kernel
I did not spend much time on that as it booted fine. But if the red led is flashing then almost 100% sure that it could not read the disk. Yes the disk worked with the old u-boot but only with 7 partitions or at total allocate space with partitions smaller then 2.2 TB. It did not work with a GPT table.
The problem will be that if a partition is defined bigger then 2.2TB the number of blocks and bytes in that partition or the sum of the partitions will be above the 32 bits limit and can not be addressed if u-boot doesn't support LBA64. Therefor I asked minibike to make a disk wit only a partition of 2 TB, I am quite sure that when making such a disk it will recognize it and boot form it. (same as my 1 TB trial disk)
In the boot loader output of the nwsp Lite it is mentioned that besides GPT also LBA64 is enabled. I did not made any change in the source code to enable it as my guess was probaly it is enabled by default. Probably not, there is a configuration parameter (see earlier post) which can be used for it. It is not used in the kw configuration file. My only doubt is if as well config_LB48 must be set and in addition CFG_LBA_64 the number of logical sectors or only one of them. But from what I read in doc's include in the source my guess is both.

README file 1.39_kw u-boot source code lacie
Code: Select all
<snip>
- ATAPI Support:
      CONFIG_ATAPI

      Set this to enable ATAPI support.

- LBA48 Support
      CONFIG_LBA48

      Set this to enable support for disks larger than 137GB
      Also look at CFG_64BIT_LBA ,CFG_64BIT_VSPRINTF and CFG_64BIT_STRTOUL
      Whithout these , LBA48 support uses 32bit variables and will 'only'
      support disks up to 2.1TB.

      CFG_64BIT_LBA:
         When enabled, makes the IDE subsystem use 64bit sector addresses.
         Default is 32bit.

- SCSI Support:
<snip>
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Tue Jan 01, 2013 11:22 am

this is the only change made in the code (ide.h) when setting that CFG_64BIT_LBA
(others are only related to printing error messages)

Code: Select all
#ifdef CFG_64BIT_LBA
typedef uint64_t lbaint_t;
#define IDE_BLOCK_NUMBER_MASK 0x0000fffff0000000
#define LBA_LOW_REG_SHIFT   24
#define LBA_MID_REG_SHIFT   32
#define LBA_HIGH_REG_SHIFT   40
#else
typedef ulong lbaint_t;
#define IDE_BLOCK_NUMBER_MASK 0xf0000000
#define LBA_LOW_REG_SHIFT   24
#define LBA_MID_REG_SHIFT   0
#define LBA_HIGH_REG_SHIFT   0
#endif

So indeed it can store large numbers
I will add in the configuration an recompile u-boot
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Tue Jan 01, 2013 3:19 pm

mmm.. this didn't delivered a properly working u-boot. No red led but it seems not to be able to read the disk (GPT or MS-dos table)
Needed to flash u-boot using clunc and tftp :whistle (close escape).
So u-boot was running but had a problem to read the disk. Restoring the version from 28 dec 2012 brought back normal functionality

:thinking
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Tue Jan 01, 2013 4:53 pm

solved,
it needed one more config setting, now it is up and running with LBA64 support added in u-boot :bananadance

In total this needed to be added for LBA64
Code: Select all
#define CFG_64BIT_LBA
#define CFG_64BIT_VSPRINTF
#define CFG_64BIT_STRTOUL
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby minibike12 » Tue Jan 01, 2013 7:34 pm

Wow nice work!
I haven't tried 2TB partition yet.
Can't seem to get linux to work on my pc (my gtx580 causes a lockup), and all the other pc's were in use...
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: No registered users and 12 guests