Difference between revisions of "DESK-MX6UL-L/Development/How to create a bootable microSD card"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "{{subst:How to create a bootable SD card | nome-som=AXEL ULite | kit-code=MX6UL | kit = mx6ul | kit-repo = desk-mx-l}}")
 
Line 1: Line 1:
 +
[[File:TBD.png|thumb|center|200px|Work in progress]]
 +
 
<section begin=History/>
 
<section begin=History/>
 
{| style="border-collapse:collapse; "
 
{| style="border-collapse:collapse; "
Line 7: Line 9:
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|X.Y.Z
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|1.0.0
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Apr 2021
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK release
|-
 
|-
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|[TBD_link X.Y.Z]
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD
 
 
|-
 
|-
 
|}
 
|}
Line 29: Line 26:
 
'''Note:''' Starting from this release the support for the SPL has been introduced in Uboot. Previous versions of this script will no longer produce a fully functional and bootable microSD card. <br>
 
'''Note:''' Starting from this release the support for the SPL has been introduced in Uboot. Previous versions of this script will no longer produce a fully functional and bootable microSD card. <br>
 
   
 
   
The procedure has been tested on a Linux PC running Ubuntu LTS (>=''TBD'') distribution with  
+
The procedure has been tested on a Linux PC running Ubuntu LTS (>=16.04) distribution with  
 
*a 16 GB microSD card [1]
 
*a 16 GB microSD card [1]
*the binary files delivered along with the [[Axel_Embedded_Linux_Kit_(XELK)#Downloadable_binary_images|DESKMX6UL-L ''1.x.x'']].
+
*the binary files delivered along with the [[Axel_Embedded_Linux_Kit_(XELK)#Downloadable_binary_images|DESK-MX6UL-L 1.0.1]]
The resulting card is partitioned as depicted [[Axel_Embedded_Linux_Kit_(XELK)#XELK_microSD_Layout|here]].
+
The resulting card is partitioned as depicted [[Axel_Embedded_Linux_Kit_(XELK)#XELK_microSD_Layout|here]]
  
The script - named <code>mksd.sh</code> - looks like this:
+
The script - named <code>desk-mx6ul-l-1.0.0_mksd.sh</code> - looks like this:
 
<pre>
 
<pre>
TBD : cat of mksd.sh script
+
#!/bin/bash
 +
 
 +
if [[ -z $1 || -z $2 || -z $3 || -z $4 || -z $5 ]]
 +
then
 +
echo "$0 Usage:"
 +
echo " $0 <device> <u-boot.img> <SPL> <binaries directory> <rootfs tar.bz2>"
 +
echo " Example: $0 /dev/sdc u-boot.img SPL binaries/ rootfs.tar.bz2"
 +
exit
 +
fi
 +
 
 +
if [ "$(whoami)" != "root" ]
 +
then
 +
echo "you must be root to run this script!"
 +
exit
 +
fi
 +
 
 +
if ! [[ -b $1 ]]
 +
then
 +
echo "$1 is not a valid block device!"
 +
exit
 +
fi
 +
 
 +
if ! [[ -e $2 ]]
 +
then
 +
echo "Incorrect u-boot.img location!"
 +
exit
 +
fi
 +
 
 +
if ! [[ -e $3 ]]
 +
then
 +
echo "Incorrect SPL location!"
 +
exit
 +
fi
 +
 
 +
if ! [[ -d $4 ]]
 +
then
 +
echo "Incorrect Binaries location!"
 +
exit
 +
fi
 +
 
 +
if ! [[ -f $5 ]]
 +
then
 +
echo "Incorrect rootfs location!"
 +
exit
 +
fi
 +
 
 +
DRIVE=$1
 +
if [[ "$DRIVE" == *"mmcblk"* ]]
 +
then
 +
echo "You're using a mmc device, I need to fix partition names"
 +
PART="p"
 +
else
 +
PART=""
 +
fi
 +
UBOOT=$2
 +
SPL=$3
 +
BINARIES=$4
 +
RFS=$5
 +
 
 +
echo "All data on "$DRIVE" now will be destroyed! Continue? [y/n]"
 +
read ans
 +
if ! [ $ans == 'y' ]
 +
then
 +
exit
 +
fi
 +
 
 +
echo "[Partitioning $1...]"
 +
 
 +
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
 +
 
 +
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
 +
 
 +
echo DISK SIZE - $SIZE bytes
 +
 
 +
CYLINDERS=`echo $SIZE/255/63/512 | bc`
 +
 
 +
# check if we're running an old (e.g. 2.20.x) or new (e.g. 2.24.x) sfdisk
 +
sfdisk --help | grep -- -H
 +
 
 +
if [ "$?" -eq "0" ]
 +
then
 +
{
 +
echo 40,1380,0x0c,*
 +
echo 1420,,83,-
 +
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
 +
else
 +
{
 +
    echo 16M,8176M,0x0c,*
 +
    echo 8192M,,83,-
 +
} | sfdisk $DRIVE
 +
fi
 +
 
 +
partprobe
 +
 
 +
 
 +
echo "[Making filesystems...]"
 +
mkfs.vfat -F 32 -n BOOT "$DRIVE$PART"1 #> /dev/null
 +
mkfs.ext3 -F -L ROOTFS "$DRIVE$PART"2 #> /dev/null
 +
 
 +
echo "[Copying files...]"
 +
 
 +
binaries_dir=${BINARIES%/}
 +
mount "$DRIVE$PART"1 /mnt
 +
cp -av --no-preserve=ownership $binaries_dir/* /mnt/
 +
umount "$DRIVE$PART"1
 +
 
 +
echo "[Extracting rfs (this may take a while...)]"
 +
mount "$DRIVE$PART"2 /mnt
 +
tar jxf $RFS -C /mnt > /dev/null
 +
chmod 755 /mnt
 +
umount "$DRIVE$PART"2
 +
 
 +
echo "[Programming SPL]"
 +
dd if=$SPL of=$DRIVE bs=512 seek=2 conv=fsync
 +
 
 +
echo "[Programming u-boot.img]"
 +
dd if=$UBOOT of=$DRIVE bs=1k seek=69 conv=fsync
 +
 
 +
echo "[Done]"
 
</pre>
 
</pre>
  
Line 43: Line 158:
 
* bootscript: <code>boot.scr</code>
 
* bootscript: <code>boot.scr</code>
 
* Linux kernel: <code>uImage</code>
 
* Linux kernel: <code>uImage</code>
* Device tree blob: <code>''carrier''.dtb</code>.
+
* Device tree blob: <code>imx6ul-lynx-som0013-cb002f.dtb</code> (or <code>imx6ul-axelulite-cb003a.dtb</code> or <code>imx6ul-axelulite-cb006c.dtb</code>)
  
 
This is the list of the binary files that will be used by the script:
 
This is the list of the binary files that will be used by the script:
 
<pre>
 
<pre>
dvdk@vagrant:~/desk-{{{kit}}}$ ls -la
+
dvdk@vagrant:~/desk-mx-l$ ll /tftpboot/desk-mx-l/
...
+
total 10916
TBD directory listing
+
drwxr-xr-x 2 dvdk root    4096 Apr 14 11:28 ./
...
+
drwxr-xr-x 3 dvdk root    4096 Apr 14 11:27 ../
 +
-rw-r--r-- 1 dvdk root  34095 Apr 14 11:28 desk-mx6ul-l-1.0.0_imx6ul-axelulite-cb003a.dtb
 +
-rw-r--r-- 1 dvdk root  33137 Apr 14 11:28 desk-mx6ul-l-1.0.0_imx6ul-axelulite-cb006c.dtb
 +
-rw-r--r-- 1 dvdk root  34211 Apr 14 11:28 desk-mx6ul-l-1.0.0_imx6ul-lynx-som0013-cb002f.dtb
 +
-rw-r--r-- 1 dvdk root  56320 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_axelulite_spi_SPL
 +
-rw-r--r-- 1 dvdk root  547528 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_axelulite_spi_u-boot.img
 +
-rw-r--r-- 1 dvdk root  56320 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_axelulite_SPL
 +
-rw-r--r-- 1 dvdk root  547200 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_axelulite_u-boot.img
 +
-rw-r--r-- 1 dvdk root  56320 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_spi_SPL
 +
-rw-r--r-- 1 dvdk root  512568 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_spi_u-boot.img
 +
-rw-r--r-- 1 dvdk root  56320 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_SPL
 +
-rw-r--r-- 1 dvdk root  512216 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_u-boot.img
 +
-rw-r--r-- 1 dvdk root  52224 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_usb_SPL
 +
-rw-r--r-- 1 dvdk root  431512 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_usb_u-boot.img
 +
-rw-r--r-- 1 dvdk root 7056696 Apr 14 11:28 desk-mx6ul-l-1.0.0_uImage
 +
-rw-r--r-- 1 dvdk root 1152054 Apr 14 11:27 splash_image.bmp
 +
dvdk@vagrant:~/desk-mx-l$
 
</pre>
 
</pre>
 
You can now run the script, by passing the following parameters:
 
You can now run the script, by passing the following parameters:
Line 59: Line 190:
 
*Archive of the target's root file system (compressed as <code>.tar.bz2</code> file).
 
*Archive of the target's root file system (compressed as <code>.tar.bz2</code> file).
 
<pre>
 
<pre>
dvdk@vagrant:~/desk-{{{kit}}}$ ./mksd.sh /dev/sd<x> <u-boot.img> <SPL> <binaries_dir>/ <rfs_filename>
+
dvdk@vagrant:~/desk-{{{kit}}}$ ./desk-mx6ul-l-1.0.0_mksd.sh /dev/sd<x> <u-boot.img> <SPL> <binaries_dir>/ <rfs_filename>
 
...
 
...
...
 
TBD
 
 
...
 
...
 
...
 
...
Line 75: Line 204:
  
 
Here below there is an example on how to create a <code>boot.scr</code> file from the '''bootscript.txt''' for booting from SD card:
 
Here below there is an example on how to create a <code>boot.scr</code> file from the '''bootscript.txt''' for booting from SD card:
 
''TBD: bootscript.txt dump''
 
  
 
<pre>
 
<pre>
echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n AXEL-Lite-DESK-SBCX -d bootscript.txt boot.scr"'
+
echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n DESK-MX6UL -d bootscript.txt boot.scr"'
  
setenv desk_release 'desk-mx6-l-1.0.0'
+
setenv desk_release 'desk-mx6ul-l-1.0.0'
  
if test 0x${cb_configid#} = 0x00000012;
+
if test 0x${som_configid#} = 0x00000013 && test 0x${cb_configid#} = 0x0000002f;
 
then
 
then
if test ${cpu} = 6DL; then
+
    setenv fdtfile ${desk_release}_imx6ul-lynx-som0013-cb002f.dtb
setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0012.dtb
+
elif test 0x${cb_configid#} = 0x0000003a
else
 
setenv fdtfile ${desk_release}_imx6q-sbcx-cb0012.dtb
 
fi
 
elif test 0x${cb_configid#} = 0x00000013;
 
 
then
 
then
if test ${cpu} = 6DL; then
+
setenv fdtfile ${desk_release}_imx6ul-axelulite-cb003a.dtb
setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0013.dtb
+
elif test 0x${cb_configid#} = 0x0000006c
else
 
setenv fdtfile ${desk_release}_imx6q-sbcx-cb0013.dtb
 
fi
 
elif test 0x${cb_configid#} = 0xffffffff;
 
 
then
 
then
if test ${cpu} = 6DL; then
+
setenv fdtfile ${desk_release}_imx6ul-axelulite-cb006c.dtb
setenv fdtfile ${desk_release}_imx6dl-desk-l-2.0.0.dtb
 
else
 
setenv fdtfile ${desk_release}_imx6q-desk-l-2.0.0.dtb
 
fi
 
 
else
 
else
 
     echo Invalid CB! Autoreset ...
 
     echo Invalid CB! Autoreset ...
Line 115: Line 230:
 
setenv mmc_loadfdt 'fatload mmc ${mmcdev}:1 ${fdtaddr} ${fdtfile}'
 
setenv mmc_loadfdt 'fatload mmc ${mmcdev}:1 ${fdtaddr} ${fdtfile}'
  
echo Booting AxelLite-DESK-SBCX via mmcboot with ${fdtfile} as device tree
+
echo Booting DESK-MX6UL via mmcboot with ${fdtfile} as device tree
  
 
run mmcboot
 
run mmcboot
Line 125: Line 240:
  
 
<pre>
 
<pre>
mkimage -A ARM -T script -C none -n AXEL-Lite-DESK-SBCX -d bootscript.txt boot.scr
+
mkimage -A ARM -T script -C none -n DESK-MX6UL -d bootscript.txt boot.scr
 
</pre>
 
</pre>
  

Revision as of 16:56, 20 April 2021

Work in progress


History
Version Issue Date Notes
1.0.0 Apr 2021 First DESK release



How to create a bootable SD card[edit | edit source]

200px-Emblem-important.svg.png

The procedure described here was tested with a physical machine. In case of a virtual machine such as the MVM, it might not work properly. Also, it is worth remembering that USB controller of the MVM is disabled by default. See also this section.


This article shows how to create a bootable microSD for the [[DESK-MX6UL-L/General/Release_Notes_(DESK-MX6UL-L)|DESK-MX6UL-L Release Notes] kit by using a simple bash script.
Note: Starting from this release the support for the SPL has been introduced in Uboot. Previous versions of this script will no longer produce a fully functional and bootable microSD card.

The procedure has been tested on a Linux PC running Ubuntu LTS (>=16.04) distribution with

The resulting card is partitioned as depicted here

The script - named desk-mx6ul-l-1.0.0_mksd.sh - looks like this:

#!/bin/bash

if [[ -z $1 || -z $2 || -z $3 || -z $4 || -z $5 ]]
then
	echo "$0 Usage:"
	echo "	$0 <device> <u-boot.img> <SPL> <binaries directory> <rootfs tar.bz2>"
	echo "	Example: $0 /dev/sdc u-boot.img SPL binaries/ rootfs.tar.bz2"
	exit
fi

if [ "$(whoami)" != "root" ]
then
	echo "you must be root to run this script!"
	exit
fi

if ! [[ -b $1 ]]
then
	echo "$1 is not a valid block device!"
	exit
fi

if ! [[ -e $2 ]]
then
	echo "Incorrect u-boot.img location!"
	exit
fi

if ! [[ -e $3 ]]
then
	echo "Incorrect SPL location!"
	exit
fi

if ! [[ -d $4 ]]
then
	echo "Incorrect Binaries location!"
	exit
fi

if ! [[ -f $5 ]]
then
	echo "Incorrect rootfs location!"
	exit
fi

DRIVE=$1
if [[ "$DRIVE" == *"mmcblk"* ]]
then
	echo "You're using a mmc device, I need to fix partition names"
	PART="p"
else
	PART=""
fi
UBOOT=$2
SPL=$3
BINARIES=$4
RFS=$5

echo "All data on "$DRIVE" now will be destroyed! Continue? [y/n]"
read ans
if ! [ $ans == 'y' ]
then
	exit
fi

echo "[Partitioning $1...]"

dd if=/dev/zero of=$DRIVE bs=1024 count=1024

SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`

echo DISK SIZE - $SIZE bytes

CYLINDERS=`echo $SIZE/255/63/512 | bc`

# check if we're running an old (e.g. 2.20.x) or new (e.g. 2.24.x) sfdisk
sfdisk --help | grep -- -H

if [ "$?" -eq "0" ]
then
	{
		echo 40,1380,0x0c,*
		echo 1420,,83,-
	} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
else
{
    echo 16M,8176M,0x0c,*
    echo 8192M,,83,-
} | sfdisk $DRIVE
fi

partprobe


echo "[Making filesystems...]"
mkfs.vfat -F 32 -n BOOT "$DRIVE$PART"1 #> /dev/null
mkfs.ext3 -F -L ROOTFS "$DRIVE$PART"2 #> /dev/null

echo "[Copying files...]"

binaries_dir=${BINARIES%/}
mount "$DRIVE$PART"1 /mnt
cp -av --no-preserve=ownership $binaries_dir/* /mnt/
umount "$DRIVE$PART"1

echo "[Extracting rfs (this may take a while...)]"
mount "$DRIVE$PART"2 /mnt
tar jxf $RFS -C /mnt > /dev/null
chmod 755 /mnt
umount "$DRIVE$PART"2

echo "[Programming SPL]"
dd if=$SPL of=$DRIVE bs=512 seek=2 conv=fsync

echo "[Programming u-boot.img]"
dd if=$UBOOT of=$DRIVE bs=1k seek=69 conv=fsync

echo "[Done]"


Here is an example that shows how to use this script. Let's assume that the binary files were downloaded in the desk subdirectory of the working directory. Before invoking the script, the following files has to be renamed in order to make them compatible with the default U-Boot environment variables:

  • bootscript: boot.scr
  • Linux kernel: uImage
  • Device tree blob: imx6ul-lynx-som0013-cb002f.dtb (or imx6ul-axelulite-cb003a.dtb or imx6ul-axelulite-cb006c.dtb)

This is the list of the binary files that will be used by the script:

dvdk@vagrant:~/desk-mx-l$ ll /tftpboot/desk-mx-l/
total 10916
drwxr-xr-x 2 dvdk root    4096 Apr 14 11:28 ./
drwxr-xr-x 3 dvdk root    4096 Apr 14 11:27 ../
-rw-r--r-- 1 dvdk root   34095 Apr 14 11:28 desk-mx6ul-l-1.0.0_imx6ul-axelulite-cb003a.dtb
-rw-r--r-- 1 dvdk root   33137 Apr 14 11:28 desk-mx6ul-l-1.0.0_imx6ul-axelulite-cb006c.dtb
-rw-r--r-- 1 dvdk root   34211 Apr 14 11:28 desk-mx6ul-l-1.0.0_imx6ul-lynx-som0013-cb002f.dtb
-rw-r--r-- 1 dvdk root   56320 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_axelulite_spi_SPL
-rw-r--r-- 1 dvdk root  547528 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_axelulite_spi_u-boot.img
-rw-r--r-- 1 dvdk root   56320 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_axelulite_SPL
-rw-r--r-- 1 dvdk root  547200 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_axelulite_u-boot.img
-rw-r--r-- 1 dvdk root   56320 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_spi_SPL
-rw-r--r-- 1 dvdk root  512568 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_spi_u-boot.img
-rw-r--r-- 1 dvdk root   56320 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_SPL
-rw-r--r-- 1 dvdk root  512216 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_u-boot.img
-rw-r--r-- 1 dvdk root   52224 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_usb_SPL
-rw-r--r-- 1 dvdk root  431512 Apr 14 11:27 desk-mx6ul-l-1.0.0_mx6uldesk_lynx_usb_u-boot.img
-rw-r--r-- 1 dvdk root 7056696 Apr 14 11:28 desk-mx6ul-l-1.0.0_uImage
-rw-r--r-- 1 dvdk root 1152054 Apr 14 11:27 splash_image.bmp
dvdk@vagrant:~/desk-mx-l$ 

You can now run the script, by passing the following parameters:

  • Device file of the microSD card (/dev/sdc in the example)
  • U-Boot image
  • SPL
  • Path of the directory containing the bootscript file, the Linux kernel image, and the device tree blob files
  • Archive of the target's root file system (compressed as .tar.bz2 file).
dvdk@vagrant:~/desk-{{{kit}}}$ ./desk-mx6ul-l-1.0.0_mksd.sh /dev/sd<x> <u-boot.img> <SPL> <binaries_dir>/ <rfs_filename>
...
...
...


[1] In case you have a different size, you'll need to change the sfdisk parameters accordingly.

bootscr[edit | edit source]

Once you got the new binaries compiled from your modified sources, they have to be installed on first SD partition preserving the original file names used into boot.scr u-boot bootscript.

Here below there is an example on how to create a boot.scr file from the bootscript.txt for booting from SD card:

echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n DESK-MX6UL -d bootscript.txt boot.scr"'

setenv desk_release 'desk-mx6ul-l-1.0.0'

if test 0x${som_configid#} = 0x00000013 && test 0x${cb_configid#} = 0x0000002f;
then
    setenv fdtfile ${desk_release}_imx6ul-lynx-som0013-cb002f.dtb
elif test 0x${cb_configid#} = 0x0000003a
then
	setenv fdtfile ${desk_release}_imx6ul-axelulite-cb003a.dtb
elif test 0x${cb_configid#} = 0x0000006c
then
	setenv fdtfile ${desk_release}_imx6ul-axelulite-cb006c.dtb
else
    echo Invalid CB! Autoreset ...
    sleep 30
	reset
fi

setenv bootfile ${desk_release}_uImage

setenv mmc_loadk 'fatload mmc ${mmcdev}:1 ${loadaddr} ${bootfile}'
setenv mmc_loadfdt 'fatload mmc ${mmcdev}:1 ${fdtaddr} ${fdtfile}'

echo Booting DESK-MX6UL via mmcboot with ${fdtfile} as device tree

run mmcboot

echo mmcboot FAILURE

and compile it using:

mkimage -A ARM -T script -C none -n DESK-MX6UL -d bootscript.txt boot.scr

Then copy the boot.scr into the <binaries_dir> directories used by the script to create the SD card.