lainchan / λ
(untitled)
Faye Valentine · 2023-07-16 06:54
hey /λ/
i really wanna make an OS, Linux distro, Firefox extensions an maybe some other stuff
what language do you guys recommend
Spooky · 2023-07-16 07:13
It really depends on what will you make. WebExtentions use Javascript. Linux distributions are just different compoments assembled and tied together and an OS from scratch is a large task that requires a good understanding of computers.
Agent Smith · 2023-07-16 09:08
>i really wanna make an OS
I would recommend Guix. You specify the whole operating system you want and Guix goes and builds it for you. For example, the following defines a simple Among Us operating system that
1) has a user named Crewmate
2) uses XFCE
3) has a Among Us themed background image
4) can be run in a virtual machine via 'guix system vm <file>'
4) can be build into a ready-to-go bootable ISO disk image via 'guix system image -t iso9660 <file>'
>Firefox extensions
You would specify the browser (Firefox is packaged as Icecat) and extensions as packages to be added to the OS.
(use-modules (gnu) (guix))
(use-service-modules desktop xorg)
(use-package-modules xfce xorg)
(define susground (local-file "susmedia/susground.jpg" "susground"))
(define susclose (local-file "susmedia/susclose.jpg" "susclose"))
(define my-xfdesktop (package
(inherit xfdesktop)
(inputs (modify-inputs (package-inputs xfdesktop) (append susground susclose)))
(arguments `(#:phases (modify-phases %standard-phases
(delete 'prepare-background-image)
(add-after 'unpack 'copy-susground
(lambda* (#:key inputs #:allow-other-keys)
(copy-file
(string-append (assoc-ref inputs "_") "")
"backgrounds/xfce-verticals.png"))))))))
(define my-xfce (package
(inherit xfce)
(inputs (modify-inputs (package-inputs xfce) (replace "xfdesktop" my-xfdesktop)))))
(operating-system
(host-name "Amogite")
(timezone "Europe/London")
(locale "en_US.UTF-8")
(keyboard-layout (keyboard-layout "us" "altgr-intl"))
(issue "Starting up, please ignore\n")
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
(keyboard-layout keyboard-layout)
(targets '("/dev/sda")))) ; or (target "/boot/efi")
(file-systems %base-file-systems)
(users (cons (user-account
(name "Crewmate")
(password "password")
(group "spaceship")
(supplementary-groups '("wheel")) ; allow use of sudo
(comment "Not an imposter"))
%base-user-accounts))
(groups (append (list
(user-group (name "spaceship")))
%base-groups))
(services (append (list
(service xfce-desktop-service-type (xfce-desktop-configuration (xfce my-xfce)))
(set-xorg-configuration
(xorg-configuration
(keyboard-layout keyboard-layout))))
(modify-services %desktop-services
(gdm-service-type config => (gdm-configuration
(inherit config)
(default-user "Crewmate")
(auto-login? #true)
(auto-suspend? #false)))))))
word · 2023-07-16 09:13
>I forgot to attach pic to the previous post.
>flood detected
>forgets to reattach pic
every single time
J.C. Denton · 2023-07-31 10:43
>>36490
Perl and Bash and do LFS (Linux from scratch) then you can get into building your own distro.
John Rain · 2023-07-31 11:55
>>36491
>an OS from scratch is a large task that requires a good understanding of computers.
This is just a meme IMO. Unless someone has delusions of supplanting Linux or something, writing an OS from scratch will _lead to_ a good understanding of computers. Yeah, almost everyone will eventually fail, but OS dev is about the journey, not the destination.
Just getting the most basic of kernels operational and managing memory will put one miles ahead of boot camp webshits in terms of knowledge.
Trinity · 2023-07-31 15:25
Zig or Odin definitely. Anyone who gives any other answer is simply incorrect
Vasya Pupkin · 2023-07-31 16:25
>>36490
>i really wanna make an OS
If you are ultra smart, asm, if just regular smart, rust.
Take 10 years to write it, and then you will know the answers for the other questions.
x<->y · 2023-07-31 18:16
>>36612
It depends what you're trying to do. Writing something dead simple where the entire feature-set is more or less "has filesystem", "displays text", and "can load program (only one at a time)", while not exactly easy, is definitely doable.
But making a "proper" operating system, something that can theoretically be used for day-to-day tasks (think TempleOS), is a big undertaking that's beyond most people's skill threshold.
William Holtzer · 2023-08-02 22:09
>>36614
Rust is a very bad answer for an OS. Anything regarding allocation will be in an unsafe block.
Almost any other language is more suitable:
Forth is fairly solid, it can run even without an operating system, nor a file system
Lisp is fairly good as well, some of the finest OS's were written in Lisp.
Overall though if you really really believe having gc is prohibitive for writing an OS (it isn't), then forth is the way to go.
>>36616
Depends, something like colorForth is only 8k lines of assembly and it's fairly serviceabile for doing every day tasks. In a way even a plain lisp forth etc is an operating system, you just end up booting most of the environment in the language itself.
>>36613
I don't see how your answer follows. If you are making a linux distro you are namely stitching together c libs, thus you use C for unix typically. For an OS, lots of things can work. The easiest language to bootstrap a system is forth, as it takes less than 4 blocks of memory [1]
[1] https://github.com/forthy42/gforth/blob/master/blocked.fb
for a better view load it into forth yourself
https://gforth.org/manual/Blocks.html
Nanashi No Gombe · 2023-08-29 19:54
>>36635
>The easiest language to bootstrap a system is forth, as it takes less than 4 blocks of memory [1]
>[1] >https://github.com/forthy42/gforth/blob/master/blocked.fb
>for a better view load it into forth yourself
>https://gforth.org/manual/Blocks.html
And gforth is a bloat forth
t · 2023-08-30 01:57
> i really wanna make an OS
Assembly, C, C++ or Rust.
Check out the OSDev wiki, there are lots of information. You can even have basic booting "OS" that displays a text (just that) in a week probably.
https://wiki.osdev.org/Bare_bones
> Linux distro
Did you check out the LFS?
https://linuxfromscratch.org/lfs/
> Firefox extensions
JavaScript. Maybe TypeScript.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension
> maybe other stuff
You can use C knowledge on Arduino or embedded projects.
C++ can be used for many things. Web browsers, server applications, Unreal Engine projects, or you can just use SDL2 and roll your own 2D games. With OpenGL (GLEW, GLM etc.) you can make your own 3D games from scratch.
With JavaScript doors to JavaScript front-end frameworks (React, Vue, Svelte, Angular) open. Also you can develop desktop apps with Electron (it's resource heavy), web servers/APIs (Node.js) and mobile applications (React Native).
It all takes time. Every one of these have advantages and disadvantages. Some people are fanatics about them, some are not.
Liet Kynes · 2023-08-30 13:45
>>36490
>i really wanna make
>OS
C, Assembly, Rust
>Linux distro
Try LFS first (linux from scratch)
>Firefox extensions
HTML+CSS+JS
Check official docs at mdn (addons, extensions)
Good luck, never give up!
Ender · 2023-08-31 14:13
>>36635
>Rust is a very bad answer for an OS. Anything regarding allocation will be in an unsafe block.
Retard spotted. Unsafe just means that the conpiler cant verify that your code will exhibit undefined behavior. In C/C++ everything is inherently unsafe yet it's what all major OSes use.
It's also vastly superior than any other language as far as I know (experienced with C/C++/Go/Scala/Haskell/JS myself) and its power is in providing you with whatever level of safety/abstraction nrcessary, therefore it can be used for everything from web servers to embedded systems.
See RedoxOS for a PoC of an OS written in Rust.
>Overall though if you really really believe having gc is prohibitive for writing an OS (it isn't), then forth is the way to go.
It is. Operating systems are real-time systems and therefore cant afford to block at any point during their execution. Forth to me seems like a programming language that will make the process of writing an OS unncessarily overcomplicated due to having zero abstractions. Might as well go for C/C++ at that point.
Masami Eiri · 2023-09-01 08:55
>>36989
> Retard spotted. Unsafe just means that the conpiler cant verify that your code will exhibit undefined behavior.
I believe you haven't thought through your position. Rust, thanks to it's borrow checker, assumes a lot more about how memory is laid out internally. This comes from a compound of facts, such as invariants the compiler is imposing upon code. in [1], a person who is sympathetic to Rust lays it out
> Unsafe Rust is hard. A lot harder than C, this is because unsafe Rust has a lot of nuanced rules about undefined behaviour (UB) — thanks to the borrow checker — that make it easy to perniciously break things and introduce bugs.
> This is because the compiler makes optimizations assuming you’re following its ownership rules. But if you break them, thats considered undefined behaviour, and the compiler chugs along, applying those same optimizations and potentially transforming your code into something dangerous.
> To make matters worse, Rust doesn’t fully know what behaviour is considered undefined4, so you could be writing code that exhibits undefined behaviour without even knowing it.
This doesn't even tackle other issues with Rust, which I'm forced to deal with at work.
> In C/C++ everything is inherently unsafe yet it's what all major OSes use.
Ι think you are over-exaggerating, I would not call the C code in the linux kernel that was created by F^★ as unsafe by any means. In fact I'd have much higher confidence in any F^★ code extracted to C, than any Rust code. Just because you have your pet static analysis tool, the borrow checker, does not mean code without it or some equivalent that any piece of code is unsafe. Linked in [2], are all F^★ examples extracted to C and used in real applications. I'll also point at NASA which does high levels of testing, and require somewhat stringent standards on their C.
> It's also vastly superior than any other language as far as I know (experienced with C/C++/Go/Scala/Haskell/JS myself)
Maybe you should use better languages. Go is a language that can't abstract and is overall rather bad. Scala has some of the worst language design I've ever seen, and working in it is a nightmare. Haskell lacks any sort of tooling, it's nice and more powerful in Rust in many ways, but my god is the tooling worse than Rust (if that is even possible [if you don't know what Ι mean go to #programming on the IRC for more details]).
All the languages you've listed, besides potentially JS, are batch languages, and Ι believe you've never really played with any language that is a proper system. A proper system let's you play with it Live. In LISP, SMALLTALK, ERLANG, or FORTH, I can very easily just define functions, redefine them, allocate memory regions, play with the memory I've allocated and see what results I all get live. The closest you have to this (besides JS), is Haskell, but the system itself does not support any such behavior, as every time you try to redefine a function it will reset all other information in your prompt. This means that many Haskeller's (and OCaml folk) simply don't use the REPL. We will get back to this point when you start to bash forth, however let it be known that you have no experience with some of the most powerful techniques that exist for writing, editing, and testing out systems.
> and its power is in providing you with whatever level of safety/abstraction nrcessary, therefore it can be used for everything from web servers to embedded systems.
Yes a language which you can't even write `if` is somehow able to be more abstract than Forth or Lisp. Also yes I know Rust Macros exist, however have fun trying to unquote this! #[symbol = "$x"]. Fundamentally Rust isn't that high level. I run into constant issues with not being able to derive traits on types that aren't in my crate. Instead of having proper mitigation strategies, the Rust language designers (and yes you can't change this) have decided you can't do it. Meanwhile in CL SLY/SLIME modify the stack frames to present it to the user better. These tools you can write yourself in a few lines of code....
> See RedoxOS for a PoC of an OS written in Rust.
I can do better than PoC for Operating systems. Technically any implementation of LISP, Smalltalk, Forth, and Erlang are all operating systems. They may not be baremetal but they are still operating systems at it's core.
The simplest one is JonesForth written in Assembly and Forth [3]. The 700 (2,000 with comments) lines of assembly is all it takes, and from there Forth writes itself, from `if` to `case`, all in Forth!
Further throughout history some of the best operating systems we've had were written in higher level languages, C when it was used to write operating systems was considered too high level for such work, and thus I present you the genera lisp machine (the finest) and the smalltalk machine [4] [5]. Further I have a list of forth systems some of them on baremetal in [6]. Note that often when one runs forth on embedded systems, you flash it once, and then when you program, it's on the embedded system talking to whatever terminal you've hookedup to it. When you are done you can flash the new words for persistence, but it's a very nice feeling to interactively test hardware, read this story about how 3 forths make a hole [7]. For one last goodie I will also link [8], 144 computers on one little chip all talking to each other with Forth!
> Operating systems are real-time systems
Wrong. Linux isn't even real-time. Some operating systems are real time, yes. However we have historical examples, of even when hardware was slow of Operating systems with running languages with GC all the way down. Your mentality reeks of the same mentality that said C was too high level for an operating system, we've just moved a few decades.
> Forth to me seems like a programming language that will make the process of writing an OS unncessarily overcomplicated due to having zero abstractions. Might as well go for C/C++ at that point.
This comment is very strange. Forth code is often much more high and low level than the equivalent rust, one defines words and builds up a system from there. For big projects this ends up with code that is quite high level. A good example of writing in forth is [9]. Further when talking about abstraction, lumping together C and C++ just shows you don't know what you're talking about. C++ adds a bunch of features to C, and is more "high level".
[1] https://zackoverflow.dev/writing/unsafe-rust-vs-zig/
[2] https://project-everest.github.io/
[3] https://github.com/ratfactor/nasmjf/blob/main/jonesforth/jonesforth.S
[4] https://en.wikipedia.org/wiki/Genera_(operating_system)
[5] https://wiki.squeak.org/squeak/1762
[6] https://forth-standard.org/systems
[7] https://www.complang.tuwien.ac.at/anton/euroforth/ef03/pelc-oakford03.pfd
[8] https://etherforth.org/
[9] https://www.youtube.com/watch?v=mvrE2ZGe-rs
Yuki Nagato · 2023-09-01 12:09
>>36991
The man wrote a paper as a reply
Roy Batty · 2023-09-01 15:45
>>36996
absolutely blasted him though, with citations and everything
watch the other guy reply with some "nuh uh" sort of reply though