Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello Guys, Today, a thought crossed my mind: “What if I had my own operating system?” I began my research and discovered that operating systems are typically written in the C programming language. However, I’m well-versed in Python. So, the question arises: Can I create my own operating system using Python?
No. What would run the Python code? You'd have to write some sort of special purpose Python interpreter and compile it to executable, then get the UEFI firmware to hand control off to it. How would you do low-level device IO and graphics with Python? Lots of teams have tried to write their own OSs, many have failed. It's a massive task.
Hello Guys, Today, a thought crossed my mind: “What if I had my own operating system?” I began my research and discovered that operating systems are typically written in the C programming language. However, I’m well-versed in Python. So, the question arises: Can I create my own operating system using Python?
I think it's safe to say that if you have to ask the question, you don't know ¼ enough to design a PC operating system. It's not just banging a few programs together, that's only the beginning. There's a huge deal of work in designing the glue that makes those programs work together. Even comparatively simple stuff like setting all the LC_* settings and knowing what programs/scripts use each one is something I'll bet you'd have to research. I certainly would. There's 1000s of those sort of tasks requiring deep knowledge.
At the other end of the scale, much simpler systems set a much lower bar. I designed something around a microcontroller in 2001 and the program that made it function was the "OS."
You bet. But.... As said above it is a lot of work to finally get 'self hosting' and certainly not with Python. But 'simplest' way to start is write a RTOS that runs on the platform, and then build from there... One of the platforms I've played with is Ultibo ( https://ultibo.org/ ) ... A lot of work when into just project which isn't self hosting, but is the only 'application' (think OS) running on the SBC (or a micro-controller). Just Ultibo, you, and the hardware. Fun! Should add and this is with a proprietary 'blob' that initializes the hardware (think interrupt tables, memory initialization, SSD access with basic disk format reading, say FAT) and then loads your application into memory to start running. Normally you'd have to write that 'blob' yourself to get started with assembly and/or say C -- cross compiling.
I think it's safe to say that if you have to ask the question, you don't know ¼ enough to design a PC operating system. It's not just banging a few programs together, that's only the beginning. There's a huge deal of work in designing the glue that makes those programs work together. Even comparatively simple stuff like setting all the LC_* settings and knowing what programs/scripts use each one is something I'll bet you'd have to research. I certainly would. There's 1000s of those sort of tasks requiring deep knowledge.
At the other end of the scale, much simpler systems set a much lower bar. I designed something around a microcontroller in 2001 and the program that made it function was the "OS."
yes bro your'e right but like i said it's just a idea. Thanks man!
I think it's safe to say that if you have to ask the question, you don't know ¼ enough to design a PC operating system. It's not just banging a few programs together, that's only the beginning. There's a huge deal of work in designing the glue that makes those programs work together. Even comparatively simple stuff like setting all the LC_* settings and knowing what programs/scripts use each one is something I'll bet you'd have to research. I certainly would. There's 1000s of those sort of tasks requiring deep knowledge.
At the other end of the scale, much simpler systems set a much lower bar. I designed something around a microcontroller in 2001 and the program that made it function was the "OS."
No. What would run the Python code? You'd have to write some sort of special purpose Python interpreter and compile it to executable, then get the UEFI firmware to hand control off to it. How would you do low-level device IO and graphics with Python? Lots of teams have tried to write their own OSs, many have failed. It's a massive task.
Yes. You have got a lot of no, here is a yes. Although you cannot write a full OS in python (as it was explained), but you can implement an emulator in python, which will mimic an OS.
But would be better to start with a simple thing, not an OS, let's say with a terminal. Later you can improve it to do more and more (and will look like an OS). As it was mentioned it is a massive task.
You CAN write your own OS, but not in an interpreted language. You would need a Python compiler that outputs static native runtime executables without dependencies. And even then there may issues.
Before C most OS code was in assembler, and that is still an option. (See Kolibri/KolibriOS as an example.) Some current projects are leaning on RUST. One I know went back to Pascal because of the structure, protections, and assembler collusion features supporting multi-level coding.
You might see if you can find a copy of the dragon book (Compiler Construction) and create your own compiler, but that project is likely to take longer than just learning to RUST.
Either way, there is a learning curve and a lot of time involved. Not a quick decision...
This seems to be a FAQ that web-searching would find lots of ideas.
To me, LFS, gentoo & mll seem like using bash to 'assemble' a linux(= just the kernel) 'distro'!
Might depend on what parts/functions of an OS interest you the most.
This seems to be a FAQ that web-searching would find lots of ideas.
To me, LFS, gentoo & mll seem like using bash to 'assemble' a linux(= just the kernel) 'distro'!
Might depend on what parts/functions of an OS interest you the most.
Starting from one of those and making custom changes would be making your own DISTRIBUTION, not making your own OS.
Various people have had various issues around screensavers,suspend/hibernate/power-off behaviour and as you see, elogind & polkit have been fingered. Although in my case, something else seems involved also. How logical is that?
My point is: There's a very real chance of you ending up with all your programs sitting up and running, but your efforts being nowhere near release status because subtle config imperfections are making life hell. The standard out there now is high. Most distros have decades of experience, miles of scripts and special purpose utilities. Or else, they have someone behind them who has assimilated such experience.
Last edited by business_kid; 04-14-2024 at 04:05 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.