LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 04-10-2024, 12:09 PM   #1
bekoikc
LQ Newbie
 
Registered: Apr 2024
Location: Berlin
Posts: 11

Rep: Reputation: 0
Lightbulb 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?
 
Old 04-10-2024, 12:40 PM   #2
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 786

Rep: Reputation: 250Reputation: 250Reputation: 250
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.
Old 04-10-2024, 01:45 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,359

Rep: Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333
Quote:
Originally Posted by bekoikc View Post
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.
Old 04-10-2024, 02:03 PM   #4
rclark
Member
 
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 487

Rep: Reputation: 180Reputation: 180
Quote:
Can I create my own 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.

Last edited by rclark; 04-11-2024 at 05:04 PM.
 
1 members found this post helpful.
Old 04-10-2024, 02:11 PM   #5
bekoikc
LQ Newbie
 
Registered: Apr 2024
Location: Berlin
Posts: 11

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by business_kid View Post
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!
 
Old 04-10-2024, 02:13 PM   #6
bekoikc
LQ Newbie
 
Registered: Apr 2024
Location: Berlin
Posts: 11

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by business_kid View Post
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!
 
Old 04-10-2024, 02:13 PM   #7
bekoikc
LQ Newbie
 
Registered: Apr 2024
Location: Berlin
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jayjwa View Post
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
 
Old 04-11-2024, 03:59 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,924

Rep: Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319
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.
 
Old 04-11-2024, 05:10 AM   #9
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
You might also look at a "unikernel" for your project. If not directly applicable, it might provide some ideas.
 
Old 04-11-2024, 10:43 AM   #10
EdGr
Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 998

Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
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
 
Old 04-11-2024, 11:35 AM   #11
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,674

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
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...
 
Old 04-12-2024, 02:58 AM   #12
___
Member
 
Registered: Apr 2023
Posts: 149
Blog Entries: 1

Rep: Reputation: Disabled
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.
 
Old 04-12-2024, 09:38 AM   #13
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,674

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
Quote:
Originally Posted by ___ View Post
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!
 
Old 04-12-2024, 10:23 AM   #14
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
http://wiki.osdev.org/
 
Old 04-14-2024, 04:03 AM   #15
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,359

Rep: Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333
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.
 
  


Reply

Tags
c++, create, operating system, python



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How difficult is it to create your own C compiler and then use that compiler to compile your own custom Linux kernel? z3rOR0ne Linux - Newbie 17 05-01-2022 03:42 PM
Need to create my own local service, my own local server - how I can do that? igadoter Linux - Server 14 09-05-2019 04:56 PM
Need info on how to create my own linux distro without using one of the roll your own xiqtem Linux - General 3 07-16-2010 11:53 PM
how to create my own slackware install DVD with my own kernel dont_stop_me Slackware 4 03-05-2010 03:33 AM
Is multiple owners of a single file possible? can user1 own a file that root also own dave247 Debian 3 10-09-2008 04:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 03:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration