I want to build an OS on windows
I want to build an OS on windows
The reason is Windows cannot compile source code to elf.
I try mingw, cygwin and etc.
But they cannot compile to elf!
I try mingw, cygwin and etc.
But they cannot compile to elf!
Re: I want to build an OS on windows
Use WSL (on Win10).
Or maybe some toolchain that can produce ELFs (for example, my Smaller C compiler produces assembly that's assembled with NASM/YASM or FASM into ELF object files, which can then be linked into a variety of executables, from ELFs and PEs to DOS EXEs).
I'd say it's not too important, whether its ELFs or PEs. a.out's will work too.
Or maybe some toolchain that can produce ELFs (for example, my Smaller C compiler produces assembly that's assembled with NASM/YASM or FASM into ELF object files, which can then be linked into a variety of executables, from ELFs and PEs to DOS EXEs).
I'd say it's not too important, whether its ELFs or PEs. a.out's will work too.
- AndrewAPrice
- Member
- Posts: 2300
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: I want to build an OS on windows
You'll need a cross compiler (a compiler that produces binaries for a system other than the host OS.)
See: https://wiki.osdev.org/GCC_Cross-Compiler
There are even a few prebuilt cross compilers for Windows at the bottom.
See: https://wiki.osdev.org/GCC_Cross-Compiler
There are even a few prebuilt cross compilers for Windows at the bottom.
My OS is Perception.
Re: I want to build an OS on windows
Or you could simply use PE for your OS. Using ELF isn't mandatory. BOOTBOOT can load PE and ELF kernels equally for example.
Cheers,
bzt
Cheers,
bzt
Re: I want to build an OS on windows
So, how I can use PE for my OS?(The Hyperon System Software)bzt wrote:Or you could simply use PE for your OS. Using ELF isn't mandatory. BOOTBOOT can load PE and ELF kernels equally for example.
Cheers,
bzt
Re: I want to build an OS on windows
I decided to use Pascal and Assembly to write the OSSiliconOS wrote:So, how I can use PE for my OS?(The Hyperon System Software)bzt wrote:Or you could simply use PE for your OS. Using ELF isn't mandatory. BOOTBOOT can load PE and ELF kernels equally for example.
Cheers,
bzt
Re: I want to build an OS on windows
I use the OpenWatcom compiler. It can create images for other OSes, although you need to adapt the runtime library for it. OTOH, you need to do this with GCC too.
Re: I want to build an OS on windows
I decided to use Pascal and ASM to write this OS.It's GUI-only, so it could more difficult to draw(The HyperDraw) the UI and etc.rdos wrote:I use the OpenWatcom compiler. It can create images for other OSes, although you need to adapt the runtime library for it. OTOH, you need to do this with GCC too.
Re: I want to build an OS on windows
I build my 64-bit ELF kernel under cygwin. It's pretty straight forward, all you need to do is compile gcc and binutils as cross-build tools for the x86_64-elf target.
If it helps, here's exactly how I built the tools:
If it helps, here's exactly how I built the tools:
Code: Select all
export PREFIX=/usr/local/x86_64-elf
export TARGET=x86_64-elf
export PATH="$PREFIX/bin:$PATH"
cd binutils-build
../binutils-2.34/configure --target=x86_64-elf --prefix=/usr/local/x86_64-elf --with-sysroot --disable-nls --disable-werror
make ; make install
cd gcc-build
../gcc-9.3.0/configure --target=x86_64-elf --prefix=/usr/local/x86_64-elf --disable-nls --enable-languages=c --without-headers
make all-gcc ; make all-target-libgcc
make install-gcc ; make install-target-libgcc
Re: I want to build an OS on windows
There's a Pascal kernel example in the repo, you can start from there. I've used Lazarus fpc under Linux, but it is said to be working on windows too.SiliconOS wrote:I decided to use Pascal and ASM to write this OS.It's GUI-only, so it could more difficult to draw(The HyperDraw) the UI and etc.
As for the GUI, the loader sets up a linear framebuffer for you, which is technically a pixel buffer, so any library that can use pixels should work without a problem. Otherwise you have to write the code yourself: start with drawing primitives: draw a box, a rectangle, a circle, a line, etc. (Note: the example I've liked provides "Procedure Puts(s : PChar);" to demonstrate how to draw text using PSF2 fonts with Pascal, you can use that). Then build widgets using those: buttons, checkboxes, selectboxes, etc. So far pretty straightforward. Then finally (and this is the hardest) implement a windowing system.
If you would use C, then I would say try nuklear, or some other simple to port GUI libraries. Not sure about Pascal though, I guess there must be similar projects. This looks promising because it uses SDL, so should be straightforward to port (SDL window is using exactly the same kind of pixelbuffer like the linear framebuffer). This might be harder to port, because it seems to have a lot more dependencies, but looks much better.
Cheers,
bzt
Re: I want to build an OS on windows
Oh, I want to build for x86_64bit pascalsj95126 wrote:I build my 64-bit ELF kernel under cygwin. It's pretty straight forward, all you need to do is compile gcc and binutils as cross-build tools for the x86_64-elf target.
If it helps, here's exactly how I built the tools:
Code: Select all
export PREFIX=/usr/local/x86_64-elf export TARGET=x86_64-elf export PATH="$PREFIX/bin:$PATH" cd binutils-build ../binutils-2.34/configure --target=x86_64-elf --prefix=/usr/local/x86_64-elf --with-sysroot --disable-nls --disable-werror make ; make install cd gcc-build ../gcc-9.3.0/configure --target=x86_64-elf --prefix=/usr/local/x86_64-elf --disable-nls --enable-languages=c --without-headers make all-gcc ; make all-target-libgcc make install-gcc ; make install-target-libgcc
Re: I want to build an OS on windows
I think this write by ASM and pascal(Because it is a OS GUI Library)bzt wrote:There's a Pascal kernel example in the repo, you can start from there. I've used Lazarus fpc under Linux, but it is said to be working on windows too.SiliconOS wrote:I decided to use Pascal and ASM to write this OS.It's GUI-only, so it could more difficult to draw(The HyperDraw) the UI and etc.
As for the GUI, the loader sets up a linear framebuffer for you, which is technically a pixel buffer, so any library that can use pixels should work without a problem. Otherwise you have to write the code yourself: start with drawing primitives: draw a box, a rectangle, a circle, a line, etc. (Note: the example I've liked provides "Procedure Puts(s : PChar);" to demonstrate how to draw text using PSF2 fonts with Pascal, you can use that). Then build widgets using those: buttons, checkboxes, selectboxes, etc. So far pretty straightforward. Then finally (and this is the hardest) implement a windowing system.
If you would use C, then I would say try nuklear, or some other simple to port GUI libraries. Not sure about Pascal though, I guess there must be similar projects. This looks promising because it uses SDL, so should be straightforward to port (SDL window is using exactly the same kind of pixelbuffer like the linear framebuffer). This might be harder to port, because it seems to have a lot more dependencies, but looks much better.
Cheers,
bzt
Re: I want to build an OS on windows
I'm not entirely sure what you're asking. All my links are for Pascal, and a kernel shouldn't be a GUI Library at all. Check out the links I gave you:SiliconOS wrote:I think this write by ASM and pascal(Because it is a OS GUI Library)
- mykernel/pas is a minimal "Hello World" kernel written in Pascal. I've used the FreePascal (fpc) compiler for that (known to work under Windows too, supports both ELF and PE). The example uses PSF2 fonts to draw text on the framebuffer (pixel based graphics mode).
- SimpleGUI is a minimal FreePascal GUI library, written for SDL so should be straightforward to port to framebuffer (just remove SDL_Surface, replace
SDL_Surface.pixels with PDword(@fb),
SDL_Surface.w with bootboot.fb_width,
SDL_Surface.h with bootboot.fb_height, and
SDL_Surface.pitch with bootboot.fb_scanline and you're good to go).
- fpGUI is a fully featured GUI library written in FreePascal, although might be more difficult to port as it has more dependencies. But it has a HOW-TO port doc.
Alternatively write your own GUI Library, you can use the PSF2 text drawing routine from my example for that.
Cheers,
bzt
Re: I want to build an OS on windows
I want to design a thing like Macintosh Toolbox, called Hyperon Toolbox. It including a set of application programming interfaces for software development on the platform.The Toolbox consists of a number of "managers.", such as HyperDraw and etc. It also have some "kernel" functions, libraries, drivers(such IDE driver, HYFS(The OS's filesystem)), fonts and some resources and useful applications(such as HyperBug).bzt wrote:I'm not entirely sure what you're asking. All my links are for Pascal, and a kernel shouldn't be a GUI Library at all. Check out the links I gave you:SiliconOS wrote:I think this write by ASM and pascal(Because it is a OS GUI Library)
- mykernel/pas is a minimal "Hello World" kernel written in Pascal. I've used the FreePascal (fpc) compiler for that (known to work under Windows too, supports both ELF and PE). The example uses PSF2 fonts to draw text on the framebuffer (pixel based graphics mode).
- SimpleGUI is a minimal FreePascal GUI library, written for SDL so should be straightforward to port to framebuffer (just remove SDL_Surface, replace
SDL_Surface.pixels with PDword(@fb),
SDL_Surface.w with bootboot.fb_width,
SDL_Surface.h with bootboot.fb_height, and
SDL_Surface.pitch with bootboot.fb_scanline and you're good to go).
- fpGUI is a fully featured GUI library written in FreePascal, although might be more difficult to port as it has more dependencies. But it has a HOW-TO port doc.
Alternatively write your own GUI Library, you can use the PSF2 text drawing routine from my example for that.
Cheers,
bzt
The Toolbox need writed by Pascal and ASM, but I don't know how to call some functions and use some resources
Re: I want to build an OS on windows
I'm trying use C++ to write the OS