Prepare a bootable SD

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

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

CAUTION:
Ensure that your SD 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 SD on a Linux host

The following is a quick, step-by-step method for formatting the SD from a terminal:
  1. Run the following command, once with the SD 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 SD 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 SD and not just a partition, you may 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 identifer 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 SD .
    Note:
    Ensure that you leave at least 1M parition for the QNX IPL.
    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 SD . 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 October 2018)

Partition and format an SD on a Windows host

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

  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 SD on this list (in this example, Disk 1):
    DISKPART> list disk
    
    Disk ###     Status       Size       Free      Gyn      Gpt
    --------     ------       ----       ----      ---      ---
    Disk 0       Online       465 GB     1024 KB
    Disk 1       Online      7580 MB      4401 MB
    
    DISKPART>   
    When the command is run with the card inserted, an additional disk should appear (in this case Disk 1). This additona is the target device. For the steps that follow, we'll be using Disk 1. Ensure you use the disk that matches your SD .
  4. Run the select disk command to perform operations on the SD :
    DISKPART > select disk 1
    
    Disk 1 is now the selected disk.
    
    DISKPART >
    
  5. Show the partitions on your disk on the SD. In this case, there are two partitions:
    DISKPART> list part
    Partition ### Type Size Offset
    ------------- ---------------- ------- -------
    Partition 1 Primary 512 MB 1024 KB
    Partition 0 Primary 2048 MB 1125 MB
    
    DISKPART>_
    
    
                    
  6. Delete all available partitions on the SD:
    DISKPART> select part 1
    
    Partition 1 is now the selected partition.
    
    DISKPART> delete part
    
    DiskPart successfully deleted the selected partition.
    
    DISKPART> list part
    
    There are no partitions on this disk to show.
    
    DISKPART>_
    
  7. Create a partition with a 1 Mb offset, by running the following command:
    DISKPART> create partition primary 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.
  8. 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
    
  9. 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>
    
  10. Run the active command to make the partition active:
    DISKPART> active
    
    DiskPart marked the current partition as active.
    
  11. Run the format command to format the partition:
    DISKPART> format fs=fat32 quick
    
      100 percent completed
    
    DiskPart successfully formatted the volume.
    
    DISKPART>
    
    Warning:
    Ensure you specify that drive where SD is located. If you incorrectly specify the wrong disk, it could result in data loss.
  12. 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 the QNX IPL or U-Boot file and IFS file to the partition.

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