Difference between revisions of "Manufacturing:X2 Ubuntu Configuration for MicroSD programming"

From Idrive
Jump to navigation Jump to search
 
(21 intermediate revisions by the same user not shown)
Line 11: Line 11:
  
 
'''Install VMplayer'''
 
'''Install VMplayer'''
 +
 +
<span style="color: red"> Use latest current version (V15). Link is old
  
 
https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/7_0
 
https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/7_0
Line 20: Line 22:
 
'''Create Ubuntu Virtual Machine'''
 
'''Create Ubuntu Virtual Machine'''
  
Download the latest Ubuntu version Ubuntu 14.0.4 with LTS(long term support) can be downloaded from the link below:  
+
<span style="color: red"> Use latest current version. Link is old
 +
 
 +
Download the latest Ubuntu version Ubuntu 18.04 with LTS(long term support) can be downloaded from the link below:  
  
 
http://www.ubuntu.com/download/desktop
 
http://www.ubuntu.com/download/desktop
Line 50: Line 54:
 
::Click Finish
 
::Click Finish
  
==System Configuration - old ==
+
==System Configuration Update for new scripts Oct 31 2018==
 +
 
 +
===Login===
  
 
After installation has finished start the virtual machine by double clicking on Ubuntu 64-Bit
 
After installation has finished start the virtual machine by double clicking on Ubuntu 64-Bit
Line 56: Line 62:
 
Log into the system ubuntu/none  
 
Log into the system ubuntu/none  
  
Open a Terminal (search for it and pin to the desktop
+
Open a Terminal (search for it and pin to the desktop)
  
'''Sudo apt-get install udisks'''  (password) (Installs UDISK)
+
===Setup===
  
Configure main.sh for the number of SD cards devices
+
====Install scripts====
  
::depends on the actual hardware used
+
The latest scripts are in the downloads section of AC (Idrive Manufacturing >SDcard Deployment Scripts (Mark 103118)
  
copy main.sh, card.sh, idrive.ico to /usr/local/bin (use sudo because the location is system protected)
+
Three shell scripts are required (idrive_card_deployer.sh, idrive_setup_sdcard.sh, check_if_card_read_only.sh) and they should be placed in /usr/local/bin
  
::'''sudo cp main.sh /usr/local/bin'''  (password)
+
copy the 3 scripts to /usr/local/bin and make the executable (use sudo because the location is system protected)
  
::'''sudo cp card.sh /usr/local/bin'''  (password)
+
::'''sudo cp idrive_card_deployer.sh /usr/local/bin'''  (password)
 +
 
 +
::'''sudo cp idrive_setup_sdcard.sh /usr/local/bin'''  (password)
  
::'''sudo cp idrive.ico /usr/local/bin'''  (password)
+
::'''sudo cp check_if_card_read_only.sh /usr/local/bin'''  (password)
  
 
::'''cd /usr/local/bin'''
 
::'''cd /usr/local/bin'''
  
::'''sudo chmod 775 card.sh'''
+
::'''sudo chmod 775 idrive_card_deployer.sh'''
  
::'''sudo chmod 775 main.sh'''
+
::'''sudo chmod 775 idrive_setup_sdcard.sh'''
  
Copy firmware image to the Documents directory (ensure name and location match the card.sh) (Example '''ltib-x2-061515.tar.gz''')
+
::'''sudo chmod 775 check_if_card_read_only.sh'''
  
Copy X2_MicroSD_prog.desktop to the Desktop directory
+
<br>
  
'''sudo visudo''' (edits sudo so you can disable the password requirements to run sfdisk, mkfs.ext4, tar , umount) add the following lines:
+
====Setup Desktop Icon====
  
::%ubuntu  ALL=(ALL:ALL) /bin/tar
 
  
::%ubuntu  ALL=(ALL:ALL) /bin/umount
+
Copy the idrive.ico (Icon file) to /usr/local/bin
  
::%ubuntu  ALL=(ALL:ALL) /sbin/mkfs.ext4
+
::'''sudo cp idrive.ico /usr/local/bin'''  (password)
  
::%ubuntu  ALL=(ALL:ALL) /sbin/sfdisk
 
  
Install Updates : System>Details>Overview
+
Copy the MicroSD_OS_Deployment.desktop file to (Desktop Icon) to /home/ubuntu/Desktop
  
==System Configuration Update for new scripts Jan 9 2017==
+
::'''cp MicroSD_OS_Deployment.desktop /home/ubuntu/Desktop'''  (sudo not needed)
  
From Florin:"
+
====Stage the frimware, filesystem and settings.db files====
added checks for read-only cards, bad sectors, bad MBR, etc. The script creates the partition and formats it the way "SD Formater" Utility does (quick or full),so there is no need of using that tool anymore. Also it show progress for each card in case multiple cards are written at the same time.  
 
  
===Login===
+
'''<span style="color: red">OLD (up to FW 25.4)'''
  
After installation has finished start the virtual machine by double clicking on Ubuntu 64-Bit
+
<span style="color: red">Copy firmware image to the /home/ubuntu/Documents/SD_home directory (Example '''Ltib-x2-032116.tar.gz''')
  
Log into the system ubuntu/none
+
<span style="color: red">::'''cp Ltib-x2-032116.tar.gz /home/ubuntu/Documents/SD_home'''
  
Open a Terminal (search for it and pin to the desktop)
+
'''New (FW 30.4 and up (Hard Float))'''
  
===Setup===
+
Copy firmware archive to the /home/ubuntu/Documents/SD_home directory ('''firmware-x2.tar.gz''')
  
Three shell scripts are required (idrive_card_deployer.sh, idrive_setup_sdcard.sh, check_if_card_read_only.sh) and they should be placed in /usr/local/bin
+
Copy filesystem archive to the /home/ubuntu/Documents/SD_home directory ('''rootfs.tar.gz''')
  
copy the 3 scripts to /usr/local/bin and make the executable (use sudo because the location is system protected)
+
Copy SETTINGS_DB to the /home/ubuntu/Documents/SD_home directory ('''settings.db''')
  
::'''sudo cp idrive_card_deployer.sh /usr/local/bin'''  (password)
+
<br>
  
::'''sudo cp idrive_setup_sdcard.sh /usr/local/bin'''  (password)
+
====Enable comand permissions with SUDO====
  
::'''sudo cp check_if_card_read_only.sh /usr/local/bin'''  (password)
+
Add entries to SUDO so that the scripts have permission to run the individual commands
  
::'''cd /usr/local/bin'''
 
 
::'''sudo chmod 775 idrive_card_deployer.sh'''
 
 
::'''sudo chmod 775 idrive_setup_sdcard.sh'''
 
 
::'''sudo chmod 775 check_if_card_read_only.sh'''
 
 
 
Copy the idrive.ico (Icon file) to /usr/local/bin
 
 
::'''sudo cp idrive.ico /usr/local/bin'''  (password)
 
 
 
Copy the X2_MicroSD_010417.desktop file to (Desktop Icon) to /home/ubuntu/Desktop
 
  
::'''cp X2_MicroSD_010417.desktop /home/ubuntu/Desktop''' (sudo not needed)
+
::'''sudo visudo''' (editor for sudo so you can disable the password requirements to run  mkfs.ext4, tar, umount, sfdisk ) add the following lines:
  
 +
:::%ubuntu  ALL=(ALL:ALL) NOPASSWD: /bin/tar
  
Copy firmware image to the /home/ubuntu/Documents/SD_home directory (Example '''Ltib-x2-032116.tar.gz''')
+
:::%ubuntu ALL=(ALL:ALL) NOPASSWD: /bin/umount
  
::'''cp Ltib-x2-032116.tar.gz /home/ubuntu/Documents/SD_home'''
+
:::%ubuntu ALL=(ALL:ALL) NOPASSWD: /bin/kill
  
 +
:::%ubuntu  ALL=(ALL:ALL) NOPASSWD:/sbin/mkfs.ext4
  
'''sudo visudo''' (edits sudo so you can disable the password requirements to run sfdisk, mkfs.ext4, tar , umount) add the following lines:
+
:::%ubuntu  ALL=(ALL:ALL) NOPASSWD:/sbin/sfdisk
  
::%ubuntu  ALL=(ALL:ALL) /bin/tar
+
:::%ubuntu  ALL=(ALL:ALL) NOPASSWD:/usr/local/bin/idrive_card_deployer.sh
  
::%ubuntu  ALL=(ALL:ALL) /bin/umount
+
:::%ubuntu  ALL=(ALL:ALL) NOPASSWD:/usr/local/bin/idrive_setup_sdcard.sh
  
::%ubuntu  ALL=(ALL:ALL) /sbin/mkfs.ext4
+
:::%ubuntu  ALL=(ALL:ALL) NOPASSWD:/usr/local/bin/check_if_card_read_only.sh
  
::%ubuntu  ALL=(ALL:ALL) /sbin/sfdisk
+
<br>
  
 
===Run the script===
 
===Run the script===
  
 +
The first time the scripts are run the check for system updates. This may make the first run much longer that the following runs.
  
 
The only script you execute is idrive_card_deployer.sh . this can be done from the command line or by clicking on the X2_MicroSD_010417 icon on the desktop.
 
The only script you execute is idrive_card_deployer.sh . this can be done from the command line or by clicking on the X2_MicroSD_010417 icon on the desktop.
 +
 +
====Script Variables====
  
 
'''idrive_card_deployer.sh''' can be edited  and set the following default variables:
 
'''idrive_card_deployer.sh''' can be edited  and set the following default variables:
Line 162: Line 157:
 
*DEPLOY_DEVICES=”” #default devices, for example “sdb sdc sdd sde”
 
*DEPLOY_DEVICES=”” #default devices, for example “sdb sdc sdd sde”
  
*FILESYSTEM_ARCHIVE=”” #default path to OD image archive (/home/ubuntu/Documents/SD_home/Ltil-x2-032116.tar.gz)  
+
*FILESYSTEM_ARCHIVE=”” #default path to filesystem archive (/home/ubuntu/Documents/SD_home/roofs.tar.gz)
 +
 
 +
*FIRMWARE_ARCHIVE=”” #default path to firmware archive (/home/ubuntu/Documents/SD_home/firmware-x2.tar.gz)
 +
 
 +
*SETTINGS_DB=”” #default path to settings DB (/home/ubuntu/Documents/SD_home/settings.db)
  
 
*DEPLOY_MODE=”” #formatting mode, “verify” = full or “simple” = quick
 
*DEPLOY_MODE=”” #formatting mode, “verify” = full or “simple” = quick
  
  
 
+
<br>
  
 
The script can be executed with (or without) parameters, you can pass: devices, OS image path, formatting mode.
 
The script can be executed with (or without) parameters, you can pass: devices, OS image path, formatting mode.
Line 173: Line 172:
  
 
Also by executing the script without parameter and no default device configured, a list of all device will be displayed so you can easy find the “target”. If you set only the DEPLOY_MODE and FILESYSTEM_ARCHIVE you can run the script “./idrive_card_deployer.sh sdc”, it’s easier when you create one card and not know all the time how the Linux OS attaches the device (see attached pics).
 
Also by executing the script without parameter and no default device configured, a list of all device will be displayed so you can easy find the “target”. If you set only the DEPLOY_MODE and FILESYSTEM_ARCHIVE you can run the script “./idrive_card_deployer.sh sdc”, it’s easier when you create one card and not know all the time how the Linux OS attaches the device (see attached pics).
 
  
 
===Results===
 
===Results===
Line 180: Line 178:
  
 
'''Success output'''
 
'''Success output'''
 +
 +
<-------------------------------------------------------------------------------------->
 +
CARD(s) STATUS:
 +
 +
card [sdb] : <span style="color:#008000">[DONE] ALL DONE
 +
 +
<-------------- DONE [1/1] (when all is done, this script will auto-exit) -------------->
  
  
  
'''failure output'''
+
'''Failure output'''
  
 
<-------------------------------------------------------------------------------------->
 
<-------------------------------------------------------------------------------------->
Line 237: Line 242:
  
 
This is all, now you can go and hit “Eject” to disconnect the device
 
This is all, now you can go and hit “Eject” to disconnect the device
 +
 +
==Helpful Utilities==
 +
 +
apt-get install mc  (Midnight Commander)
 +
 +
sudo su - -c mc

Latest revision as of 20:19, 9 November 2018

Programming of Micro SD cards for X2 using Ubuntu Linux

MicroSD programming

Setup programming stations for MicroSD programming

Basic Install

Install VMplayer

Use latest current version (V15). Link is old

https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/7_0

Launch VMware
Check use VMware Player in free non-comercial mode (enter an email address)

Create Ubuntu Virtual Machine

Use latest current version. Link is old

Download the latest Ubuntu version Ubuntu 18.04 with LTS(long term support) can be downloaded from the link below:

http://www.ubuntu.com/download/desktop

Open VMware player and click on "Create a new virtual machine" to open the "New virtual machine wizard"

Browse for the .iso image of Ubuntu and click next:
Full Name: ubuntu
User name: ubuntu
password: none (the word, not blank)
Click Next
Use default Virtual Machine name: Ubuntu 64-bit
Click Next
Maximum disk size (30GB recommended)
Select Split virtual disk into multiple files

after that the Ubuntu Linux install will start.

Click Next
Click Finish

System Configuration Update for new scripts Oct 31 2018

Login

After installation has finished start the virtual machine by double clicking on Ubuntu 64-Bit

Log into the system ubuntu/none

Open a Terminal (search for it and pin to the desktop)

Setup

Install scripts

The latest scripts are in the downloads section of AC (Idrive Manufacturing >SDcard Deployment Scripts (Mark 103118)

Three shell scripts are required (idrive_card_deployer.sh, idrive_setup_sdcard.sh, check_if_card_read_only.sh) and they should be placed in /usr/local/bin

copy the 3 scripts to /usr/local/bin and make the executable (use sudo because the location is system protected)

sudo cp idrive_card_deployer.sh /usr/local/bin (password)
sudo cp idrive_setup_sdcard.sh /usr/local/bin (password)
sudo cp check_if_card_read_only.sh /usr/local/bin (password)
cd /usr/local/bin
sudo chmod 775 idrive_card_deployer.sh
sudo chmod 775 idrive_setup_sdcard.sh
sudo chmod 775 check_if_card_read_only.sh


Setup Desktop Icon

Copy the idrive.ico (Icon file) to /usr/local/bin

sudo cp idrive.ico /usr/local/bin (password)


Copy the MicroSD_OS_Deployment.desktop file to (Desktop Icon) to /home/ubuntu/Desktop

cp MicroSD_OS_Deployment.desktop /home/ubuntu/Desktop (sudo not needed)

Stage the frimware, filesystem and settings.db files

OLD (up to FW 25.4)

Copy firmware image to the /home/ubuntu/Documents/SD_home directory (Example Ltib-x2-032116.tar.gz)

::cp Ltib-x2-032116.tar.gz /home/ubuntu/Documents/SD_home

New (FW 30.4 and up (Hard Float))

Copy firmware archive to the /home/ubuntu/Documents/SD_home directory (firmware-x2.tar.gz)

Copy filesystem archive to the /home/ubuntu/Documents/SD_home directory (rootfs.tar.gz)

Copy SETTINGS_DB to the /home/ubuntu/Documents/SD_home directory (settings.db)


Enable comand permissions with SUDO

Add entries to SUDO so that the scripts have permission to run the individual commands


sudo visudo (editor for sudo so you can disable the password requirements to run mkfs.ext4, tar, umount, sfdisk ) add the following lines:
%ubuntu ALL=(ALL:ALL) NOPASSWD: /bin/tar
%ubuntu ALL=(ALL:ALL) NOPASSWD: /bin/umount
%ubuntu ALL=(ALL:ALL) NOPASSWD: /bin/kill
%ubuntu ALL=(ALL:ALL) NOPASSWD:/sbin/mkfs.ext4
%ubuntu ALL=(ALL:ALL) NOPASSWD:/sbin/sfdisk
%ubuntu ALL=(ALL:ALL) NOPASSWD:/usr/local/bin/idrive_card_deployer.sh
%ubuntu ALL=(ALL:ALL) NOPASSWD:/usr/local/bin/idrive_setup_sdcard.sh
%ubuntu ALL=(ALL:ALL) NOPASSWD:/usr/local/bin/check_if_card_read_only.sh


Run the script

The first time the scripts are run the check for system updates. This may make the first run much longer that the following runs.

The only script you execute is idrive_card_deployer.sh . this can be done from the command line or by clicking on the X2_MicroSD_010417 icon on the desktop.

Script Variables

idrive_card_deployer.sh can be edited and set the following default variables:

  • DEPLOY_DEVICES=”” #default devices, for example “sdb sdc sdd sde”
  • FILESYSTEM_ARCHIVE=”” #default path to filesystem archive (/home/ubuntu/Documents/SD_home/roofs.tar.gz)
  • FIRMWARE_ARCHIVE=”” #default path to firmware archive (/home/ubuntu/Documents/SD_home/firmware-x2.tar.gz)
  • SETTINGS_DB=”” #default path to settings DB (/home/ubuntu/Documents/SD_home/settings.db)
  • DEPLOY_MODE=”” #formatting mode, “verify” = full or “simple” = quick



The script can be executed with (or without) parameters, you can pass: devices, OS image path, formatting mode.


Also by executing the script without parameter and no default device configured, a list of all device will be displayed so you can easy find the “target”. If you set only the DEPLOY_MODE and FILESYSTEM_ARCHIVE you can run the script “./idrive_card_deployer.sh sdc”, it’s easier when you create one card and not know all the time how the Linux OS attaches the device (see attached pics).

Results

Written to a log file in /home/ubuntu/Documents/SD_home/logs

Success output

<--------------------------------------------------------------------------------------> CARD(s) STATUS:

card [sdb] : [DONE] ALL DONE

<-------------- DONE [1/1] (when all is done, this script will auto-exit) -------------->


Failure output

<--------------------------------------------------------------------------------------> CARD(s) STATUS:

card [sdb] : [ERROR][CARDISBAD/READONLY] see log [/home/ubuntu/Documents/SD_home/logs//sdb-deploylog-Mon-Jan--9-11:44:57-PST-2017.log] for details

<-------------- DONE [1/1] (when all is done, this script will auto-exit) -------------->



Install Updates : System>Details>Overview

Add suppport for Exfat filesystem (64GB cards)

sudo add-apt-repository -y ppa:relan/exfat
sudo apt-get update -qq
sudo apt-get install exfat-utils


Double click the X2 MicroSD Programming Icon

Still waiting for cards… 1min50sec for 1 card

Wait for the "Cards are done!" message.

Partitioning SD Cards in Linux

  1. dmesg (display kernel messages after SD card is plugged in order to find your device path - probably /dev/sdc )
  1. sudo fdisk /dev/sdc

Command(m for help): p (print the partition table)

Command(m for help): n (add a new partition)

Select (default p): p

Partition number (1-4, default 1): 1

First sector (….): [ENTER]

Last sector, +sectors or +size{K,M,G} (….): [ENTER]

Command(m for help): p (print the partition table...just check)

Command(m for help): w (write table to disk and exit)

This is all, now you can go and hit “Eject” to disconnect the device

Helpful Utilities

apt-get install mc (Midnight Commander)

sudo su - -c mc