Open main menu

DAVE Developer's Wiki β

Changes

no edit summary
<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"|VersionIssue 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 DateNotes|-| 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" |{{oldid|14119|2021/07/16}}| 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" |{{oldid|16989|2022/03/04}}| 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" |DESK-MX6-L 3.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" |2023/04/27! 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:white#000000"|NotesDESK-MX6-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"|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"|First 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-MX6-L/General/Release_Notes|DESK-MX6-L Release Notes]] kit by using a simple bash script. <br>
'''Note:''' Starting from this '''DESK-MX6-L 1.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-MX6-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-MX6-L/General/Release_Notes#Downloadable_binary_images|DESKMX6DESK-MX6-L 14.0.0]].
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
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
if [[ "$DRIVE" == *"mmcblk"* ]]
then
echo "You're using a mmc device, I need to fix partition names" PART="p"
else
PART=""
fi
UBOOT=$2
if ! [ $ans == 'y' ]
then
exit
fi
if [ "$?" -eq "0" ]
then
{ echo 40,1380,0x0c,* echo 1420,,83,- } | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
else
{
mkfs.vfat -F 32 -n BOOT "$DRIVE$PART"1 #> /dev/null
mkfs.ext3 -F -L ROOTFS "$DRIVE$PART"2 #> /dev/null
 
# wait for the VM to recognize the uSD
sleep 60
echo "[Copying files...]"
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>desk<delivered with [[DESK-MX6-L/code> subdirectory of the working directoryGeneral/Release_Notes#Downloadable_binary_images|DESK-MX6-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>
* splash image: <code>splash_image.bmp</code>* Linux kernel: <code>uImagedesk-mx6-l-4.0.0_uImage</code>* Device tree blob: <code>desk-mx6-l-14.0.0_imx6dl-sbcx-cb0012.dtb</code>. In the case of you don't have some file on MVM, please download it from [https://mirror.dave.eu/desk-mx-l/ mirror.dave.eu].
This is the list of the We will copy them into <code>~/desk-mx-l/desk</code> directory. Needed binary files that will can be used by found on <code>MVM</code> in the scriptfollowing location:
<pre>
dvdk@vagrant:~/desk-mx-l$ ll /tftpboot/desk-mxmx6-l/total 1038811360drwxr-xr-x 2 dvdk root 4096 Jul Apr 1 143 17:53 57 ./drwxr-xr-x 3 dvdk root 4096 Apr 9 154 07:52 16 ../-rw-r--r-- 1 dvdk dvdk 1556 Jul 1 14:53 boot.scr-rw-r--r-- 1 dvdk root 52939 52247 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6dl-sbcx-cb0012.dtb-rw-r--r-- 1 dvdk root 53252 52560 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6dl-sbcx-cb0013.dtb-rw-r--r-- 1 dvdk root 52837 52161 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6dl-sbcx-cb0018.dtb-rw-r--r-- 1 dvdk root 53939 53231 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6dl-sbcx-cb0050.dtb-rw-r--r-- 1 dvdk root 53212 52536 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6dl-sbcx-cb0055.dtb-rw-r--r-- 1 dvdk root 49142 48736 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6dl-xelk-l.dtb-rw-r--r-- 1 dvdk root 53760 53524 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6q-sbcx-cb0012.dtb-rw-r--r-- 1 dvdk root 54069 53833 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6q-sbcx-cb0013.dtb-rw-r--r-- 1 dvdk root 50131 50177 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6q-xelk-l-2-0-0.dtb-rw-r--r-- 1 dvdk root 49959 50009 Apr 9 153 17:53 38 desk-mx6-l-14.0.0_imx6q-xelk-l.dtb-rw-r--r-- 1 dvdk root 56320 Apr 9 153 17:52 38 desk-mx6-l-4.0.0_mx6qdldesk_SPL-rw-r--r--1dvdk root 56320 Apr 3 17:38 desk-mx6-l-4.0.0_mx6qdldesk_nand_SPL-rw-r--r-- 1 dvdk root 570224 576288 Apr 9 153 17:52 38 desk-mx6-l-14.0.0_mx6qdldesk_nand_u-boot.img-rw-r--r-- 1 dvdk root 56320 Apr 9 153 17:52 38 desk-mx6-l-14.0.0_mx6qdldesk_spi_SPL-rw-r--r-- 1 dvdk root 569984 554004 Apr 9 153 17:52 38 desk-mx6-l-14.0.0_mx6qdldesk_spi_u-boot.img-rw-r--r-- 1 dvdk root 56320 576000 Apr 9 153 17:52 38 desk-mx6-l-14.0.0_mx6qdldesk_SPL0_mx6qdldesk_u-boot.img-rw-r--r-- 1 dvdk root 569864 8038640 Apr 9 153 17:52 38 desk-mx6-l-14.0.0_mx6qdldesk_u-boot.img0_uImage-rw-r--r-- 1 dvdk root 7031584 1152054 Apr 9 153 17:38 splash_image.bmpdvdk@vagrant:53 ~$ ll ~/desk-mx-l/desk-mx6-l-14.0.0_uImage0_boot.scr -rw-r-rw-r-- 1 dvdk root 1152054 dvdk 1556 Apr 9 153 17:57 /home/dvdk/desk-mx-l/desk-mx6-l-4.0.0_boot.scrdvdk@vagrant:~$ mkdir -p ~/desk-mx-l/desk/dvdk@vagrant:~$ cp /tftpboot/desk-mx6-l/desk-mx6-l-4.0.0_uImage ~/desk-mx-l/desk/desk-mx6-l-4.0.0_uImagedvdk@vagrant:52 ~$ cp /tftpboot/desk-mx6-l/desk-mx6-l-4.0.0_imx6dl-sbcx-cb0012.dtb ~/desk-mx-l/desk/desk-mx6-l-4.0.0_imx6dl-sbcx-cb0012.dtbdvdk@vagrant:~$ cp ~/desk-mx-l/desk-mx6-l-4.0.0_boot.scr ~/desk-mx-l/desk/boot.scrdvdk@vagrant:~$ cp /tftpboot/desk-mx6-l/splash_image.bmp~/desk-mx-l/desk/dvdk@vagrant:~$ cp ~/desk-mx-l/rfs/desk-mx6-l-4.0.0_modules.tar.gz ~/desk-mx-l$ /desk/
</pre>
You can now run the script, by passing the following parameters:
*Device file of the microSD card (<code>/dev/sdcsdb</code> 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 <code>.tar.bz2</code> file).
<pre>
dvdk@vagrant:~/desk-mx-l$ umount /dev/sdb*dvdk@vagrant:~/desk-mx-l$ sudo ./desk-mx6-l-14.0.0_mksd.sh /dev/sdb /tftpboot/desk-mxmx6-l/desk-mx6-l-14.0.0_mx6qdldesk_u-boot.img /tftpboot/desk-mxmx6-l/desk-mx6-l-14.0.0_mx6qdldesk_SPL /tftpboot~/desk-mx-l/ desk ./rfs/davedesk-image-develqt6-desk-mx6.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.0706 228364 s, 341 kB4.6 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 0x2c61a4d60xeba9791f./dev/sdb1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 8 GiB./dev/sdb2: Sector 16384000 is already allocated.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: 0xeba9791f
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.
Calling ioctl() to re-read partition table.
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...]
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 Jul 1 14:57:17 2021Creating filesystem with 1792384 5694592 4k blocks and 448800 1425408 inodesFilesystem UUID: 330007bc2b7edb0e-831cb75b-4c5d4685-b51e87b9-626bbac325da1933bfd0c8f0
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...]
'/tftpboothome/dvdk/desk-mx-l/desk/boot.scr' -> '/mnt/boot.scr''/tftpboothome/dvdk/desk-mx-l/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0012.dtb' -> '/mnt/desk-mx6-l-14.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''/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''/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_imx6dl-sbcx-cb0050.dtb' -> '/mnt/desk-mx6-l-14.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''home/tftpbootdvdk/desk-mx-l/desk-mx6-l-1.0.0_imx6q-xelk-l.dtb' -> '/mnt/desk-mx6-l-14.0.0_imx6q-xelk-l.dtb''/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_nand_SPL0_uImage' -> '/mnt/desk-mx6-l-14.0.0_mx6qdldesk_nand_SPL0_uImage''/tftpboot/desk-mx-l/desk-mx6-l-1.0.0_mx6qdldesk_nand_u-boot.img' -> '/mnthome/desk-mx6-l-1.0.0_mx6qdldesk_nand_u-boot.img''/tftpbootdvdk/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...)]
[Programming SPL]
110+0 records in
110+0 records out
56320 bytes (56 kB, 55 KiB) copied, 0.181772 0340295 s, 310 kB1.7 MB/s
[Programming u-boot.img]
556562+1 records in556562+1 records out569864 576000 bytes (570 576 kB, 557 562 KiB) copied, 20.31068 201931 s, 247 kB2.9 MB/s
[Done]
</pre>
<pre>
echo 'bootscript generated with command "mkimage -A ARM -T script -C none -n AXEL-Lite-DESK-SBCX MX6 -d bootscript.txt boot.scr"'
setenv desk_release 'desk-mx6-l-14.0.0'
if test 0x${cb_configid#} = 0x00000002;then if test ${cpu} = 6DL; then setenv fdtfile ${desk_release}_imx6dl-sbcx.dtb else setenv fdtfile ${desk_release}_imx6q-sbcx.dtb fielif test 0x${cb_configid#} = 0x00000003;then if test ${cpu} = 6DL; then setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0003.dtb else setenv fdtfile ${desk_release}_imx6q-sbcx-cb0003.dtb fielif test 0x${cb_configid#} = 0x00000012;
then
if test ${cpu} = 6DL; then
setenv fdtfile ${desk_release}_imx6q-sbcx-cb0013.dtb
fi
elif test 0x${cb_configid#} = 0xffffffff0x00000077;then if test ${cpu} = 6DL; then setenv fdtfile ${desk_release}_imx6dl-sbcx-cb0077.dtb else setenv fdtfile ${desk_release}_imx6q-sbcx-cb0077.dtb fielif test 0x${cb_configid#} = 0x00000001;
then
if test ${cpu} = 6DL; then
setenv fdtfile ${desk_release}_imx6dl-deskxelk-l-2.0.0.dtb
else
setenv fdtfile ${desk_release}_imx6q-deskxelk-l-2.0.0.dtb
fi
elif test 0x${cb_configid#} = 0xffffffff;
then
setenv fdtfile ${desk_release}_imx6q-xelk-l-2-0-0.dtb
else
echo Invalid CB! Autoreset ...
fi
setenv bootfile ${desk_release}_uImageuImage
setenv mmc_loadk 'fatload mmc ${mmcdev}:1 ${loadaddr} ${bootfile}'
setenv mmc_loadfdt 'fatload mmc ${mmcdev}:1 ${fdtaddr} ${fdtfile}'
echo Booting AxelLite-DESK-SBCX MX6 via mmcboot with ${fdtfile} as device tree
run mmcboot
Then copy the ''boot.scr'' into the <code><binaries_dir></code> directories used by the script to create the SD card.
 
===Install Module===
 
To install kernel modules, follow the steps below.
 
<pre>
root@desk-mx6:~# sudo mount /dev/mmcblk0p1 /media
root@desk-mx6:~# tar xvzf /media/desk-mx6-l-4.0.0_modules.tar.gz -C /
</pre>
 
After installation, run the following command to verify that the installation was successful:
 
<pre>
root@desk-mx6:~# ls -l /lib/modules/$(uname -r)
total 304
lrwxrwxrwx 1 541 502 63 Apr 3 2023 build -> /home/jenkins/workspace/workspace/DESK-MX6-L-4.x.x_Linux-kernel
drwxr-xr-x 6 541 502 4096 Apr 3 2023 kernel
-rw-r--r-- 1 541 502 2812 Apr 3 2023 modules.alias
-rw-r--r-- 1 541 502 4926 Apr 3 2023 modules.alias.bin
-rw-r--r-- 1 541 502 15368 Apr 3 2023 modules.builtin
-rw-r--r-- 1 541 502 35496 Apr 3 2023 modules.builtin.alias.bin
-rw-r--r-- 1 541 502 17986 Apr 3 2023 modules.builtin.bin
-rw-r--r-- 1 541 502 107589 Apr 3 2023 modules.builtin.modinfo
-rw-r--r-- 1 541 502 10767 Apr 3 2023 modules.dep
-rw-r--r-- 1 541 502 21773 Apr 3 2023 modules.dep.bin
-rw-r--r-- 1 541 502 0 Apr 3 2023 modules.devname
-rw-r--r-- 1 541 502 8733 Apr 3 2023 modules.order
-rw-r--r-- 1 541 502 85 Apr 3 2023 modules.softdep
-rw-r--r-- 1 541 502 16970 Apr 3 2023 modules.symbols
-rw-r--r-- 1 541 502 23964 Apr 3 2023 modules.symbols.bin
lrwxrwxrwx 1 541 502 63 Apr 3 2023 source -> /home/jenkins/workspace/workspace/DESK-MX6-L-4.x.x_Linux-kernel
</pre>
 
=== Attention !===
* <code>/home/dvdk/desk-mx-l/desk-mx6-l-14.0.0_boot.scr</code> has been generated using the images available at the moment of VM creation: please, use the previous indication ax as an example on how to create a '''proper''' bootscript for your own purposes* <code>/home/dvdk/desk-mx-l/desk-mx6-l-14.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]]
8,220
edits