- https://android.googlesource.com/platform/frameworks/base/+/master/media/jni/ - Apache 2.0 license. - Requires Android configfs MTP gadget module which is not in the Linux kernel. - Seems to be very closely tied to Android media code and require many other android libraries that I did not want to merge.
- TIZEN MTP
- https://build.tizen.org/package/show?package=mtp-responder&project=Tizen%3AIVI - Apache 2.0 license. - Requires GLIB 2.0 and some capi that would inflate our image size by a good bit.
- BUTEO MTP
- Current repo: https://git.merproject.org/mer-core/buteo-mtp/tree/master - Repo I used: https://github.com/pcercuei/buteo-mtp (Pcercuei already separated it from buteo-syncfw here, see next bullet) - Newer version of buteo is intrinsically tied to buteo-syncfw. buteo-syncfw requires many more platform code packages to be pulled in from the Meego or Mer code base. Since this added code handles config and networking etc, it was not very useful to me. - Buteo was originally written for gadgetfs and alot of the documentation still shows this. However, Buteo now uses functionfs gadget module with configfs. This adds to the confusion a bit.
- UBUNTU MTP
- http://bazaar.launchpad.net/~phablet-team/mtp/trunk/files - Requires Boost library with certain packages, dbus-cpp, libglog. Boost library will inflate our image size a good bit. - Also requires bazaar installed on the dev machine to pull from the Ubuntu repo. - Requires Android configfs MTP gadget module which is not in the Linux kernel.
- https://github.com/viveris/uMTP-Responder - Thanks to Jean-François DEL NERO for the update on this. - Recently released by Viveris under GPLv3. (This is newer than the instructions here) - Implemented in C, in user space and use the GadgetFs layer. - This is most likely a better option than the instructions below. Give it a try!
Note: There may be a better and more proper Linux way to implement MTP, but in the time frame I have, this was the fastest working way I found with existing code. It seems that good details are hard to find on MTP responders when you don't want to write your own.
I first began looking at buteo since it used functionfs which is already in the kernel. I was able to pull the old version and build it. Running the binary seemed to work, however attaching the gadget configuration to the UDC caused a kernel oops every time.
Ubuntu was the second flavor I tried and ultimately found success. Thank you Android and Canonical phablet team! Here's the steps and files necessary to pull Ubuntu's MTP daemon into a buildroot system:
**1. Pull down the kernel patch for the MTP gadget driver that was never accepted into the kernel. Add this to your build.**
1. https://patches.linaro.org/patch/52411/ 2. Download from the patch link 3. cp RFC-1-2-usb-gadget-configfs-add-MTP-function.patch
**2. Select the newly added MTP gadget option in the kernel config**
1. make linux-menuconfig 2. Device Drivers -> USB Support -> USB Gadget Support -> USB Gadget Drivers -> USB functions configurable through configfs 3. Select MTP gadget 4. Also select any others you want to use. I'm also selecting ACM serial and Mass Storage. 3. Save the configuration to your default config (optional)
make linux-savedefconfig cp output/build/linux-linux4sam_5.3/defconfig 4. Setup ubuntu-mtp package in buildroot
6. Add patches to package directory. These patches strip out code that ties it to the ubuntu phablet and hard codes some config options. they also modify some build files to include libraries. Some assembly required here. Note you may want to modify these patch files to expose the proper disk locations. Currently, i'm exposing the /root partition for testing.
0001-CMake-remove-android-libraries-and-fix-module-names.patch 0002-remove-android-properties-and-ubuntu-phablet-specific.patch 0003-convert-android-properties-to-hardcoded-strings.patch 7. Pull down the MTP responder from the ubuntu bzr repo. Note: I saved the tgz to our repo so that bazaar is not a requirement for the build
Download the tarball here: http://bazaar.launchpad.net/~phablet-team/mtp/trunk/revision/71?start_revid=71 Add this to your ubuntu-mtp package directory 8. Package is done, add it to the top level Config.in
vim ../../Config.in 9. Select it in the menuconfig along with the dependencies and hope it builds
make menuconfig User Provided Options select ubuntu-mtp 10. After it builds and installs, create the gadget startup script. Simple example shown here. Also, get your own vid/pid ya bum!.