[How-To] Boot Entirely from SATA

This forum is for all other ARMv5 devices

[How-To] Boot Entirely from SATA

Postby WarheadsSE » Tue Dec 20, 2011 2:31 am

Reasoning
Many of you have run into some wonky behaviors, or caused something to go wrong with your oxnas based units, and there will only be more to come, so this method will try to solve it. As an aside, this is a way to boot from Arch Linux ARM without modifying NAND at all, but requiring an eSATA housing, and the appropriate case modifications to go along with that.

note: I am doing this with a Tt BlacX. There are reports that this does not work with some other eSATA docks.

Prerequisites
  • A PLX OXNAS 782x based system, probable a Cloud Engines Pogoplug Pro, V3 or B01 (P01/P21/P25/B01/B02/B03/B04)
  • Willingness to crack that casing open.
  • A blank, or to-be-blanked SATA HDD.
  • An eSATA dock/housing (preferably with USB also) & an eSATA to SATA adapter (or you can ghetto rig, but that's not a pretty solution)
  • A linux system (or vm, or live cd/usb) in order to use the commands, scripts & files.
  • This tarball: http://ppl.ug/r1LnA0CT83U/ (patched 12/31/11 md5:b09ce58f93c79164c9dae0d62758be6c)
  • Don't be stupid. Read the whole post.

Preparation
Disk
Place it into your enclosure, and attach to the machine/vm you will use for this process.
Partitions
Remove all. Yes, all. We will create new ones in a bit.
Extract Tarball
Download & extract the tarball, to a location of your choosing.

Steps
Configuration
Our first step will be to edit the `disk_create` script to ensure it is going to write this information to the disk we want. Out of the tar it addresses /dev/sdX. Make this match the drive you wish to use. If you do not understand what this means, STOP NOW.

Next, if you `ls -l` you will see the contents of the tarball, and there are 3 symlinks. These three symlinks are: stage1.wrapped, u-boot.wrapped and uImage. Out of the tarball, I have the 850Mhz overclocked stage1 symlinked, the only u-boot I have included symlinked and the uImage.pci kernel symlinked. Unless you have a PCI bus, such as on the Pogoplug Pro (P01), you MUST change this. If you are not sure, ASK!

If at any time in the future, you want to replace any of these parts, you may do so by removing the symlinks to the parts you do not want to replace, and re-run the script. (e.g. You prefer the stock 700Mhz from Cloud Engines, some manufacturers are less.)

Writing Stage1 & U-Boot
Once you have configure your setup with the correct drive, and stage1/u-boot/uImage, you may run the script via `./disk_create`. Doing this will pre-setup the MBR, stage1 & u-boot. You will get an error from dd about the uImage not writing. You haven't partitioned yet.

Partitioning
For the purposes of these instructions, I will use fdisk. If you prefer to use GPT, so be it, but I also cannot prove at the time that the u-boot from PLX will accept GPT partitions.
We will use the fdisk command to partition our disk.
What you want, and I am not your manual, is to:
  • create an msdos partition table (fidsk -c=dos)
  • create a new primary partition, #1, with the first sector being 2048, and the size being small. I sized mine at 10M, for 10MB. This guide & process may be updated in the future with file system support and you can definitely spare a few megs.
  • create a new primary partition, #2, the size of your choice, as this will be your rootfs.
  • write the partition table to disk

Formatting
Personally, I would use ext3. I apologize but ext4 is not built into the kernel at this time. `mkfs.ext3 /dev/sdz2` or whatever your device is. For the sake of continuity, also label the partition "rootfs" `tune2fs -L "rootfs" /dev/sdz2`. Note the second partition. The Kernel will be placed in the first, unformatted partition!

Installing Kernel
Now that we have the partitions in place, we will re-run the disk_create script, which will now place the kernel into /dev/sdz1.

Download, Extract & Prepare Oxnas rootfs
Mount your newly formatted /dev/sdz2. Download the oxnas rootfs here and extract it to your newly formatted partition. The last thing needed is this: create & edit usr/local/mac_addr on the extracted rootfs, (not this machine you are using to do this!) and place in your device's MAC address in the format XX:XX:XX:XX:XX:XX.

Sync, Unmount & Remove
Flush to disk, using the `sync` command before you unmount and remove your drive.

Attaching & Booting
At this point, you attach the drive to your device, via eSATA or direct SATA, apply power to the drive then the device. I leave it to you to mod your device as necessary, but will add a link to my public G+ gallery. ( link to gallery )

Profit
This should boot right off the SATA disk, directly into Arch Linux ARM.


256MB memory device users: http://ppl.ug/3QrAMaurJE8/
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 jmandawg » Tue Dec 20, 2011 3:07 am

This is really cool. So you can leave the nand uboot parameters stock? How does it know to boot from the hard drive instead of from nand?
jmandawg
 
Posts: 34
Joined: Mon Oct 25, 2010 4:07 am

Re: [How-To] Boot Entirely from SATA

Postby WarheadsSE » Tue Dec 20, 2011 3:10 am

It's magic :ugeek:

But seriously, the SoC has a tiny ROM that reads from SATA, then SPI, then NAND. SATA comes first, so if it picks up all it needs, it will boot without touching the NAND.
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 youngbilly » Tue Dec 20, 2011 4:14 am

The place you talk about format, I want to make sure I understand. Assume my drive is /dev/sdb:

I create a partition with starting sector as 2048, say /dev/sdb1. Format it as msdos. Create /dev/sdb2 as my root-fs, format it with ext3.

Am I right? Does it matter the size of each sector of the disk? Always start /dev/sdb1 from 2048?

Thanks!
youngbilly
 
Posts: 15
Joined: Tue Nov 02, 2010 3:39 am

Re: [How-To] Boot Entirely from SATA

Postby dinjo » Tue Dec 20, 2011 4:41 am

Whats the risk in picking up the hdd(/dev/sdb) within the script itself ?
dinjo
 
Posts: 258
Joined: Mon Nov 28, 2011 5:59 am

Re: [How-To] Boot Entirely from SATA

Postby WarheadsSE » Tue Dec 20, 2011 1:29 pm

@youngbilly
The stage1 & u-boot think of disks as 512B clusters clusters, considering when they were designed. TBH, I haven't tried this on a disk with a larger sector size. Partition 1 has no format. You are using fdisk to create and msdos partition table.

@dinjo
The risk is getting it wrong, ever, and destroying a disk.
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 fuchini » Tue Dec 20, 2011 6:29 pm

Great guide, should be a sticky. I'll try it when I have enough money to buy a 2.5 drive.
fuchini
 
Posts: 18
Joined: Tue Sep 13, 2011 7:12 pm

Re: [How-To] Boot Entirely from SATA

Postby deathbearer » Tue Dec 20, 2011 8:22 pm

If anyone is going to try this then plz make a video guide for noobs like me :D
deathbearer
 
Posts: 1
Joined: Tue Dec 20, 2011 8:13 pm

Re: [How-To] Boot Entirely from SATA

Postby WarheadsSE » Tue Dec 20, 2011 8:30 pm

This is the method I use for my OC'd plug that has a fried NAND chip (bad sector in middle of the first erase block :/)
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 slycat » Tue Dec 20, 2011 11:25 pm

Maaannnn, had I waited a little longer in setting up my drive I would have done this. It's too much work to backup and remigrate all my media again just to get a little more oomph out of the plug ;)

Bookmarked should I ever need to reformat. Thanks WHSE, made it easy.
Pogoplug Pro w/ Wireless User -> decomm.
Cubox-i4pro User
4TB eSATA HDD (8g/3700+ Sw/Storage)
Kodi / Transmission / Minidlna / Samba / Batch-audio-conversions / Lighttpd
------------------------------
Rollback Machine - Thanks to impatt
slycat
 
Posts: 169
Joined: Wed Feb 09, 2011 3:07 am
Location: Miami, FL

Next

Return to Community Supported

Who is online

Users browsing this forum: No registered users and 3 guests

cron