Boot Entirely from SATA on Akitio

This forum is for all other ARMv5 devices

Re: [How-To] Boot Entirely from SATA

Postby jmandawg » Mon Jun 11, 2012 10:17 pm

$this->bbcode_second_pass_code('', 'Starting kernel ...')

Well, it worked this time. The only difference is the first time i set the drive up over the USB interface on my other pogo device. This time i used my server with the esata interface. Most likely i screwed up one of the steps up last night.

Thanks for the help!
jmandawg
 
Posts: 34
Joined: Mon Oct 25, 2010 4:07 am

Re: [How-To] Boot Entirely from SATA

Postby WarheadsSE » Tue Jun 12, 2012 12:00 am

Not a problem.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: [How-To] Boot Entirely from SATA

Postby Asure » Tue Jun 19, 2012 2:00 pm

You have another error/assumption in your script. It assumes that /dev/sdb1 actually points to a hardware device. When you're playing as root on your linux/vm and have read/write everywhere, strange things happen when of=/dev/sdb1, and your disk has no partitions..

(I had followed the instructions to the letter, and nuked the partitions away. So first time your script runs it creates a real file holding the uImage, blocking all writes to actual disk part sdb1..)

$this->bbcode_second_pass_code('', '
root@asure-vmdesktop:/oxnas/1# ls -la /dev/sd*
brw-rw---- 1 root disk 8, 0 2011-10-27 11:12 /dev/sda
brw-rw---- 1 root disk 8, 1 2011-10-27 11:12 /dev/sda1
brw-rw---- 1 root disk 8, 2 2011-10-27 11:12 /dev/sda2
brw-rw---- 1 root disk 8, 5 2011-10-27 11:12 /dev/sda5
brw-rw---- 1 root disk 8, 16 2012-06-19 15:14 /dev/sdb
-rw-r--r-- 1 root root 2159948 2012-06-19 15:14 /dev/sdb1
')

I spent about 2.5 hours figuring out why i kept getting the damn 'bad magic number' error all the time.
And once you get into this situation.. root/disk never creates correct files for /dev/sdb*..
My tests with dd if=/dev/sdb1 yielded correct dumps for the uImage which was not really read from real sectors on /dev/sdb, kept fooling me..

So, I would suggest adding something to check for /dev/sdb1 presence before writing to it.
If it's not present, the disk is not partitioned
If it's present, we can write to it, as it's a real partition.

Edit: Still stuck at the 'bad magic number' even with a kernel written to /dev/sdb1.
Seems the bootloader does not detect my disks properly?

This one is actually 500GB disk:
$this->bbcode_second_pass_code('', '
Bus 0: Found first device OK
Device 0: Model: ST3500412AS Firm: CC32 Ser#: 6VV1FN6C
Type: Hard Disk
Capacity: 131071.9 MB = 127.9 GB (268435455 x 512)
')

And for 1TB:
$this->bbcode_second_pass_code('', '
Bus 0: Found first device OK
Device 0: Model: SAMSUNG HD103SI Firm: 1AQ10001 Ser#: S2SDJ9JB600497
Type: Hard Disk
Capacity: 131071.9 MB = 127.9 GB (268435455 x 512)
')

Help?
Asure
 
Posts: 6
Joined: Tue Jun 19, 2012 1:51 pm

Re: [How-To] Boot Entirely from SATA

Postby WarheadsSE » Tue Jun 19, 2012 2:59 pm

Where are you getting sdb1 from?

from disk_create:
$this->bbcode_second_pass_code('', '# uncomment line below and set to the correct disk
#disk=/dev/sdX

if [ -z "${disk}" ] ; then
echo "You must uncomment/set the 'disk' variable"
exit -1
fi')

I also realize I need to update this package with the new uImages!
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: [How-To] Boot Entirely from SATA

Postby Asure » Tue Jun 19, 2012 6:39 pm

My bad. "sdb" is set in your script by, as it's my target disk.

Still, i can't seem to get past the 'bad magic', but at least now i'm 100% sure the image is written to sdb1 correctly, so there must be something else causing this problem. Maybe sector size? I'm assuming kernel doesn't start on the sector of the disk where the bootloader expects it. Could also be enclosure-related, perhaps i need a different usb-to-sata adapter.
Asure
 
Posts: 6
Joined: Tue Jun 19, 2012 1:51 pm

Re: [How-To] Boot Entirely from SATA

Postby WarheadsSE » Tue Jun 19, 2012 6:51 pm

If it is loading uboot, then that is most likely not the problem. The question is, did you follow the directions and do the partitioning as described? The script does not make the paritioning, at all.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: [How-To] Boot Entirely from SATA

Postby Asure » Tue Jun 19, 2012 6:58 pm

I don't have access to the device and my vm right now (i'm at my parents for the night.), but i'm 100% sure i have /dev/sdb1 starting at 2048 (+10M), and /dev/sdb2 at 4096 just to be sure. I'll post fdisk & "ide part" output tomorrow.

Off the top of my head 'ide part' did not show 2048 as starting sector for partition #1 on any of the disks i tried. It was more like 23476 or some 5-digit number.
Asure
 
Posts: 6
Joined: Tue Jun 19, 2012 1:51 pm

Re: [How-To] Boot Entirely from SATA

Postby Asure » Wed Jun 20, 2012 8:27 am

This is the pc-side, /dev/sdb is my usb adapter with the target drive connected.
$this->bbcode_second_pass_code('', '
From dmesg
[32811.299971] scsi 23:0:0:0: Direct-Access SAMSUNG HD103SI 1AQ1 PQ: 0 ANSI: 5
[32811.318181] sd 23:0:0:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB)
fdisk -l
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00008000

Device Boot Start End Blocks Id System
/dev/sdb1 2048 2049 16065 83 Linux
/dev/sdb2 4096 121601 943866945 83 Linux
')

Cold boot from the nas (it's a dual-bay variant)
$this->bbcode_second_pass_code('', '
Stage-1 Bootloader Mon Nov 14 22:15:13 EST 2011
Attempting to set PLLA to 700MHz ...
plla_ctrl0 : 0x0000000A
plla_ctrl1 : 0x000E0000
plla_ctrl2 : 0x001B01A0
plla_ctrl3 : 0x00000016
PLLA Set

Setup memory, testing
Reading disk 0, Image 0
Sector : 0x0000009A
Hdr len: 0x0001FB34
Hdr CRC: 0x2229BDCD
OK
Initialising disks
SATA PHY not ready for device 1
Detecting SATA busses:
Bus 0: Found first device OK
Device 0: Model: SAMSUNG HD103SI Firm: 1AQ10001 Ser#: S2SDJ9JB600497
Type: Hard Disk
Capacity: 131071.9 MB = 127.9 GB (268435455 x 512)
Device 1: not available
Failed to read valid environment from disk, using built-in default


U-Boot 1.1.2 (Dec 31 2011 - 15:24:45)

U-Boot code: 60E00000 -> 60E1FB34 BSS: -> 60E5435C
RAM Configuration:
Bank #0: 60000000 128 MB
SRAM Configuration:
64KB at 0x50000000
NAND:256 MiB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Setting Linux mem= boot arg value

IDE read: device 0 block # 288, count 1 ... 1 blocks read: OK
Hit any key to stop autoboot: 0

Loading from IDE device 0, partition 1: Name: hda1
Type: U-Boot

** Bad Magic Number **

Loading from IDE device 0, partition 2: Name: hda2
Type: U-Boot

** Bad Magic Number **
Unknown command 'lightled' - try 'help'
')

And, the strange output of 'ide part' which shows really wierd start sectors, even though the pc-side has them at 2048/4096..

$this->bbcode_second_pass_code('', '
$ ide part
Partition Map for IDE device 0 -- Partition Type: DOS
Partition Start Sector Num Sectors Type
1 32885055 32130 83
2 65786175 1887733890 83
')

And yes, i used linux fdisk and 'o' command to build a new dos partition type.

Also testing a bit with ide read command to get data into 60500000, seems to use hex instead of dec :)

$this->bbcode_second_pass_code('', '
$ ide part

Partition Map for IDE device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 32885055 32130 83
2 65786175 1887733890 83

$ ide read 60500000 800 1000
IDE read: device 0 block # 2048, count 4096 ... 4096 blocks read: OK
$ bootm 60500000
## Booting image at 60500000 ...
Bad Magic Number

$ ide read 60500000
IDE read: device 0 block # 2048, count 4096 ... 4096 blocks read: OK
$ bootm 60500000
## Booting image at 60500000 ...
Bad Magic Number

$
')

Tested with a new eSata dock, but the results are the same. It refuses to boot kernel :(

Edit: This is an Akitio-based dual bay nas, and i just tried to use nand with the u-boot on disk, but it won't read to ram correctly for some reason. This exact same command is used in the on-board u-boot with no problem.

(i figured to write the uImage from nand to IDE and see if i could boot from it that way..)

Is the u-boot for 'sata boot' suited to also boot a kernel from Nand?

$this->bbcode_second_pass_code('', '
$ nboot 60500000 0 440000
Loading from device 0: 256MiB 3,3V 8-bit (offset 0x440000)
** Bad Magic Number 0xb8e3cf2c **
')

Note that the device boots fine from internal u-boot, but my ubifs rootfs is damaged badly, hence the need to boot from sata..
Asure
 
Posts: 6
Joined: Tue Jun 19, 2012 1:51 pm

Re: All PLX based chips - Important Upgrade Note [updated]

Postby jmandawg » Wed Jun 20, 2012 10:50 am

I was trying to start do a fresh install to sata with the new rootFS, here are the steps i did where /dev/sdx is my existing target drive:

1. rm -rf * from /dev/sdx2 (delete old rootfs)
2. untar the new rootfs (ArchLinuxARM-2012.06-oxnas.tar.gz) to /dev/sdx2
3. dd'd the uImage.pci from the new rootfs (/boot/uImage.pci) to /dev/sdx1


$this->bbcode_second_pass_code('', '
mount: unknown filesystem type 'devtmpfs'
mount: mount point /proc/sys/fs/binfmt_misc does not exist
:: Mounting Root Read-Only [DONE]
Your kernel does not have devtmpfs support. This is not supported.
.
.
.
:: Configuring Virtual Consoles [FAIL]

and eventually it can't seed PRNG
')

am i doing something wrong?
jmandawg
 
Posts: 34
Joined: Mon Oct 25, 2010 4:07 am

Re: [How-To] Boot Entirely from SATA

Postby WarheadsSE » Wed Jun 20, 2012 12:09 pm

Let's spawn this into another thread shall we?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

PreviousNext

Return to Community Supported

Who is online

Users browsing this forum: No registered users and 7 guests

cron