thisiscoding1234 / os

x86 OS (to PR)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BlueberryOS

Good luck with install (you'll need it)

To install:

curl https://raw.githubusercontent.com/spartanproj/os/master/install.sh -o install.sh;chmod +x install.sh;./install.sh - This requires sudo access (only tested on macOS and Debian)!

  • If you want to install on a non-tested or non Debian based system, install these packages: build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo nasm qemu. You may need more depending on how minimal your OS is

Authored by werdl

Lines of code License Last commit

logo

x86 OS that can do some things

  • maybe ARM but not rn
  • will just have to rewrite some asm

FAQ

Q: Why AGPL?
A: Source code should be available
Q: Why x86?
A: Because ARM asm is hard
Q: Keyboard input isn't working!! oh no!
A: it works on my machine... actually the reason is probably your keyboard. try running with qemu-system-i386
Q: the makefile isn't working!! help!!!
A: do you have everything installed? If you do, try modifying the makefile a bit.

Things it can do

  • print
  • input
  • kernel panic 😎
  • kernel print
  • IDT
  • print integers of any base
  • random numbers (done with Unix system time)
  • memory allocation
  • A few basic commands, but mainly shells will be in userspace
  • Tic tac toe & coin flip
  • 21 Game
  • 'filesystem' WIP
  • backspaces
  • initrd
  • splash text
  • configuration
graph TD
subgraph Basics
A1[Print char *]-->B1[Print decimal];
B1-->C1[Print hex];
B1-->D1[Print any base];
C1-->D1;
B1-->E1[Random numbers];
F1[Memory];
G1[Kernel panic];
A1-->G1;
C1-->G1;
A1-->H1[User input];
H1-->I1[Games];
I1-->J1[21];
I1-->K1[Tic tac toe];
E1-->K1;
A1-->H1-->L1[Basic shell];
style A1 fill:green;
style B1 fill:green;
style C1 fill:green;
style D1 fill:green;
style E1 fill:green;
style F1 fill:green;
style G1 fill:green;
style H1 fill:green;
style I1 fill:green;
style J1 fill:#8B8000;
style K1 fill:green;
style L1 fill:green;
end
subgraph Filesystems
F1-->A;
F1-->B;
A[Journaling];
B-->C[FAT32];
B-->D[EXT2];
A-->B[Custom filesystem];
end
subgraph GUI
A1-->G;
E[Bitmaps];
F[Fonts];
B-->E;
E-->F;
E-->G[GUI];
F-->I;
I-->H[GUI Games];
E-->I[LibGUI];
end
subgraph Usability
I-->J[Porting things];
H-->J;
G-->J;
B-->L[LibC];
L-->Q[Rosemary];
J-->Q;
L-->P[Userspace];
end
L-->J;
subgraph External Storage
C-->M[USBs];
D-->M;

C-->O[Initrd];
O-->L;
L-->O;
O-->P;

end
style A fill:green;
style L fill:#8B8000;
style B fill:#8B8000;
style Filesystems fill:#626619
style Basics fill:#0a6127

Loading

BSOD

Plans

  • libc
  • text based GUI
  • "port" a rewritten Rosemary

Compiling

You will need:

  • A Unix-like environment (Windows no, BSD variants probably, MacOS yes, Cygwin yes, Linux yes, other old Unix variants (eg Irix) probably?? maybe source install for packages)
  • a gcc cross compiler (and binutils) for i386 or i686 (here's how to get that)
  • qemu-system-i386 (brew install -y qemu-system-i386 or the package manager on your distro (check the internet if it's not working.))
  • patience

Testing

We regularly test on:

  • Linux (Debian and Ubuntu) @werdl uses this, so this will almost certainly work
  • Linux mint @thisiscoding1234
  • MacOS by @uimaxbai

When we have spare time on our hands:

  • msys2 (bug with loader means compilation is much harder, wouldn't recommend)
  • Cygwin
  • WSL

Notes for those on MacOS

  • You might say "Aha! I have gcc preinstalled!". You don't. You have a wrapper around clang. The reasoning behind this can be left up to people more important than myself.
  • So you will need gcc normally, as well as your cross-compiled version
  • I'm sure there will be a way!

I can't compile the cross compiler...

  • It is a fair chance that with the right flags that your system gcc is OK (not you MacOS users).
  • If you see something like this
  -march=                               i686
  Known valid arguments for -march= option:
  • when you run
gcc -m32 -Q --help=target | grep march
  • Your compiler is probably fine anyway. For example, on my Github codespace I don't have a cross compiler, but my gcc works anyway!
If your output looks different:
  • Are you rocking GenuineIntel? If not, then you are going to need the cross compiler
  • You are? Well, most modern chips should mainly work, but ARE NOT tested. Pentiums are a bit different under the hood, and probably won't work.
  • Even if you have AMD x86_64, it only may work. ARM will never work, you will need a cross-compiler

I really cannot!

  • Fine, boot up an x86_64 VM and use that systems gcc.
  • I think this is harder than just sucking it up and installing a cross compiler, but who am I to judge?

Steps:

  • git clone this repo
  • install to your dir of choice.
  • run make to compile and run it. Then ctrl-c in your terminal to clean everything up.
  • The script will work out what you have and haven't installed.

It isn't working...

  • If you do not have access to a fully-fledged display, then run
  • Establish if you are on an x86 computer (32-bit or 64-bit). If not, virtualise! It does not work on other architectures.
  • You are on x86...
  • If so, get out your blueberry hat, read through the messages, and attempt to self-compile. If you cannot, then

I don't have make!

  • If you don't have make, get it. You will need a Unix env anyway so it will pay off
  • If you are on Windows, I recommend you try WSL (Debian/similar) or Cygwin.

I love Windows/can't use anything else

  • Step 1 - install msys2
  • Step 2 - install qemu with the installer on their downloads page
  • Step 3 - obtain a kernel.bin from releases or your friends
  • Step 4 - run path/to/qemu-system-i386 -rtc base=localtime -kernel path/to/kernel.bin in msys2

I still haven't found a way to compile on Windows, but I am working on it.

Known limitations

  • can't get *nix timestamp, computationally too much
  • sleep function crashes if launched in the last 5ish seconds of a minute
  • numbers under 10 are suffixed with a triangle ?

How does random work?

In a nutshell:

At compile time, a bash script is run that grabs the Unix epoch time using date +%s. This is then written into a little header file along with some other RNG stuff. DO NOT CHANGE THE NUMBERS unless you know what you are doing!

   ___      _                     _                                _  _    ___     ___   
  | _ )    | |    _  _     ___   | |__     ___      _ _     _ _   | || |  / _ \   / __|  
  | _ \    | |   | +| |   / -_)  | '_ \   / -_)    | '_|   | '_|   \_, | | (_) |  \__ \  
  |___/   _|_|_   \_,_|   \___|  |_.__/   \___|   _|_|_   _|_|_   _|__/   \___/   |___/  
_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_| """"|_|"""""|_|"""""| 
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'                                                                                                   
   ___                              ___      __              ___     ___                                                                            
  /   \   _ _       o O O  __ __   ( _ )    / /      o O O  / _ \   / __|                                                                           
  | - |  | ' \     o       \ \ /   / _ \   / _ \    o      | (_) |  \__ \                                                                           
  |_|_|  |_||_|   TS__[O]  /_\_\   \___/   \___/   TS__[O]  \___/   |___/                                                                           
_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|                                                                          
"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'                                                                          
  _____   _                        _                          __                                                       _      _              __ _   
 |_   _| | |_     __ _    _ _     | |__    ___      o O O    / _|   ___      _ _     o O O    _ _    ___    __ _    __| |    (_)    _ _     / _` |  
   | |   | ' \   / _` |  | ' \    | / /   (_-<     o        |  _|  / _ \    | '_|   o        | '_|  / -_)  / _` |  / _` |    | |   | ' \    \__, |  
  _|_|_  |_||_|  \__,_|  |_||_|   |_\_\   /__/_   TS__[O]  _|_|_   \___/   _|_|_   TS__[O]  _|_|_   \___|  \__,_|  \__,_|   _|_|_  |_||_|   |___/   
_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|  
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'  
  _  _                              __ _                      _                      _                _       _                _      _        _    
 | \| |    ___   __ __ __   o O O  / _` |   ___      o O O   (_)    _ _      ___    | |_    __ _     | |     | |      o O O   (_)    | |_     | |   
 | .` |   / _ \  \ V  V /  o       \__, |  / _ \    o        | |   | ' \    (_-<    |  _|  / _` |    | |     | |     o        | |    |  _|    |_|   
 |_|\_|   \___/   \_/\_/  TS__[O]  |___/   \___/   TS__[O]  _|_|_  |_||_|   /__/_   _\__|  \__,_|   _|_|_   _|_|_   TS__[O]  _|_|_   _\__|   _(_)_  
_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_| """ | 
"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-' 
   ___                                              _ __     _       _                        _      _        _                                     
  / __|    ___      o O O   __      ___    _ __    | '_ \   (_)     | |     ___      o O O   (_)    | |_     | |                                    
 | (_ |   / _ \    o       / _|    / _ \  | '  \   | .__/   | |     | |    / -_)    o        | |    |  _|    |_|                                    
  \___|   \___/   TS__[O]  \__|_   \___/  |_|_|_|  |_|__   _|_|_   _|_|_   \___|   TS__[O]  _|_|_   _\__|   _(_)_                                   
_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_| """ |                                  
"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'  

About

x86 OS (to PR)

License:GNU General Public License v3.0


Languages

Language:C 66.9%Language:Python 24.2%Language:Shell 7.3%Language:Makefile 0.9%Language:Assembly 0.6%