How to prepare SATA disk for booting

cancel
Showing results for 
Search instead for 
Did you mean: 

How to prepare SATA disk for booting

5,853 Views
PhilEndecott
Contributor II
Dear All, My board arrived today and it seem to be functional. I have a SATA disk which I'd like to use instead of the microSD. So far it works in as much as I can see /dev/sda, and I've found docs describing what soldering I have to do to make the system boot from it. What I have not yet found is any info about what I have to put on the disk to make it bootable. Presumably it requires a particular partitioning scheme with u-boot in the right place, etc. Can anyone point me to appropriate docs, or tell me what I have to do? Thanks, Phil.
Labels (1)
7 Replies

2,002 Views
DejanDeletic
Contributor I

i.MX53 QSB SATA Howto:

=========================

I've been searching the internet for a while on how to boot from SATA as SD Cards quickly became insufficient for what I needed my iMX53 QSB for. This page often came top in various searches. I've managed mixed boot (u-boot on SD Card, Ubuntu on a SATA hard disk), and here I describe the process in hope it may help someone. The process is really simple (if you have a suitable Linux computer).

Requirements:

-----------------------------------------

    - SATA Hard disk

    - external SATA power source. 

    - A Linux computer with a spare SATA connection.  

    - SD Card reader

A note for Windows users: I use Linux as it comes with 'dd' and 'gparted' pre-installed. There are free Windows equivalents. See http://sourceforge.net/projects/windd/ and for example http://www.partition-tool.com/

Synopsis:

-----------------------------------------

    1. Use 'dd' on a desktop Linux box to clone (byte-for-byte) the SD Card that came with the QSB (loaded

        with Ubuntu) to the SATA hard disk. This will obviously leave lots of unused space on the disk, but

        we'll deal with it later.

    2. Reconfigure u-boot to boot Linux from the SATA disk.

    3. Make all space on the SATA disk usable using 'gparted' on the desktop Linux box.

Step 1. - Clone the SD card to the hard disk. 

-----------------------------------------------------------------

Use external Linux box to clone. You cannot use the QSB as disks (and SD Cards) must not be mounted for successful cloning. If you don't have a Linux box, there used to be a Windows version of 'dd' - google might help here.

Power off your Linux box, install your new SATA disk in it and reboot. Ensure you know what device the new disk is mounted as (I use 'gparted' to inspect partitions on all detected disks, and it tells me that my /dev/sdb is an unformatted  160GB disk). So I write down /dev/sdb as my destination disk (yours is likely to be different). 

Plug in the SD Card via the SD Card Reader. Ensure you know what device the SD Card is mounted as (again 'gparted' tells me that my /dev/sdc is a 4GB device with an ext3 file system - so I conclude that my source device is /dev/sdc; yours is likely to be different). Repeat the test with the card unplugged. Source device should not be listed by gparted. 

IMPORTANT: Stop if you're unsure on which is your source and which is your destination device. If you get it wrong, you may wipe the SD card contents off. Or worse, a disk in your Linux box.

Clone using command line:

    sudo dd if=<your_source_device> of=<your_destination_device> bs=128M

e.g.:

    sudo dd if=/dev/sdc of=/dev/sdb bs=128M

Cloning may take a while (15 min). Once done, power off, disconnect your SATA disk, and your SD Card. At this point we have a hard disk with contents identical to the SD Card.

Step 2. - Reconfigure u-boot. 

-----------------------------------------------------------------

Plug in the SD Card and SATA disk into your i.MX35 QSB, connect serial console, power the board up.

Stop boot process from a terminal window.

Check that the hard dish had been detected:

MX53-LOCO U-Boot > sata init

......

MX53-LOCO U-Boot > sata info

SATA device 0: Model: Firm: Ser#:
        Type: Hard Disk
        Supports 48-bit addressing
        Capacity: 152627.8 MB = 149.0 GB (312581808 x 512)

If successful, type the following commands:

MX53-LOCO U-Boot > setenv bootargs_sata 'set bootargs ${bootargs} root=/dev/sda1 rw rootwait init=/sbin/init rw rootwait'
MX53-LOCO U-Boot > setenv bootcmd_sata 'run bootargs_base bootargs_sata; sata init ; ext2load sata 0:1 ${loadaddr} /boot/${bootfile} ; bootm'
MX53-LOCO U-Boot > saveenv
At this point, we have prepared u-boot for booting from SATA, but haven't committed to it yet. Next time you reboot, it'll still use the SD Card. We first want to make sure everything works. Let's try it - at this point you may want to unplug the SD card to make sure system is booting from the hard disk
MX53-LOCO U-Boot > setenv bootcmd 'run bootcmd_sata'

MX53-LOCO U-Boot > boot

Fingers crossed... If successful, you can commit changes to u-boot, and make the system boot from the disk automatically:

- Reboot and stop u-boot from your terminal window.

- Type

MX53-LOCO U-Boot > setenv bootcmd 'run bootcmd_sata'

MX53-LOCO U-Boot > saveenv

MX53-LOCO U-Boot > boot


Step 3. - Reconfigure hard disk. 

-----------------------------------------------------------------

Plug the hard disk into your Linux box again, start it up and run 'gparted' . Again, it is extremely important you know your disk device (it is /dev/sdb in my case). Resize the partition(s) to use the available disk space and commit changes. 

2,002 Views
WayneRadochonsk
Contributor I

Dejan

Thanks for documenting this procedure.  Your kindness saved me a great deal of time and frustration.

If you're ever in the Monterey Bay Area (US -CA), I will buy whatever you are drinking!

Have you been able to boot directly from the SSD yet?

Wayne

0 Kudos

2,002 Views
drscott
Contributor I

To create a 'mixed' booting scenario where u-boot is on the sd-card and the file system is on sata:

 

1. stop booting within -u-boot from a terminal window

2. Add the following commands:

 

u-boot> setenv bootargs_sata 'set bootargs ${bootargs} root=/dev/sda1 init=/sbin/init rw rootwait'
u-boot> setenv bootcmd_mixed 'run bootargs_base bootargs_sata; mmc read 0 ${loadaddr} 0x800 0x1800; bootm'
u-boot> setenv bootcmd 'run bootargs_mixed'
saveenv

0 Kudos

2,002 Views
JackyHuang
Contributor III

Hi Mariano,

 

I have confirm the silicon version of the chip is rev2.0,  Is that means the i.MX53 chip can boot from SATA hard disk?

meanwhile,  I found a bad message that i.MX53 chip can not boot from SATA if the SATA PHY connect without the external clock from the errata.

So, I'm very confused whether the QSB can boot from SATA or not!

if it can do this,  what can I do to make it boot.


Mariano Goluboff said:

Hi Phil,

 

Take a look at the first "Known Issue" in section 11 of the QSB Hardware Reference Manual. Depending on what silicon version of the chip you have, you might have to initially boot from microSD and then pass on to SATA.

 

Once you do that, look at section 6.2.2 of the Linux BSP UserGuide (included in this download bundle: https://www.freescale.com/webapp/Download?colCode=IMX53_QSB_1101_LI...)

 

 

This will tell you how to put the kernel and setup the u-boot environment variables to boot from SATA.

 

The pdf name in that package is i.MX53_START_Linux_UserGuide.pdf.

 

Mariano

0 Kudos

2,002 Views
PhilEndecott
Contributor II

> look at section 6.2.2 of the Linux BSP UserGuide

Right, so as far as I can see that is describing how to have u-boot run from the microSD card and load a kernel and root fs from the SATA drive.

There are probably three possibilities here:

1. Put u-boot, kernel and root on the SATA drive.

2. Keep u-boot on the microSD and put the kernel and root on the SATA drive.

3. Keep u-boot and kernel on the microSD and put the root on the SATA drive.

I think that only (1) requires soldering and is affected by the errata.

(2) is described in the doc linked before; (3) presumably just requires that I have root=/dev/sdaN in the kernel command line.

I guess I should partition the SATA drive to leave space for u-boot and kernel at some point in the future, and try just moving the root filesystem for now.

0 Kudos

2,002 Views
PhilEndecott
Contributor II
Thanks Mariano. Re the silicon version, this board should be from the "new batch" and hopefully has the latest version, but I've not yet worked out how to map from the package markings to the silicon versions described in the various errata. (But I've not really looked yet). Thanks for the download link. I take it that that is different from the User Guide (MX53UG.pdf) that I already have, as it doesn't have a section 6.2.2.... Phil.
0 Kudos

2,002 Views
MarianoGoluboff
Contributor III

Hi Phil,

 

Take a look at the first "Known Issue" in section 11 of the QSB Hardware Reference Manual. Depending on what silicon version of the chip you have, you might have to initially boot from microSD and then pass on to SATA.

 

Once you do that, look at section 6.2.2 of the Linux BSP UserGuide (included in this download bundle: https://www.freescale.com/webapp/Download?colCode=IMX53_QSB_1101_LINUXDOCS_BUNDLE&location=null&fpsp...)

 

 

This will tell you how to put the kernel and setup the u-boot environment variables to boot from SATA.

 

The pdf name in that package is i.MX53_START_Linux_UserGuide.pdf.

 

Mariano

0 Kudos