In order to boot from sdcard card you will need three ingredients: u-boot, linux image with dtb for your device, and linux file system. This article will not cover how to obtain parts mentioned above, I just focus on a brief howto about deploying linux on SD card.
If you just want to update existing u-boot you should skip this step. If you are preparing a card which has some data and partitioning on it you’d better save the image of the card and then clean this card before writing u-boot with commands below.
# this command can take time if you sd card is large
sudo dd if=/dev/<your-sd-card> of=/sd_card_backup.img
# this command will delete partition table
sudo dd if=/dev/zero of=/dev/<your-sd-card> bs=1M count=1
sudo dd if=u-boot.imx of=/dev/<your-sd-card> bs=1k seek=1
Insert card into device, you should be able to see u-boot output in tty console with u-boot version and discription of your device. U-boot will give you an error about absence of partition table.
Before deploying the image we need to create filesystem on SD card. We need two partitions: first patition for the image should be formatted to vfat and second partition for the file system should be formatted to ext4.
sudo fdisk /dev/<your-card>
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xc401ca5b.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1–4, default 1):
First sector (2048–31116287, default 2048): +100M
Value out of range.
First sector (2048–31116287, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048–31116287, default 31116287): +100M
Created a new partition 1 of type ‘Linux’ and of size 100 MiB.
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): c
If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information.
Changed type of partition ‘Linux’ to ‘W95 FAT32 (LBA)’.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (2–4, default 2):
First sector (206848–31116287, default 206848):
Last sector, +sectors or +size{K,M,G,T,P} (206848–31116287, default 31116287):
Created a new partition 2 of type ‘Linux’ and of size 14.8 GiB.
Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): 83
Changed type of partition ‘Linux’ to ‘Linux’.
Command (m for help): w
The partition table has been altered.
sudo mkfs.vfat /dev/<your-card>1
mkfs.fat 3.0.27 (2014-11-12)
sudo mkfs.ext4 /dev/<your-card>2
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 3863680 4k blocks and 966656 inodes
Filesystem UUID: 6473c15f-094f-4972-b209-33f63a8e9a60
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
sudo mount /dev/<your-card>1 /mnt
sudo cp zImage /mnt/
sudo cp -r dtb/* /mnt/
ls /mnt
imx6qp-sabreauto.dtb imx6qp-sabreauto-ecspi.dtb imx6qp-sabreauto-flexcan1.dtb imx6qp-sabreauto-gpmi-weim.dtb zImage
If you copy file system image like shown below, your filesystem will be the size of the image and won't use all partition space.
sudo dd if=fsl-image-gui-imx6qsabresd.ext3 of=/dev/<your-card>2 bs=1M
If you want to use the whole patition for the file system, cope files manually.
mkdir ~/mnt
mkdir ~/mnt/target
mkdir ~/mnt/yocto
sudo mount /dev/<your-card>2 ~/mnt/target/
sudo mount -o loop tmp/deploy/images/imx6qpsabreauto/fsl-image-machine-test-imx6qpsabreauto.ext4 ~/mnt/yocto/
sudo cp -a ~/mnt/yocto/* ~/mnt/target
sudo umount ~/mnt/target
sudo umount ~/mnt/yocto
Now SD card is ready for boot!
References: