UDOO and SATA boot - How I Succeed

Discussion in 'Troubleshooting' started by Davide Nicotra, Feb 20, 2016.

  1. Davide Nicotra

    Davide Nicotra New Member

    Joined:
    Feb 19, 2016
    Messages:
    5
    Likes Received:
    3
    Since I've experienced a lot of troubles trying to make my UDOO boot from my brand new SSD storage, I'm sharing with you the way I succeed.

    Used Devices
    - UDOO Quad
    - Samsung SSD 850 EVO 500GB (FwRev: EMT02B6Q)

    Software versions
    - UDOObuntu 1.1 (Release date: 2015-01-07)
    - Kernel version: 3.0.35 #10
    - U-Boot 2013.10-rc3

    The How

    I DO NOT GUARANTEE THIS PROCEDURE WILL WORK IN YOUR CASE.

    1) Flash the UDOObuntu image from http://www.udoo.org/download on a microSD card as described on http://www.udoo.org/tutorial/creating-a-bootable-micro-sd-card-with-linux-ubuntu-from-image. Do the first-boot from the mSD card with the SSD powered and connected.

    2) Create 2 partitions on the SSD with gParted. Format the first one with ext3(it will be your main root partition), leave the second one as a linux swap partition(2 gigabyte are usually enough).

    3) With root permission mount somewhere the first partition you've just created (it should be /dev/sda1) and somewhere else your mSD card root partition (it should be /dev/mmcblk0p1), let's assume that you mount those on /media/satadisk and /media/microsd.

    4) Following instructions from http://www.elinux.org/UDOO_boot_from_sata, paragraph “Preparing the drive”, sub-paragraph “Using an existing Linux system” copy your existing linux system from the mSD card to the your SATA disk, with precedent assumptions, execute
    Code:
    cp -rvp /media/microsd/* /media/satadisk/
    5) Using udooupdate tool, update your boot-loader and kernel to the latest version (maybe this step is not strictly needed but I've done it and I'm telling you). Follow instructions there http://www.udoo.org/update-procedure/


    6) Using the UDOO Configuration Tool, reset the U-Boot environment variables from “U-Boot → Reset U-Boot Environment”.


    7) Using the UDOO Configuration Tool, set the Partiton 1 of your SATA device as Default Boot Device. Be careful in selecting Partition 1.


    8) Reboot and interrupt the autoboot process using the serial debug port and your PC. For references see http://www.udoo.org/tutorial/connecting-via-serial-cable/


    9) Be very careful, this step is crucial. Override the existing sataboot variabile with this new one using this command:
    Code:
    setenv sataboot “if iminfo;then run sataargs; echo Booting from preloaded uImage in memory;bootm;else echo Loading uImage and resetting; dcache off;sata init; run sataloaduimage; reset;fi”
    10) Save the changes on environment variables and reboot executing:

    Code:
    saveenv
    reset
    11) If everything went fine you should see your system booting from the SATA drive. Keep an eye on the Serial debug console to make sure no kernel panics are occurring. Finally edit /etc/fstab from your SATA linux system and add the following line:

    Code:
    /dev/sda2 swap swap defaults 0 0
    12) Reboot and you'll have a working UDOO booting from SATA with a working swap partition.

    The Why

    I'll give you a brief explanation about the crucial step of this method, explaining how I got to it.

    First thing first, if you tried to boot from your SATA device and you looked for some information on the net, you can notice that, until step 9, that is a quite standard method to solve this problem.

    In facts, my problem was not to create a working linux filesystem to boot, but to make my SATA device available on kernel loading to be mounted as root partition.

    I got tons of kernel panics saying “I can't find any device named /dev/sda1” so it seemed that kernel can't see my device at boot-time.


    U-Boot loads the kernel image from the SATA drive and run it in three step:

    - sata init : initializes the SATA communication with your device

    - ext2load sata 0:1 ${loadaddr} /boot/uImage : loads on memory the kernel image from SATA

    - bootm : boots the kernel image loaded on memory.


    Each step, in the most cases, works pretty well but however you get a kernel panic. After tons of tries I came to two facts:

    - If I boot the kernel from the mSD, setting /dev/sda1 as root partition, so not invoking sata init, my udoobuntu boots correctly from the SATA drive. So it seems that each time I invoke sata init without resetting the CPU the kernel can't detect my device. But it's not possible to load the image on memory from SATA drive without sata init.

    -If I load an image on the memory, than it survive to a soft-reset (reset button) or to a reset command from U-Boot shell.


    So finally here is what my environment variable does: it checks memory, looking for a valid kernel image on it, if it finds it than it boots(without invoking sata init because the image is already on the memory), if not it loads it from SATA device (invoking sata init and ext2load) and reset the CPU(leaving the image on the memory to be found by itself). The dcache off command disables the cached read of the SATA device, avoiding corrupted images to be loaded.

    So when you power on your UDOO you'll see the UDOO logo appearing twice because firstly it loads the image than it reboots and starts the kernel.

    Again I can NOT guarantee that this method will work for you, but I tried to explain not only the method itself but also to comment the troubles I got and how I solved them.
     
    Pavel Vovk and Andrea Rovai like this.
  2. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Hey, great! Three times great!
    Just a question: why have you developed this solution for UDOObuntu 1.1 instead of UDOObuntu 2? Then my second question: would you be able to build it for UDOObuntu 2???
     
  3. sirrab

    sirrab UDOOer

    Joined:
    Jul 26, 2014
    Messages:
    264
    Likes Received:
    32
    Yeah, you'd be a hero, making that work!
     
  4. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    You'd be, definitely!
     
  5. Davide Nicotra

    Davide Nicotra New Member

    Joined:
    Feb 19, 2016
    Messages:
    5
    Likes Received:
    3
    Hi,
    I've been busy with my studies. I think that method is easily portable to udoobuntu 2. I'll give a try as soon as possible.
    Can somebody confirm that worked for someone apart from me?
     
  6. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
  7. Davide Nicotra

    Davide Nicotra New Member

    Joined:
    Feb 19, 2016
    Messages:
    5
    Likes Received:
    3
    Great, I'll try that way as soon as possible on Udoobuntu 2 but as I can see the Udoobuntu 1 method may not work on some hardware because it's essentially the same of many others that failed with me. However it worth a try.
     
  8. Theflorianmaas

    Theflorianmaas UDOOer

    Joined:
    Dec 7, 2013
    Messages:
    22
    Likes Received:
    2
    Hello Davide,
    Did you try with Udoobuntu 2? Could you boot from sata?
    I tried but the new procedure didn't work for me.
    Ciao
    Franco
     
  9. Davide Nicotra

    Davide Nicotra New Member

    Joined:
    Feb 19, 2016
    Messages:
    5
    Likes Received:
    3
    I haven't tested my procedure with udoobuntu 2. Are you referring to that or to the new official procedure?
     
  10. Theflorianmaas

    Theflorianmaas UDOOer

    Joined:
    Dec 7, 2013
    Messages:
    22
    Likes Received:
    2
    The official procedure with udoobuntu 2 didn't work for me. The boot starts but it stops on "waiting for root device /dev/sda2" so I just wondering if your method could be applied to udoobuntu 2 and if tried. Thank you for your replay.
     
  11. jorgerivera

    jorgerivera New Member

    Joined:
    Apr 29, 2016
    Messages:
    1
    Likes Received:
    0
    Hi! Have any of you guys had any luck at this? I tried for the first time with UDOObuntu 2 today and found the same problem that Theflorianmaas described.
     

Share This Page