Open main menu

DAVE Developer's Wiki β

Changes

How to create a bootable microSD card (XUELK)

830 bytes added, 08:47, 11 March 2021
no edit summary
{{InfoBoxTop}}{{AppliesToAXELULite}}{{AppliesToSBCLynx}}{{InfoBoxBottom}}  {{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]].}}  This article shows how to create a bootable microSD card for the [[AXEL_ULite_and_SBC_Lynx_Embedded_Linux_Kit_(XUELK )|XUELK]] kit by using a simple bash script. The procedure has been tested on a Linux PC running Ubuntu LTS (>=12 .04) distribution with
*a 16 GB microSD card [1]
*the binary files delivered along with the [[AXEL_ULite_and_SBC_Lynx_Embedded_Linux_Kit_(XUELK)#Downloadable_binary_images|XUELK 1.1.3]].
The resulting card is partitioned as depicted [[AXEL_ULite_and_SBC_Lynx_Embedded_Linux_Kit_(XUELK)#XUELK_microSD_Layout|here]].
 
The script - named <code>mksd.sh</code> - looks like this:
<pre>
The script - named <code>mksd.sh</code> - looks like this:
#!/bin/bash
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 10,1380,0x0c,*
echo 1390,,83,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
else
{
echo 1010M,13804086M,0x0c,* echo 13904096M,,83,-} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVEsudo fi partprobe 
echo "[Making filesystems...]"
*bootscript: <code>boot.scr</code>
*Linux kernel: <code>uImage</code>
*Device tree blob: <code>imx6ul-lynx.dtb</code>.
This is the list of the binary files that will be used by the script:
<pre>
</pre>
You can now run the script, by passing the following parameters:
*device Device file of the microSD card (<code>/dev/sdc</code> in the example)
*U-Boot image
*path Path of the directory containing the bootcript bootscript file, the Linux kernel image, and the device tree blob*Archive of the target's root file system (compressed as <code>.tar.bz2</code> file).
<pre>sysadmin@stagesw:~/devel/sbclynx/uSD$ sudo ./mksd.sh /dev/sdc xuelk-1.1.3/xuelk-1.1.2_mx6ul_lynx_u-boot.imx xuelk-1.1.3 xuelk-1.1.3/xuelk-1.1.3_lynx-image-networking-sbc-lynx.tar.bz2
[sudo] password for sysadmin:
All data on /dev/sdc now will be destroyed! Continue? [y/n]
507948 bytes (508 kB) copied, 2.20883 s, 230 kB/s
[Done]
 </pre>
[1] In case you have a different size, you'll need to change the <code>sfdisk</code> parameters accordingly.
8,226
edits