• Tutorial: boot Parallella from USB external hard drive (using standard SD image)

    I’ve been using my Parallella for a few months now and I’ve already burnt a couple of SD Cards…

    Therefore I thought that it would be better to load the OS from an USB attached Hard Disk, using the SD Card for the boot process only.

    Parallella Board

    In general Linux allows to easily change the root partition by passing the appropriate parameters to the Kernel (or through a bootloader). However in the standard image used by Parallella, a Device Tree is used. This means that you cannot pass directly the desired parameters to the Kernel, but you need modify the standard Device Tree. This is located in the Kernel package available at: http://www.parallella.org/create-sdcard/. See the point #2 (Parallella Linux Kernel – with ot without HDMI support, as you prefer) to download it.

    Once you have decompressed the content (as explained in the instructions), you will see that one of the files is called “devicetree.dtb”. The file is compiled so we’ll need to decompile it. On the Parallella, make a copy of the file in another folder and launch the command:

    dtc -I dtb -o dev.dts -O dts devicetree.dtb

    if the command cannot be found, just install it using:

    sudo apt-get install device-tree-compiler

     

    Now the file dev.dts is in text again and can be customized.

    Open the file with your favourite text editor and look for the line that begins with “bootargs”. In there you can specify any kernel boot options as described here.

    In our case, we want to boot from a USB attached drive. In order to do so, we need to use the instructions we saw before at Parallella site to copy the official image to an Hard Disk (CAUTION, YOU WILL DELETE YOUR HARD DISK CONTENT – YOU’VE BEEN WARNED!!!). It’s quite simple as you just need to adapt the command to create the partitions by using the appropriate /dev/sdxx device that is related to your external hard disk.

     

    Therefore the bootargs line will have to look like:

    bootargs = "rootwait root=/dev/sda2 rw rootfstype=ext4";

     

    Finally, re-compile the new Device Tree:

    dtc -I dts -O dtb -o devicetree.dtb dev.dts

    And now overwrite the old Device Tree with the new one. Happy OS loading from USB!

  • Tutorial: How to mount raw images (.img) images on Linux

    If you have a few .img files coming as disk images from devices like floppies, CDs, DVDs, SD cards, etc, you will realize that  you cannot mount the in Linux, because they contain a file system that has to be mounted.

    In linux you would need to use the mount command as for any physical device, however you need to know the correct syntax that is based on understanding the information related to the partition(s) available in the image.

    First step is to read the partition Start point using fdisk:

    In the terminal type:

    sudo fdisk -l imgfile.img

    You will see an output similar to the one below:
    Device        boot    Start     End         Blocks      Id  System
    imgfile.img1      *             63           266544          722233           C     W95 FAT32 (LBA)
    imgfile.img2                   25679      25367890        245667890+      83    Linux

    As you can see there are two partitions, one that is FAT32 and the other one that it’s ExtFS. This means that to mount the first partition we have to tell Linux that we need to start at the sector 63. The standard sector size is 512 bytes, however there are other possibilities like 128 or 1024. Assuming that the place from where you are downloading the image doesn’t specify any sector size, we can type in the terminal:

    sudo mount -t vfat -o loop,offset=$((63 * 512)) imgfile.img /mnt/disk

    To mount the second partition, as you can imagine:

    mount -t ext4 -o loop,offset=$((25679 * 512)) imgfile.img /mnt/disk1

    It’s important to copy the “Start” sector number correctly, otherwise you’ll get an error message like:

    mount : wrong fs type, bad option, band superblock on /dev/loop,
    missing codepage or helper proggram, or other error
    In some cases useful info is found in syslog – try
    dmesg | tail or so

    One last thing, the standard sector size for CDs and DVDs is 2352 instead of 512. If you are opening such image, you’ll have to use this value instead of 512.

  • Support: PRIME: is it supported? no

    What happens if you see the error message “PRIME: is it supported? no” in the terminal when launching nvidia-settings application to configure your NVIDIA card on your Optimus system?

    Most probably there has been some issues when updating the driver or wrong configuration. The way to fix this is quite simple (tested on Ubuntu and Lubuntu 14.04):

    First of all let’s remove NVIDIA drivers:
    sudo apt-get purge bumblebee*
    sudo apt-get purge nvidia-*

    Then reboot the computer and install the latest version (in my case was nvidia-331-updates):

    sudo apt-get install nvidia-331-updates

    this will install nvidia-settings and nvidia-prime and reboot one last time – your configuration is now correct!