1

I am trying to use device mapper in Android, but still stuck on the command "dmsetup" didn't found in Android.

I have loaded the linear.ko and zero.ko which are target device classes successfully in my Android device, but cannot create a virtual device by device mapper because "dmsetup" cannot be found. If anyone know how to get one for Android or have any other methods to create a virtual device?

By the way, I saw a file "device-mapper" in /dev folder, what is used for? I am really appreciate who can help me on this.

BR, -Wenji

user3457702
  • 31
  • 1
  • 4
  • `/dev/device-mapper` is the character device used by `dmsetup` to speak to the kernel. It is usually named `/dev/mapper/control`. We can tell by looking at it (i.e. with `ls -FlA`) and seeing that the major & minor numbers are `10, 236`, which we can look up (e.g. [here](https://github.com/LineageOS/android_kernel_lge_msm8996/blob/e1e29ed881e3eabd8f5bf453b650a84a21621e04/Documentation/devices.txt#L453)) to see it is indeed the device mapper control. – phs Feb 10 '18 at 22:56

1 Answers1

0

There is an API that you can use programatically to talk to the device mapper: http://lwn.net/Articles/35077/

This is based around ioctl(), so it's not the friendliest, but it's pretty well documented: http://androidxref.com/4.4.4_r1/xref/bionic/libc/kernel/common/linux/dm-ioctl.h

There is a great example of its use at: https://github.com/nelenkov/cryptsetup, albeit focussed on dm-verity.

lane
  • 633
  • 12
  • 18