[FE training-materials-updates] yocto: data: update the sdcard script and add a compatibility option

Antoine Ténart antoine.tenart at free-electrons.com
Thu Sep 22 13:52:14 CEST 2016


Repository : git://git.free-electrons.com/training-materials.git
On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=3a2e9c70bc701fb62b92131bcf33b3b0bfce55f7

>---------------------------------------------------------------

commit 3a2e9c70bc701fb62b92131bcf33b3b0bfce55f7
Author: Antoine Tenart <antoine.tenart at free-electrons.com>
Date:   Thu Sep 22 13:51:31 2016 +0200

    yocto: data: update the sdcard script and add a compatibility option
    
    Signed-off-by: Antoine Tenart <antoine.tenart at free-electrons.com>


>---------------------------------------------------------------

3a2e9c70bc701fb62b92131bcf33b3b0bfce55f7
 lab-data/yocto/script/format_sdcard.sh | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lab-data/yocto/script/format_sdcard.sh b/lab-data/yocto/script/format_sdcard.sh
index 4f0d298..6ed346b 100755
--- a/lab-data/yocto/script/format_sdcard.sh
+++ b/lab-data/yocto/script/format_sdcard.sh
@@ -5,21 +5,24 @@ if [ $(id -u) -ne 0 ]; then
   exit
 fi
 
-if [ $# -ne 1 ]; then
+if [ $# -lt 1 ]; then
   echo "Usage: $0 mmc_device"
   exit
 fi
 
 [[ $1 =~ mmcblk[0-9]+ ]] && delim='p'
 
-exec 1>&-
-exec 2>&-
-
 dd if=/dev/zero of=$1 bs=1M count=16
-sfdisk --in-order --L --unit M $1 <<EOF
+if [ "$2" == "--compatibility" ]; then
+  sfdisk --in-order --L --unit M $1 <<EOF
 1,48,0xE,*
+EOF
+else
+  sfdisk $1 <<EOF
+1M,48M,0xE,*
 ,,,-
 EOF
+fi
 
 mkfs.vfat -F 16 ${1}${delim}1 -n boot
 mkfs.ext4 ${1}${delim}2 -L rootfs




More information about the training-materials-updates mailing list