Skip to content

Commit

Permalink
kernel: Last prep-work for v1.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sasdallas committed Sep 10, 2024
1 parent 809349e commit 3d2c227
Show file tree
Hide file tree
Showing 37 changed files with 930 additions and 896 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ The initial ramdisk and the kernel are placed under `sysroot/boot/`.

Running `qemu make_drive` will create an ext2 drive with `sysroot` as its filesystem.

# Real Hardware
Scary! I wouldn't do this, but it's possible. Here are some issues I've encountered:

- reduceOS will commonly fail to initialize a video driver. If this happens you'll see the message that says "BIOS call failed". To fix this, add `--force_vga` to the kernel (the only way you'll see the BIOS call failed message is with this anyways)
- Occasionally module and debug symbols will fail to load. No way to fix this unless you patch the kernel.
- reduceOS won't usually run on newer UEFI-only hardware. No fix.


# Kernel Drivers
reduceOS operates on a semi-modular design, which allows for drivers/modules to be easily made and loaded.
Expand Down
Binary file modified obj/gfx/gfx.o
Binary file not shown.
Binary file modified obj/kernel/cmds.o
Binary file not shown.
Binary file modified obj/kernel/kernel.o
Binary file not shown.
Binary file modified obj/polyaniline/efi/BOOTX64.EFI
Binary file not shown.
Binary file modified obj/polyaniline/efi/efi.so
Binary file not shown.
Binary file modified obj/polyaniline/efi/efildr/boot.o
Binary file not shown.
Binary file modified obj/polyaniline/efi/polyaniline/boot_terminal.o
Binary file not shown.
Binary file modified obj/polyaniline/efi/polyaniline/elf.o
Binary file not shown.
Binary file modified obj/polyaniline/efi/polyaniline/libc_string.o
Binary file not shown.
Binary file modified obj/polyaniline/efi/polyaniline/main.o
Binary file not shown.
Binary file modified out/fatimg/isodir/initrd
Binary file not shown.
Binary file modified out/fatimg/isodir/kernel
Binary file not shown.
Binary file modified out/iso/builddir/boot/kernel.elf
Binary file not shown.
4 changes: 2 additions & 2 deletions source/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ $(OUT_EFI)/%.o: %.S Makefile

# .c compilation (polyaniline is totally part of the kernel, dw about it)
$(OUT_EFI)/%.o: %.c Makefile
gcc $< -D__KERNEL__ -Ipolyaniline/include/ -c -fno-stack-protector -fpic -fshort-wchar -mno-red-zone -I /usr/include/efi/ -I /usr/include/efi/x86_64 -DEFI_FUNCTION_WRAPPER -DPLATFORM_IS_SELECTED -DPLATFORM_EFI -o $@
gcc $< -g -D__KERNEL__ -w -Ipolyaniline/include/ -c -fno-stack-protector -fpic -fshort-wchar -mno-red-zone -I /usr/include/efi/ -I /usr/include/efi/x86_64 -DEFI_FUNCTION_WRAPPER -DPLATFORM_IS_SELECTED -DPLATFORM_EFI -o $@

# Compilation functions (BIOS)
$(OUT_BIOS)/%.o: %.S Makefile
$(CC) -m32 -c $< -o $@

$(OUT_BIOS)/%.o: %.c Makefile
$(CC) $(BIOS_C_FLAGS) -c $< -o $@
$(CC) $(BIOS_C_FLAGS) -w -c $< -o $@

$(OUT_BIOS)/mbr.bin:
nasm -f bin biosmbr/mbr.asm -o $(OUT_BIOS)/mbr.bin
Expand Down
5 changes: 5 additions & 0 deletions source/boot/efildr/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
Image_Handle = ImageHandle;

// Print loading text
EFI_LOADED_IMAGE *loadedImage = NULL;
EFI_STATUS status = uefi_call_wrapper(ST->BootServices->HandleProtocol, 3, ImageHandle, &LoadedImageProtocol, (void**)&loadedImage);
Print(L"Image base: 0x%lx\n", loadedImage->ImageBase);


Print(L"Starting the Polyaniline bootloader...\n");
Print(L"Initializing graphics subsystem...\n");

Expand Down
4 changes: 3 additions & 1 deletion source/boot/legacy/newboot/polyaniline/boot_terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ int GOP_Init() {

EFI_STATUS status = uefi_call_wrapper(ST->BootServices->LocateHandleBuffer, 5, ByProtocol, &efi_graphics_output_protocol_guid, NULL, &handles_count, &handles);
if (EFI_ERROR(status)) {
Print(L"terminal: uefi_call_wrapper(ST->BootServices->LocateHandleBuffer) failed");
Print(L"terminal: uefi_call_wrapper(ST->BootServices->LocateHandleBuffer) failed\n");
for (;;);
}

Print(L"Handle buffer located\n");


status = uefi_call_wrapper(ST->BootServices->HandleProtocol, 3, handles[0], &efi_graphics_output_protocol_guid, (void**)&graphics);
if (EFI_ERROR(status)) {
Expand Down
2 changes: 1 addition & 1 deletion source/boot/polyaniline/boot_terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ EFI_GRAPHICS_OUTPUT_PROTOCOL *gop; // Graphics Output Protocol
// Initialize the Graphics Output Protocol function
int GOP_Init() {
// todo: rewrite this!

Print(L"Initializing GOP\n");
static EFI_GUID efi_graphics_output_protocol_guid = {0x9042a9de,0x23dc,0x4a38, {0x96,0xfb,0x7a,0xde,0xd0,0x80,0x51,0x6a}};

// Grab handle buffers
Expand Down
1 change: 1 addition & 0 deletions source/boot/polyaniline/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ char *initrd_filename = "RAMDISK.IMG";
static int boot();

void bootloader_main() {

_clearScreen();
draw_polyaniline_testTube();
boot_printf("polyaniline v%s - codename %s\n", VERSION, CODENAME);
Expand Down
Loading

0 comments on commit 3d2c227

Please sign in to comment.