java OS?
java OS?
I am trying to make it so I can use the java language to program an OS in.
I know it is a poor choice but my objective is not actually to create a OS in java just to have the ability to do it.
So the steps in doing this
1) somehow load the JVM into kernel memory then pass my java bytecode program to it.
Basically that is all I should have to do.
Problem is how to do all that.
First I would think I need the source code to the JVM?
Second I don't know if the JVM.dll is a standalone meaning would I have to compile anything else into it.
Third don't know where to load it into memory weather their is some type of fix place you have to load it?
Note I have worked with the JNI alot to call java from c and visa-versa but I would also need to somehow compile this into the JVM or create a dll and put it into memory somewhere that the JVM can use ,....etc
I am alittle lost on how to go about doing this.
Any help would be great
Thanks
I know it is a poor choice but my objective is not actually to create a OS in java just to have the ability to do it.
So the steps in doing this
1) somehow load the JVM into kernel memory then pass my java bytecode program to it.
Basically that is all I should have to do.
Problem is how to do all that.
First I would think I need the source code to the JVM?
Second I don't know if the JVM.dll is a standalone meaning would I have to compile anything else into it.
Third don't know where to load it into memory weather their is some type of fix place you have to load it?
Note I have worked with the JNI alot to call java from c and visa-versa but I would also need to somehow compile this into the JVM or create a dll and put it into memory somewhere that the JVM can use ,....etc
I am alittle lost on how to go about doing this.
Any help would be great
Thanks
Re: java OS?
The standard Java and JVMs typically depend on an OS to run. For example, on Linux the JVM makes heavy use of the functionality povided by libc to manage memory, files etc. To develop your OS in Java you'd have to somehow resolve that bootstrap problem.
Re: java OS?
Well I have heard that their are java OS out their.
I was wondering how their where created and if their is a free JVM source out their that will allow me to have a java OS is their anybody that knows how to do it out their.
I.e I know how java works I just need to know how to get the jvm running in kernel mode and pass it my java bytecodes.
Is their any free source or implementation I can use to make it so I can use the language java for my Os.
I was wondering how their where created and if their is a free JVM source out their that will allow me to have a java OS is their anybody that knows how to do it out their.
I.e I know how java works I just need to know how to get the jvm running in kernel mode and pass it my java bytecodes.
Is their any free source or implementation I can use to make it so I can use the language java for my Os.
Re: java OS?
Perhaps "GuestVM" can give you a few ideas: http://labs.oracle.com/projects/guestvm
Re: java OS?
That helped allittle bit but it seems that I really don't know how to go about it...
I also need the JNI which I would need to some how put this into the mix.
I am wondering is their away to use the native command in jave so to use it like extern.
I don't want to have to create the dll ...etc just want to have the ability to make c function calls directly from java.
Their way I don't know what the best action is to port java....
I know the command gcj allows me to compile java down to an .exe but I don't know if it can some how be used to create flat binary files.
Also I am wondering what gcj is doing to make java programs into exe programs .... is it just compiling the jvm and all it's depencence into an exe which just pass's the java bytecodes to the jvm that was compiled into it.
If that is what it is then the best course would be finding a way to make it into a flat binary by using objdump , objcopy... etc
Anybody know how gcj works in making .java files into .exe <-- that would be a big help since I am really curious on how it does it.
Thanks
I also need the JNI which I would need to some how put this into the mix.
I am wondering is their away to use the native command in jave so to use it like extern.
I don't want to have to create the dll ...etc just want to have the ability to make c function calls directly from java.
Their way I don't know what the best action is to port java....
I know the command gcj allows me to compile java down to an .exe but I don't know if it can some how be used to create flat binary files.
Also I am wondering what gcj is doing to make java programs into exe programs .... is it just compiling the jvm and all it's depencence into an exe which just pass's the java bytecodes to the jvm that was compiled into it.
If that is what it is then the best course would be finding a way to make it into a flat binary by using objdump , objcopy... etc
Anybody know how gcj works in making .java files into .exe <-- that would be a big help since I am really curious on how it does it.
Thanks
Re: java OS?
from http://gcc.gnu.org/java/
andGCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code.
Just download it and try it. Then you can tell us how it works.GCJ can also be configured as a cross-compiler, suitable for embedded systems programming
If a trainstation is where trains stop, what is a workstation ?
Re: java OS?
Writing an OS in Java and porting/writing a JVM is possible, but is a mammoth task. Can I advise that you start small and work your way up? Without knowing 100% what you're doing every step of the way, you'll never make it.
Re: java OS?
Ok well I found that with gcj I can just compile the java to elf .o file with this
this gives me MyJavaProg.o
In theory I should beable to create my linker script for my Os and add the MyJavaProg.o to the linker ld command
something like this should allow me to have a flat binary java based os in kernel mode
linker script example link.ld
Then just issue (as usual)
If that all works then I should beable to look at where the start/functions methods for a typical java file are put in kernel.bin and just call it from c or asm using extern "C" function to run the java code.
I can use objdump to look at what the mangled names is weather I have to call it with an _ or not ,...etc etc
QUESTION
I am curious now how the gcj command is actually compiling java to an exe file.
Is it compiling the JVM directly into the exe file and then passing the bytecodes to the compiled in JVM. (or compileing the java bytecodes somehow directly into the asm/c function equivalents)
Or is it just creating an exe which is just a program that calls the outside JVM passing the bytecodes to it (exactly like java.exe does to run a java .class file )
If it is the second case then gcj is no good because all it is really doing is renaming the java.exe file to something different and passing the bytecode internally.
Hopefully it is the first option above because that means I can use it for a java os. Because the first option would allow this exe to run on any machine even the ones that don't have a JVM installed.
Anybody that knows how gcj works please elaborate.
I believe it is the way I want it judging by the file size ...etc
Thanks for any help
Going by this
Anyway gcj has been working in user land fine I can make any java program a running .exe program.
And by my above post ld / linker script should allow me to use the java programming language in kernel mode for my OS as well.
The cool find is that I can compile and not link using gcj java files into elf object files which then I would think ld would not have a problem in converting to bin using the linker script.
I am crossing my fingers I will get back to you if I have a success.
Code: Select all
gcj -c -g -O MyJavaProg.java
In theory I should beable to create my linker script for my Os and add the MyJavaProg.o to the linker ld command
something like this should allow me to have a flat binary java based os in kernel mode
linker script example link.ld
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00001000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
startitup.o (.text);
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
Then just issue (as usual)
Code: Select all
ld -T link.ld -o kernel.bin start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o MyJavaProg.o
I can use objdump to look at what the mangled names is weather I have to call it with an _ or not ,...etc etc
QUESTION
I am curious now how the gcj command is actually compiling java to an exe file.
Is it compiling the JVM directly into the exe file and then passing the bytecodes to the compiled in JVM. (or compileing the java bytecodes somehow directly into the asm/c function equivalents)
Or is it just creating an exe which is just a program that calls the outside JVM passing the bytecodes to it (exactly like java.exe does to run a java .class file )
If it is the second case then gcj is no good because all it is really doing is renaming the java.exe file to something different and passing the bytecode internally.
Hopefully it is the first option above because that means I can use it for a java os. Because the first option would allow this exe to run on any machine even the ones that don't have a JVM installed.
Anybody that knows how gcj works please elaborate.
I believe it is the way I want it judging by the file size ...etc
Thanks for any help
Going by this
I think this all should work out for me. Curious about how it converts bytecodes into native machine code. Their really doesn't seem to be a one to one corrospondence??? (but the JVM must be like the middle man where it translates the bytecodes into the raw machine code equivalent..... gcj must just take what the JVM does on the file and convert it down to machine code.GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code.
Anyway gcj has been working in user land fine I can make any java program a running .exe program.
And by my above post ld / linker script should allow me to use the java programming language in kernel mode for my OS as well.
The cool find is that I can compile and not link using gcj java files into elf object files which then I would think ld would not have a problem in converting to bin using the linker script.
I am crossing my fingers I will get back to you if I have a success.
Re: java OS?
Hi,
Java OS, wow I'm really interested about this idea, in this time I've reading Cosmos doc , maybe you have do some things like Cosmos http://www.gocosmos.org/Docs/Dev/FromCS ... ot.EN.aspx?
Writing Java programs -> Convect it to ASM (machine code by gcj) -> and add it to your os?
but, in reality I don't want to covert anything to ASM or Machine Language, I want write a Bootloader and proting only JVM (ex :OpenJDK), and writing Kernel, other stuff by using Java , it's possible ?
I've reading in osdev wiki and looking many java os source, but no one use really Java.
thanks!
Java OS, wow I'm really interested about this idea, in this time I've reading Cosmos doc , maybe you have do some things like Cosmos http://www.gocosmos.org/Docs/Dev/FromCS ... ot.EN.aspx?
Writing Java programs -> Convect it to ASM (machine code by gcj) -> and add it to your os?
but, in reality I don't want to covert anything to ASM or Machine Language, I want write a Bootloader and proting only JVM (ex :OpenJDK), and writing Kernel, other stuff by using Java , it's possible ?
I've reading in osdev wiki and looking many java os source, but no one use really Java.
thanks!
Last edited by quok on Wed Jun 16, 2010 5:18 pm, edited 1 time in total.
Reason: Edited to remove colors.
Reason: Edited to remove colors.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: java OS?
As that article says, Jazelle is deprecated.pcmattman wrote:Jazelle might be something to look at.
It will still require C/ASM glue to actually get anywhere, mind you.
None of the ARM Cortex-A8/9 or Qualcomm Snapdragon processors shipping today have anything besides a trivial implementation (Where a trivial implementation always invokes the software interpreter)
Jazelle is gone. Thumb-EE is its successor, an operating mode designed explicitly for a JIT to target