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

From DAVE Developer's Wiki
Jump to: navigation, search
(How to create a bootable SD card)
(Update SD card section for DESK-MX6-L v3.0.0 release)
Line 1: Line 1:
<section begin=History/>
+
<section begin="History" />
 
{| style="border-collapse:collapse; "
 
{| style="border-collapse:collapse; "
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
+
! colspan="4" style="width:100%; text-align:left" ; border-bottom:solid 2px #ededed" |History
 
|-  
 
|-  
!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"|Version
+
! 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" |Version
!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"|Issue Date
+
! 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" |Issue Date
!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"|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" |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"|Jun 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" |Jun 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"|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" |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" |3.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" |Feb 2022
 +
| 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" |3.0.0 DESK release
 
|}
 
|}
<section end=History/>
+
<section end="History" />
 
__FORCETOC__
 
__FORCETOC__
<section begin=Body/>
+
<section begin="Body" />
  
 
==How to create a bootable SD card==
 
==How to create a bootable SD card==
  
{{ImportantMessage|text=The procedure described here was tested with a physical machine. In case of a virtual machine such as the [[Managed_Virtual_Machine_(MVM)|MVM]], it might not work properly. Also, it is worth remembering that USB controller of the MVM is disabled by default. See also [[MVM_FAQs#Q:_How_to_use_the_USB_devices_connected_to_the_host_machine.3F|this section]].}}
+
{{ImportantMessage|text=The procedure described here was tested with a virtual machine such as the [[Managed_Virtual_Machine_(MVM)|MVM]]. The USB controller of the MVM should be enabled by default. If you are using Linux-based distribution and are having trouble detecting a USB device in virtual machine, please make sure your user belongs to the ''vboxusers'' group.}}
  
  
 
This article shows how to create a bootable microSD for the [[DESK-MX6-L/General/Release_Notes|DESK-MX6-L Release Notes]] kit by using a simple bash script. <br>
 
This article shows how to create a bootable microSD for the [[DESK-MX6-L/General/Release_Notes|DESK-MX6-L Release Notes]] kit by using a simple bash script. <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>
+
'''Note:''' Starting from '''DESK-MX6-L 1.0.0''' release the support for the SPL has been introduced in U-Boot. 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 16.04 distribution with  
+
The procedure has been tested on a MVM released with '''DESK-MX6-L 3.0.0''' release with  
 
*a 16 GB microSD card [1]
 
*a 16 GB microSD card [1]
*the binary files delivered along with the [[DESK-MX6-L/General/Release_Notes#Downloadable_binary_images|DESKMX6-L 1.0.0]].
+
*a USB SD card reader
 +
*the binary files delivered along with the [[DESK-MX6-L/General/Release_Notes#Downloadable_binary_images_2|DESK-MX6-L 3.0.0]].
 
The resulting card is partitioned as depicted here below:
 
The resulting card is partitioned as depicted here below:
  
 
* bootable partition (mmcblk0p1, vfat) containing:
 
* bootable partition (mmcblk0p1, vfat) containing:
** binary images (u-boot and kernel images)
+
** binary images (U-Boot and kernel images)
 
* root file system partition (mmcblk0p2, ext3)
 
* root file system partition (mmcblk0p2, ext3)
 
** root file system binaries and init scripts
 
** root file system binaries and init scripts
Line 39: Line 44:
 
if [[ -z $1 || -z $2 || -z $3 || -z $4 || -z $5 ]]
 
if [[ -z $1 || -z $2 || -z $3 || -z $4 || -z $5 ]]
 
then
 
then
echo "$0 Usage:"
+
        echo "$0 Usage:"
echo " $0 <device> <u-boot.img> <SPL> <binaries directory> <rootfs tar.bz2>"
+
        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"
+
        echo " Example: $0 /dev/sdc u-boot.img SPL binaries/ rootfs.tar.bz2"
exit
+
        exit
 
fi
 
fi
  
 
if [ "$(whoami)" != "root" ]
 
if [ "$(whoami)" != "root" ]
 
then
 
then
echo "you must be root to run this script!"
+
        echo "you must be root to run this script!"
exit
+
        exit
 
fi
 
fi
  
 
if ! [[ -b $1 ]]
 
if ! [[ -b $1 ]]
 
then
 
then
echo "$1 is not a valid block device!"
+
        echo "$1 is not a valid block device!"
exit
+
        exit
 
fi
 
fi
  
 
if ! [[ -e $2 ]]
 
if ! [[ -e $2 ]]
 
then
 
then
echo "Incorrect u-boot.img location!"
+
        echo "Incorrect u-boot.img location!"
exit
+
        exit
 
fi
 
fi
  
 
if ! [[ -e $3 ]]
 
if ! [[ -e $3 ]]
 
then
 
then
echo "Incorrect SPL location!"
+
        echo "Incorrect SPL location!"
exit
+
        exit
 
fi
 
fi
  
 
if ! [[ -d $4 ]]
 
if ! [[ -d $4 ]]
 
then
 
then
echo "Incorrect Binaries location!"
+
        echo "Incorrect Binaries location!"
exit
+
        exit
 
fi
 
fi
  
 
if ! [[ -f $5 ]]
 
if ! [[ -f $5 ]]
 
then
 
then
echo "Incorrect rootfs location!"
+
        echo "Incorrect rootfs location!"
exit
+
        exit
 
fi
 
fi
  
Line 84: Line 89:
 
if [[ "$DRIVE" == *"mmcblk"* ]]
 
if [[ "$DRIVE" == *"mmcblk"* ]]
 
then
 
then
echo "You're using a mmc device, I need to fix partition names"
+
        echo "You're using a mmc device, I need to fix partition names"
PART="p"
+
        PART="p"
 
else
 
else
PART=""
+
        PART=""
 
fi
 
fi
 
UBOOT=$2
 
UBOOT=$2
Line 98: Line 103:
 
if ! [ $ans == 'y' ]
 
if ! [ $ans == 'y' ]
 
then
 
then
exit
+
        exit
 
fi
 
fi
  
Line 116: Line 121:
 
if [ "$?" -eq "0" ]
 
if [ "$?" -eq "0" ]
 
then
 
then
{
+
        {
echo 40,1380,0x0c,*
+
                echo 40,1380,0x0c,*
echo 1420,,83,-
+
                echo 1420,,83,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
+
        } | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
 
else
 
else
 
{
 
{
Line 157: Line 162:
  
  
Here is an example that shows how to use this script. Let's assume that the binary files were downloaded in the <code>desk</code> 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:
+
Here is an example that shows how to use this script. We use here files delivered with [[DESK-MX6-L/General/Release_Notes#Downloadable_binary_images_2|DESK-MX6-L 3.0.0]] release. 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: <code>boot.scr</code>
 
* bootscript: <code>boot.scr</code>
* Linux kernel: <code>uImage</code>
+
* splash image: <code>splash_image.bmp</code>
* Device tree blob: <code>desk-mx6-l-1.0.0_imx6dl-sbcx-cb0012.dtb</code>.
+
* Linux kernel: <code>desk-mx6-l-3.0.0_uImage</code>
 +
* Device tree blob: <code>desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb</code>.
  
This is the list of the binary files that will be used by the script:
+
We will copy them into <code>~/desk-mx-l/desk</code> directory. Needed binary files can be found on <code>MVM</code> in the following location:
 
<pre>
 
<pre>
dvdk@vagrant:~/desk-mx-l$ ll /tftpboot/desk-mx-l/
+
dvdk@vagrant:~$ ll /tftpboot/desk-mx-l/
total 10388
+
total 11616
drwxr-xr-x 2 dvdk root    4096 Jul  1 14:53 ./
+
drwxr-xr-x 2 dvdk root    4096 Feb 24 13:11 ./
drwxr-xr-x 3 dvdk root    4096 Apr  9 15:52 ../
+
drwxr-xr-x 3 dvdk root    4096 Feb 24 13:08 ../
-rw-r--r-- 1 dvdk dvdk    1556 Jul  1 14:53 boot.scr
+
-rw-r--r-- 1 dvdk root  51910 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb
-rw-r--r-- 1 dvdk root  52939 Apr  9 15:53 desk-mx6-l-1.0.0_imx6dl-sbcx-cb0012.dtb
+
-rw-r--r-- 1 dvdk root  52223 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0013.dtb
-rw-r--r-- 1 dvdk root  53252 Apr  9 15:53 desk-mx6-l-1.0.0_imx6dl-sbcx-cb0013.dtb
+
-rw-r--r-- 1 dvdk root  51824 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0018.dtb
-rw-r--r-- 1 dvdk root  52837 Apr  9 15:53 desk-mx6-l-1.0.0_imx6dl-sbcx-cb0018.dtb
+
-rw-r--r-- 1 dvdk root  52894 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0050.dtb
-rw-r--r-- 1 dvdk root  53939 Apr  9 15:53 desk-mx6-l-1.0.0_imx6dl-sbcx-cb0050.dtb
+
-rw-r--r-- 1 dvdk root  52199 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0055.dtb
-rw-r--r-- 1 dvdk root  53212 Apr  9 15:53 desk-mx6-l-1.0.0_imx6dl-sbcx-cb0055.dtb
+
-rw-r--r-- 1 dvdk root  48399 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-xelk-l.dtb
-rw-r--r-- 1 dvdk root  49142 Apr  9 15:53 desk-mx6-l-1.0.0_imx6dl-xelk-l.dtb
+
-rw-r--r-- 1 dvdk root  53187 Feb 24 13:10 desk-mx6-l-3.0.0_imx6q-sbcx-cb0012.dtb
-rw-r--r-- 1 dvdk root  53760 Apr  9 15:53 desk-mx6-l-1.0.0_imx6q-sbcx-cb0012.dtb
+
-rw-r--r-- 1 dvdk root  53496 Feb 24 13:10 desk-mx6-l-3.0.0_imx6q-sbcx-cb0013.dtb
-rw-r--r-- 1 dvdk root  54069 Apr  9 15:53 desk-mx6-l-1.0.0_imx6q-sbcx-cb0013.dtb
+
-rw-r--r-- 1 dvdk root  49840 Feb 24 13:10 desk-mx6-l-3.0.0_imx6q-xelk-l-2-0-0.dtb
-rw-r--r-- 1 dvdk root  50131 Apr  9 15:53 desk-mx6-l-1.0.0_imx6q-xelk-l-2-0-0.dtb
+
-rw-r--r-- 1 dvdk root  49672 Feb 24 13:11 desk-mx6-l-3.0.0_imx6q-xelk-l.dtb
-rw-r--r-- 1 dvdk root  49959 Apr  9 15:53 desk-mx6-l-1.0.0_imx6q-xelk-l.dtb
+
-rw-r--r-- 1 dvdk root  60416 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_nand_SPL
-rw-r--r-- 1 dvdk root  56320 Apr  9 15:52 desk-mx6-l-1.0.0_mx6qdldesk_nand_SPL
+
-rw-r--r-- 1 dvdk root  625300 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_nand_u-boot.img
-rw-r--r-- 1 dvdk root  570224 Apr  9 15:52 desk-mx6-l-1.0.0_mx6qdldesk_nand_u-boot.img
+
-rw-r--r-- 1 dvdk root  60416 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_spi_SPL
-rw-r--r-- 1 dvdk root  56320 Apr  9 15:52 desk-mx6-l-1.0.0_mx6qdldesk_spi_SPL
+
-rw-r--r-- 1 dvdk root  602668 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_spi_u-boot.img
-rw-r--r-- 1 dvdk root  569984 Apr  9 15:52 desk-mx6-l-1.0.0_mx6qdldesk_spi_u-boot.img
+
-rw-r--r-- 1 dvdk root  60416 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_SPL
-rw-r--r-- 1 dvdk root  56320 Apr  9 15:52 desk-mx6-l-1.0.0_mx6qdldesk_SPL
+
-rw-r--r-- 1 dvdk root  624932 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_u-boot.img
-rw-r--r-- 1 dvdk root  569864 Apr  9 15:52 desk-mx6-l-1.0.0_mx6qdldesk_u-boot.img
+
-rw-r--r-- 1 dvdk root 8154280 Feb 24 13:10 desk-mx6-l-3.0.0_uImage
-rw-r--r-- 1 dvdk root 7031584 Apr  9 15:53 desk-mx6-l-1.0.0_uImage
+
-rw-r--r-- 1 dvdk root 1152054 Feb 24 13:08 splash_image.bmp
-rw-r--r-- 1 dvdk root 1152054 Apr  9 15:52 splash_image.bmp
+
dvdk@vagrant:~$ ll ~/desk-mx-l/desk-mx6-l-3.0.0_boot.scr
dvdk@vagrant:~/desk-mx-l$  
+
-rw-rw-r-- 1 dvdk dvdk 1556 Feb 24 14:43 /home/dvdk/desk-mx-l/desk-mx6-l-3.0.0_boot.scr
 +
dvdk@vagrant:~$ cp /tftpboot/desk-mx-l/desk-mx6-l-3.0.0_uImage ~/desk-mx-l/desk/desk-mx6-l-3.0.0_uImage
 +
dvdk@vagrant:~$ cp /tftpboot/desk-mx-l/desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb ~/desk-mx-l/desk/desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb
 +
dvdk@vagrant:~$ cp ~/desk-mx-l/desk-mx6-l-3.0.0_boot.scr ~/desk-mx-l/desk/boot.scr
 +
dvdk@vagrant:~$ cp /tftpboot/desk-mx-l/splash_image.bmp ~/desk-mx-l/desk/
 
</pre>
 
</pre>
  
 
You can now run the script, by passing the following parameters:
 
You can now run the script, by passing the following parameters:
*Device file of the microSD card (<code>/dev/sdc</code> in the example)
+
*Device file of the microSD card (<code>/dev/sdb</code> in the example)
 
*U-Boot image
 
*U-Boot image
 
*SPL
 
*SPL
*Path of the directory containing the bootscript file, the Linux kernel image, and the device tree blob files
+
*Path of the directory containing the bootscript file, the splash image, the Linux kernel image and the device tree blob files
 
*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-mx-l$ sudo ./desk-mx6-l-1.0.0_mksd.sh /dev/sdb /tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_u-boot.img /tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_SPL /tftpboot/desk-mx-l/ ./rfs/dave-image-devel-desk-mx6.tar.bz2  
+
dvdk@vagrant:~/desk-mx-l$ sudo ./desk-mx6-l-3.0.0_mksd.sh /dev/sdb /tftpboot/desk-mx-l/desk-mx6-l-3.0.0_mx6qdldesk_u-boot.img /tftpboot/desk-mx-l/desk-mx6-l-3.0.0_mx6qdldesk_SPL ~/desk-mx-l/desk ./rfs/desk-mx6-l-3.0.0_desk-image-qt5-desk-mx6.tar.bz2  
 
All data on /dev/sdb now will be destroyed! Continue? [y/n]
 
All data on /dev/sdb now will be destroyed! Continue? [y/n]
 
y
 
y
Line 203: Line 213:
 
1024+0 records in
 
1024+0 records in
 
1024+0 records out
 
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 3.0706 s, 341 kB/s
+
1048576 bytes (1.0 MB, 1.0 MiB) copied, 2.01554 s, 520 kB/s
 
DISK SIZE - 15931539456 bytes
 
DISK SIZE - 15931539456 bytes
 
Checking that no-one is using this disk right now ... OK
 
Checking that no-one is using this disk right now ... OK
  
Disk /dev/sdb: 14.9 GiB, 15931539456 bytes, 31116288 sectors
+
Disk /dev/sdb: 14.86 GiB, 15931539456 bytes, 31116288 sectors
 +
Disk model: Transcend     
 
Units: sectors of 1 * 512 = 512 bytes
 
Units: sectors of 1 * 512 = 512 bytes
 
Sector size (logical/physical): 512 bytes / 512 bytes
 
Sector size (logical/physical): 512 bytes / 512 bytes
 
I/O size (minimum/optimal): 512 bytes / 512 bytes
 
I/O size (minimum/optimal): 512 bytes / 512 bytes
  
>>> Created a new DOS disklabel with disk identifier 0x2c61a4d6.
+
>>> Created a new DOS disklabel with disk identifier 0x40f56c1d.
Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 8 GiB.
+
/dev/sdb1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 8 GiB.
/dev/sdb2: Sector 16384000 is already allocated.
+
/dev/sdb2: Created a new partition 2 of type 'Linux' and of size 6.9 GiB.
Created a new partition 2 of type 'Linux' and of size 6.9 GiB.
+
/dev/sdb3: Done.
/dev/sdb3:  
+
 
 
New situation:
 
New situation:
 +
Disklabel type: dos
 +
Disk identifier: 0xe38701f1
 +
 +
Device    Boot    Start      End  Sectors  Size Id Type
 +
/dev/sdb1  *      32768 16777215 16744448    8G  c W95 FAT32 (LBA)
 +
/dev/sdb2      16777216 62333951 45556736 21.7G 83 Linux
 +
 +
New situation:
 +
Disklabel type: dos
 +
Disk identifier: 0x40f56c1d
  
 
Device    Boot    Start      End  Sectors  Size Id Type
 
Device    Boot    Start      End  Sectors  Size Id Type
Line 226: Line 247:
 
Calling ioctl() to re-read partition table.
 
Calling ioctl() to re-read partition table.
 
Syncing disks.
 
Syncing disks.
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.
 
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.
 
 
[Making filesystems...]
 
[Making filesystems...]
mkfs.fat 3.0.28 (2015-05-16)
+
mkfs.fat 4.1 (2017-01-24)
mke2fs 1.42.13 (17-May-2015)
+
mke2fs 1.45.5 (07-Jan-2020)
/dev/sdb2 contains a ext3 file system labelled 'ROOTFS'
 
last mounted on /mnt on Thu Jul  1 14:57:17 2021
 
 
Creating filesystem with 1792384 4k blocks and 448800 inodes
 
Creating filesystem with 1792384 4k blocks and 448800 inodes
Filesystem UUID: 330007bc-831c-4c5d-b51e-626bbac325da
+
Filesystem UUID: 969ecf69-e872-4709-b325-627b3d1c9201
 
Superblock backups stored on blocks:  
 
Superblock backups stored on blocks:  
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
+
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
  
 
Allocating group tables: done                             
 
Allocating group tables: done                             
 
Writing inode tables: done                             
 
Writing inode tables: done                             
Creating journal (32768 blocks): done
+
Creating journal (16384 blocks): done
 
Writing superblocks and filesystem accounting information: done  
 
Writing superblocks and filesystem accounting information: done  
  
 
[Copying files...]
 
[Copying files...]
'/tftpboot/desk-mx-l/boot.scr' -> '/mnt/boot.scr'
+
'/home/dvdk/desk-mx-l/desk/boot.scr' -> '/mnt/boot.scr'
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0012.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0012.dtb'
+
'/home/dvdk/desk-mx-l/desk/desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb' -> '/mnt/desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb'
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0013.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0013.dtb'
+
'/home/dvdk/desk-mx-l/desk/desk-mx6-l-3.0.0_uImage' -> '/mnt/desk-mx6-l-3.0.0_uImage'
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0018.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0018.dtb'
+
'/home/dvdk/desk-mx-l/desk/splash_image.bmp' -> '/mnt/splash_image.bmp'
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0050.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0050.dtb'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0055.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0055.dtb'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6dl-xelk-l.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6dl-xelk-l.dtb'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6q-sbcx-cb0012.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6q-sbcx-cb0012.dtb'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6q-sbcx-cb0013.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6q-sbcx-cb0013.dtb'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6q-xelk-l-2-0-0.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6q-xelk-l-2-0-0.dtb'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6q-xelk-l.dtb' -> '/mnt/desk-mx6-l-1.0.0_imx6q-xelk-l.dtb'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_nand_SPL' -> '/mnt/desk-mx6-l-1.0.0_mx6qdldesk_nand_SPL'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_nand_u-boot.img' -> '/mnt/desk-mx6-l-1.0.0_mx6qdldesk_nand_u-boot.img'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_spi_SPL' -> '/mnt/desk-mx6-l-1.0.0_mx6qdldesk_spi_SPL'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_spi_u-boot.img' -> '/mnt/desk-mx6-l-1.0.0_mx6qdldesk_spi_u-boot.img'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_SPL' -> '/mnt/desk-mx6-l-1.0.0_mx6qdldesk_SPL'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_u-boot.img' -> '/mnt/desk-mx6-l-1.0.0_mx6qdldesk_u-boot.img'
 
'/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_uImage' -> '/mnt/desk-mx6-l-1.0.0_uImage'
 
'/tftpboot/desk-mx-l/splash_image.bmp' -> '/mnt/splash_image.bmp'
 
 
[Extracting rfs (this may take a while...)]
 
[Extracting rfs (this may take a while...)]
 
[Programming SPL]
 
[Programming SPL]
110+0 records in
+
118+0 records in
110+0 records out
+
118+0 records out
56320 bytes (56 kB, 55 KiB) copied, 0.181772 s, 310 kB/s
+
60416 bytes (60 kB, 59 KiB) copied, 0.129522 s, 466 kB/s
 
[Programming u-boot.img]
 
[Programming u-boot.img]
556+1 records in
+
610+1 records in
556+1 records out
+
610+1 records out
569864 bytes (570 kB, 557 KiB) copied, 2.31068 s, 247 kB/s
+
624932 bytes (625 kB, 610 KiB) copied, 1.84936 s, 338 kB/s
 
[Done]
 
[Done]
 
</pre>
 
</pre>
Line 284: Line 286:
  
 
<pre>
 
<pre>
echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n AXEL-Lite-DESK-SBCX -d bootscript.txt boot.scr"'
+
'V��3Fb���6"�DESK-MX6-L�echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n DESK-MX6-L -d bootscript.txt boot.scr"'
  
setenv desk_release 'desk-mx6-l-1.0.0'
+
setenv desk_release 'desk-mx6-l-3.0.0'
  
 
if test 0x${cb_configid#} = 0x00000012;
 
if test 0x${cb_configid#} = 0x00000012;
 
then
 
then
if test ${cpu} = 6DL; then
+
        if test ${cpu} = 6DL; then
setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0012.dtb
+
                setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0012.dtb
else
+
        else
setenv fdtfile ${desk_release}_imx6q-sbcx-cb0012.dtb
+
                setenv fdtfile ${desk_release}_imx6q-sbcx-cb0012.dtb
fi
+
        fi
 
elif test 0x${cb_configid#} = 0x00000013;
 
elif test 0x${cb_configid#} = 0x00000013;
 
then
 
then
if test ${cpu} = 6DL; then
+
        if test ${cpu} = 6DL; then
setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0013.dtb
+
                setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0013.dtb
else
+
        else
setenv fdtfile ${desk_release}_imx6q-sbcx-cb0013.dtb
+
                setenv fdtfile ${desk_release}_imx6q-sbcx-cb0013.dtb
fi
+
        fi
 +
elif test 0x${cb_configid#} = 0x00000001;
 +
then
 +
        if test ${cpu} = 6DL; then
 +
                setenv fdtfile ${desk_release}_imx6dl-xelk-l.dtb
 +
        else
 +
                setenv fdtfile ${desk_release}_imx6q-xelk-l.dtb
 +
        fi
 +
elif test 0x${cb_configid#} = 0x00000018;
 +
then
 +
        setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0018.dtb
 +
elif test 0x${cb_configid#} = 0x00000050;
 +
then
 +
        setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0050.dtb
 +
elif test 0x${cb_configid#} = 0x00000055;
 +
then
 +
        setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0055.dtb
 
elif test 0x${cb_configid#} = 0xffffffff;
 
elif test 0x${cb_configid#} = 0xffffffff;
 
then
 
then
if test ${cpu} = 6DL; then
+
        setenv fdtfile ${desk_release}_imx6q-xelk-l-2-0-0.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 ...
 
     sleep 30
 
     sleep 30
reset
+
        reset
 
fi
 
fi
  
Line 320: Line 334:
 
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-MX6-L via mmcboot with ${fdtfile} as device tree
  
 
run mmcboot
 
run mmcboot
Line 336: Line 350:
  
 
=== Attention !===
 
=== Attention !===
* <code>/home/dvdk/desk-mx-l/desk-mx6-l-1.0.0_boot.scr</code> has been generated using the images available at the moment of VM creation: please, use the previous indication ax an example on how to create a '''proper''' bootscript for your own purposes
+
* <code>/home/dvdk/desk-mx-l/desk-mx6-l-3.0.0_boot.scr</code> has been generated using the images available at the moment of VM creation: please, use the previous indication as an example on how to create a '''proper''' bootscript for your own purposes
* <code>/home/dvdk/desk-mx-l/desk-mx6-l-1.0.0_mksd.sh</code> bash script has been validated using a single SD card version: the size of the partitions and the related ''sfdisk'' parameters have to be properly modified according to your own SD card used and to your partitions specification. You can use it an an example to be modified according your use case
+
* <code>/home/dvdk/desk-mx-l/desk-mx6-l-3.0.0_mksd.sh</code> bash script has been validated using a single SD card version: the size of the partitions and the related ''sfdisk'' parameters have to be properly modified according to your own SD card used and to your partitions specification. You can use it an an example to be modified according your use case
  
 
----
 
----
  
 
[[Category:AXEL Lite]]
 
[[Category:AXEL Lite]]

Revision as of 08:09, 25 February 2022

History
Version Issue Date Notes
1.0.0 Jun 2021 First DESK release
3.0.0 Feb 2022 3.0.0 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 virtual machine such as the MVM. The USB controller of the MVM should be enabled by default. If you are using Linux-based distribution and are having trouble detecting a USB device in virtual machine, please make sure your user belongs to the vboxusers group.


This article shows how to create a bootable microSD for the DESK-MX6-L Release Notes kit by using a simple bash script.
Note: Starting from DESK-MX6-L 1.0.0 release the support for the SPL has been introduced in U-Boot. Previous versions of this script will no longer produce a fully functional and bootable microSD card.

The procedure has been tested on a MVM released with DESK-MX6-L 3.0.0 release with

  • a 16 GB microSD card [1]
  • a USB SD card reader
  • the binary files delivered along with the DESK-MX6-L 3.0.0.

The resulting card is partitioned as depicted here below:

  • bootable partition (mmcblk0p1, vfat) containing:
    • binary images (U-Boot and kernel images)
  • root file system partition (mmcblk0p2, ext3)
    • root file system binaries and init scripts

The script - named mksd.sh - can be realized with the following code:

#!/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. We use here files delivered with DESK-MX6-L 3.0.0 release. 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
  • splash image: splash_image.bmp
  • Linux kernel: desk-mx6-l-3.0.0_uImage
  • Device tree blob: desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb.

We will copy them into ~/desk-mx-l/desk directory. Needed binary files can be found on MVM in the following location:

dvdk@vagrant:~$ ll /tftpboot/desk-mx-l/
total 11616
drwxr-xr-x 2 dvdk root    4096 Feb 24 13:11 ./
drwxr-xr-x 3 dvdk root    4096 Feb 24 13:08 ../
-rw-r--r-- 1 dvdk root   51910 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb
-rw-r--r-- 1 dvdk root   52223 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0013.dtb
-rw-r--r-- 1 dvdk root   51824 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0018.dtb
-rw-r--r-- 1 dvdk root   52894 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0050.dtb
-rw-r--r-- 1 dvdk root   52199 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-sbcx-cb0055.dtb
-rw-r--r-- 1 dvdk root   48399 Feb 24 13:10 desk-mx6-l-3.0.0_imx6dl-xelk-l.dtb
-rw-r--r-- 1 dvdk root   53187 Feb 24 13:10 desk-mx6-l-3.0.0_imx6q-sbcx-cb0012.dtb
-rw-r--r-- 1 dvdk root   53496 Feb 24 13:10 desk-mx6-l-3.0.0_imx6q-sbcx-cb0013.dtb
-rw-r--r-- 1 dvdk root   49840 Feb 24 13:10 desk-mx6-l-3.0.0_imx6q-xelk-l-2-0-0.dtb
-rw-r--r-- 1 dvdk root   49672 Feb 24 13:11 desk-mx6-l-3.0.0_imx6q-xelk-l.dtb
-rw-r--r-- 1 dvdk root   60416 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_nand_SPL
-rw-r--r-- 1 dvdk root  625300 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_nand_u-boot.img
-rw-r--r-- 1 dvdk root   60416 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_spi_SPL
-rw-r--r-- 1 dvdk root  602668 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_spi_u-boot.img
-rw-r--r-- 1 dvdk root   60416 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_SPL
-rw-r--r-- 1 dvdk root  624932 Feb 24 13:08 desk-mx6-l-3.0.0_mx6qdldesk_u-boot.img
-rw-r--r-- 1 dvdk root 8154280 Feb 24 13:10 desk-mx6-l-3.0.0_uImage
-rw-r--r-- 1 dvdk root 1152054 Feb 24 13:08 splash_image.bmp
dvdk@vagrant:~$ ll ~/desk-mx-l/desk-mx6-l-3.0.0_boot.scr 
-rw-rw-r-- 1 dvdk dvdk 1556 Feb 24 14:43 /home/dvdk/desk-mx-l/desk-mx6-l-3.0.0_boot.scr
dvdk@vagrant:~$ cp /tftpboot/desk-mx-l/desk-mx6-l-3.0.0_uImage ~/desk-mx-l/desk/desk-mx6-l-3.0.0_uImage
dvdk@vagrant:~$ cp /tftpboot/desk-mx-l/desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb ~/desk-mx-l/desk/desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb
dvdk@vagrant:~$ cp ~/desk-mx-l/desk-mx6-l-3.0.0_boot.scr ~/desk-mx-l/desk/boot.scr
dvdk@vagrant:~$ cp /tftpboot/desk-mx-l/splash_image.bmp ~/desk-mx-l/desk/

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

  • Device file of the microSD card (/dev/sdb in the example)
  • U-Boot image
  • SPL
  • Path of the directory containing the bootscript file, the splash image, 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-mx-l$ sudo ./desk-mx6-l-3.0.0_mksd.sh /dev/sdb /tftpboot/desk-mx-l/desk-mx6-l-3.0.0_mx6qdldesk_u-boot.img /tftpboot/desk-mx-l/desk-mx6-l-3.0.0_mx6qdldesk_SPL ~/desk-mx-l/desk ./rfs/desk-mx6-l-3.0.0_desk-image-qt5-desk-mx6.tar.bz2 
All data on /dev/sdb now will be destroyed! Continue? [y/n]
y
[Partitioning /dev/sdb...]
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 2.01554 s, 520 kB/s
DISK SIZE - 15931539456 bytes
Checking that no-one is using this disk right now ... OK

Disk /dev/sdb: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Disk model: Transcend       
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

>>> Created a new DOS disklabel with disk identifier 0x40f56c1d.
/dev/sdb1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 8 GiB.
/dev/sdb2: Created a new partition 2 of type 'Linux' and of size 6.9 GiB.
/dev/sdb3: Done.

New situation:
Disklabel type: dos
Disk identifier: 0xe38701f1

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdb1  *       32768 16777215 16744448    8G  c W95 FAT32 (LBA)
/dev/sdb2       16777216 62333951 45556736 21.7G 83 Linux

New situation:
Disklabel type: dos
Disk identifier: 0x40f56c1d

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdb1  *       32768 16777215 16744448    8G  c W95 FAT32 (LBA)
/dev/sdb2       16777216 31116287 14339072  6.9G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[Making filesystems...]
mkfs.fat 4.1 (2017-01-24)
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 1792384 4k blocks and 448800 inodes
Filesystem UUID: 969ecf69-e872-4709-b325-627b3d1c9201
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

[Copying files...]
'/home/dvdk/desk-mx-l/desk/boot.scr' -> '/mnt/boot.scr'
'/home/dvdk/desk-mx-l/desk/desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb' -> '/mnt/desk-mx6-l-3.0.0_imx6dl-sbcx-cb0012.dtb'
'/home/dvdk/desk-mx-l/desk/desk-mx6-l-3.0.0_uImage' -> '/mnt/desk-mx6-l-3.0.0_uImage'
'/home/dvdk/desk-mx-l/desk/splash_image.bmp' -> '/mnt/splash_image.bmp'
[Extracting rfs (this may take a while...)]
[Programming SPL]
118+0 records in
118+0 records out
60416 bytes (60 kB, 59 KiB) copied, 0.129522 s, 466 kB/s
[Programming u-boot.img]
610+1 records in
610+1 records out
624932 bytes (625 kB, 610 KiB) copied, 1.84936 s, 338 kB/s
[Done]

[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:

'V��3Fb���6"�DESK-MX6-L�echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n DESK-MX6-L -d bootscript.txt boot.scr"'

setenv desk_release 'desk-mx6-l-3.0.0'

if test 0x${cb_configid#} = 0x00000012;
then
        if test ${cpu} = 6DL; then
                setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0012.dtb
        else
                setenv fdtfile ${desk_release}_imx6q-sbcx-cb0012.dtb
        fi
elif test 0x${cb_configid#} = 0x00000013;
then
        if test ${cpu} = 6DL; then
                setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0013.dtb
        else
                setenv fdtfile ${desk_release}_imx6q-sbcx-cb0013.dtb
        fi
elif test 0x${cb_configid#} = 0x00000001;
then
        if test ${cpu} = 6DL; then
                setenv fdtfile ${desk_release}_imx6dl-xelk-l.dtb
        else
                setenv fdtfile ${desk_release}_imx6q-xelk-l.dtb
        fi
elif test 0x${cb_configid#} = 0x00000018;
then
        setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0018.dtb
elif test 0x${cb_configid#} = 0x00000050;
then
        setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0050.dtb
elif test 0x${cb_configid#} = 0x00000055;
then
        setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0055.dtb
elif test 0x${cb_configid#} = 0xffffffff;
then
        setenv fdtfile ${desk_release}_imx6q-xelk-l-2-0-0.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-MX6-L 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-MX6-L -d bootscript.txt boot.scr

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

Attention ![edit | edit source]

  • /home/dvdk/desk-mx-l/desk-mx6-l-3.0.0_boot.scr has been generated using the images available at the moment of VM creation: please, use the previous indication as an example on how to create a proper bootscript for your own purposes
  • /home/dvdk/desk-mx-l/desk-mx6-l-3.0.0_mksd.sh bash script has been validated using a single SD card version: the size of the partitions and the related sfdisk parameters have to be properly modified according to your own SD card used and to your partitions specification. You can use it an an example to be modified according your use case