====== Create Bootable TF Card ======
What is a bootable TF card?
* A bootable TF card is an TF card that has a bootloader installed on it.
* A bootable TF card is also known as a boot disk, which your SBC can boot-up from.
Why do we need a bootable TF card?
* You can release your custom ROM as a bootable TF card, in order to speed up the testing and development process.
* You can use a bootable TF card to do system/file recovery, in the event that your SBC is unable to boot from the eMMC.
The process for VIM1, VIM2, VIM3, VIM3L, VIM1S, VIM4 and VIM 5 are similar, so we will use VIM1 as an example.
===== Download boot images =====
Download U-Boot for ([[dl>products/vim1/firmware/|VIM1]]/[[dl>products/vim2/firmware/|VIM2]]/[[dl>products/vim3/firmware/|VIM3]]/[[dl>products/vim3l/firmware/|VIM3L]]/[[dl>products/vim1s/firmware/|VIM1S]]/[[dl>products/vim4/firmware/|VIM4]]/[[dl>products/vim-5/firmware/|VIM-5]]), or get the correct bootloader blob for your TF card and manually build U-Boot. Regardless of which method you choose, you need to remember that there are different bootloader blobs for different boot disks/media.
* ''u-boot.bin.sd.bin'' is for TF cards
* ''u-boot.bin'' is for eMMC storage
* ''u-boot.bin.sd.bin.signed'' is for TF cards
* ''u-boot.bin.signed'' is for eMMC storage
===== Linux command line usage examples =====
Insert the TF card into your PC, and unmount it:
```shell
$ sudo umount /dev/sdX1
```
Format the TF card as FAT32:
```shell
$ sudo mkfs.vfat /dev/sdX1
```
Run ''dd'' to write the U-Boot blob into the first sector of TF card:
```shell
$ sudo dd if=u-boot.bin.sd.bin of=/dev/sdX conv=fsync,notrunc bs=1 count=444
$ sudo dd if=u-boot.bin.sd.bin of=/dev/sdX conv=fsync,notrunc bs=512 skip=1 seek=1
```
```shell
$ sudo dd if=u-boot.bin.sd.bin.signed of=/dev/sdX conv=fsync,notrunc bs=1 count=444
$ sudo dd if=u-boot.bin.sd.bin.signed of=/dev/sdX conv=fsync,notrunc bs=512 skip=1 seek=1
```
Eject the TF card from your PC:
```shell
$ sudo eject /dev/sdX
```
Replace ''sdX'' with the correct device node on your PC.
===== Bootable TF Card logs =====
You need to [[products:sbc:common:development:setup-serial-tool|Setup Serial Debug Tool]] fisrt, then insert the Bootable TF card into your SBC and power on. \\
If your SBC has successfully booted from the TF card, you should get this Terminal print-out:
```txt
GXL:BL1:9ac50e:a1974b;FEAT:ADFC318C;POC:3;RCY:0;EMMC:0;READ:0;CHK:AA;SD:0;READ:0;0.0;CHK:0;
no sdio debug board detected
TE: 194208
BL2 Built : 13:48:56, Sep 23 2016.
gxl g7459bd4 - jianxin.pan@droid06
set vcck to 1120 mv
set vddee to 1000 mv
Board ID = 6
CPU clk: 1200MHz
DQS-corr enabled
DDR scramble enabled
DDR3 chl: Rank0+1 @ 792MHz - PASS
Rank0: 1024MB(auto)-2T-11
Rank1: 1024MB(auto)-2T-11
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x00004000
New fip structure!
Load bl30 from SD, src: 0x00010200, des: 0x01100000, size: 0x0000d600
Load bl31 from SD, src: 0x00020200, des: 0x10100000, size: 0x00015400
Load bl33 from SD, src: 0x00038200, des: 0x01000000, size: 0x000a3400
NOTICE: BL3-1: v1.0(debug):2e39a99
...
```
In rare cases, you may need to erase eMMC in order to boot from an TF card.