Changes

Jump to: navigation, search

How to create a bootable microSD card (XUELK)

4,093 bytes added, 14:14, 15 March 2017
no edit summary
U-boot file <code>u-boot.imx</code> must be stored into first raw sector of the SD card using <code>dd</code> commandThe following script can be used This article shows how to create a bootable microSD cardfor the XUELK kit by using a simple bash script. Is The procedure has been tested on a Linux PC running Ubuntu 12 distribution with *a 16 GB microSD cards. In case you have a card [1]different size, you'll need to change *the binary files delivered along with the <code>sfdisk</code> parameters accordingly[[AXEL_ULite_and_SBC_Lynx_Embedded_Linux_Kit_(XUELK)#Downloadable_binary_images|XUELK 1.1.3]]. The resulting card is partitioned as depicted in the previous section[[AXEL_ULite_and_SBC_Lynx_Embedded_Linux_Kit_(XUELK)#XUELK_microSD_Layout|here]].
<pre>
The script - named <code>mksd.sh</code> - looks like this:
#!/bin/bash
</pre>
Here is an example that shows how to use this script . Let's assume that the binary files were downloaded in the <code>xuelk-1.1.3</code> subdirectory of the working directory. Before invoking the script, the following files has to be renamed in order to program a bootable make them compatible with the default U-Boot environment variables:*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>sysadmin@stagesw:~/devel/sbclynx/uSD$ ll xuelk-1.1.3/total 51436drwxrwxr-x 2 sysadmin sysadmin 4096 Mar 15 14:12 ./drwxrwxr-x 3 sysadmin sysadmin 4096 Mar 14 18:03 ../-rw-rw-r-- 1 sysadmin sysadmin 668 Mar 14 14:11 boot.scr-rw-rw-r-- 1 sysadmin sysadmin 31436 Mar 12 20:53 imx6ul-lynx.dtb-rw-rw-r-- 1 sysadmin sysadmin 6765480 Mar 12 20:54 uImage-rw-rw-r-- 1 sysadmin sysadmin 507948 Mar 12 21:03 xuelk-1.1.2_mx6ul_lynx_u-boot.imx-rw-rw-r-- 1 sysadmin sysadmin 45346549 Mar 15 12:19 xuelk-1.1.3_lynx-image-networking-sbc-lynx.tar.bz2</pre>You can now run the script, by passing the following parameters:*device file of the microSD card(<code>/dev/sdc</code> in the example)*U-Boot image*path of the directory containing the bootcript file, the Linux kernel image, and the device tree blob. 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]y[Partitioning /dev/sdc...]1024+0 records in1024+0 records out1048576 bytes (1.0 MB) copied, 3.65572 s, 287 kB/sDisk /dev/sdc doesn't contain a valid partition tableDISK SIZE - 15976103936 bytesChecking that no-one is using this disk right now ...OK Disk /dev/sdc: 1942 cylinders, 255 heads, 63 sectors/track sfdisk: ERROR: sector 0 does not have an msdos signature /dev/sdc: unrecognized partition table typeOld situation:No partitions foundNew situation:Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0  Device Boot Start End #cyls #blocks Id System/dev/sdc1 * 10 1389 1380 11084850 c W95 FAT32 (LBA)/dev/sdc2 1390 1941 552 4433940 83 Linux/dev/sdc3 0 - 0 0 0 Empty/dev/sdc4 0 - 0 0 0 EmptySuccessfully wrote the new partition table Re-reading the partition table ... If you created or changed a DOS partition, /dev/foo7, say, containing then use dd(1)to zero the binaries delivered along with first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1(See fdisk(8).)[Making filesystems...]mkfs.vfat 3.0.12 (29 Oct 2011)mke2fs 1.42 (29-Nov-2011)Filesystem label=ROOTFSOS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks277440 inodes, 1108485 blocks55424 blocks (5.00%) reserved for the XUELK super userFirst data block=0Maximum filesystem blocks=113665638434 block groups32768 blocks per group, 32768 fragments per group8160 inodes per groupSuperblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done  [Copying files...]`xuelk-1.1.3/boot.scr' -> `/mnt/boot.scr'`xuelk-1.1.3/imx6ul-lynx.dtb' -> `/mnt/imx6ul-lynx.dtb'`xuelk-1.1.3/uImage' -> `/mnt/uImage'`xuelk-1.1.3/xuelk-1.1.2_mx6ul_lynx_u-boot.imx' -> `/mnt/xuelk-1.1.2_mx6ul_lynx_u-boot.imx'`xuelk-1.1.3/xuelk-1.1.3_lynx-image-networking-sbc-lynx.tar.bz2' -> `/mnt/xuelk-1.1.3_lynx-image-networking-sbc-lynx.tar.bz2'[Extracting rfs (this may take a while...)][Programming u-boot.imx]496+1 records in496+1 records out507948 bytes (508 kB) copied, 2.20883 s, 230 kB/s[Done]     [1] In case you have a different size, you'll need to change the <code>sfdisk</code> parameters accordingly.
4,650
edits

Navigation menu