OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 1:20 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Bochs, Android, hard disk
PostPosted: Sun Jun 12, 2022 5:34 am 
Offline
Member
Member

Joined: Fri Nov 17, 2006 5:26 am
Posts: 232
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?


Top
 Profile  
 
 Post subject: Re: Bochs, Android, hard disk
PostPosted: Sun Jun 12, 2022 6:55 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
I think so: https://www.wikihow.com/Use-Your-Android-As-a-Portable-Hard-Drive

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: Bochs, Android, hard disk
PostPosted: Sun Jun 12, 2022 9:47 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.

nexos wrote:

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.


Top
 Profile  
 
 Post subject: Re: Bochs, Android, hard disk
PostPosted: Mon Jun 13, 2022 2:12 am 
Offline
Member
Member

Joined: Fri Nov 17, 2006 5:26 am
Posts: 232
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


Top
 Profile  
 
 Post subject: Re: Bochs, Android, hard disk
PostPosted: Mon Jun 13, 2022 10:52 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: Bochs, Android, hard disk
PostPosted: Mon Jun 13, 2022 7:34 pm 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: Bochs, Android, hard disk
PostPosted: Sat Jun 25, 2022 5:30 pm 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 812
Location: Hyperspace
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:
+--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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: 8infy, Google [Bot] and 70 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group