fdisk命令没有提供有关此事的详细信息。我想知道哪个硬件内存设备映射到嵌入式linux上/ dev /下的哪个分区节点。
我在智能设备主板的i.mx处理器6quad SABRESD上运行3.10嵌入式linux(yocto项目)。
答案 0 :(得分:1)
如果您在嵌入式系统中使用udev
,则可以从udev
获取一些信息(因为您使用的是Yocto,因此很有可能#&} 39;重新使用udev
,除非您真的将其缩减到最小系统。)
例如,我在BeagleBone Black系统上运行Yocto,该系统有一个SD卡和一个板载eMMC。设备显示为/dev/mmcblk0
和/dev/mmcblk1
,并且它的方式取决于它从哪个内存引导(引导设备始终为/dev/mmcblk0
)。
您可以使用udevadm info -a -n <dev-name>
获取有关设备的信息:
# udevadm info -a -n /dev/mmcblk0
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/ocp/48060000.mmc/mmc_host/mmc0/mmc0:b368/block/mmcblk0':
KERNEL=="mmcblk0"
SUBSYSTEM=="block"
DRIVER==""
ATTR{ro}=="0"
ATTR{size}=="1953792"
ATTR{stat}==" 585 388 38332 3420 78 64 1136 1370 0 2960 4790"
ATTR{range}=="8"
ATTR{discard_alignment}=="0"
ATTR{force_ro}=="0"
ATTR{ext_range}=="8"
ATTR{alignment_offset}=="0"
ATTR{inflight}==" 0 0"
ATTR{removable}=="0"
ATTR{capability}=="10"
looking at parent device '/devices/ocp/48060000.mmc/mmc_host/mmc0/mmc0:b368':
KERNELS=="mmc0:b368"
SUBSYSTEMS=="mmc"
DRIVERS=="mmcblk"
ATTRS{cid}=="1b534d30303030301002b2ffa200b27f"
ATTRS{csd}=="002f00325b5983b9edb7ff9f16400005"
ATTRS{scr}=="0225000000000000"
ATTRS{date}=="02/2011"
ATTRS{name}=="00000"
ATTRS{type}=="SD"
ATTRS{preferred_erase_size}=="4194304"
ATTRS{fwrev}=="0x0"
ATTRS{hwrev}=="0x1"
ATTRS{oemid}=="0x534d"
ATTRS{manfid}=="0x00001b"
ATTRS{serial}=="0x02b2ffa2"
ATTRS{erase_size}=="512"
looking at parent device '/devices/ocp/48060000.mmc/mmc_host/mmc0':
KERNELS=="mmc0"
SUBSYSTEMS=="mmc_host"
DRIVERS==""
looking at parent device '/devices/ocp/48060000.mmc':
KERNELS=="48060000.mmc"
SUBSYSTEMS=="platform"
DRIVERS=="omap_hsmmc"
looking at parent device '/devices/ocp':
KERNELS=="ocp"
SUBSYSTEMS=="platform"
DRIVERS==""
然后你可以制作一个udev规则来建立你感兴趣的设备/分区的符号链接。例如:
SUBSYSTEM=="block", ATTRS{type}=="MMC", ATTR{partition}=="2", SYMLINK+="mmcblk-emmc-data"
SUBSYSTEM=="block", ATTRS{type}=="SD", ATTR{partition}=="2", SYMLINK+="mmcblk-sd-data"
哪一个应该是一个或两个符号链接:
# ls -al /dev/mmcblk-*
lrwxrwxrwx 1 root root 9 Jul 1 17:34 /dev/mmcblk-emmc-data -> mmcblk1p2
lrwxrwxrwx 1 root root 9 Jul 1 17:34 /dev/mmcblk-sd-data -> mmcblk0p2