3

In our embedded Linux solution using uClinux, I have just added a larger flash device. I want to be able to query which device I have installed (hardware device).

The small and large device both have different device ID's which I can read in my device driver code.

What I don't know is how to get that information in "user land". I.e. in a shell/bash script.

I have looked at:

cat /proc/mtd - this gives information on the size of the partitions. But I can't tell from this, infact I will need to change the partition sizes based on which flash chip is installed.

mtd_debug info /dev/mtd0 - This is pretty close, it tells me about the sector size (erase size), the mtd type, etc... but since the two flash chips are the same type this also is not enough info.

code_fodder
  • 1,461
  • 5
  • 20
  • 29
  • It looks like this is handled very differently depending on the driver and chip: Some support JEDEC READ ID, some don't, etc. Can you narrow down the possible drivers that would be used in your case? – dirkt Mar 09 '17 at 11:28

2 Answers2

1

I have made a code-based solution to this, its in stack overflow here: how-can-i-determine-what-mtd-flash-device-is-installed

However, since this is a code change (even if its just one-line) it does require a re-build of the kernel, so I am not marking this up as the solution yet...

code_fodder
  • 1,461
  • 5
  • 20
  • 29
0

Quickly but ugly you can scan kernel output for a message about NAND:

dmesg | grep 'Manufacturer ID'

The message varies from version to version (2.6.32, 4.10). Here is result for 2.6.32.57:

[root@board /]# dmesg | grep 'Manufacturer ID'
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
SergA
  • 316
  • 3
  • 5
  • dmesg looks like a good idea - but did not work for me :( I can see the flash partitions being mounted, but I can't see any manufacturer / ID information.... – code_fodder Feb 27 '17 at 15:21