How to emulate Linux program?
-
- Posts: 2
- Joined: Mon Jun 04, 2018 9:39 pm
How to emulate Linux program?
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.
Re: How to emulate Linux program?
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.
Re: How to emulate Linux program?
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.
-
- Posts: 2
- Joined: Mon Jun 04, 2018 9:39 pm
Re: How to emulate Linux program?
I mean, how to run Linux program (that is already compiled in Linux machine) to run in my OS?
Re: How to emulate Linux program?
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.danaprakoso5 wrote:I mean, how to run Linux program (that is already compiled in Linux machine) to run in my OS?