Linux - Desktop This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
|
04-10-2024, 12:09 PM
|
#1
|
LQ Newbie
Registered: Apr 2024
Location: Berlin
Posts: 11
Rep:
|
Can i Create My Own OS
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?
|
|
|
04-10-2024, 12:40 PM
|
#2
|
Senior Member
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 1,039
|
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.
|
|
1 members found this post helpful.
|
04-10-2024, 01:45 PM
|
#3
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,608
|
Quote:
Originally Posted by bekoikc
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."
|
|
1 members found this post helpful.
|
04-10-2024, 02:03 PM
|
#4
|
Member
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 653
|
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.
Last edited by rclark; 04-11-2024 at 05:04 PM.
|
|
1 members found this post helpful.
|
04-10-2024, 02:11 PM
|
#5
|
LQ Newbie
Registered: Apr 2024
Location: Berlin
Posts: 11
Original Poster
Rep:
|
Quote:
Originally Posted by business_kid
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!
|
|
|
04-10-2024, 02:13 PM
|
#6
|
LQ Newbie
Registered: Apr 2024
Location: Berlin
Posts: 11
Original Poster
Rep:
|
Quote:
Originally Posted by business_kid
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 man your'e right thanks!
|
|
|
04-10-2024, 02:13 PM
|
#7
|
LQ Newbie
Registered: Apr 2024
Location: Berlin
Posts: 11
Original Poster
Rep:
|
Quote:
Originally Posted by jayjwa
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 man right thanks
|
|
|
04-11-2024, 03:59 AM
|
#8
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,320
|
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.
|
|
|
04-11-2024, 05:10 AM
|
#9
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,756
|
You might also look at a "unikernel" for your project. If not directly applicable, it might provide some ideas.
|
|
|
04-11-2024, 10:43 AM
|
#10
|
Senior Member
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 1,061
|
One person can realistically write about 0.1% of the code in a modern OS.
One needs to choose those areas carefully, and of course, leverage the work of a thousand helpers.
Ed
|
|
|
04-11-2024, 11:35 AM
|
#11
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,195
|
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...
|
|
|
04-12-2024, 02:58 AM
|
#12
|
Member
Registered: Apr 2023
Distribution: mll,4M
Posts: 271
Rep: 
|
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.
|
|
|
04-12-2024, 09:38 AM
|
#13
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,195
|
Quote:
Originally Posted by ___
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.
On the other hand, it would be a lot less work!
|
|
|
04-12-2024, 10:23 AM
|
#14
|
Member
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 701
|
|
|
|
04-14-2024, 04:03 AM
|
#15
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,608
|
If you wanted to fix screensavers turning off the monitor, ask yourself what you would check? I don't know to what extent you're following other threads, but there's interesting things going on thaqt give an insight to the issues you can face building a distro.
https://www.linuxquestions.org/quest...on-4175735987/
https://www.linuxquestions.org/quest...nt-4175735916/
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.
|
|
|
All times are GMT -5. The time now is 07:03 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|