Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX6UL-L/Development/How to create a bootable microSD card

250 bytes removed, 07:20, 28 February 2022
Update SD card section for DESK-MX6UL-L v3.0.0 release
<section begin="History" />
{| style="border-collapse:collapse; "
!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"|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:#edf8fb; padding:5px; color:#000000"|1.0.1|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" |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" />
__FORCETOC__
<section begin="Body" />
==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 The USB controller of the MVM is disabled should be enabled by default. See also [[MVM_FAQs#Q:_How_to_use_the_USB_devices_connected_to_the_host_machine.3F|this section]]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-MX6UL-L/General/Release_Notes|DESK-MX6UL-L Release Notes]] kit by using a simple bash script. <br>'''Note:''' Note: Starting from this '''DESK-MX6UL-L 1.0.1''' 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 16MVM released with '''DESK-MX6-L 3.04 distribution 0.0''' release with
*a 16 GB microSD card [1]
*a USB SD card reader*the binary files delivered along with the [[DESK-MX6UL-L/General/Release_Notes#Downloadable_binary_imagesDownloadable_binary_images_2|DESK-MX6UL-L 13.0.10]]
The resulting card is partitioned as depicted here below:
* bootable partition (mmcblk0p1, vfat) containing:
** binary images (uU-boot Boot and kernel images)
* root file system partition (mmcblk0p2, ext3)
** root file system binaries and init scripts
</pre>
Here is an example that shows how to use this script. We use here files delivered with [[DESK-MX6UL-L/General/Release_Notes#Downloadable_binary_images_2|DESK-MX6UL-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>
* splash image: <code>splash_image.bmp</code>
* Linux kernel: <code>desk-mx6ul-l-3.0.0_uImage</code>
* Device tree blob: <code>desk-mx6ul-l-3.0.0_imx6ul-axelulite-cb003a.dtb</code>.
Here is an example that shows how to use this script. Let's assume that the binary files were downloaded in the We will copy them into <code>~/desk-mx-l/desk</code> subdirectory of the working directory. Before invoking the script, the following Needed binary files has to can be renamed in order to make them compatible with the default U-Boot environment variables:* bootscript: found on <code>boot.scrMVM</code>* Linux kernel: <code>uImage</code>* Device tree blobin the following location: <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:
<pre>
dvdk@vagrant:~/desk-mx-l$ ll /tftpboot/desk-mx-l/total 1091612180drwxr-xr-x 2 dvdk root 4096 Jul 1 11Feb 27 18:42 54 ./drwxr-xr-x 3 dvdk root 4096 Jun 24 10Feb 27 18:01 52 ../-rw-r--r-- 1 dvdk root 34095 Jun 24 1032441 Feb 27 18:03 54 desk-mx6ul-l-13.0.1_imx6ul0_imx6ul-axelulite-cb003a.dtb-rw-r--r-- 1 dvdk root 33137 Jun 24 1031479 Feb 27 18:03 54 desk-mx6ul-l-13.0.1_imx6ul0_imx6ul-axelulite-cb006c.dtb-rw-r--r-- 1 dvdk root 34211 Jun 24 1032518 Feb 27 18:03 54 desk-mx6ul-l-13.0.1_imx6ul0_imx6ul-lynx-som0013-cb002f.dtb-rw-r--r-- 1 dvdk root 56320 Jun 24 1044032 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_axelulite_spi_SPL0_mx6uldesk_axelulite_spi_SPL-rw-r--r-- 1 dvdk root 547528 Jun 24 10600280 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_axelulite_spi_u0_mx6uldesk_axelulite_spi_u-boot.img-rw-r--r-- 1 dvdk root 56320 Jun 24 1044032 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_axelulite_SPL0_mx6uldesk_axelulite_SPL-rw-r--r-- 1 dvdk root 547200 Jun 24 10600280 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_axelulite_u0_mx6uldesk_axelulite_u-boot.img-rw-r--r-- 1 dvdk root 56320 Jun 24 1044032 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_lynx_spi_SPL0_mx6uldesk_lynx_spi_SPL-rw-r--r-- 1 dvdk root 512568 Jun 24 10564844 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_lynx_spi_u0_mx6uldesk_lynx_spi_u-boot.img-rw-r--r-- 1 dvdk root 56320 Jun 24 1044032 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_lynx_SPL0_mx6uldesk_lynx_SPL-rw-r--r-- 1 dvdk root 512216 Jun 24 10564244 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_lynx_u0_mx6uldesk_lynx_u-boot.img-rw-r--r-- 1 dvdk root 52224 Jun 24 1044032 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_lynx_usb_SPL0_mx6uldesk_lynx_usb_SPL-rw-r--r-- 1 dvdk root 431512 Jun 24 10457216 Feb 27 18:01 52 desk-mx6ul-l-13.0.1_mx6uldesk_lynx_usb_u0_mx6uldesk_lynx_usb_u-boot.img-rw-r--r-- 1 dvdk root 7056696 Jun 24 108189464 Feb 27 18:03 54 desk-mx6ul-l-13.0.1_uImage0_uImagedvdk@vagrant:~$ ll ~/desk-mx-l/desk-mx6ul-l-3.0.0_boot.scr-rw-rw-r--r1 dvdk dvdk 936 Feb 28 07:36 /home/dvdk/desk-mx-l/desk-mx6ul-l-3.0.0_boot.scrdvdk@vagrant:~$ cp /tftpboot/desk-mx-l/desk-mx6ul-l-3.0.0_uImage ~/desk-mx-l/desk/desk-mx6ul-l-3.0.0_uImagedvdk@vagrant:~$ cp /tftpboot/desk-mx-l/desk-mx6ul-l-3.0.0_imx6ul-axelulite-cb003a.dtb ~/desk-mx-l/desk/desk-mx6ul-l-3.0.0_imx6ul-axelulite- 1 cb003a.dtbdvdk root 1152054 Jun 24 10@vagrant:01 ~$ cp /tftpboot/desk-mx-l/splash_image.bmp~/desk-mx-l/desk/dvdk@vagrant:~$ cp ~/desk-mx-l/desk-mx6ul-l-3.0.0_boot.scr ~/desk-mx-l$ /desk/boot.scr
</pre>
*Archive of the target's root file system (compressed as <code>.tar.bz2</code> file).
<pre>
dvdk@vagrant:~/desk-mx-l$ sudo ./mksddesk-mx6ul-l-3.0.0_mksd.sh /dev/sdb /tftpboot/desk-mx-l/desk-mx6ul-l-13.0.1_mx6uldesk_axelulite_u0_mx6uldesk_axelulite_u-boot.img /tftpboot/desk-mx-l/desk-mx6ul-l-13.0.1_mx6uldesk_axelulite_SPL /tftpboot0_mx6uldesk_axelulite_SPL ~/desk-mx-l/ desk ./rfs/desk-mx6ul-l-13.0.1_dave0_dave-image-devel-desk-mx6ul.tar.bz2
All data on /dev/sdb now will be destroyed! Continue? [y/n]
y
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 32.14558 05358 s, 333 511 kB/s
DISK SIZE - 15931539456 bytes
Checking that no-one is using this disk right now ... OK
Disk /dev/sdb: 14.9 86 GiB, 15931539456 bytes, 31116288 sectorsDisk 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 0x81b8796c0x3adbf72f./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: 0x3adbf72f
Device Boot Start End Sectors Size Id Type
Syncing disks.
[Making filesystems...]
mkfs.fat 34.0.28 1 (20152017-0501-1624)mke2fs 1.4245.13 5 (1707-MayJan-20152020)/dev/sdb2 contains a ext3 file system labelled 'ROOTFS' last mounted on /mnt on Thu Sep 17 16:27:41 2020
Creating filesystem with 1792384 4k blocks and 448800 inodes
Filesystem UUID: 97e6964b3f65294a-f60c899d-4f1f417c-b5e99092-33569c976f4be8bf209ec6b2
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 16384 blocks): done
Writing superblocks and filesystem accounting information: done
[Copying files...]
'/tftpboothome/dvdk/desk-mx-l/desk/boot.scr' -> '/mnt/boot.scr''/tftpboothome/dvdk/desk-mx-l/desk-mx6ul-l-1.0.1_imx6ul-axelulite-cb003a.dtb' -> '/mnt/desk-mx6ul-l-13.0.1_imx6ul0_imx6ul-axelulite-cb003a.dtb''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_imx6ul-axelulite-cb006c.dtb' -> '/mnt/desk-mx6ul-l-13.0.1_imx6ul0_imx6ul-axelulite-cb006c.dtb''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_imx6ul-lynx-som0013-cb002f.dtb' -> '/mnt/desk-mx6ul-l-1.0.1_imx6ul-lynx-som0013-cb002fcb003a.dtb''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_axelulite_spi_SPL' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_axelulite_spi_SPL''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_axelulite_spi_u-boot.img' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_axelulite_spi_u-boot.img''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_axelulite_SPL' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_axelulite_SPL''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_axelulite_u-boot.img' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_axelulite_u-boot.img''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_spi_SPL' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_spi_SPL''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_spi_u-boot.img' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_spi_u-boot.img''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_SPL' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_SPL''home/tftpbootdvdk/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_u-boot.img' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_u-boot.img''/tftpboot/desk-mx-l/desk-mx6ul-l-13.0.1_mx6uldesk_lynx_usb_SPL0_uImage' -> '/mnt/desk-mx6ul-l-13.0.1_mx6uldesk_lynx_usb_SPL0_uImage''/tftpboot/desk-mx-l/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_usb_u-boot.img' -> '/mnt/desk-mx6ul-l-1.0.1_mx6uldesk_lynx_usb_u-boot.img''home/tftpbootdvdk/desk-mx-l/desk-mx6ul-l-1.0.1_uImage' -> '/mnt/desk-mx6ul-l-1.0.1_uImage''/tftpboot/desk-mx-l/splash_image.bmp' -> '/mnt/splash_image.bmp'
[Extracting rfs (this may take a while...)]
[Programming SPL]
11086+0 records in11086+0 records out56320 44032 bytes (56 44 kB, 55 43 KiB) copied, 0.263141 0930599 s, 214 473 kB/s
[Programming u-boot.img]
534586+1 records in534586+1 records out547200 600280 bytes (547 600 kB, 534 586 KiB) copied, 21.26831 64853 s, 241 364 kB/s
[Done]
</pre>
 
[1] In case you have a different size, you'll need to change the <code>sfdisk</code> parameters accordingly.
===bootscr ===
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 <i>boot.scr</i> uU-boot Boot bootscript.
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:
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-13.0.10'
if test 0x${som_configid#} = 0x00000013 && test 0x${cb_configid#} = 0x0000002f;
devwiki_user
120
edits