Using an SSD via mPCIe on our i.MX8 Nitrogen boards
Published on May 6, 2020
We would like to share some basic instructions for using an SSD via the mPCIe interface on one of our i.MX8 based Nitrogen boards. This has been tested on our Nitrogen8M and Nitrogen8M MINI SBCs.
We officially support the U-SNS8154P3/256GJ Kingston SSD so our testing was done using this. In addition to the SSD, you will need this daughter board in order to connect the SSD to the mPCIe connector on the i.MX8 board.
The connection will look like this:
Now, you can boot up any of our OS images and use the SSD. In this example we will be using our Yocto Zeus image for Nitrogen8M.
First, verify the hardware connection is good by executing "lspci" on the console and verify you can see the Kingston SSD:
root@nitrogen8m:~# lspci
00:00.0 PCI bridge: Synopsys, Inc. DWC_usb3 (rev 01)
01:00.0 Non-Volatile memory controller: Kingston Technology Company, Inc. Device 5008 (rev 01)
Next, determine the disk name by executing "fdisk -l". In this case, the kingston is "/dev/nvme0n1p1"
root@nitrogen8m:~# fdisk -l
Disk /dev/mmcblk0: 7296 MB, 7650410496 bytes, 14942208 sectors
233472 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 * 0,0,9 609,0,22 8 77973 77966 38.0M c Win95 FAT32 (LBA)
/dev/mmcblk0p2 609,0,25 1023,3,32 77976 4839759 4761784 2325M 83 Linux
Disk /dev/sda: 3796 MB, 3980394496 bytes, 7774208 sectors
1019 cylinders, 123 heads, 62 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sda1 * 0,0,9 640,0,10 8 81929 81922 40.0M c Win95 FAT32 (LBA)
Partition 1 has different physical/logical end:
phys=(640,0,10) logical=(10,91,28)
/dev/sda2 640,0,17 1023,3,32 81936 1244617 1162682 567M 83 Linux
Partition 2 has different physical/logical start (non-Linux?):
phys=(640,0,17) logical=(10,91,35)
Partition 2 has different physical/logical end:
phys=(1023,3,32) logical=(163,25,30)
Disk /dev/nvme0n1: 238 GB, 256060514304 bytes, 500118192 sectors
1420790 cylinders, 22 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/nvme0n1p1 1,0,1 486,21,16 2048 500118191 500116144 238G 83 Linux
Then, create an ext4 filesystem (or any fs format of your choice) on the SSD.
root@nitrogen8m:~# mkfs.ext4 /dev/nvme0n1
Discarding device blocks: done
Creating filesystem with 62514774 4k blocks and 15630336 inodes
Filesystem UUID: 4d1aecb1-1c1b-4ba9-b7e8- 5092d1588b96
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
Now we can mount the SSD and start using it. Lets create a simple file for a sanity test.
root@nitrogen8m:~# mkdir /tmp/kingston_ssd
root@nitrogen8m:~# mount /dev/nvme0n1 /tmp/kingston_ssd/
[ 296.092862] EXT4-fs (nvme0n1): mounted filesystem with ordered data mode. Opts: (null)
root@nitrogen8m:~# cd /tmp/kingston_ssd/
root@nitrogen8m:/tmp/kingston_ssd# ls
lost+found
root@nitrogen8m:/tmp/kingston_ssd# echo This is a test! > test.txt
root@nitrogen8m:/tmp/kingston_ssd# cd
root@nitrogen8m:~# umount /tmp/kingston_ssd/
Now reboot and verify the file is in tact.
root@nitrogen8m:~# mkdir /tmp/kingston_ssd
root@nitrogen8m:~# mount /dev/nvme0n1 /tmp/kingston_ssd/
[ 68.319706] EXT4-fs (nvme0n1): mounted filesystem with ordered data mode. Opts: (null)
root@nitrogen8m:~# cd /tmp/kingston_ssd/
root@nitrogen8m:/tmp/kingston_ssd# cat test.txt
This is a test!
There you have it! You are now up and running with an SSD on our one of our i.MX8 based Nitrogen boards.
If you have any issues, please email support@boundarydevices.com