General NAS-Central Forums

Welcome to the NAS community
It is currently Thu May 25, 2017 6:18 pm

All times are UTC




Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Sun Sep 14, 2014 6:53 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 5994
Hm. Re-reading the wiki and some forum articles I think it's perfectly possible that the '1st-32MiB file' doesn't contain a partition table. For the EMC imager stick the box only needs to boot. The bootscript in the (original) initrd re-creates the partition table. So there doesn't need to be a partition table to start with.
You can just create one, if you first save the MBR code area. That is needed by the rather simple bootloader in the SoC:
Code:
dd if=/dev/sdX of=/path/to/MBRCodeArea bs=446 count=1
fdisk /dev/sdX #(or parted /dev/sdX, if you prefer)
dd if=/path/to/MBRCodeArea of=/dev/sdX


Top
 Profile  
 
PostPosted: Sun Sep 14, 2014 7:30 pm 
Offline

Joined: Sat Sep 13, 2014 8:25 am
Posts: 16
I've tried your code but it didn't have any effect.. Looking at the wiki page I tried the following different approach. It at least seems to leave the partition table intact, I'm however not so sure if the bootstuff is still perfectly fine.

Code:
dd of=/dev/sda if=Iomega-HMNHD-CE-1st-32M.img bs=512 seek=34 skip=3


Edit: well that seems to keep the partition table intact but it does break the rest.
I've also tried booting it without a partition and just the magic stuff on it. The NAS hangs; so that confirms that it indeed tries to boot from the HDD!


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 7:21 am 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 5994
christiaan wrote:
I've tried your code but it didn't have any effect..
No effect? THe idea is that you create a partition table with fdisk. How can that have no effect?
christiaan wrote:
Code:
dd of=/dev/sda if=Iomega-HMNHD-CE-1st-32M.img bs=512 seek=34 skip=3
Edit: well that seems to keep the partition table intact but it does break the rest.
Shouldn't the value of seek and skip be the same? An you still need the code area. No idea if that will be preserved by a partition editor.


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 7:56 am 
Offline

Joined: Sat Sep 13, 2014 8:25 am
Posts: 16
I've been going about this completely wrong. Rereading your answer apparently the MBR area contains code needed to boot.

Should I create a normal ms-dos partition table or a GPT table, because the Wiki also speaks of a GPT area.

I'll try your exact instructions this afternoon instead of misinterpreting it myself ;) thanks!

Edit: My collegue found this topic about booting Arch Linux on the 782x entirely from Sata. The sector offsets etc all seem to be the same so I'll be trying that first.


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 10:54 am 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 5994
Quote:
Should I create a normal ms-dos partition table or a GPT table, because the Wiki also speaks of a GPT area.
It doesn't matter. The data in the CodeArea makes the SoC to find the 1st stage bootloader on sector 34. the 1st stage bootloader finds u-boot @154, and so on.

The partition table is only important when Linux wants to read it. And Linux can read both GPT and MBR.

But of course, make sure the 1st partition starts at 32MiB+.


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 4:56 pm 
Offline

Joined: Tue May 21, 2013 10:49 pm
Posts: 79
Hello,

Ive done:
Code:
 zcat Iomega-HMNHD-CE-1st-32M.img.gz | dd of=/dev/sdb bs=1M
0+1024 records in
0+1024 records out
33554432 bytes (34 MB) copied, 2.95846 s, 11.3 MB/s
dd if=uImage of=/dev/sdb bs=512 seek=1290
5989+1 records in
5989+1 records out
3066408 bytes (3.1 MB) copied, 0.54459 s, 5.6 MB/s

and then I followed these instructions
Quote:
rdimg.gz is actually a gzipped ext2 filesystem, with an uImage header. You can extract the filesystem:
Code:
tail -c +65 rdimg.gz | gzip -d >initrd
and mount it
Code:
mkdir -p initrd.d
mount -o loop initrd initrd.d
Now you can edit the bootscript (/rclinux) to setup the network, and start a telnet daemon....


and edited /etc/rc (added telnet daemon)
but I'm stuck (as a newbie) on how to make proper rdimg.gz from the mounted initrd.d. Can you pls poin me (does regular gzip will suffice?)

After that I have a question - if I'll manage to login via telnet, how to invoke firmware flashing ?


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 5:12 pm 
Offline

Joined: Sat Sep 13, 2014 8:25 am
Posts: 16
wicked wrote:
but I'm stuck (as a newbie) on how to make proper rdimg.gz from the mounted initrd.d. Can you pls poin me (does regular gzip will suffice?)


I did it like this

Code:
umount initrd.d
gzip initrd

mkimage -A ARM -O Linux -T RAMDisk -C gzip -a 61000000 -e 61000000 -d initrd.gz rdimg.gz.new


It seemed to work, mkimage gave the same header information on the old rdimg.gz file and this newly created one.


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 6:15 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 5994
wicked wrote:
After that I have a question - if I'll manage to login via telnet, how to invoke firmware flashing ?

Mijzelf wrote:
If you manage to get telnet access, the script /rclinux contains the code to flash the files from KD20.zip. I think you can suffice with the ubi fs, as that is the only partition which should be editable from the webinterface.


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 6:20 pm 
Offline

Joined: Tue May 21, 2013 10:49 pm
Posts: 79
christiaan wrote:
wicked wrote:
but I'm stuck (as a newbie) on how to make proper rdimg.gz from the mounted initrd.d. Can you pls poin me (does regular gzip will suffice?)


I did it like this

Code:
umount initrd.d
gzip initrd

mkimage -A ARM -O Linux -T RAMDisk -C gzip -a 61000000 -e 61000000 -d initrd.gz rdimg.gz.new


It seemed to work, mkimage gave the same header information on the old rdimg.gz file and this newly created one.


done that however Iwas expecting that NAS would obtain ip from dhcp and nothing happened.
I dod not do partition for logs as the MBR was faulty (as discussed earlier)


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 6:25 pm 
Offline

Joined: Sat Sep 13, 2014 8:25 am
Posts: 16
Mijzelf wrote:
Hm. Re-reading the wiki and some forum articles I think it's perfectly possible that the '1st-32MiB file' doesn't contain a partition table. For the EMC imager stick the box only needs to boot. The bootscript in the (original) initrd re-creates the partition table. So there doesn't need to be a partition table to start with.
You can just create one, if you first save the MBR code area. That is needed by the rather simple bootloader in the SoC:
Code:
dd if=/dev/sdX of=/path/to/MBRCodeArea bs=446 count=1
fdisk /dev/sdX #(or parted /dev/sdX, if you prefer)
dd if=/path/to/MBRCodeArea of=/dev/sdX


I can confirm that this works. I've got a magic drive with a single partition on it as well now.


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 6:28 pm 
Offline

Joined: Tue May 21, 2013 10:49 pm
Posts: 79
christiaan wrote:

I can confirm that this works. I've got a magic drive with a single partition on it as well now.


are you using Shuttle KD20 or other oxnas based device?


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 6:29 pm 
Offline

Joined: Sat Sep 13, 2014 8:25 am
Posts: 16
The KD20


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 6:37 pm 
Offline

Joined: Tue May 21, 2013 10:49 pm
Posts: 79
so to sum up, my steps were:
Code:
#make gpt partition table
zcat Iomega-HMNHD-CE-1st-32M.img.gz | dd of=/dev/sdb bs=1M
dd if=uImage of=/dev/sdb bs=512 seek=1290
#after whole mounting init.rd.gz, modifying /rc startup script:
umount initrd.d
gzip initrd
mkimage -A ARM -O Linux -T RAMDisk -C gzip -a 61000000 -e 61000000 -d initrd.gz rdimg.gz.new
dd if=rdimg.gz.new of=/dev/sdb bs=512 seek=16674

was your procedure any different ?


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 6:42 pm 
Offline

Joined: Sat Sep 13, 2014 8:25 am
Posts: 16
wicked wrote:
so to sum up, my steps were:
Code:
zcat Iomega-HMNHD-CE-1st-32M.img.gz | dd of=/dev/sdb bs=1M
dd if=uImage of=/dev/sdb bs=512 seek=1290
#after whole mounting init.rd.gz, modifying /rc startup script:
umount initrd.d
gzip initrd
mkimage -A ARM -O Linux -T RAMDisk -C gzip -a 61000000 -e 61000000 -d initrd.gz rdimg.gz.new
dd if=rdimg.gz.new of=/dev/sdb bs=512 seek=16674

was your procedure any different ?


Except for the fact that afterwards I did the
Code:
dd if=/dev/sdX of=/path/to/MBRCodeArea bs=446 count=1
fdisk /dev/sdX #(or parted /dev/sdX, if you prefer)
dd if=/path/to/MBRCodeArea of=/dev/sdX


to create a partition on the disk. FYI the only thing I've got going on right now is the KD20 not booting up and hanging with just a blue light. And when I remove the disk it boots from the nand.
So I still have a long way ahead I guess, I've had trouble opening up the case otherwise I might have the stuff laying around to fix a serial cable.


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 6:49 pm 
Offline

Joined: Tue May 21, 2013 10:49 pm
Posts: 79
christiaan wrote:
...to create a partition on the disk. FYI the only thing I've got going on right now is the KD20 not booting up and hanging with just a blue light. And when I remove the disk it boots from the nand.
So I still have a long way ahead I guess, I've had trouble opening up the case otherwise I might have the stuff laying around to fix a serial cable.


and your disk has ms-dos or gpt partition table ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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