-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f42267c
Showing
12 changed files
with
248 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# BluShellOS | ||
## The greatest iteration of BluShell. | ||
 | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
menuentry "BluShell" { | ||
multiboot /boot/blushell.elf | ||
boot | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
default 0 | ||
timeout 0 | ||
|
||
title BluShell | ||
kernel /boot/kernel.elf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |