• Stars
    star
    200
  • Rank 195,325 (Top 4 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created almost 3 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The NanoShell Operating System 🐢

The NanoShell Operating System

NanoShell is a preemptively multi-tasked 32-bit operating system with a windowed GUI.

Be advised that this is beta-level software and you should not expect any stability from it.

Third-party attributions

This software is licensed under the GNU General Public License version 3 or later, except in the following components:

The following third party code is also licensed under the GNU GPL version 3.

Want to contribute?

Just do it! Kidding aside, feel free to make a pull request! (I'd like it even more if you could help me clean up the source!)

Coding style guidelines NanoShell C Library info

Demo Screenshots

[More images...](https://github.com/iProgramMC/NanoShellOS/blob/master/images)

Goals

This OS is entirely running in ring-0. I'm not particularly concerned with safety, as the OS isn't about safety, it's about having fun. The design is NOT the best, by ANY means, so you probably shouldn't imitate this design.

Feel free to submit issues you may have with this OS in the Issues tab. To discuss other things, join the Discord server.

  • Hello World

Primordial tasks

  • Paging and dynamic memory allocation
  • Loading an ELF at some virtual address with its own heap and executing it
  • Task Switching (concurrent threads)
  • TSC-backed timing (works best on systems with an invariant TSC, but it's not that crappy on older systems, as the TSC recalibrates itself every second)
  • FPU and SSE support

User

  • A basic shell, can execute applications
  • Get a GUI running (Also in a task)
  • Applications can use the GUI API
  • Port DOOM
  • Move all applications that don't depend on features I'm not willing to expose to user applications (i.e. taskbar/systemmonitor will stay)
  • Compile C code to an NSE file (I'll probably port TCC to NanoShell)
  • Allow applications to temporarily upload and use their own resources in the kernel (icons, text, images etc)

Drivers

  • PS/2 Mouse and Keyboard
  • EGA Text mode
  • VBE Graphics mode (fast)
  • Bochs/QEMU debugcon (E9 hack)
  • Serial port
  • PCI (Barebones support right now)
  • VirtualBox/QEMU/Bochs graphics device (not VBE)
  • VMware absolute cursor
  • VirtualBox absolute cursor
  • VMware SVGA device
  • Sound devices (e.g. SoundBlaster 16, AC'97, Intel HD Audio)
  • USB keyboard
  • USB mouse
  • Some USB storage devices

Permanent memory

  • Block storage abstraction base
  • ATA devices (PIO mode)
  • ATA devices (using DMA)
  • AHCI devices (using DMA)
  • NVMe?
  • USB stick device driver

File system

  • EXT2:
  • * Read only support.
  • * Expand a file.
  • * Shrink a file.
  • * Write data to a file.
  • * Create a file entry.
  • * Rename a file entry.
  • * Unlink a file.
  • * Create a directory.
  • * Remove an empty directory.
  • * Do all these things with flying colors from e2fsck.
  • FAT32:
  • * Read only support.
  • * Expand a file.
  • * Shrink a file.
  • * Write data to a file.
  • * Create a file entry.
  • * Rename a file entry.
  • * Delete a file.
  • * Create a directory.
  • * Remove an empty directory.
  • * Do all these things with flying colors from chkdsk.

The future

  • An installer, which deploys Limine onto a system, creates a FAT32 (or EXT2?) file system and creates a working installation of NanoShell
  • An in-built IDE (which depends on the compiler thing I mentioned earlier)
  • (ultimate boss) Port Mesa and Super Mario 64 (based on the DOS port, please)

Build instructions

Linux:

The following dependencies are required: xorriso clang ld. Install them first. An example of how to install them:

sudo apt-get install xorriso clang

Then, run make.

(Note: you can use NCC=<compiler>, NAS=<assembler> or NLD=<linker> to build NanoShell with different versions of clang, nasm or ld)

Building an image

To build the image, run the following set of commands:

make
make initrd
make limine
make image

In the build directory, you should now have an image.iso that you can mount into your favorite x86 emulator and run.

Building NanoShell applications

Should you wish to build NanoShell applications as well, you will also have to do the following command:

make -C tools

Afterwards, you can cd apps/<whatever> and simply type make. You will have to copy the resulting *.nse over by yourself, though.

Windows:

It may or may not come back soon.

Installation

GRUB

If you don't have grub2, install it. It's relatively easy.

Once you have a grub installed on your favorite USB drive, create a grub.cfg inside the grub directory. Add the following lines:

menuentry "NanoShell" {
	multiboot /boot/kernel.bin root=/ emergency=no
	module    /boot/initrd.tar
	set gfxpayload=1024x768x32
	boot
}

Side note: if you've installed NanoShell on a FAT32-formatted IDE hard disk you can use root=/Fat0 (where Fat0 can be swapped out for any FatX device). Also you may change the gfxpayload to any resolution that GRUB supports.

Note that you can place your kernel image anywhere, but I prefer /boot/kernel.bin. Place your kernel image so that grub can find it, and then restart.

Limine

To boot NanoShell using Limine, you can take a look at the example limine.cfg.

TIMEOUT=3

:NanoShell OS

PROTOCOL=multiboot1

CMDLINE=root=/ emergency=no
KERNEL_PATH=boot:///kernel.bin
MODULE_PATH=boot:///initrd.tar

Just like in the grub install example, you can change the root to anywhere.

And you're done! You should be in NanoShell now. If you are in emergency text mode (another parameter in the CMDLINE: emergency=yes), the command w takes you to the GUI.

Running

QEMU

NanoShell works on QEMU version 6.2.0 with TCG, though I'm pretty sure it also works on earlier versions too.

NanoShell does not work on QEMU version 6.2.0 with WHPX enabled.

VirtualBox

NanoShell works on VirtualBox version 6.0 - 6.1 for sure, though I'm pretty sure it also works on earlier versions too.

The OS works best with VT-x/AMD-V enabled. Hyper-V performance in VirtualBox is very slow even on Windows. It's best to turn OFF Hyper-V/Virtual Machine Platform on Windows.

VMware

I've only done one VMware test, but it should work fine on there too.

Real Hardware

My main testing box is a computer with an Intel Core 2 CPU and 2 GB of RAM (reported 512 MB though). It works just fine, although you will need a real PS/2 mouse (a USB mouse will not work, yet), and a real PS/2 keyboard (I haven't done any testing whether USB keyboards also work with PS/2 emulation, but I like to be on the safe side and use both.)

Because it works on QEMU with TCG on my machine (which is a software emulator), I think it'll work on slower machines too.

More Repositories

1

Boron

The Boron Operating System - an experimental SMP operating system inspired by a particular 1990s workstation OS
C
41
star
2

NanoShell64

The NanoShell64 Operating System - an x86_64 SMP aware OS. Abandoned as of August 20th, 2023, see below link.
C++
15
star
3

DSGameEngine

A DS game engine based off libnds with frame buffer capabilities for the top screen.
C
7
star
4

Growtopia_ItemsDatReader

Deserializer for items.dat (Growtopia)
C#
7
star
5

Growtopia_ItemsDatEncoder

Items.dat encoder for the Growtopia_ItemsDatReader outputted files.
C#
6
star
6

FPRaycaster

simple first person raycaster written in C++ using olcPixelGameEngine
C++
3
star
7

sm64-wide-textboxes

Mod for SM64, includes wide textboxes
C
2
star
8

CPPOregonTrail

Inspired by https://github.com/jefftasticgames/school-projects/blob/main/oregon.py, easily portable to other platforms
C++
2
star
9

NanoShellExperimental

This repository is where I put my experiments regarding OS dev. Successful experiments may be ported later on to https://github.com/iProgramMC/NanoShellOS
C
2
star
10

EasyExporter

This is a level exporter. Requires SM64 decomp and a knowledge of how levels work.
C#
2
star
11

NanoShellSW

Software for the NanoShell Operating System. https://github.com/iProgramMC/NanoShellOS
C
1
star
12

sm64port2

Shell
1
star
13

ActivityMonitor

An activity monitor for Windows.
C#
1
star
14

OneLoneCoder_Platformer_XNAPort

A port in C# with the XNA Game Framework of OneLoneCoder's platformer engine
C#
1
star
15

iProgramMC

1
star
16

DSPlatformMaker

Platformer game maker for the Nintendo DS.
C++
1
star
17

BinarySerialization

This is a utility function for serializing stuff. You can also use .NET's own BinaryReader/Writer combo, but this works on a Byte array, not a Stream.
C#
1
star