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"|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{{oldid|14312|2021/07/20}}| 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-MX6UL-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:#edf8fb; padding:5px; color:#000000" |{{oldid|16327|2022/03/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" |DESK-MX6UL-L 3.0.10 release|-! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fbededed; padding:5px; color:#000000"|Jun 20212023/05/05|! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fbededed; padding:5px; color:#000000"|First DESK -MX6UL-L 4.0.0 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-MX6UL-L 4.0.04 distribution 1''' release with *a 16 32 GB microSD card [1]*a USB SD card reader*the binary files delivered along with the [[AXEL_ULite_SOM/DESK-MX6UL-L/General/Release_Notes#Downloadable_binary_imagesDownloadable_binary_images_3|DESK-MX6UL-L 14.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
The script - named <code>mksd.sh</code> - can be realized with the following code:
<pre>
#!/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!" exitfi
if ! [[ -e $2 ]]
then echo "Incorrect u-boot.img location!" exit fi if ! [[ -e $3 ]] then echo "Incorrect SPL location!" exit
fi
 if ! [[ -e $3 ]]then echo "Incorrect SPL location!" exitfi
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
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...]"
</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_3|DESK-MX6UL-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>desk-mx6ul-l-4.0.0_uImage</code>
* Device tree blob: <code>desk-mx6ul-l-4.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 In the <code>desk</code> subdirectory case of the working directory. Before invoking the scriptyou don't have some file on MVM, the following files has to be renamed in order to make them compatible with the default U-Boot environment variablesplease download it from [https:* bootscript: <code>boot//mirror.dave.scr<eu/code>desk-mx-l mirro.dave.eu].  * Linux kernel: We will copy them into <code>uImage<~/code>* Device tree blob: <code>imx6uldesk-lynxmx-som0013-cb002f.dtbl/desk</code> (or <code>imx6ul-axelulite-cb003adirectory.dtb</code> or Needed binary files can be found on <code>imx6ul-axelulite-cb006c.dtbMVM</code>)in the following location:
This is the list of the binary files that will be used by the script:
<pre>
dvdk@vagrant:~/desk-mx-l$ ll /tftpboot/desk-mxmx6ul-l/total 10916drwxr-xr-x 2 dvdk root 4096 Jul 1 11:42 ./drwxr-xr-x 3 dvdk root 4096 Jun 24 10:01 ../11352-rw-r--r-- 1 dvdk root 34095 Jun 24 1032964 Mar 31 11:03 01 desk-mx6ul-l-14.0.1_imx6ul0-imx6ul-axelulite-cb003a.dtb-rw-r--r-- 1 dvdk root 33137 Jun 24 1032002 Mar 31 11:03 01 desk-mx6ul-l-14.0.1_imx6ul0-imx6ul-axelulite-cb006c.dtb-rw-r--r-- 1 dvdk root 34211 Jun 24 1033028 Mar 31 11:03 01 desk-mx6ul-l-14.0.1_imx6ul0-imx6ul-lynx-som0013-cb002f.dtb-rw-r--r-- 1 dvdk root 56320 Jun 24 108017976 Mar 31 11:01 desk-mx6ul-l-14.0.1_mx6uldesk_axelulite_spi_SPL0-uImage-rw-r--r-- 1 dvdk root 547528 Jun 24 35840 Mar 31 10:01 59 desk-mx6ul-l-14.0.1_mx6uldesk_axelulite_spi_u0-boot.imgmx6uldesk_axelulite_SPL-rw-r--r-- 1 dvdk root 56320 Jun 24 48128 Mar 31 10:01 59 desk-mx6ul-l-14.0.1_mx6uldesk_axelulite_SPL0-mx6uldesk_axelulite_spi_SPL-rw-r--r-- 1 dvdk root 547200 Jun 24 10552184 Mar 31 11:01 00 desk-mx6ul-l-14.0.1_mx6uldesk_axelulite_u0-mx6uldesk_axelulite_spi_u-boot.img-rw-r--r-- 1 dvdk root 56320 Jun 24 551704 Mar 31 10:01 59 desk-mx6ul-l-14.0.0-mx6uldesk_axelulite_u-boot.1_mx6uldesk_lynx_spi_SPLimg-rw-r--r-- 1 dvdk root 512568 Jun 24 35840 Mar 31 10:01 59 desk-mx6ul-l-14.0.1_mx6uldesk_lynx_spi_u0-boot.imgmx6uldesk_lynx_SPL-rw-r--r-- 1 dvdk root 56320 Jun 24 48128 Mar 31 10:01 59 desk-mx6ul-l-14.0.1_mx6uldesk_lynx_SPL0-mx6uldesk_lynx_spi_SPL-rw-r--r-- 1 dvdk root 512216 Jun 24 517248 Mar 31 10:01 59 desk-mx6ul-l-14.0.1_mx6uldesk_lynx_u0-mx6uldesk_lynx_spi_u-boot.img-rw-r--r-- 1 dvdk root 52224 Jun 24 516776 Mar 31 10:01 59 desk-mx6ul-l-14.0.1_mx6uldesk_lynx_usb_SPL0-mx6uldesk_lynx_u-boot.img-rw-r--r-- 1 dvdk root 431512 Jun 24 1152054 Mar 31 10:01 59 splash_image.bmpdvdk@vagrant:~$ mkdir -p ~/desk-mx-l/deskdvdk@vagrant:~$ cp /tftpboot/desk-mx6ul-l/desk-mx6ul-l-14.0.1_mx6uldesk_lynx_usb_u0_uImage ~/desk-boot.imgmx-rwl/desk/desk-rmx6ul-l-r4.0.0_uImagedvdk@vagrant:~$ cp /tftpboot/desk-mx6ul- 1 dvdk root 7056696 Jun 24 10:03 l/desk-mx6ul-l-14.0.1_uImage0_imx6ul-axelulite-cb003a.dtb ~/desk-mx-rwl/desk/desk-rmx6ul-l-r4.0.0_imx6ul-axelulite- 1 cb003a.dtbdvdk root 1152054 Jun 24 10@vagrant:01 ~$ cp /tftpboot/desk-mx6ul-l/splash_image.bmp~/desk-mx-l/desk/dvdk@vagrant:~$ cp ~/desk-mx-l/boot.scr ~/desk-mx-l/desk/boot.scrdvdk@vagrant:~$ cp ~/desk-mx-l/rfs/desk-mx6ul-l-4.0.0_modules.tar.gz ~/desk-mx-l/desk/
</pre>
*Archive of the target's root file system (compressed as <code>.tar.bz2</code> file).
<pre>
dvdk@vagrant:~/desk-mx-l$ sudo umount /dev/sdb*dvdk@vagrant:~/desk-mx-l$ sudo ./mksddesk-mx6ul-l-4.0.1_mksd.sh /dev/sdb /tftpboot/desk-mxmx6ul-l/desk-mx6ul-l-14.0.1_mx6uldesk_axelulite_u0_mx6uldesk_axelulite_u-boot.img /tftpboot/desk-mxmx6ul-l/desk-mx6ul-l-14.0.1_mx6uldesk_axelulite_SPL /tftpboot0_mx6uldesk_axelulite_SPL ~/desk-mx-l/ desk ./rfs/desk-mx6ul-l-14.0.1_dave-image-devel-desk-mx6ul.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, 30.14558 262305 s, 333 kB4.0 MB/sDISK SIZE - 15931539456 31002198016 bytes
Checking that no-one is using this disk right now ... OK
Disk /dev/sdb: 1428.9 89 GiB, 15931539456 31002198016 bytes, 31116288 60551168 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 0x81b8796c0x937180d6./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 620.9 GiB./dev/sdb3: Done. 
New situation:
Disklabel type: dos
Disk identifier: 0x937180d6
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 32768 16777215 16744448 8G c W95 FAT32 (LBA)
/dev/sdb2 16777216 31116287 14339072 660551167 43773952 20.9G 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)
/dev/sdb2 contains a ext3 file system labelled 'ROOTFS'
last mounted created on /mnt on Thu Sep 17 16Mon Apr 3 10:2719:41 202052 2023Creating filesystem with 1792384 5471744 4k blocks and 448800 1368064 inodesFilesystem UUID: 97e6964ba0208180-f60c9d1c-4f1f47e8-b5e9a8e0-33569c976f4bc92a63a7059aSuperblock 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-mx6ul-l-1.0.1_imx6ul-axelulite-cb003a.dtb' -> '/mnt/desk-mx6ul-l-14.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-14.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-14.0.1_mx6uldesk_lynx_usb_SPL0_uImage' -> '/mnt/desk-mx6ul-l-14.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]
11070+0 records in11070+0 records out56320 35840 bytes (56 36 kB, 55 35 KiB) copied, 0.263141 0120358 s, 214 kB3.0 MB/s
[Programming u-boot.img]
534538+1 records in534538+1 records out547200 551704 bytes (547 552 kB, 534 539 KiB) copied, 20.26831 164175 s, 241 kB3.4 MB/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-14.0.10'
if test 0x${som_configid#} = 0x00000013 && test 0x${cb_configid#} = 0x0000002f;
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-mx6ul-axelulite:~# sudo mount /dev/mmcblk0p1 /media
root@desk-mx6ul-axelulite:~# tar xvzf /media/desk-mx6ul-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-mx6ul-axelulite:~# ls -l /lib/modules/$(uname -r)
total 300
lrwxrwxrwx 1 541 502 65 Apr 3 2023 build -> /home/jenkins/workspace/workspace/DESK-MX6UL-L-4.x.x_Linux-kernel
drwxr-xr-x 6 541 502 4096 Apr 3 2023 kernel
-rw-r--r-- 1 541 502 2718 Apr 3 2023 modules.alias
-rw-r--r-- 1 541 502 4768 Apr 3 2023 modules.alias.bin
-rw-r--r-- 1 541 502 14878 Apr 3 2023 modules.builtin
-rw-r--r-- 1 541 502 34704 Apr 3 2023 modules.builtin.alias.bin
-rw-r--r-- 1 541 502 17778 Apr 3 2023 modules.builtin.bin
-rw-r--r-- 1 541 502 105373 Apr 3 2023 modules.builtin.modinfo
-rw-r--r-- 1 541 502 10689 Apr 3 2023 modules.dep
-rw-r--r-- 1 541 502 21666 Apr 3 2023 modules.dep.bin
-rw-r--r-- 1 541 502 0 Apr 3 2023 modules.devname
-rw-r--r-- 1 541 502 8657 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 65 Apr 3 2023 source -> /home/jenkins/workspace/workspace/DESK-MX6UL-L-4.x.x_Linux-kernel
</pre>
----
[[Category:AXEL ULite]]
8,226
edits