I'm trying to figure out the easiest programatic way of detecting if
we've booted from (using as rootfs) the eMMC or uSD card. I'm sure
some more knowledgeable with Linux might have some inputs to the
approach I've found so far.
If booting from eMMC:
root@beaglebone:~# ls /sys/bus/mmc/devices/mmc1\:0001/block
mmcblk0
If booting from uSD:
root@beaglebone:~# ls /sys/bus/mmc/devices/mmc1\:0001/block
mmcblk1
mmc1:0001 is the eMMC and mmc0:1234 is the uSD. The root device with
the 3.8.x-boneX kernels is always mmcblk0.
maybe, findmnt?
root@beaglebone:~# findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mmcblk0p2 ext4 rw,noatime,errors=remount-ro,data=ordered
http://linux.die.net/man/8/findmnt
Regards,
I'm trying to figure out the easiest programatic way of detecting if
we've booted from (using as rootfs) the eMMC or uSD card. I'm sure
some more knowledgeable with Linux might have some inputs to the
approach I've found so far.
If booting from eMMC:
root@beaglebone:~# ls /sys/bus/mmc/devices/mmc1\:0001/block
mmcblk0
If booting from uSD:
root@beaglebone:~# ls /sys/bus/mmc/devices/mmc1\:0001/block
mmcblk1
mmc1:0001 is the eMMC and mmc0:1234 is the uSD. The root device with
the 3.8.x-boneX kernels is always mmcblk0.
maybe, findmnt?
root@beaglebone:~# findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mmcblk0p2 ext4 rw,noatime,errors=remount-ro,data=ordered
http://linux.die.net/man/8/findmnt
Booting from eMMC:
root@beaglebone:~# findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/disk/by-uuid/48d01e43-db81-4ce7-b634-f883e5ee4382 ext4
rw,noatime,errors=remount-ro,data=ordered
Booting from uSD:
root@beaglebone:~# findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mmcblk0p2 ext4 rw,noatime,errors=remount-ro,data=ordered
Is there any real advantage to this method? I'd rather limit
dependencies on various userspace tools. Also, it is a bit difficult
to make the leap to understand how this definitively says what host
controller slot-id/base-address is used for the rootfs.