nwsp2 classic gpt support

Re: nwsp2 classic gpt support

Postby fvdw » Sun Dec 23, 2012 3:13 pm

minibike12 wrote:I meant pull the U-Boot from the lite so you can compare them this way to make a GPT compatible U-Boot for the classic.
This instead of waiting for the sourcecode.


Its a binary and I can read and see differences, but you can not edit like a text file. When making changes it needs to be recompiled from source, there is no other way. Adding GPT support is adding another file format stucture, driver.

I first need to be able to write to the flash. As said on the to do list but not on short notice, sorry
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby minibike12 » Sun Dec 23, 2012 3:16 pm

Okey, that is too bad.
I would like to help, but i am not that experienced yet unfortunately.

Anyway, i will use the tip from Mijzelf with a loop partition.
I hope that he can explain this a bit more.
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby Mijzelf » Sun Dec 23, 2012 6:49 pm

fvdw wrote:our partition structure deviate from Lacie standard
In our case the data partition is partition 8.
Whatever.
ps the bootloader expect an ms-dos partition table so a problem will arise when defining partition 4, that must an extended one covering the remainder of the disk..and then you have the max blocks issue again.
Why? Does the bootloader care if partition 4 fills the whole disk? I think you can just make it big enough to contain partitions 5-7. The bootloader is smart enough to find partition 6, but I don't think it will do any consistency tests on the partition table.
minibike12 wrote:Will this have a big impact on performance?
And i should be able to access the full 3TB with this method?
Theoretically there will be a small performance hit. But I don't think it will be noticable. And yes, you should be able to access the full 3TB, providing the bootloader won't choke in the disksize.

BTW, I don't think this can be done (easily) in the original Lacie software. There is that terrible unicorn, which will refuse service when it can't mount sda2. The alternative firmware is better in this, I think.
Mijzelf
 
Posts: 255
Joined: Wed Nov 21, 2012 9:12 am

Re: nwsp2 classic gpt support

Postby minibike12 » Sun Dec 23, 2012 7:41 pm

Hmm, ok.
So i should use nwsp2 custom firmware with the losetup?

Can you explain losetup a bit more?
How to calculate offset etc?
I have an 4096 advanced format drive.
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby Mijzelf » Sun Dec 23, 2012 9:59 pm

minibike12 wrote:Hmm, ok.
So i should use nwsp2 custom firmware with the losetup?
Yes, I think so.
Can you explain losetup a bit more?
How to calculate offset etc?
I have an 4096 advanced format drive.
The offset is the offset in bytes, on the device /dev/sda. The needed offset is dependent on the used disk space. I had a look at the installation instructions here. I suggest you to follow the instructions, and also use the provided GPT supporting kernel. (GPT support is not really necessary, but maybe also large disk support is added, which *is* needed).
But when building the partition table, let partition 4 end at cylinder 400, and also partition 8. (fdisk will automagically propose cylinder 400 as ending cylinder for partition 8). When you have build your disk following the instructions, plug it in the nas, and boot. If it boots, the bootloader is not choked.

Now, login via ssh, and create the loop device. Our disk is filled upto cylinder 400, and one cylinder is 8001KiB, which makes 3277209600 bytes. To be safe, I suggest to use 3686809600 as offset, which is a multiple of 4096.
So create the loop device:
Code: Select all
losetup -o 3686809600 /dev/loop0 /dev/sda
Create a filesystem
Code: Select all
mke2fs -j /dev/loop0
and mount it
Code: Select all
mkdir /tmp/mountpoint
mount /dev/loop0 /tmp/mountpoint
The command 'df' should now show an almost 3TB partition, which is 97% free, or something like that. Now unmount the partition, and reboot the box
Code: Select all
umount /tmp/mountpount
reboot
When the box has rebooted, re-create and mount the loop device:
Code: Select all
losetup -o 3686809600 /dev/loop0 /dev/sda
mkdir /tmp/mountpoint
mount /dev/loop0 /tmp/mountpoint
If this works without complaints, I suppose it's all gonna work.

But some help of fvdw is needed. I looked at the scripts in his firmware, and actually I couldn't find where the data partition is being mounted, and so I also don't know where to inject this code. But so far you can try if the bootloader can be tricked, and if the filesystem on the loopdevice survives a reboot.
Mijzelf
 
Posts: 255
Joined: Wed Nov 21, 2012 9:12 am

Re: nwsp2 classic gpt support

Postby fvdw » Sun Dec 23, 2012 10:21 pm

yes we can adapt the script to handle this
sda8 is mounted on /share/1000 in root file system. The folder /share is present in the firmware image and the folder /share/1000 must be created first time.
Mounting the loop device instead of sda8 should be possible.

However some conflict may arise when using /dev/loop0 as that can be use for an image used to make back side usb port operational
Better use /dev/loop1

first lets see if this works at all

ps in the meantime I looked to the flash partition size and found that sector size is 4k so I adjusted the size of the u-boot partition to match the sector size and recompiled the kernel.
Now it seems to writable from userland...now are we brave enough to play with it..

dmesg output
Code: Select all
<snip>
m25p80 spi0.0: mx25l4005a (512 Kbytes)
Creating 2 MTD partitions on "spi_flash":
0x000000000000-0x00000007d000 : "u-boot"
0x00000007e000-0x00000007f000 : "u-boot-env"
<snip>
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Sun Dec 23, 2012 10:50 pm

mmm.... I checked my files
From my summer trials I even have a compiled u-boot version based on version 1.3.9 that should enable GPT support on the classic...or brick it
Now that the flash seems to be writable...
are there volunteers to try it ?
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 24, 2012 9:19 am

@Mijzelf & fvdw
Thanks for the info!

@Mijzelf
But if i understand it good enough with the data fvdw gave it should be done like this:
Create loop device
Code: Select all
losetup -o 3686809600 /dev/loop0 /dev/sda

Create a filesystem
Code: Select all
mke2fs -j /dev/loop0

and mount it
Code: Select all
mkdir /share/1000
mount /dev/loop1 /share/1000

unmount the partition, and reboot the box
Code: Select all
umount /tmp/mountpount

reboot
When the box has rebooted, re-create and mount the loop device:
Code: Select all
losetup -o 3686809600 /dev/loop0 /dev/sda
mkdir /share/1000
mount /dev/loop0 /share/1000


Do i have to resetup losetup when the box reboots, or shuts down due to powerloss?
And there is no chance of major dataloss in case of an powerloss?

@fvdw
How big is the chance to brick it, what JTAG do we need to recover it, and is the JTAG recovery 100% guaranteed?
And do you know how the JTAG recovery works.
minibike12
 
Posts: 99
Joined: Sat Dec 22, 2012 9:23 pm
Location: The Netherlands

Re: nwsp2 classic gpt support

Postby fvdw » Mon Dec 24, 2012 9:46 am

to be honest I don't know the details, I never worked with JTAG but on the internet there is a lot of information on it and guides.
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 24, 2012 10:13 am

Hmm okey.
I am willing to try the new U-Boot.
But for this i have to buy my own nwsp2.
The current classic we have is shared with some other people, and they will kill me if i brick it :-D


Do you know the JTAG pinout?

I've had some JTAG lessons with AVR, ARM and FPGA chips, so i should be possible to figure this out.
The only things i need are, JTAG pinout, JTAG pcb (i might buy this), and original and modified U-Boot.

Maybe Mijzelf, knows a bit more about this.
And it would be great if Mijzelf could look at the losetup commands i posted, to be sure that it is right.
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 11 guests