Open main menu

DAVE Developer's Wiki β

Changes

Updates for DESK-MX8-L 4.0.0 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"|17/02/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"|First DESK-MX8M-L release
|-
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |{{oldid|17546|17546}}
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |24/02/2023
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX8M-L-2.0.0 release
|-
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |{{oldid|17546|17546}}
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |2425/0207/2023! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX8M-L-24.0.0 release
|-
 
|}
<section end=History/>
==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-MX8M-L/General/Release_Notes_(DESK-MX8M-L)|DESK-MX8M-L Release Notes] kit by using a simple bash script. <br>
'''Note:''' Starting from this '''DESK-MX8M-L-2.0.0''' release the support for the SPL has been introduced in UbootU-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-MX8M-L 4.0.04) distribution 0''' release with *a 16 32 GB microSD card [1]*a USB SD card reader*the binary files delivered along with the [[DESK-MX8M-L/General/Release_Notes#Downloadable_binary_imagesDownloadable_binary_images_3|DESKMX8MDESK-MX8M-L 24.0.0]].
The resulting card is partitioned as depicted [[ORCA_SOM/ORCA_Evaluation_Kit/Getting_started/Unboxing#microSD_Layout|here]].
The script - named <code>mksddesk-mx8m-l-4.0.0_mksd.sh</code> - can be realized with the following code: <preclass="workstation-terminal">
#!/bin/bash
{{ImportantMessage|text=if you are making a uSD for MITO 8M Mini SOM, then the last line must be modified with '''dd if=$BOOT of=$DRIVE bs=1k seek=33'''.}}
Here is an example that shows how to use this script. Let's assume that the binary We use here files were downloaded in the <code>sdcard<delivered with [[DESK-MX8M-L/code> subdirectory of the working directoryGeneral/Release_Notes#Downloadable_binary_images_3|DESK-MX8M-L 4.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>
* Linux kernel: <code>Image</code>
* Device tree blob: <code>imx8mp-mito8mplus-cb1008.dtb</code> or <code>imx8mm-mito8mmini-cb100a.dtb</code> Let's start with creating <code>boot.scr</code>. On MVM there is <code>/home/dvdk/desk-mx-l/desk-mx8m-l-4.0.0_bootscript.txt</code> file that we can use to create needed file. Here below there is an example on how to create a <code>boot.scr</code> file from the '''desk-mx8m-l-4.0.0_bootscript.txt''' for booting from SD card: <pre class="workstation-terminal">echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n DESK-MX8M -d bootscript.txt boot.scr"' setenv desk_release 'desk-mx8m-l-4.0.0' if test 0x${cb_configid#} = 0x00001001;then setenv fdtfile imx8mp-mito8mplus-cb1001.dtbelif test 0x${cb_configid#} = 0x00001004;then setenv fdtfile imx8mp-mito8mplus-cb1004.dtbelif test 0x${cb_configid#} = 0x00001005;then setenv fdtfile imx8mp-mito8mplus-cb1005.dtb # CM7 boot setenv cm7_loadaddr 0x48000000 setenv cm7_tcm_start 0x7e0000 setenv cm7_boot 'fatload mmc ${sd_dev}:1 ${cm7_loadaddr} stress_m7.bin;cp.b ${cm7_loadaddr} ${cm7_tcm_start} 20000; bootaux ${cm7_tcm_start}'elif test 0x${cb_configid#} = 0x00001008;then setenv fdtfile imx8mp-mito8mplus-cb1008.dtbelif test 0x${cb_configid#} = 0x0000100a;then setenv fdtfile imx8mm-mito8mmini-cb100a.dtbelse echo Invalid CB ConfigID! Autoreset ... sleep 30 resetfi setenv bootfile Imagesetenv mmc_loadk 'fatload mmc ${sd_dev}:1 ${loadaddr} ${bootfile}'setenv mmc_loadfdt 'fatload mmc ${sd_dev}:1 ${fdt_addr} ${fdtfile}'setenv mmcboot 'run mmc_loadk; run mmc_loadfdt; run bootk'setenv bootargs 'console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 root=/dev/mmcblk1p2'setenv bootk 'booti ${loadaddr} - ${fdt_addr}' echo Booting DESK-MX8M via mmcboot with ${fdtfile} as device tree run mmcboot
This is the list of the binary files that will be used by the script:echo mmcboot FAILURE
</pre>
 
and compile it using:
<pre class="workstation-terminal">
dvdk@vagrant:~$ mkimage -A ARM -T script -C none -n DESK-MX8M -d ~/desk-mx-l/desk-mx8m-l-4.0.0_bootscript.txt ~/desk-mx-l/sdcard$ ls boot.scrImage Name: DESK-laRMX8MCreated: Tue Jul 25 12:24:35 2023Image Type: ARM Linux Script (uncompressed)Data Size: 1371 Bytes = 1.34 KiB = 0.00 MiBLoad Address:00000000total 734040Entry Point: 00000000drwxrwxr-x 3 dvdk dvdk 4096 Feb 16 09Contents:41 .drwxr-xr-x 7 dvdk dvdk 4096 Feb 16 09 Image 0:21 1363 Bytes = 1.33 KiB = 0.00 MiBdrwxrwxr-x 2 dvdk dvdk 4096 Feb 16 09@vagrant:41 binaries~$</pre>-rwxrwxr-x 1 dvdk dvdk 743273295 Feb 16 09In the case of you don't have some file on MVM, please download it from [https:34 //mirror.dave.eu/desk-imagemx-devel-desk-mx8mpl mirro.tar.bz2-rw-r--r-- 1 root root 1304608 Feb 16 09:32 flashdave.bin-rwxrwxr-x 1 dvdk dvdk 1908 Feb 16 09:22 mksdeu].sh
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 class="workstation-terminal">dvdk@vagrant:~$ mkdir -p ~/binariesdesk-mx-l/deskdvdk@vagrant:~$ cd ~/desk-mx-l/deskdvdk@vagrant:~/desk-mx-l/desk$ ls /tftpboot/desk-mx8m-l/ -ltotal 2760434872drwxrwxr-x 2 rw-r--r-- 1 dvdk root 31351296 Jul 24 08:50 desk-mx8m-l-4.0.0_Image-rw-r--r-- 1 dvdk 4096 Feb 16 09root 1406688 Jul 24 08:41 48 desk-mx8m-l-4.0.0_imx8mm_flash.bindrwxrwxr-x 3 rw-r--r-- 1 dvdk root 43034 Jul 24 08:50 desk-mx8m-l-4.0.0_imx8mm-mito8mmini-cb100a.dtb-rw-r--r-- 1 dvdk 4096 Feb 16 09root 43022 Jul 24 08:41 50 desk-mx8m-l-4.0.0_imx8mm-mito8mmini.dtb-rw-r--r-- 1 dvdk root 1433040 Jul 24 08:48 desk-mx8m-l-4.0.0_imx8mp_flash.bin-rw-r--r-- 1 dvdk root 60443 Jul 24 08:50 desk-mx8m-l-4.0.0_imx8mp-mito8mplus-cb1001.dtb-rw-r--r-- 1 dvdk 695 Feb 16 09root 62520 Jul 24 08:41 boot50 desk-mx8m-l-4.0.0_imx8mp-mito8mplus-cb1004.scrdtb-rw-r--r-- 1 dvdk dvdk 28150272 Feb 16 09root 61258 Jul 24 08:35 Image50 desk-mx8m-l-4.0.0_imx8mp-mito8mplus-cb1005.dtb-rw-r--r-- 1 dvdk dvdk root 40521 Feb 16 61299 Jul 24 08:50 desk-mx8m-l-4.0.0_imx8mp-mito8mplus-cb1008.dtblrwxrwxrwx 1 root root 49 Jul 24 09:42 Image -> /tftpboot/desk-mx8m-l/desk-mx8m-l-4.0.0_Imagelrwxrwxrwx 1 root root 60 Jul 24 09:42 imx8mm_flash.bin -> /tftpboot/desk-mx8m-l/desk-mx8m-l-4.0.0_imx8mm_flash.binlrwxrwxrwx 1 root root 72 Jul 24 09:35 42 imx8mm-mito8mmini-cb100a.dtb -> /tftpboot/desk-mx8m-l/desk-mx8m-l-4.0.0_imx8mm-mito8mmini-cb100a.dtblrwxrwxrwx 1 root root 60 Jul 24 09:42 imx8mp_flash.bin -> /tftpboot/desk-mx8m-l/desk-mx8m-l-4.0.0_imx8mp_flash.binlrwxrwxrwx 1 root root 72 Jul 24 09:42 imx8mp-mito8mplus-cb1008.dtb -> /tftpboot/desk-mx8m-l/desk-mx8m-l-4.0.0_imx8mp-mito8mplus-cb1008.dtb-rw-r--r-- 1 dvdk root 1152054 Jul 24 08:48 splash_image.bmpdvdk@vagrant:~/desk-mx-l/desk$ mkdir binariesdvdk 58111 Feb 16 09@vagrant:~/desk-mx-l/desk$ cp /tftpboot/desk-mx8m-l/Image binaries/dvdk@vagrant:35 ~/desk-mx-l/desk$ cp /tftpboot/desk-mx8m-l/imx8mp-mito8mplus-cb1008.dtbbinaries/dvdk@vagrant:~/desk-mx-l/sdcarddesk$ cp ~/desk-mx-l/boot.scr binaries/dvdk@vagrant:~/desk-mx-l/desk$ cp /tftpboot/desk-mx8m-l/imx8mp_flash.bin flash.bindvdk@vagrant:~/desk-mx-l/desk$
</pre>
You can now run the script, by passing the following parameters:
*Archive of the target's root file system (compressed as <code>.tar.bz2</code> file).
<pre class="workstation-terminal">
dvdk@vagrant:~/desk-mx-l/sdcarddesk$ cd ~/desk-mx-l/dvdk@vagrant:~/desk-mx-l$ sudo umount /dev/sdb*umount: /dev/sdb: not mounted.umount: /mksddev/sdb1: not mounted.dvdk@vagrant:~/desk-mx-l$ sudo ./desk-mx8m-l-4.0.0_mksd.sh /dev/sdb desk/flash.bin desk/binaries/ daverfs/desk-mx8m-l-4.0.0_desk-image-develqt6-desk-mx8mp.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, 30.03198 285905 s, 346 kB3.7 MB/sDISK SIZE - 15931539456 31914983424 bytes
Checking that no-one is using this disk right now ... OK
Disk /dev/sdb: 1429.9 74 GiB, 15931539456 31914983424 bytes, 31116288 62333952 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 0xcd2d3b4e0x688f6e07./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 621.9 7 GiB./dev/sdb3: Done. 
New situation:
Disklabel type: dos
Disk identifier: 0x688f6e07
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 32768 16777215 16744448 8G c W95 FAT32 (LBA)
/dev/sdb2 16777216 31116287 14339072 662333951 45556736 21.9G 7G 83 Linux
The partition table has been altered.
Syncing disks.
[Making filesystems...]
mkfs.fat 34.0.28 1 (20152017-0501-1624)mke2fs 1.4245.13 5 (1707-MayJan-20152020)Creating filesystem with 1792384 5694592 4k blocks and 448800 1425408 inodesFilesystem UUID: ce8daece393fccfd-3f5800af-4b43487c-bd11ae97-7bafd10bba73a255d18ab558
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[Copying files...]
'desk/binaries/boot.scr' -> '/mnt/boot.scr''desk/binaries/Imagedesk-mx8m-l-4.0.0-rc2_bootscript.txt' -> '/mnt/Imagedesk-mx8m-l-4.0.0-rc2_bootscript.txt''desk/binaries/imx8mm-mito8mmini.dtbImage' -> '/mnt/imx8mm-mito8mmini.dtbImage''desk/binaries/imx8mp-mito8mplus-cb1008.dtb' -> '/mnt/imx8mp-mito8mplus-cb1008.dtb'
[Extracting rfs (this may take a while...)]
[Programming flash.bin]
12741399+0 1 records in12741399+0 1 records out1304608 1433040 bytes (1.3 4 MB, 1.3 4 MiB) copied, 40.1375 30112 s, 344 kB4.8 MB/s
[Done]
dvdk@vagrant:~/desk-mx-l/sdcard$
</pre>
[1] In case you have a different size, you'll need to change the <code>sfdisk</code> parameters accordingly.
 
===boot.scr ===
 
Once you got the new binaries compiled from your modified sources, they have to be installed on the first SD partition preserving the original file names used into <i>boot.scr</i> u-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:
 
* for [[ORCA SOM | ORCA SOM]]
<pre>
echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n DESK-MX8M -d bootscript.txt boot.scr"'
 
setenv fdtfile imx8mp-mito8mplus-cb1008.dtb
setenv bootfile Image
setenv mmc_loadk 'fatload mmc ${sd_dev}:1 ${loadaddr} ${bootfile}'
setenv mmc_loadfdt 'fatload mmc ${sd_dev}:1 ${fdt_addr} ${fdtfile}'
setenv mmcboot 'run mmc_loadk; run mmc_loadfdt; run bootk'
setenv bootargs 'console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 root=/dev/mmcblk1p2'
setenv bootk 'booti ${loadaddr} - ${fdt_addr}'
 
echo Booting DESK-MX8M via mmcboot with ${fdtfile} as device tree
 
run mmcboot
 
echo mmcboot FAILURE
</pre>
 
* for [[MITO 8M Mini SOM | MITO 8M Mini SOM]]
<pre>
echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n DESK-MX8M -d bootscript.txt boot.scr"'
 
setenv fdtfile imx8mm-mito8mmini.dtb
setenv bootfile Image
setenv mmc_loadk 'fatload mmc ${sd_dev}:1 ${loadaddr} ${bootfile}'
setenv mmc_loadfdt 'fatload mmc ${sd_dev}:1 ${fdt_addr} ${fdtfile}'
setenv mmcboot 'run mmc_loadk; run mmc_loadfdt; run bootk'
setenv bootargs 'console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 root=/dev/mmcblk1p2'
setenv bootk 'booti ${loadaddr} - ${fdt_addr}'
 
echo Booting DESK-MX8M via mmcboot with ${fdtfile} as device tree
 
run mmcboot
 
echo mmcboot FAILURE
</pre>
 
and compile it using:
 
<pre>
mkimage -A ARM -T script -C none -n DESK-MX8M -d bootscript.txt boot.scr
</pre>
 
Then copy the ''boot.scr'' into the <code><binaries_dir></code> directories used by the script to create the SD card.
----
[[Category:ORCA]] [[Category:MITO 8M Mini]]
devwiki_user
120
edits