Skip to content

Commit f42267c

Browse files
committed
release the memes
0 parents  commit f42267c

File tree

12 files changed

+248
-0
lines changed

12 files changed

+248
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.o
2+
*.iso
3+
*.elf
4+
5+
# https://raw.githubusercontent.com/whitequark/story-os/master/grub/stage2_eltorito for you nerds
6+
stage2_eltorito

.vscode/tasks.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Build ISO",
8+
"type": "shell",
9+
"command": "./scripts/build.cmd",
10+
"problemMatcher": []
11+
},
12+
{
13+
"label": "Purge Old Files",
14+
"type": "shell",
15+
"command": "./scripts/purge.cmd",
16+
"problemMatcher": []
17+
},
18+
{
19+
"label": "Start QEMU",
20+
"type": "shell",
21+
"command": "./scripts/start.cmd",
22+
"problemMatcher": []
23+
}
24+
]
25+
}

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# BluShellOS
2+
## The greatest iteration of BluShell.
3+
![](screen.png)
4+
Drop your Windows, Linux, macOS installations for the most light-weight and easy-to-use operating system yet.
5+
## Features
6+
* Setup
7+
*
8+
9+
## Running
10+
1. Download the .iso from the [releases]()
11+
2. Attach the .iso to a QEMU x86_64/i386 machine
12+
3. Experience BluShell Setup
13+
14+
## Building
15+
Just don't
16+
17+
## Credits
18+
* Me
19+
* [BluDood](https://bludood.com)
20+
* [OSDev](https://wiki.osdev.org)

isoroot/boot/grub/grub.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
menuentry "BluShell" {
2+
multiboot /boot/blushell.elf
3+
boot
4+
}

isoroot/boot/grub/menu.lst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
default 0
2+
timeout 0
3+
4+
title BluShell
5+
kernel /boot/kernel.elf

kernel.c

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#include <stddef.h>
2+
#include <stdint.h>
3+
4+
#if defined(__linux__)
5+
#error "This code must be compiled with a cross-compiler"
6+
#elif !defined(__i386__)
7+
#error "This code must be compiled with an x86-elf compiler"
8+
#endif
9+
10+
volatile uint16_t* vga_buffer = (uint16_t*)0xB8000;
11+
const int VGA_COLS = 80;
12+
const int VGA_ROWS = 24;
13+
14+
int term_col = 0;
15+
int term_row = 0;
16+
uint8_t term_color = 0x1F;
17+
18+
void term_init() {
19+
for (int col = 0; col < VGA_COLS; col ++) {
20+
for (int row = 0; row < VGA_ROWS; row ++) {
21+
const size_t index = (VGA_COLS * row) + col;
22+
vga_buffer[index] = ((uint16_t)term_color << 8) | ' ';
23+
}
24+
}
25+
}
26+
27+
void term_putc(char c) {
28+
switch (c) {
29+
case '\n':
30+
{
31+
term_col = 0;
32+
term_row ++;
33+
break;
34+
}
35+
36+
default:
37+
{
38+
const size_t index = (VGA_COLS * term_row) + term_col;
39+
vga_buffer[index] = ((uint16_t)term_color << 8) | c;
40+
term_col ++;
41+
break;
42+
}
43+
}
44+
45+
if (term_col >= VGA_COLS) {
46+
term_col = 0;
47+
term_row ++;
48+
}
49+
50+
if (term_row >= VGA_ROWS) {
51+
term_col = 0;
52+
term_row = 0;
53+
}
54+
}
55+
56+
void term_setpos(int col, int row) {
57+
term_col = col;
58+
term_row = row;
59+
}
60+
61+
void term_setbg(uint8_t color) {
62+
term_color = color;
63+
}
64+
65+
void term_print(const char* str) {
66+
for (size_t i = 0; str[i] != '\0'; i ++) {
67+
term_putc(str[i]);
68+
}
69+
}
70+
71+
void kernel_main() {
72+
term_init();
73+
term_print("\n");
74+
term_print(" BluDood Inc. BluShell Kernel 1.0 Setup\n");
75+
term_print(" ============================");
76+
term_setbg(0xF0);
77+
for (int i = 0; i <= 80; i++) {
78+
term_setpos(i, VGA_ROWS);
79+
if (i == 60) {
80+
term_print("|");
81+
} else {
82+
term_print(" ");
83+
}
84+
}
85+
const char* bottom = "stay sussy";
86+
for (size_t i = 0; bottom[i] != '\0'; i ++) {
87+
term_setpos(i, VGA_ROWS);
88+
term_putc(bottom[i]);
89+
}
90+
term_setbg(0x1F);
91+
term_setpos(3, 4);
92+
term_print("Welcome to Setup.");
93+
term_setpos(3, 6);
94+
term_print("The Setup program prepared BluDood Inc. BluShell 1.0 to");
95+
term_setpos(3, 7);
96+
term_print("run on your computer.");
97+
term_setpos(5, 9);
98+
term_print(" * To set up BluShell now, press Enter.");
99+
term_setpos(5, 11);
100+
term_print(" * To learn more about Setup before continuingm press F1.");
101+
term_setpos(5, 13);
102+
term_print(" * To quit Setup without installing BluShell, press F3.");
103+
term_setpos(3, 15);
104+
term_print("Note: BluShell is not functional. Nothing works :troll:");
105+
term_setpos(3, 17);
106+
term_print("Socials:");
107+
term_setpos(5, 19);
108+
term_print("Email: [email protected]");
109+
term_setpos(5, 21);
110+
term_print("Twitter: @ItsBluDood");
111+
}

linker.ld

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
ENTRY(start)
2+
3+
SECTIONS
4+
{
5+
. = 1M;
6+
7+
.rodata BLOCK(4K) : ALIGN(4K)
8+
{
9+
*(.multiboot)
10+
}
11+
12+
.text BLOCK(4K) : ALIGN(4K)
13+
{
14+
*(.text)
15+
}
16+
17+
.rodata BLOCK(4K) : ALIGN(4K)
18+
{
19+
*(.rodata)
20+
}
21+
22+
.data BLOCK(4K) : ALIGN(4K)
23+
{
24+
*(.data)
25+
}
26+
27+
.bss BLOCK(4K) : ALIGN(4K)
28+
{
29+
*(COMMON)
30+
*(.bss)
31+
}
32+
}

screen.png

3.39 KB
Loading

scripts/build.cmd

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@echo off
2+
call scripts/purge.cmd
3+
echo Building ISO...
4+
i686-elf-gcc -std=gnu99 -ffreestanding -g -c start.s -o start.o
5+
i686-elf-gcc -std=gnu99 -ffreestanding -g -c kernel.c -o kernel.o
6+
i686-elf-gcc -ffreestanding -nostdlib -g -T linker.ld start.o kernel.o -o kernel.elf -lgcc
7+
copy kernel.elf isoroot\boot
8+
genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o blushell.iso isoroot
9+
call scripts/purge.cmd
10+
call scripts/start.cmd

scripts/purge.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
echo Purging old files...
3+
del kernel.o start.o kernel.elf isoroot\boot\kernel.elf

scripts/start.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
echo Starting QEMU...
3+
qemu-system-x86_64 -cdrom blushell.iso

start.s

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.extern kernel_main
2+
3+
.global start
4+
5+
.set MB_MAGIC, 0x1BADB002
6+
.set MB_FLAGS, (1 << 0) | (1 << 1)
7+
.set MB_CHECKSUM, (0 - (MB_MAGIC + MB_FLAGS))
8+
9+
.section .multiboot
10+
.align 4
11+
.long MB_MAGIC
12+
.long MB_FLAGS
13+
.long MB_CHECKSUM
14+
15+
.section .bss
16+
.align 16
17+
stack_bottom:
18+
.skip 4096
19+
stack_top:
20+
21+
.section .text
22+
start:
23+
mov $stack_top, %esp
24+
call kernel_main
25+
26+
hang:
27+
cli
28+
hlt
29+
jmp hang

0 commit comments

Comments
 (0)