Commit Graph

43 Commits

Author SHA1 Message Date
Bananymous fb35f06cf5 Kernel: Add better support for bootloaders loading the kernel
Before I assumed that bootloaders loaded the kernel at physical address
0, but this patch kinda allows loading to different addresses. This
still doesn't fully work as kernel bootstrap paging relies on kernel
being loaded at 0
2024-08-22 14:48:21 +03:00
Bananymous c69919738b BuildSystem: Move all userpace libraries under the userspace directory
As the number of libraries is increasing, root directory starts to
expand. This adds better organization for libraries
2024-06-18 13:14:35 +03:00
Bananymous 9ac3f48fcb Bootloader: Implement better memset and memcpy for 32 bit addresses 2024-04-20 18:14:05 +03:00
Bananymous 6ac3681604 Bootloader: Implement loading for 32 bit ELF files. 2024-04-02 15:30:35 +03:00
Bananymous b35cad0c2e Bootloader allow installation when BANAN_ARCH=i686 2024-04-02 12:48:35 +03:00
Bananymous ca23360d07 Bootloader: Fix GDRT pointer size to 32 bits 2024-03-26 03:04:57 +02:00
Bananymous dfe5a2d665 All: Cleanup all files
Add newline to end of files and remove whitespace from end of lines
2024-01-24 15:53:38 +02:00
Bananymous 7e36a0be75 Bootloader: Add .data section 2024-01-12 19:27:36 +02:00
Bananymous ff2486f58c Bootloader: Try to enable A20 line if it is disabled
VirtualBox seems to have A20 disabled by default
2024-01-12 02:55:06 +02:00
Bananymous 2fec718590 Bootloader: cleanup code 2024-01-08 10:50:55 +02:00
Bananymous ccaa159a73 Bootloader: Add support for ext2 blocks up to 4 KiB
This should work with blocks bigger than that, but my linux system
only supports up to 4 KiB, so I cannot test this.

This allows getting rid of forced block size in mkfs and let the
program select appropriately sized blocks.
2024-01-03 18:26:03 +02:00
Bananymous 7356a83a44 Bootloader: Optimize some unnecessary branches on carry add/sub 2024-01-03 17:05:33 +02:00
Bananymous 2a68df81e2 Bootloader: Fix bootloader on bochs
Bochs int 0x10 seems to scrap full ebp and top bits in some
registers. I now save all 32-bit registers on call frame. Also
ebp is across all int 0x10 calls.
2024-01-03 13:09:55 +02:00
Bananymous 50ca2ac09e Bootloader: Interpret 0x7F (DEL) as backspace
This allows backspace to work over qemu's serial connection
2024-01-03 11:58:50 +02:00
Bananymous 3f3e81fcf2 Bootloader: Align boot information passed to kernel
UBSAN found this bug
2023-12-14 10:52:51 +02:00
Bananymous abc69fa3d5 Bootloader: Search framebuffer information from kernel memory
Framebuffer information is no longer hard coded into bootloader.
Kernel can define framebuffer info structure in its memory which is
used for finding proper video mode.
2023-12-09 17:32:10 +02:00
Bananymous 8b01e2d4a2 Bootloader: Generalize framebuffer video mode search
Framebuffer size is now taken as arguments to vesa_find_video_mode
2023-12-09 16:48:04 +02:00
Bananymous 25485069e6 Bootloader: Add cache to ext2 inode data block indices
This reduces the number of read calls with current kernel size from
~1700 to ~700 (60% performance boots). Loading the kernel is now alot
faster.
2023-11-22 13:54:53 +02:00
Bananymous f80bd040c8 Bootloader: add missing size directive 2023-11-21 19:11:48 +02:00
Bananymous 9e44e8be75 Buildsystem: default bootloader is not my custom one
You can set BANAN_BOOTLOADER=GRUB to use grub instead. Image creation
does not convert disk image now automatically between bootloaders and
calling ./bos image-full is now required.
2023-11-18 17:18:03 +02:00
Bananymous cd646a1ab7 Bootloader do some directory restructuring 2023-11-18 13:59:45 +02:00
Bananymous c9e9cfd361 Bootloader: Implement VESA video mode query and pass it to kernel
Kernel now gets framebuffer from bootloader. Framebuffer dimensions
and bpp are hardcoded in bootloader, but will probably be read from
config file at some point.
2023-11-17 22:45:35 +02:00
Bananymous ac96ea3370 Bootloader: Fix kernel memset to zero 2023-11-17 21:05:02 +02:00
Bananymous ef53aab24a Bootloader add temporary initial command line
This will probably be read from some config file at some point
2023-11-17 20:38:38 +02:00
Bananymous cb5a5d3ed1 Kernel/Bootloader: banan-os can now be booted with my bootloader :D 2023-11-17 20:33:02 +02:00
Bananymous d1444761a3 Bootloader: Clear screen, better memcpy
Clear screen before jumping to kernel. Memcpy now uses ebx as offset
register, so only one register has to updated every loop
2023-11-17 20:31:42 +02:00
Bananymous 641a2dec00 Bootloader: Load kernel to memory and jump to it! 2023-11-17 16:36:29 +02:00
Bananymous 9e69053e64 Bootloader enter unreal mode at the start of stage2 2023-11-17 14:22:21 +02:00
Bananymous 1a415a380a Bootloader: Fix getting command line 2023-11-17 13:17:44 +02:00
Bananymous a19c5c672b Bootloader: implement reading from inode 2023-11-17 13:17:44 +02:00
Bananymous 3bcbc7c018 Bootloader: add support for indirect inode blocks 2023-11-16 13:34:21 +02:00
Bananymous b371abade5 Bootloader: Add helpers for printing n bit hexadecimal numbers 2023-11-16 13:30:01 +02:00
Bananymous 9d4101e0c5 Bootloader: Implement basic ext2 filesystem
This can search for files in an ext2 filesystem. Only 12 blocks
are currently supported.

Now only ELF loading is missing for loading the actual kernel!
2023-11-15 16:58:26 +02:00
Bananymous c791a1c200 Bootloader: Build with cmake instead of custom script 2023-11-14 03:44:47 +02:00
Bananymous bd3f2bb61c Bootloader: Split bootloader into multiple files
This cleans up the code since bootloader is starting to near 1k lines
2023-11-14 03:27:52 +02:00
Bananymous 7ca9a961b3 Bootloader move bootloader code from arch directory
The os itself only supports x86 so this won't matter. x86_64 and i386
use the same bootloader assembly.
2023-11-13 21:42:58 +02:00
Bananymous cbb9422ee0 Bootloader: installer now uses banan os elf headers intead of Linux's 2023-11-13 21:40:15 +02:00
Bananymous 048bbf874a Bootloader: Find root partition from GPT header 2023-11-13 18:55:48 +02:00
Bananymous d2970b5b8d Bootloader: installer now patches GPT GUID's 2023-11-13 18:53:55 +02:00
Bananymous 0004d3b435 Bootloader: Add API to create GUID from string 2023-11-13 18:52:41 +02:00
Bananymous d5aa08baa5 BuildSystem: add bootloader target
Use this target to run banan-os with custom bootloader
2023-11-12 01:50:30 +02:00
Bananymous 381cfdad77 Bootloader: Continue work on bootloader
Bootloader can now get the memory map and read cmdline from user.

Now 'just' video mode query, ext2 and ELF parsing are needed :D
2023-11-11 22:49:00 +02:00
Bananymous cfc7313451 Bootloader: Start work on bootloader
I wrote a fast first stage bootloader and a installer to put it into
a disk image.
2023-11-09 22:42:47 +02:00