Skip to content

Commit

Permalink
release the memes
Browse files Browse the repository at this point in the history
  • Loading branch information
BluDood committed Jun 28, 2022
0 parents commit f42267c
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.o
*.iso
*.elf

# https://raw.githubusercontent.com/whitequark/story-os/master/grub/stage2_eltorito for you nerds
stage2_eltorito
25 changes: 25 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build ISO",
"type": "shell",
"command": "./scripts/build.cmd",
"problemMatcher": []
},
{
"label": "Purge Old Files",
"type": "shell",
"command": "./scripts/purge.cmd",
"problemMatcher": []
},
{
"label": "Start QEMU",
"type": "shell",
"command": "./scripts/start.cmd",
"problemMatcher": []
}
]
}
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# BluShellOS
## The greatest iteration of BluShell.
![](screen.png)
Drop your Windows, Linux, macOS installations for the most light-weight and easy-to-use operating system yet.
## Features
* Setup
*

## Running
1. Download the .iso from the [releases]()
2. Attach the .iso to a QEMU x86_64/i386 machine
3. Experience BluShell Setup

## Building
Just don't

## Credits
* Me
* [BluDood](https://bludood.com)
* [OSDev](https://wiki.osdev.org)
4 changes: 4 additions & 0 deletions isoroot/boot/grub/grub.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
menuentry "BluShell" {
multiboot /boot/blushell.elf
boot
}
5 changes: 5 additions & 0 deletions isoroot/boot/grub/menu.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
default 0
timeout 0

title BluShell
kernel /boot/kernel.elf
111 changes: 111 additions & 0 deletions kernel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#include <stddef.h>
#include <stdint.h>

#if defined(__linux__)
#error "This code must be compiled with a cross-compiler"
#elif !defined(__i386__)
#error "This code must be compiled with an x86-elf compiler"
#endif

volatile uint16_t* vga_buffer = (uint16_t*)0xB8000;
const int VGA_COLS = 80;
const int VGA_ROWS = 24;

int term_col = 0;
int term_row = 0;
uint8_t term_color = 0x1F;

void term_init() {
for (int col = 0; col < VGA_COLS; col ++) {
for (int row = 0; row < VGA_ROWS; row ++) {
const size_t index = (VGA_COLS * row) + col;
vga_buffer[index] = ((uint16_t)term_color << 8) | ' ';
}
}
}

void term_putc(char c) {
switch (c) {
case '\n':
{
term_col = 0;
term_row ++;
break;
}

default:
{
const size_t index = (VGA_COLS * term_row) + term_col;
vga_buffer[index] = ((uint16_t)term_color << 8) | c;
term_col ++;
break;
}
}

if (term_col >= VGA_COLS) {
term_col = 0;
term_row ++;
}

if (term_row >= VGA_ROWS) {
term_col = 0;
term_row = 0;
}
}

void term_setpos(int col, int row) {
term_col = col;
term_row = row;
}

void term_setbg(uint8_t color) {
term_color = color;
}

void term_print(const char* str) {
for (size_t i = 0; str[i] != '\0'; i ++) {
term_putc(str[i]);
}
}

void kernel_main() {
term_init();
term_print("\n");
term_print(" BluDood Inc. BluShell Kernel 1.0 Setup\n");
term_print(" ============================");
term_setbg(0xF0);
for (int i = 0; i <= 80; i++) {
term_setpos(i, VGA_ROWS);
if (i == 60) {
term_print("|");
} else {
term_print(" ");
}
}
const char* bottom = "stay sussy";
for (size_t i = 0; bottom[i] != '\0'; i ++) {
term_setpos(i, VGA_ROWS);
term_putc(bottom[i]);
}
term_setbg(0x1F);
term_setpos(3, 4);
term_print("Welcome to Setup.");
term_setpos(3, 6);
term_print("The Setup program prepared BluDood Inc. BluShell 1.0 to");
term_setpos(3, 7);
term_print("run on your computer.");
term_setpos(5, 9);
term_print(" * To set up BluShell now, press Enter.");
term_setpos(5, 11);
term_print(" * To learn more about Setup before continuingm press F1.");
term_setpos(5, 13);
term_print(" * To quit Setup without installing BluShell, press F3.");
term_setpos(3, 15);
term_print("Note: BluShell is not functional. Nothing works :troll:");
term_setpos(3, 17);
term_print("Socials:");
term_setpos(5, 19);
term_print("Email: [email protected]");
term_setpos(5, 21);
term_print("Twitter: @ItsBluDood");
}
32 changes: 32 additions & 0 deletions linker.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ENTRY(start)

SECTIONS
{
. = 1M;

.rodata BLOCK(4K) : ALIGN(4K)
{
*(.multiboot)
}

.text BLOCK(4K) : ALIGN(4K)
{
*(.text)
}

.rodata BLOCK(4K) : ALIGN(4K)
{
*(.rodata)
}

.data BLOCK(4K) : ALIGN(4K)
{
*(.data)
}

.bss BLOCK(4K) : ALIGN(4K)
{
*(COMMON)
*(.bss)
}
}
Binary file added screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions scripts/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@echo off
call scripts/purge.cmd
echo Building ISO...
i686-elf-gcc -std=gnu99 -ffreestanding -g -c start.s -o start.o
i686-elf-gcc -std=gnu99 -ffreestanding -g -c kernel.c -o kernel.o
i686-elf-gcc -ffreestanding -nostdlib -g -T linker.ld start.o kernel.o -o kernel.elf -lgcc
copy kernel.elf isoroot\boot
genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o blushell.iso isoroot
call scripts/purge.cmd
call scripts/start.cmd
3 changes: 3 additions & 0 deletions scripts/purge.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
echo Purging old files...
del kernel.o start.o kernel.elf isoroot\boot\kernel.elf
3 changes: 3 additions & 0 deletions scripts/start.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
echo Starting QEMU...
qemu-system-x86_64 -cdrom blushell.iso
29 changes: 29 additions & 0 deletions start.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.extern kernel_main

.global start

.set MB_MAGIC, 0x1BADB002
.set MB_FLAGS, (1 << 0) | (1 << 1)
.set MB_CHECKSUM, (0 - (MB_MAGIC + MB_FLAGS))

.section .multiboot
.align 4
.long MB_MAGIC
.long MB_FLAGS
.long MB_CHECKSUM

.section .bss
.align 16
stack_bottom:
.skip 4096
stack_top:

.section .text
start:
mov $stack_top, %esp
call kernel_main

hang:
cli
hlt
jmp hang

0 comments on commit f42267c

Please sign in to comment.