mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
feat(boot): Add SUB-OS boot logo and splash, share the console font, and lift the kernel size ceiling
Boot logo (init/bootlogo.c, init/logo_data.c, scripts/mklogo.py): The logo appears in two forms because the framebuffer does not exist for the first third of boot. An ASCII rendition goes to the text console and serial line from the first moments; once the video driver is up at step [5/14] the real bitmap takes over as a graphical splash with a progress bar tied to the actual boot stages. The asset is 4-bit palette indexed, so 160x160 pixels cost 12.5 KB instead of 100 KB, and carries a transparency mask so the mark composites onto the gradient rather than stamping a flat rectangle over it. scripts/mklogo.py regenerates init/logo_data.c from the source PNG. Boot reaches the desktop in well under a second, so the splash is held for a minimum duration and the bar sweeps to 100% during the hold; without that the logo would flash past unseen. `splashtime=<ms>` tunes it and `nosplash`, `nogui` or `text` skip it. Bootloader (boot/stage2.asm): stage2 staged the whole kernel in conventional RAM before copying it to 1 MB, which capped the kernel at roughly 576 KB before the load ran into video memory at 0xA0000. The logo pushed it over that line and the kernel stopped booting. Each 32 KB chunk now goes into one fixed low buffer and is copied straight to its final address, using unreal mode for the 32-bit reach. The ceiling is now the image itself, 1.375 MB. Console font (lib/font8x8.c): fb_draw_char was a stub that ignored its character argument and drew a filled rectangle, which is why the splash rendered its text as solid blocks. It now renders real glyphs, and the table it uses is shared: the framebuffer console, the canvas rasterizer and the desktop compositor had three divergent private copies, two of which still carried the `// \` line-continuation defect. printk console sink (kernel/printk.c): printk output can be redirected to a callback, so a caller can run a subsystem that reports via printk and capture what it printed. Serial and the dmesg ring still see everything, which keeps a captured run debuggable. Shell builtins (userland/lazybox/shell.c): The builtin chain is extracted into shell_execute_builtin(), so the kernel TTY and the desktop terminal accept the same vocabulary instead of the GUI seeing only the applet table. Callers that cannot be suspended pass allow_blocking = false to refuse the animating ones. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L5yKJT4Wo2cV3rfPrwY5MP
This commit is contained in:
1 parent
1aee7c7a0d
commit
56a378b142
15 files changed
+1713
-154
No files matched your search
+2
-95
@@ -1,4 +1,5 @@
|
||||
#include <drivers/canvas.h>
|
||||
#include <lib/font8x8.h>
|
||||
#include <drivers/fb.h>
|
||||
#include <mm/kmalloc.h>
|
||||
#include <lib/string.h>
|
||||
@@ -8,100 +9,6 @@ static uint32_t* back_buffer = NULL;
|
||||
static uint32_t screen_width = 320;
|
||||
static uint32_t screen_height = 200;
|
||||
|
||||
// Basic 8x8 font bitmap for ASCII characters (32..126)
|
||||
static const uint8_t font8x8_basic[96][8] = {
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // (space)
|
||||
{0x18,0x3c,0x3c,0x18,0x18,0x00,0x18,0x00}, // !
|
||||
{0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00}, // "
|
||||
{0x6c,0x6c,0xfe,0x6c,0xfe,0x6c,0x6c,0x00}, // #
|
||||
{0x18,0x3e,0x60,0x3c,0x06,0x7c,0x18,0x00}, // $
|
||||
{0x00,0x63,0x66,0x0c,0x18,0x33,0x63,0x00}, // %
|
||||
{0x38,0x6c,0x38,0x76,0xdc,0xcc,0x76,0x00}, // &
|
||||
{0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00}, // '
|
||||
{0x0c,0x18,0x30,0x30,0x30,0x18,0x0c,0x00}, // (
|
||||
{0x30,0x18,0x0c,0x0c,0x0c,0x18,0x30,0x00}, // )
|
||||
{0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00}, // *
|
||||
{0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00}, // +
|
||||
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x30}, // ,
|
||||
{0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00}, // -
|
||||
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00}, // .
|
||||
{0x06,0x0c,0x18,0x30,0x60,0xc0,0x80,0x00}, // /
|
||||
{0x7c,0xc6,0xce,0xd6,0xe6,0xc6,0x7c,0x00}, // 0
|
||||
{0x18,0x38,0x18,0x18,0x18,0x18,0x7e,0x00}, // 1
|
||||
{0x7c,0xc6,0x06,0x1c,0x30,0x66,0xfe,0x00}, // 2
|
||||
{0x7c,0xc6,0x06,0x3c,0x06,0xc6,0x7c,0x00}, // 3
|
||||
{0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x1e,0x00}, // 4
|
||||
{0xfe,0xc0,0xfc,0x06,0x06,0xc6,0x7c,0x00}, // 5
|
||||
{0x7c,0xc6,0xc0,0xfc,0xc6,0xc6,0x7c,0x00}, // 6
|
||||
{0xfe,0x06,0x0c,0x18,0x30,0x30,0x30,0x00}, // 7
|
||||
{0x7c,0xc6,0xc6,0x7c,0xc6,0xc6,0x7c,0x00}, // 8
|
||||
{0x7c,0xc6,0xc6,0x7e,0x06,0xc6,0x7c,0x00}, // 9
|
||||
{0x00,0x18,0x18,0x00,0x18,0x18,0x00,0x00}, // :
|
||||
{0x00,0x18,0x18,0x00,0x18,0x18,0x30,0x00}, // ;
|
||||
{0x06,0x0c,0x18,0x30,0x18,0x0c,0x06,0x00}, // <
|
||||
{0x00,0x00,0x7e,0x00,0x7e,0x00,0x00,0x00}, // =
|
||||
{0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0x00}, // >
|
||||
{0x7c,0xc6,0x0c,0x18,0x18,0x00,0x18,0x00}, // ?
|
||||
{0x7c,0xc6,0xde,0xde,0xdc,0xc0,0x7c,0x00}, // @
|
||||
{0x38,0x6c,0xc6,0xfe,0xc6,0xc6,0xc6,0x00}, // A
|
||||
{0xfc,0x66,0x66,0x7c,0x66,0x66,0xfc,0x00}, // B
|
||||
{0x3c,0x66,0xc0,0xc0,0xc0,0x66,0x3c,0x00}, // C
|
||||
{0xf8,0x6c,0x66,0x66,0x66,0x6c,0xf8,0x00}, // D
|
||||
{0xfe,0x62,0x68,0x78,0x68,0x62,0xfe,0x00}, // E
|
||||
{0xfe,0x62,0x68,0x78,0x68,0x60,0xf0,0x00}, // F
|
||||
{0x3c,0x66,0xc0,0xc0,0xce,0x66,0x3a,0x00}, // G
|
||||
{0xc6,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00}, // H
|
||||
{0x7e,0x18,0x18,0x18,0x18,0x18,0x7e,0x00}, // I
|
||||
{0x1e,0x0c,0x0c,0x0c,0xcc,0xcc,0x78,0x00}, // J
|
||||
{0xe6,0x66,0x6c,0x78,0x6c,0x66,0xe6,0x00}, // K
|
||||
{0xf0,0x60,0x60,0x60,0x62,0x66,0xfe,0x00}, // L
|
||||
{0xc6,0xee,0xfe,0xfe,0xd6,0xc6,0xc6,0x00}, // M
|
||||
{0xc6,0xe6,0xf6,0xde,0xce,0xc6,0xc6,0x00}, // N
|
||||
{0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00}, // O
|
||||
{0xfc,0x66,0x66,0x7c,0x60,0x60,0xf0,0x00}, // P
|
||||
{0x7c,0xc6,0xc6,0xc6,0xd6,0x7c,0x0e,0x00}, // Q
|
||||
{0xfc,0x66,0x66,0x7c,0x6c,0x66,0xe6,0x00}, // R
|
||||
{0x7c,0xc6,0x60,0x38,0x0c,0xc6,0x7c,0x00}, // S
|
||||
{0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x00}, // T
|
||||
{0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00}, // U
|
||||
{0xc6,0xc6,0xc6,0xc6,0x6c,0x38,0x10,0x00}, // V
|
||||
{0xc6,0xc6,0xd6,0xfe,0xfe,0xee,0xc6,0x00}, // W
|
||||
{0xc6,0x6c,0x38,0x38,0x6c,0xc6,0x00,0x00}, // X
|
||||
{0x66,0x66,0x66,0x3c,0x18,0x18,0x3c,0x00}, // Y
|
||||
{0xfe,0x06,0x0c,0x18,0x30,0x60,0xfe,0x00}, // Z
|
||||
{0x3c,0x30,0x30,0x30,0x30,0x30,0x3c,0x00}, // [
|
||||
{0xc0,0x60,0x30,0x18,0x0c,0x06,0x02,0x00}, // backslash
|
||||
{0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00}, // ]
|
||||
{0x10,0x38,0x6c,0xc6,0x00,0x00,0x00,0x00}, // ^
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff}, // _
|
||||
{0x30,0x18,0x0c,0x00,0x00,0x00,0x00,0x00}, // `
|
||||
{0x00,0x00,0x78,0x0c,0x7c,0xcc,0x76,0x00}, // a
|
||||
{0xe0,0x60,0x7c,0x66,0x66,0x66,0xdc,0x00}, // b
|
||||
{0x00,0x00,0x78,0xcc,0xc0,0xcc,0x78,0x00}, // c
|
||||
{0x1c,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00}, // d
|
||||
{0x00,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00}, // e
|
||||
{0x38,0x6c,0x60,0xf0,0x60,0x60,0xf0,0x00}, // f
|
||||
{0x00,0x00,0x76,0xcc,0xcc,0x7c,0x0c,0xf8}, // g
|
||||
{0xe0,0x60,0x6c,0x76,0x66,0x66,0xe6,0x00}, // h
|
||||
{0x18,0x00,0x38,0x18,0x18,0x18,0x3c,0x00}, // i
|
||||
{0x0c,0x00,0x1c,0x0c,0x0c,0xcc,0xcc,0x78}, // j
|
||||
{0xe0,0x60,0x66,0x6c,0x78,0x6c,0xe6,0x00}, // k
|
||||
{0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00}, // l
|
||||
{0x00,0x00,0xec,0xfe,0xd6,0xd6,0xd6,0x00}, // m
|
||||
{0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x00}, // n
|
||||
{0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7c,0x00}, // o
|
||||
{0x00,0x00,0xdc,0x66,0x66,0x7c,0x60,0xf0}, // p
|
||||
{0x00,0x00,0x76,0xcc,0xcc,0x7c,0x0c,0x1e}, // q
|
||||
{0x00,0x00,0xdc,0x76,0x60,0x60,0xf0,0x00}, // r
|
||||
{0x00,0x00,0x7c,0xc0,0x78,0x0c,0xf8,0x00}, // s
|
||||
{0x10,0x30,0x7c,0x30,0x30,0x34,0x18,0x00}, // t
|
||||
{0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x76,0x00}, // u
|
||||
{0x00,0x00,0xc6,0xc6,0xc6,0x6c,0x38,0x00}, // v
|
||||
{0x00,0x00,0xc6,0xd6,0xfe,0xfe,0x6c,0x00}, // w
|
||||
{0x00,0x00,0xc6,0x6c,0x38,0x6c,0xc6,0x00}, // x
|
||||
{0x00,0x00,0xc6,0xc6,0xce,0x76,0x06,0x7c}, // y
|
||||
{0x00,0x00,0xfe,0x0c,0x38,0x60,0xfe,0x00}, // z
|
||||
};
|
||||
|
||||
void canvas_init(void) {
|
||||
const fb_info_t* fb = fb_get_info();
|
||||
@@ -192,7 +99,7 @@ void canvas_draw_circle(int cx, int cy, int r, uint32_t color, bool filled) {
|
||||
|
||||
void canvas_draw_char(int x, int y, char c, uint32_t color, uint32_t bg_color) {
|
||||
if (c < 32 || c > 126) c = ' ';
|
||||
const uint8_t* glyph = font8x8_basic[c - 32];
|
||||
const uint8_t* glyph = font8x8_glyph(c);
|
||||
|
||||
for (int row = 0; row < 8; row++) {
|
||||
uint8_t line = glyph[row];
|
||||
|
||||
+17
-3
@@ -1,4 +1,5 @@
|
||||
#include <drivers/fb.h>
|
||||
#include <lib/font8x8.h>
|
||||
#include <lib/string.h>
|
||||
#include <kernel/printk.h>
|
||||
|
||||
@@ -53,9 +54,22 @@ void fb_clear(uint32_t color) {
|
||||
}
|
||||
|
||||
void fb_draw_char(uint32_t x, uint32_t y, char c, uint32_t fg, uint32_t bg) {
|
||||
(void)c;
|
||||
fb_draw_rect(x, y, 8, 16, bg);
|
||||
fb_draw_rect(x + 2, y + 2, 4, 12, fg);
|
||||
const uint8_t* glyph = font8x8_glyph(c);
|
||||
|
||||
// A background of 0 means "leave what is already there", which lets the
|
||||
// boot splash draw status text straight over its gradient.
|
||||
bool opaque = (bg != 0);
|
||||
|
||||
for (uint32_t row = 0; row < FONT8X8_HEIGHT; row++) {
|
||||
uint8_t bits = glyph[row];
|
||||
for (uint32_t col = 0; col < FONT8X8_WIDTH; col++) {
|
||||
if (bits & (0x80u >> col)) {
|
||||
fb_put_pixel(x + col, y + row, fg);
|
||||
} else if (opaque) {
|
||||
fb_put_pixel(x + col, y + row, bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fb_draw_string(uint32_t x, uint32_t y, const char* str, uint32_t fg, uint32_t bg) {
|
||||
|
||||
Reference in new issue
Block a user