rootdev: Strip partitions less aggressively

In device names like dm-N or loopN, the N is not a partition number and
should not be stripped off.  These can arise for example if run inside a
chroot mounted on a loopback device.

BUG=chromium:748665, chromium:730144
TEST=New unit tests.

Change-Id: If7ecacbfcf00690376cb4ffc75baa45422579085
Commit-Ready: Benjamin Gordon <>
Tested-by: Benjamin Gordon <>
Reviewed-by: Simon Glass <>
Reviewed-by: Mike Frysinger <>
2 files changed