To create the SD image for SAMA5D27-SOM1-EK, it is required a PC running linux (i.e: Ubuntu desktop 19.10)
1. Installing mandatory packages in the PC:

    sudo apt-get install sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio python unzip rsync file bc wget

2. Installing other packages in the PC:

    sudo apt-get install libncurses5-dev libncursesw5-dev bzr cvs git mercurial rsync subversion graphviz python-matplotlib

3. Getting sources:

    git clone https://github.com/linux4sam/buildroot-at91.git
    git clone https://github.com/linux4sam/buildroot-external-microchip.git
    cd buildroot-external-microchip
    git checkout linux4sam_5.8 -b buildroot-external-microchip-linux4sam_5.8
    cd ..
    cd buildroot-at91
    git checkout linux4sam_5.8 -b buildroot-at91-linux4sam_5.8

4. Build rootfs image

In buildroot-at91 folder:
    BR2_EXTERNAL=../buildroot-external-microchip/ make atmel_sama5d27_som1_ek_mmc_dev_defconfig
    make

5. Customizing Buildroot

    make menuconfig

Enable the packages:
    - \Target packages\Networking applications\iputils
    - \Target packages\Networking applications\openssh
    - \Target Packages\Databases\sqlite3
    - \Target Packages\Text and terminal handling\ncurses
    - \Target Packages\Text and terminal handling\readline

6. Run Buildroot compilation

    make

7. Kernel configuration

    make linux-menuconfig

Enable as module:
   - If using a PL360G55 board, enable the Atmel USB support as a module:
	- \Device Drivers\usb\gadget\udc\“atmel_usba_udc"
   - If using an ATPL360 board, enable the CDC-ACM USB class support as module:
	- \Device Drivers\usb\class\“cdc-acm”
   - If using an ATPL230BN board, enable the CP210X USB serial support as module:
	- \Device Drivers\usb\serial\“cp210x”

    make linux-build

8. Creation of SD image

    make

9. Copy SD image to SD card (not uSD)

    Copy /linux_coord/buildroot-at91/output/images/sdcard.img to SD card (i.e: using balenaEtcher)

10. Connect SD card to SAMA5D27-SOM1-EK1 an power-up

11. Config IP address in SAMA5D27-SOM1-EK1 linux to access easily to it

For example:
    ip address add 192.168.1.102/24 dev eth0
    ifconfig eth0 up

So <target-ip-address> is 192.168.1.102

-------------- Coordinator example ---------------------
Using USI_host v2.3.0

12. Compile example:

- Decompress USI HOST package on local folder and go into the "primeBN_linux" folder
- Select the cross-compiler

    export CROSS_COMPILE=~/linux_coord/buildroot-at91/output/host/bin/arm-buildroot-linux-gnueabihf-

- Clean and compile code

    make clean && make all

13. Copy application to EK

    scp bn_prime root@<target-ip-address>:/usr/bin














