snek icon indicating copy to clipboard operation
snek copied to clipboard

Documentation?

Open TechStudent10 opened this issue 3 years ago • 26 comments

I would really like to make my own OS, but there is no documentation.

So how can I?

TechStudent10 avatar Jan 24 '22 17:01 TechStudent10

There's really no "one way" to make an OS. You just kinda have to wing it. There are some good tutorials online (like wiki.osdev.org or jamesmolloy.co.uk) but even those OS's are pretty limited. There are a bunch of components that go into an OS, and that's kinda why something like the Linux kernel is still around.

llamaking136 avatar Jan 24 '22 19:01 llamaking136

As in I want to use Snek.

TechStudent10 avatar Jan 24 '22 19:01 TechStudent10

Oh, alright. In the Makefile for pythonOS, there is a call to os.system that includes the arguments to snek. It is snek <input filename> <output filename>.

llamaking136 avatar Jan 24 '22 19:01 llamaking136

Oh, alright. In the Makefile for pythonOS, there is a call to os.system that includes the arguments to snek. It is snek <input filename> <output filename>.

Got it. Thanks. Also, I cloned pythonOS to my drive and am now making changes. Is there a way I can get user input?

TechStudent10 avatar Jan 24 '22 19:01 TechStudent10

From they keyboard?

llamaking136 avatar Jan 24 '22 19:01 llamaking136

Yes

TechStudent10 avatar Jan 24 '22 19:01 TechStudent10

https://forum.osdev.org/viewtopic.php?f=1&t=28437

llamaking136 avatar Jan 24 '22 19:01 llamaking136

In Python

TechStudent10 avatar Jan 24 '22 19:01 TechStudent10

This is the result of me using input().

image

TechStudent10 avatar Jan 24 '22 19:01 TechStudent10

The basic fundamentals still apply. Using Python-to-C translators haven't really been used for OS development before, and snek is even newer. If you haven't done OS development before, it'll be even harder doing it in Python.

llamaking136 avatar Jan 24 '22 19:01 llamaking136

This is the result of me using input().

image

Well, in that regard, it looks like the bootloader isn't finding the kernel image. Not sure about that.

llamaking136 avatar Jan 24 '22 19:01 llamaking136

If you haven't done OS development before, it'll be even harder doing it in Python.

Yeah that's true. I've never actually went through and completed an OS.

The basic fundamentals still apply. Using Python-to-C translators haven't really been used for OS development before, and snek is even newer.

That is something I never knew about. I assumed all the PythonOSes used something like snek.

TechStudent10 avatar Jan 24 '22 19:01 TechStudent10

This is the result of me using input(). image

Well, in that regard, it looks like the bootloader isn't finding the kernel image. Not sure about that.

I think that input() isn't being recognized in C, causing it to not compile correctly and just continue and error out.

TechStudent10 avatar Jan 24 '22 19:01 TechStudent10

Do you have a repo for your code?

llamaking136 avatar Jan 24 '22 19:01 llamaking136

Nah, but I can create one quickly.

TechStudent10 avatar Jan 24 '22 20:01 TechStudent10

Okay, I might be able to diagnose the error then.

llamaking136 avatar Jan 24 '22 20:01 llamaking136

Okay it's TechStudent11/snek-test

TechStudent10 avatar Jan 24 '22 20:01 TechStudent10

Okay, thanks.

llamaking136 avatar Jan 24 '22 20:01 llamaking136

Alright. I see the issue. The reason that Limine can't find the kernel executable is because the compiler isn't happy. I re-wrote the build script to make sure that every call to os.system recognized an error and stopped the program. It can't find input because it isn't in the OS (yet).

llamaking136 avatar Jan 24 '22 20:01 llamaking136

So you'll have to do it the old-fashioned way and read wiki.osdev.org.

llamaking136 avatar Jan 24 '22 20:01 llamaking136

Alright. I see the issue. The reason that Limine can't find the kernel executable is because the compiler isn't happy. I re-wrote the build script to make sure that every call to os.system recognized an error and stopped the program. It can't find input because it isn't in the OS (yet).

That makes sense.

So you'll have to do it the old-fashioned way and read wiki.osdev.org.

Ah I guess. When I saw Snek I got super excited that now I was able to write an entire OS in my favorite language but oh well C and Assembly it is.

TechStudent10 avatar Jan 24 '22 20:01 TechStudent10

It's fine if you do it with snek, but I'd recommend C + Assembly to understand the wiki and for usability. You know what, I should make a C-to-Python translator instead...

llamaking136 avatar Jan 24 '22 20:01 llamaking136

Thanks for your help.

TechStudent10 avatar Jan 24 '22 20:01 TechStudent10

Yeah, no problem.

llamaking136 avatar Jan 24 '22 20:01 llamaking136

You know what, I should make a C-to-Python translator instead...

That would be awesome. I've never seen a C to Python translator. Maybe instead of CPython, you'll call it PythonC haha.

TechStudent10 avatar Jan 24 '22 20:01 TechStudent10