Page 1 of 1

Bochs, Android, hard disk

Posted: Sun Jun 12, 2022 5:34 am
by kerravon
I can run pdos (pdos.org) under bochs on an Android phone.

Bochs accept a fat32 disk image as a drive.

I would like to make that same file as a defacto external hard disk when I connect the Android to a normal PC via USB cable.

If I have a PC with a bios it will then think that this is an external hard drive and mount it and even boot from it.

This will enable me to transfer data between pdos running on the PC and pdos running on the Android.

I would shut down bochs before using the file as a hard disk.

Does anyone else run their x86 os on an Android?

Can the Android do this? Perhaps with an app from the Google Play store?

Re: Bochs, Android, hard disk

Posted: Sun Jun 12, 2022 6:55 pm
by nexos

Re: Bochs, Android, hard disk

Posted: Sun Jun 12, 2022 9:47 pm
by Octocontrabass
kerravon wrote:Can the Android do this? Perhaps with an app from the Google Play store?
I found an app that claims to do this, but it requires root, and it hasn't been updated in a while and may not work on recent Android versions. You might find a newer app that's compatible with newer Android versions if you look around.
These are instructions for enabling MTP to access the contents of an SD card. It doesn't use disk images, and you definitely can't boot from it.

Re: Bochs, Android, hard disk

Posted: Mon Jun 13, 2022 2:12 am
by kerravon
Thanks for that! It looks like the principle is sound. I'm surprised root is required.

Another option would be an app that extracts a single or all files from a disk image. Then the problem would be transformed - assuming my Android is, or can be made fat32, would my file be visible to the PC bios? So that I can boot from a USB stick and the Android is a data drive to pdos.

Thanks

Re: Bochs, Android, hard disk

Posted: Mon Jun 13, 2022 10:52 am
by Octocontrabass
kerravon wrote:assuming my Android is, or can be made fat32, would my file be visible to the PC bios?
I found an app to make your SD card available as a mass storage device, but it also requires root and hasn't been updated in a while.

Old Android versions would expose their storage as a FAT-formatted mass storage device, but modern Android devices only support MTP and PTP. BIOS (and probably UEFI as well) only supports mass storage. You'll need a whole USB stack to access MTP or PTP.

Re: Bochs, Android, hard disk

Posted: Mon Jun 13, 2022 7:34 pm
by kerravon
Thanks for all that.

I thought of one more thing that could help me.

Bochs reads my vhd (basically IMG) fine.

But can I mount it under Android the same as I can mount it under windows?

This would allow me to get files on and off, although different from my original question.

A Google search was inconclusive.

Re: Bochs, Android, hard disk

Posted: Sat Jun 25, 2022 5:30 pm
by eekee
Sounds like the sort of questions I'd find complicated too. :) Going back to the original question...
kerravon wrote:If I have a PC with a bios it will then think that this is an external hard drive and mount it and even boot from it.

This will enable me to transfer data between pdos running on the PC and pdos running on the Android.
You could use the same image for an emulated or virtual PC on the real PC. Perhaps the guest could have access to a partition in addition to the Android-hosted disk image. Make the PC dual-boot, with the other OS being PDOS accessing the partition. I made a plain-text diagram of this; just felt like it. :)

Code: Select all

+--Android--+         +--PC--------------------+
|           |         | WinLinWhatever         |
|           |         | +--VM-----+            |
|           |         | |PDOS     |            |
|           |         | |         |            |
| DiskImage-+---MTP---+-+ ↔files↔ +-PartitionN |
|           |         | |         |            |
|           |         | +---------+            |
|           |         |                        |
+-----------+         +------------------------+

Reboot PC...

+--PC----------------+
| PDOS on PartitionN |
|                    |
+--------------------+

As for the 2nd question, I'm sure you could use mtools under Termux or under any of the many Linux chroot environments you can get for Android.

Honestly, for the first question, you could use mtools on the MTP-served disk image instead of running a PDOS VM.

EDIT: Today I tried to edit a text file shared over MTP, but it wouldn't save to the phone. I guess you may not be able to write to the disk image served from the phone. So many useful things in Android require root access, and I can often understand why. What I don't understand is why I myself haven't rooted every Android phone I've ever owned. :)