Bochs, Android, hard disk

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kerravon
Member
Member
Posts: 266
Joined: Fri Nov 17, 2006 5:26 am

Bochs, Android, hard disk

Post 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?
nexos
Member
Member
Posts: 1072
Joined: Tue Feb 18, 2020 3:29 pm
Freenode IRC: nexos

Re: Bochs, Android, hard disk

Post by nexos »

"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: Bochs, Android, hard disk

Post 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.
kerravon
Member
Member
Posts: 266
Joined: Fri Nov 17, 2006 5:26 am

Re: Bochs, Android, hard disk

Post 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
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: Bochs, Android, hard disk

Post 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.
kerravon
Member
Member
Posts: 266
Joined: Fri Nov 17, 2006 5:26 am

Re: Bochs, Android, hard disk

Post 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.
User avatar
eekee
Member
Member
Posts: 827
Joined: Mon May 22, 2017 5:56 am
Freenode IRC: eekee
Location: Hyperspace
Contact:

Re: Bochs, Android, hard disk

Post 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. :)
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Post Reply