OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 7:56 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to emulate Linux program?
PostPosted: Mon Jun 04, 2018 9:44 pm 
Offline

Joined: Mon Jun 04, 2018 9:39 pm
Posts: 2
Hello, I am a beginner OS developer and I want to know how to emulate Linux program? I want to port some nice program for Linux. I already created simple Linux program to display text using printf() function, and then I compile it with GCC for Linux, now how can I make the text be displayed in screen of emulator (same as writing text to memory address 0xB8000)?? Thanks.


Top
 Profile  
 
 Post subject: Re: How to emulate Linux program?
PostPosted: Mon Jun 04, 2018 10:15 pm 
Offline
Member
Member

Joined: Tue Apr 03, 2018 2:44 pm
Posts: 36
I'm confused, do you want to emulate or port? Emulating means you don't change the program but instead modify your OS to provide a similar-ish environment that the program expects, while porting means you modify the program itself to work in your OS. Assuming the former, that depends greatly on how far along your OS is, so we need more details. You're going to need an ELF loader and support the system calls the program expects, some amount of libc unless the program was statically linked etc. Tell us more about the state of your OS and what you're trying to do.

_________________
Image is my operating system.

"...not because [it is] easy, but because [it is] hard; because that goal will serve to organize and measure the best of [my] energies and skills..."


Top
 Profile  
 
 Post subject: Re: How to emulate Linux program?
PostPosted: Tue Jun 05, 2018 2:00 am 
Offline

Joined: Wed Feb 22, 2017 4:57 pm
Posts: 8
From what I can gather, he wants to port a program that prints hello world, that he wrote in Linux to an x86 emulator. I recommend you start from here before doing anything.


Top
 Profile  
 
 Post subject: Re: How to emulate Linux program?
PostPosted: Sat Jul 14, 2018 9:40 am 
Offline

Joined: Mon Jun 04, 2018 9:39 pm
Posts: 2
I mean, how to run Linux program (that is already compiled in Linux machine) to run in my OS?


Top
 Profile  
 
 Post subject: Re: How to emulate Linux program?
PostPosted: Sat Jul 14, 2018 11:07 am 
Offline
Member
Member

Joined: Fri Aug 19, 2016 10:28 pm
Posts: 360
danaprakoso5 wrote:
I mean, how to run Linux program (that is already compiled in Linux machine) to run in my OS?
You need to have a dynamic linker/loader that is capable of loading elf files, as well as versions of the dynamic libraries that the executable uses, built for your platform, but binary compatible with the originals. The latter includes the libc library at minimum, but may include many others - libnss, libgcc, etc.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 51 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