Manjaro ARM for the VIM3

@Spikerguy Hello , I have tested PCIE, it works normally, M2X is just a hardware connection, there is no related patch

Neither AML mainline uboot, nor Krescue
SPI uboot by Hyphop can detect and load anything from NVME M.2 SSD.

some correct info

  1. mainline uboot for amlogic still not support nvme
  2. linux kernel support OK
  3. krescue use same mainline linux kernel and same can use nvme without problem

PS: in any case its not problem - just make boot partition with kernel to emmc
and next rootfs and other partition can load from nvme

Hello hyphop

just make boot partition with kernel to emmc
and next rootfs and other partition can load from nvme

As I’d like to keep Android in my emmc I’m wondering is it possible to start Linux from NVME SSD disk like from USB or SDCard?
Or to make Linux Boot partition with kernel along with Android partition like with CoreElec installation in emmc allowing switching between Android and CoreElec?
Is there any possible workaround?

If you check my screenshot of Gparted made in Ubuntu-xfce-bionic_Linux-4.9 which detects SSD as an external drive (3 posts above) you will see that there are Boot Manjaro partition and Rootfs Manjaro flashed on nvme0n1 which is my SSD but nothing can load and start directly from this SSD

yes for example easiest way for u

boot uboot and linux kernel from SD card and continue load rootfs and other from nvme already

can you write a short manual of how to make it for noob users like me? :laughing:

I searched the forum and found several topics about nvme ssd issues.
For instance I’ve found this:

I confirmed that I had set the correct portmode in Krescue. I have successfully partitioned and formatted the drive as ext4 in Ubuntu bionic with 4.9 kernel (I understand that the NVME driver may have been disabled in 5.7 due to stability issues).
M2X board with 1TB NVME running Android Pie or CoreElec

So I’m wondering is there any way to enable NVME support in latest kernels and future Manjaro builds at least to have an ability to mount nvme ssd as external drive. Now it doesn’t work

Sounds good.

I need an nvme drive to test. :frowning:

I think the module is enabled. Unless it is something other than standard config.

@hyphop can you confirm which config is needed in latest kernel for m2 port to work?

1 Like

@Spikerguy Hello,

I’ve managed to mount ssd on VIM3_Ubuntu-server-focal_Linux-5.7-rc7_arm64_SD-USB_V0.9-20200530 after adding this line to env.txt of boot:
# User kernel args
# Add customer kernel args here
user_kernel_args=nvme_core.default_ps_max_latency_us=200

so actually pcie is supported by latest kernels but possibly some wrong config settings prevented ssd from detecting by the board.

I think we could discuss it. :innocent:

3 Likes

That’s good to hear. Where did you get this argument from?

You should try the same with Manjaro and add it to extlinux.conf

1 Like

@Spikerguy,

I searched many topics related to nvme boot issues and should admit that there is not so much information.
I’ve found some in Russian and Western Internet resources:



which were similar to my errors got in Ubuntu 5.7:
[    1.687553] nvme nvme0: pci function 0000:01:00.0
[    1.691600] nvme 0000:01:00.0: enabling device (0000 -> 0002)
[    1.700974] nvme nvme0: missing or invalid SUBNQN field.
[    1.702563] nvme nvme0: Shutdown timeout set to 8 seconds
[    1.770859] nvme nvme0: 6/0/0 default/read/poll queues
[    1.787665]  nvme0n1: p1 p2
[   33.757398] nvme nvme0: controller is down; will reset: CSTS=0xffffffff, PCI_STATUS=0x10
[   33.813949] blk_update_request: I/O error, dev nvme0n1, sector 488396928 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
[   33.853219] nvme 0000:01:00.0: enabling device (0000 -> 0002)
[   33.868044] nvme nvme0: Removing after probe failure status: -19

I’m going to try adding the line to extlinux.conf as you advised
Should I make it that way:

APPEND root=LABEL=ROOT_MNJRO rootflags=data=writeback rw console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 user_kernel_args=nvme_core.default_ps_max_latency_us=200 bootsplash.bootfile=bootsplash-themes/manjaro/bootsplash

Or to write it additionally in separate line?

I’m not sure that it will help because unlike two Ubuntu distros I used Manjaro unfortunately gives no outputs to nvme related commands like lspci or dmesg | grep -i nvme

khadas@Khadas:~$ lspci
00:00.0 PCI bridge: Synopsys, Inc. DWC_usb3 / PCIe bridge (rev 01)
01:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983

khadas@Khadas:~$ sudo dmesg|grep -i nvme
[sudo] password for khadas: 
[    0.800414] nvme nvme0: pci function 0000:01:00.0
[    0.800494] nvme 0000:01:00.0: enabling device (0000 -> 0002)
[    0.923610]  nvme0n1: p1 p2

khadas@Khadas:~$ sudo fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 232,91 GiB, 250059350016 bytes, 488397168 sectors
Disk model: Samsung SSD 970 EVO Plus 250GB          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x11ff4fbd

Device         Boot  Start      End  Sectors   Size Id Type
/dev/nvme0n1p1       62500   500000   437501 213,6M  c W95 FAT32 (LBA)
/dev/nvme0n1p2      500001 10885119 10385119     5G 83 Linux
1 Like

First i need to understand which config is needed in kernel config to make the linux kernel detect the nvme drive once we can see the drive then we can look into the booting side of it.

Update: Bought an nvme 256gb by kingston a2000 and it doesn’t seem to detect on Manjaro even when using mainline kernel.

@hyphop or @frank can you share which kernel config is needed for m2 to work on mainline?
As you said the dtb have m2 support already then please share what module is needed to get it to work.

Thanks.

Update: I found something on Kernel side which I remember now that USB3 and M2 PCIE is muxed.

So we need to enable kbi or something to make it use pcie instead of the usb3 connector.
Or patch this dts by uncommented those lines.

I also see a patch for pcie in fenix git. @numbqq can you help me understand why 0092-VIM3-hack-for-PCIe.patch is needed?

1 Like

The PCIe/USB3 switch can be accessed from the command line as shown in Khadas Docs.

2 Likes

Thanks @RDFTKV This helped but not without a custom dtb with pcie enabled.
Finally I can see it visible in lsblk

What is needed:

  1. Enable kbi to PCIE Mode using this guide.
  2. Change dtb to pcie enabled version which I build, Will share the dtb here later.

Add-pcie-vim3-makefile.patch

meson-g12b-a311d-khadas-vim3-pcie.dtb

Try this dtb and also change it to pcie using uboot kbi steps.

There seems to be some problem when using NVME,
When NVME is being used the screen would keep flickering and glitching all the time. without the nvme it will not do this.

3 Likes

Hello, @Spikerguy

Thank you for great work!
I can check it tomorrow.
PCIE mode is switched on with Krescue in kbi settings.

Should I only add meson-g12b-a311d-khadas-vim3-pcie.dtb to dtbs and change it in
extlinux.conf?
Or do I also need to apply Add-pcie-vim3-makefile.patch?

Please also find here how this PCIE-USB3 switch is made in Khadas Ubuntu 4.9 and 5.7
I hope it will be useful.
https://yadi.sk/d/5Cr8sSnemnxxAQ

And there are also some NVME related files in the same folder
https://yadi.sk/d/ZxBfjJLYbkKWpw?w=1

If it helps I can also check the other configs.

2 Likes

Yes just paste meson-g12b-a311d-khadas-vim3-pcie.dtb in /boot/dtbs/amlogic/
replace meson-g12b-a311d-khadas-vim3.dtbto meson-g12b-a311d-khadas-vim3-pcie.dtb in extlinux.conf

Update: I have switched to Mainline Kernel and I cannot get the Fan to work @numbqq or @hyphop any advice on fan for mainline kernel ?

2 Likes

The FAN driver merged long time ago, it should work.

Yes I was aware of the MCu driver added to upstream kernel

Tripping point at 80°C is too high.
Will have to set it to 60.

Thanks its working fine now.

@numbqq any advice on this? I am using Kingston A2000 256gb nvme and I tried to use khadas official psu to Power up the vim3 I thought it was power draw issue but it is now I have tested the power draw and it’s not going above 0.7amp which makes me think that nvme is pulling alot of power and causing the screen to flicker constantly.


This is the power draw during nvme write process.

Are you using Khadas 10w or the 24w USB-C power supply? Your tester shows only 5 volts. You might be looking at a power starvation issue if only 5 volts is supplied to the VIM3.

5V should work stable, the output is max 3A, 12V@2A is still enough I think