1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 19:23:01 +03:00
mobile-nixos/examples/target-disk-mode
2021-01-30 22:53:49 -05:00
..
app examples/target-disk-mode: Simplify interface implementation 2021-01-25 18:40:54 -05:00
configuration.nix examples/target-disk-mode: Try to enable ADB 2021-01-27 22:16:55 -05:00
default.nix examples/target-disk-mode: Rename to target disk mode 2021-01-04 05:52:01 -05:00
gui-task.rb examples/target-disk-mode: Kill splash to free DRM context 2021-01-30 22:53:49 -05:00
README.md examples/target-disk-mode: Update README 2021-01-05 17:37:52 -05:00

Target Disk Mode

What's this?

This is a system that allows you to present the internal storage of a device over the USB connection using Linux USB gadget mode.

How to use

This will differ depending on the device.

The main thing to know is that you need to build a bootable image for your device.

This will have different implications depending on the device.

U-Boot based systems

(E.g. pine64-pinephone)

 $ nix-build examples/target-disk-mode/ --argstr device pine64-pinephone -A build.default
 $ file -L result
result: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 319555 sectors, extended partition table (last)

The disk image produced can be flashed to a bootable medium (e.g. an SD card).

Android-based systems

(None)

Note

: Adding this feature for android-based systems, at the time being, is dangerous. Overwriting parts of the disk could lead to really actually bricked devices.

 $ nix-build examples/target-disk-mode/ --argstr device ____ -A build.android-bootimg
 $ file -L result
result: Android bootimg, kernel (0x10008000), ramdisk (0x11000000), page size: 2048, cmdline (...)

This boot image can be ran using fastboot boot, if the device supports it, or flashed to the recovery or the boot partition.


While the project differs in implementation, I want to acknowledge the inspiration taken from the JumpDrive project.