Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to make OS with Qt (Operating System)



  • How do i code a Operating System with Qt?Cause i searched Google,and theres is no result for "Create OS with Qt".

    So i decided to make a new thread for it.
    And i got some question:
    if i want to create a OS with Qt,Can i design it like normal(Like coding an Application).And i need other language(Like Assembly,Javascript .etc) for it?

    Please help me
    I will be very grateful,cause its my dream since i start learned coding



  • @ELEMENTICY

    Seriously?! :D

    Operating Systems work on another level. There is so much more you need to do for that (filesystem, bootloader, different services, etc etc)

    Qt is a GUI framework to create apps for different OS.

    You could do something like this:

    Create your own custom linux distro
    (https://www.linuxjournal.com/content/diy-build-custom-minimal-linux-distribution-source)

    But you are never gonna build your own complex OS from scratch :D



  • @ELEMENTICY

    Seriously?! :D

    Operating Systems work on another level. There is so much more you need to do for that (filesystem, bootloader, different services, etc etc)

    Qt is a GUI framework to create apps for different OS.

    You could do something like this:

    Create your own custom linux distro
    (https://www.linuxjournal.com/content/diy-build-custom-minimal-linux-distribution-source)

    But you are never gonna build your own complex OS from scratch :D



  • @ELEMENTICY said in How to make OS with Qt (Operating System):

    I will be very grateful,cause its my dream since i start learned coding

    Suggest you pick some other more useful/realistic dream! :)

    Entirely as @Pl45m4 has answered. Qt requires an Operating System --- specifically, Windows, Linux, MacOS or whatever mobile --- and is built on top of that. So by definition you could not write an OS in Qt since it already needs & uses one.

    Now, you could write your own OS from scratch --- not using Qt, nor any of the existing ones it can run on --- and then port Qt to support that OS as an additional one. But neither of these tasks (write OS, port Qt) would be for the faint-hearted :)



  • It is Ok to have dreams, Linus Torvalds dreamed with its own operating system, it involved thousands of skilled engineers, companies, many years and millions of dollars to make it a reality. KDE is a Qt based desktop environment that runs on top of the Operating system. Making a custom desktop environment like KDE or gnome is also a huge project, but certainly not as big as a whole operating system.



  • Owh Okay



  • redundant answer but modern computers are based on a layered approach where you start with hardware and then add a common interface layer to communicate with the hardware. On top of that you add common services (that is the OS). Qt is an application framework that exists two layers above the OS.

    OS -> windowing system -> Qt

    And yes, I know the windowing system isn't technically required but the vast majority of Qt apps are GUIs.



  • I'd like to add that this is a very interesting question. The outfacing interface of the Qt framework provides everything one would need for application development. Qt is also written to support different backends. So, to write an operating system using Qt would require to write a new backend. However, the backend needs to be low-level and could not rely on Qt. Basically, you would need a bootloader (at least some assembly on x86 - or use an existing bootloader to load your operating system), input handler, graphics driver, timers, interrupt handlers, ... For example, QFile would need an implementation to access the disk. If you imagine Qt as part of your OS QFile could contain the file system implementation and disk driver. Usually, the OS provides functions for opening, reading and writing files, and Qt will just provide a common interface on different platforms to these functions. But Qt could be extended to provide this functionality itself.

    Typically, all the low-level stuff would be written with some small amount of assembler and the major part using C or C++. Note that by default C++ does not have a standard library if you write your own operating system. You need to provide your own new/delete, std::cout, std::vector, std::string, exception handling, etc. Output, vectors, strings could all be replaced by Qt counterparts. Output/input handling would need to be rewritten with some low-level code outside of Qt.

    To be precise: You cannot write an operating system just using Qt. However, you can write a backend for Qt using very little of Qt (you could already use QString and QVector (QVector after providing new and delete) and such). A lot of the higher level functionality of your OS could then fully rely on Qt. For a fully fledged OS maybe 90+% could be written using Qt. But, until you get Qt fully working, at that point for your very tiny OS 90+% would need to be written without using Qt.



  • @SimonSchroeder

    ... yes, and this would take years or even decades, when you have to do everything on your own.

    Imagine how many developers are currently working on new Ubuntu releases... and these are just upgrades... They don't reinvent the wheel :)
    To create your own independent OS, you'll need a bunch of (skilled and experienced!!) developers and "some" money.

    Even if you get your OS running... There would probably be only one user in the world... you, unless you do something much better or more efficient than the "big three" Windows, Macintosh and UNIX / Linux (or four, if you add Android as separate OS), which would be very unlikely.



  • There was a guy that attempted this. I will let you research him on your own. He is an interesting person (now deceased). He wrote TempleOS. I found the source here. The code is written in a C like dialect that can only be compiled while running templeos. I don't know how to bootstrap the os or build a virtual machine. I think this took him 5 to 10 years to make. This should give you an idea of the scale of what your are proposing. Not compatible with Qt.

    Qt is not suitable for creating an OS. It depends upon an OS itself.

    Now, if you want an "OS" that uses Qt for all its windows. Then you can run KDE window manager on a Linux distro. Kubunutu is a derivative of Ubuntu that defaults to the KDE window manager.



  • You could resurrect the approach of an OS like GEORGE. We need more batch-processing OSes, with offline batch jobs for your work and card input. Modern window-y things are a waste of time & space. And this might be more approachable than Lin/Mac/Win.



  • @JonB You may write that tongue-in-cheek, but it is ridiculous how much the instant gratification model has warped data processing. Much bulk processing could still be done by batch, and give folks a real opportunity to step back, sip a cup of coffee, and smell the roses as it were...it's a sign of a larger societal problem.



  • @Kent-Dorfman
    I do not disagree! Having been brought up on UNIX (not GEORGE!), I do not see why people should need visual file managers when there is ls -l | sort | grep. I can still type faster into vi than move a mouse around a visual editor. Computers should be for the technical elite, not the great unwashed masses ;-)



  • @fcarney TempleOS is just one example of many. Back in the days when newsgroups were a thing, I subscribed to alt.os.dev. There were a lot of hobbyist OS developers. And they all got their own operating systems running. They wrote their own bootloader, input handler (usually just keyboard), terminal output, filesystem (usually their own inventions), and some more. You can get a small OS running in a year or so. It just won't have a GUI and a whole bunch of software.

    If you want to support just a single hardware (or virtual machine) - which means you just need one simple set of drivers - you can certainly pull your own OS. And I believe you can even support Qt if you are a serious hobbyist developer. Sure, it will not be an OS for the masses. For this you would need to build momentum, involve a lot more developers, and much more.

    @Pl45m4 Maintaining Ubuntu is a lot of work because it is a huge OS (compared to one-person toy OSes). It has drivers for a lot of hardware, supports different file systems, has thousands of applications which needs to be maintained, etc. However, getting a small toy OS running is not too much work. At first, it will also not do much because it will miss all the different software.



  • I'd just like to add that OS dev wiki is a good resource. I would start on this page: https://wiki.osdev.org/Required_Knowledge

    It gives you a bit of insight as to what kind of challenge this is. It really is on a whole different level, but if you're dedicated enough, it's not impossible.



  • @SimonSchroeder

    re - writing your own hobbiist OS: and I spend a majority of my time pounding my fist on the table and screaming at the managers when they consider a vendor with an innadequate BSP for the hardware they want us to use.

    re - ubuntu: let canonical do all the work. I mean they are the ones who turned it into "spy"buntu.


Log in to reply