Prepare a bootable microSD card

You can prepare a bootable microSD card on a Linux or Windows host system. We recommend that you use Class 10 (or UHS-1) microSD cards.

Depending on your host OS, follow the steps in either the Prepare a bootable microSD card on a Linux host or Partition and format the microSD card on a Windows host section to prepare your microSD card. After you've prepared the card, you can copy the image to it so that you can boot the board.

CAUTION:
Ensure that your microSD card isn't write-protected.

When using a microSD card adapter or SD card, there's typically a lock switch on its side. If this switch is in the lock position, you can't modify or delete the contents of the card. Make sure that this switch is in the unlock position so that you can format and partition the card.

Prepare a bootable microSD card on a Linux host

The following is a quick, step-by-step method for formatting the microSD card from a terminal:
  1. Run the following command, once with the microSD card out of the reader on your host system:
    $ mount
    . . .
    

    Note the mounted devices listed. Now insert the card and run the same command a second time.

    $ mount
    . . .
    /dev/sda1

    When the command is run with the card inserted, an additional device should appear (for example, sda1 or mmcblk0p1; what you see may differ on your computer). This additional device is the target device.

    For the remainder of these instructions, we'll use sda1 for the device used. Substitute your own device that you noted when you ran the mount command for the second time.

  2. If the device is mounted, unmount it. For example:
    $ umount /dev/sda1

    After you run the command, your microSD card is now ready to be partitioned.

  3. Using administrator privileges, run the following commands, substituting your device for sda1, and responding to the prompts as indicated. For example:
    $ sudo fdisk /dev/sda
    Note:
    Since you are formatting the whole microSD card and not just a partition, you need to strip the identifier at the end of the mountpoint when you run the fdisk command. For example, for sda1, the identifier is 1 or for mmcblk0p1, the identifier is p1. For more information about the identifier, see the user guide for the variant of Linux that you're running.
  4. Remove the existing partitions. Keep typing the d command until no partitions are left. For example:
    Command (m for help): d    
    No partition is defined yet!
  5. Type u and then o to create an empty DOS partition table:
    ...
    
    Command (m for help): u
    Changing display/entry units to cylinders
    
    Command (m for help): o
     
    Building a new DOS disklabel with disk identifier 0xcdd1b702.
    Changes will remain in memory only, until you decide to write them.
    After that, of course, the previous content won't be recoverable.
    
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by write.
    
    WARNING: cylinders as display units are deprecated. Use command 'u' to change units to sectors.
  6. Type n followed by p to create a new primary partition. For example:
    Command (m for help): n
    
    Partition type:
    p   primary (0 primary, 0 extended, 4 free)
    e   extended
    Select (default p): p
  7. Type 1 to set the partition as the primary partition and specify the defaults for your card. For example, enter the specified defaults for start cylinder and end cylinder, which in this example are 1 and 240. Your defaults may be different depending on the size of your microSD card.
    Partition number (1-4, default 1): 1
    
    First cylinder (1-240, default 1): start cylinder
    
    Last cylinder, (100-240, default 240): end cylinder
        
    Using default value 240
  8. Type a to set the active partition. Generally, this should be partition 1.
    Command (m for help): a 
    Partition number (1-4): 1
  9. Type t and then c to set the partition type (1 is default).
    Command (m for help): t
    Selected partition 1
        
    Hex code (type L to list codes): c
    Changed system type of partition 1 to c (W95 FAT32 (LBA))
  10. Type w to write the changes.
    Command (m for help): w
        
    The partition table has been altered!
        
    Calling ioctl() to re-read partition table.
    Syncing disks.
  11. Format the microSD card. Note that the identifier, such as 1 or p1 at the end of the mountpoint must be included:
    $ sudo mkfs.vfat /dev/sda1
    mkfs.msdos 3.0.12 (16 Jan 2017)

Partition and format the microSD card on a Windows host

The default Windows formatting tool that appears when you insert a blank (or unrecognized) microSD card into a Windows host isn't sufficient to format the microSD card with a bootable partition. In addition, some microSD cards come with pre-created partitions that aren't suitable to boot the board. Instead, use the diskpart command-line tool to format your microSD card.

  1. Start a Command Prompt window (e.g., on Windows 10, run Start Menu > All Programs > Accessories > Command Prompt). Ensure that you start the Command Prompt window using Administrator privileges.
  2. Run the diskpart utility from your Command Prompt window:
    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.
    
    C:\windows\system32>diskpart
    
    Microsoft DiskPart version 6.3.9600
    
    Copyright (C) 1999-2013 Microsoft Corporation.
    On computer: CI0700000001064
    
    DISKPART>
  3. Run the list disk command to get a list of available drives, then identify your microSD card on this list (in this example, Disk 3):
    DISKPART> list disk
                        
    Disk ###     Status       Size       Free      Gyn      Gpt
    --------     ------       ----       ----      ---      ---
    Disk 0       Online       40 GB      20 GB   
    Disk 1       No Media      0  B       0  B
    Disk 2       No Media      0  B       0  B
    Disk 3       Online       14 GB       0  B
    
  4. Run the select disk command to perform operations on the microSD card:
    DISKPART > select disk 3
    
    Disk 3 is now the selected disk.
    
    DISKPART >
    
  5. Run the clean command to erase any existing partitions:
    DISKPART> clean
    
    DiskPart succeeded in cleaning the disk.
    
    DISKPART>
    
  6. Create a 256 MB partition with a 1024 byte offset, by running the following command:
    DISKPART> create partition primary size=256 offset=1024
    
    DiskPart succeeded in creating the specified partition.
    
    DISKPART>
    
    Note:
    You can choose a larger size for the partition. The offset you use may vary based on the hardware platform. For more information regarding the offset to use, see the documentation for your hardware platform.
  7. Run the list partition command, to see the partition you created:
    DISKPART> list partition
    
      Partition ###  Type              Size     Offset
      -------------  ----------------  -------  -------
    * Partition 1    Primary            256 MB  1024 KB
    
  8. Run the select partition command to perform operations on the partition that you created in the previous step:
    DISKPART> select partition 1
    
    Partition 1 is now the selected partition.
    
    DISKPART>
    
  9. Run the active command to make the partition active:
    DISKPART> active
    
    DiskPart marked the current partition as active.
    
  10. Run the format command to format the partition:
    DISKPART> format fs=fat32 label="CMD" QUICK
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DISKPART>
    
  11. Run the list partition command to verify that the partition is active and that you have the correct partition size and offset:
    DISKPART> list partition
    
      Partition ###  Type              Size     Offset
      -------------  ----------------  -------  -------
    * Partition 1    Primary            256 MB  1024 KB
    
    DISKPART>
    

    The * (asterisk) beside the partition name indicates that the partition is active. You can now copy U-Boot file and QNX IFS file to the partition.

  12. Exit the diskpart utility:
    DISKPART> exit
    
    Leaving DiskPart...
    
    C:\windows\system32>
    
Page updated: