Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEA] support for flashing NVMe SSD disk #3

Open
fboudra opened this issue Oct 15, 2024 · 5 comments
Open

[FEA] support for flashing NVMe SSD disk #3

fboudra opened this issue Oct 15, 2024 · 5 comments

Comments

@fboudra
Copy link

fboudra commented Oct 15, 2024

Hi,

I'm not sure if it's the right place to ask for feature request, feel free to redirect me in the right direction if needed.

Using the Toradex i.MX 8M Plus and contributed support for PCIe/NVME on U-Boot:
https://source.denx.de/u-boot/u-boot/-/commit/950e74f60fd6b03bea45a5cb2e8516f44b6342a9

We can use an SSD to store and boot the OS successfuly.

Ideally, we can use a tezi image and TEZI to flash the OS directly on NVMe. As of today, only eMMC is supported with TEZI.

@rbeims
Copy link

rbeims commented Oct 15, 2024

Hello @fboudra, in theory, TEZI should be able to write data to any block device that's present in the system. You can define the needed devices and partition table using the blockdevs variable in image.json. Here's the documentation of the variables that are available in image.json:
https://developer.toradex.com/easy-installer/5.0/toradex-easy-installer/toradex-easy-installer-configuration-files

Said that, I'm not sure the kernel we distribute with the standard TEZI will properly detect the NVME disk. I assume it will, but there's a possibility that there's some configuration missing.
Would you be able to boot the module into recovery with the serial port connected and check if the NVME device is available?

@fboudra
Copy link
Author

fboudra commented Oct 15, 2024

@rbeims Thanks for the pointers. I checked with tezi 6.8.0+build.8 and I can confirm its kernel doesn't have NVMe enabled (dmesg and zcat /proc/config.gz).

@fboudra
Copy link
Author

fboudra commented Oct 15, 2024

@rbeims I sent a patch for the scarthgap branch to enable PCIe/NVMe support as described in the README.

I still need to figure out a proper configuration to write a Torizon OS 7.0 using blockdevs variable.

@rbeims
Copy link

rbeims commented Oct 16, 2024

Thank you for the patch, we will review it internally.

fboudra added a commit to fboudra/meta-toradex-tezi that referenced this issue Oct 17, 2024
Add kernel configuration for linux 6.x serie to enable PCIe/NVMe support.
The i.MX8MP interconnect driver has been introduced in linux 6.0.

It's required in order to flash Torizon OS on NVMe SSD. See the feature request
on toradex#3

Tested on Toradex Verdin i.MX 8M Plus SoM.

[    0.744749] nvme nvme0: pci function 0000:01:00.0
[    0.744766] nvme 0000:01:00.0: enabling device (0000 -> 0002)
[    0.747602] nvme nvme0: Shutdown timeout set to 10 seconds
[    0.749410] nvme nvme0: 1/0/0 default/read/poll queues
[    0.753817]  nvme0n1: p1

Suggested-by: Rafael Beims <[email protected]>
Signed-off-by: Fathi Boudra <[email protected]>
@fboudra
Copy link
Author

fboudra commented Oct 20, 2024

@rbeims it looks like the kernel enablement isn't the only issue. While it looks like I'm using NVMe, the otaroot isn't correct:

/dev/disk/by-label/otaroot  29899644 1075416  27280036   4% /sysroot
/dev/nvme0n1p1             960302096 1075768 910371904   1% /var/rootdirs/media/otaroot

/dev/disk/by-label/otaroot -> /dev/mmcblk2p1

I suspect there's something that needs to be fixed with udev to propely populate /dev/disk/by-label and is most likely hardcoded or coupled somehow with mmcblk.

You need NVMe driver built-in in the kernel because the kernel modules aren't automatically loaded in the initramfs, hence udev doesn't create the disk/by-label symlink for NVMe.

SamBissig pushed a commit that referenced this issue Oct 21, 2024
The PCI is enabled at linux-toradex-kconfig/cfg/base/base.cfg file. Do
not disable it here, which will make the following kconfigs to be
enabled as consequence:

CONFIG_NVME_CORE=m
CONFIG_BLK_DEV_NVME=m
CONFIG_PHY_FSL_IMX8M_PCIE=m
CONFIG_INTERCONNECT_IMX=y
CONFIG_INTERCONNECT_IMX8MP=m

These kconfigs are required in order to flash Torizon OS on NVMe SSD. See
the feature request at [1]

[1] #3

Suggested-by: Rafael Beims <[email protected]>
Suggested-by: Fathi Boudra <[email protected]>
Signed-off-by: Hiago De Franco <[email protected]>
SamBissig pushed a commit that referenced this issue Oct 21, 2024
The PCI is enabled at linux-toradex-kconfig/cfg/base/base.cfg file. Do
not disable it here, which will make the following kconfigs to be
enabled as consequence:

CONFIG_NVME_CORE=m
CONFIG_BLK_DEV_NVME=m
CONFIG_PHY_FSL_IMX8M_PCIE=m
CONFIG_INTERCONNECT_IMX=y
CONFIG_INTERCONNECT_IMX8MP=m

These kconfigs are required in order to flash Torizon OS on NVMe SSD. See
the feature request at [1]

[1] #3

Suggested-by: Rafael Beims <[email protected]>
Suggested-by: Fathi Boudra <[email protected]>
Signed-off-by: Hiago De Franco <[email protected]>
(cherry picked from commit 924ed6c)
fboudra added a commit to fboudra/meta-toradex-tezi that referenced this issue Oct 22, 2024
Add kernel configuration for linux 6.x serie to enable PCIe/NVMe support.
The i.MX8MP interconnect driver has been introduced in linux 6.0.

It's required in order to flash Torizon OS on NVMe SSD. See the feature request
on toradex#3

Tested on Toradex Verdin i.MX 8M Plus SoM.

[    0.744749] nvme nvme0: pci function 0000:01:00.0
[    0.744766] nvme 0000:01:00.0: enabling device (0000 -> 0002)
[    0.747602] nvme nvme0: Shutdown timeout set to 10 seconds
[    0.749410] nvme nvme0: 1/0/0 default/read/poll queues
[    0.753817]  nvme0n1: p1

Suggested-by: Rafael Beims <[email protected]>
Signed-off-by: Fathi Boudra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants