aboutsummaryrefslogtreecommitdiff
path: root/boot.old
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-02-24 06:56:58 +0530
committerBobby <[email protected]>2026-02-24 06:56:58 +0530
commit5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8 (patch)
tree2ae2a13678844b82b43583ca28eed4d4b6223ec0 /boot.old
parent297c66b480a238dad5ce7f03405fe6f5b9123701 (diff)
downloadakiba-5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8.tar.xz
akiba-5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8.zip
Bunch of stuff moved as .old for new arch change
Diffstat (limited to 'boot.old')
-rw-r--r--boot.old/boot.s229
-rw-r--r--boot.old/boot64.s40
-rw-r--r--boot.old/grub/grub.cfg30
-rw-r--r--boot.old/grub/themes/akiba/f/akiba.pf2bin0 -> 7629 bytes
-rw-r--r--boot.old/grub/themes/akiba/frame_n.pngbin0 -> 603 bytes
-rw-r--r--boot.old/grub/themes/akiba/frame_ne.pngbin0 -> 671 bytes
-rw-r--r--boot.old/grub/themes/akiba/frame_nw.pngbin0 -> 727 bytes
-rw-r--r--boot.old/grub/themes/akiba/frame_s.pngbin0 -> 591 bytes
-rw-r--r--boot.old/grub/themes/akiba/frame_se.pngbin0 -> 686 bytes
-rw-r--r--boot.old/grub/themes/akiba/frame_sw.pngbin0 -> 677 bytes
-rw-r--r--boot.old/grub/themes/akiba/inbox_c.pngbin0 -> 557 bytes
-rw-r--r--boot.old/grub/themes/akiba/inbox_e.pngbin0 -> 560 bytes
-rw-r--r--boot.old/grub/themes/akiba/inbox_w.pngbin0 -> 564 bytes
-rw-r--r--boot.old/grub/themes/akiba/select_c.pngbin0 -> 4178 bytes
-rw-r--r--boot.old/grub/themes/akiba/theme.txt65
15 files changed, 364 insertions, 0 deletions
diff --git a/boot.old/boot.s b/boot.old/boot.s
new file mode 100644
index 0000000..a7a485c
--- /dev/null
+++ b/boot.old/boot.s
@@ -0,0 +1,229 @@
+.section .text
+.global _start
+
+.align 8
+multiboot2_header_start:
+ .long 0xE85250D6
+ .long 0
+ .long multiboot2_header_end - multiboot2_header_start
+ .long -(0xE85250D6 + 0 + (multiboot2_header_end - multiboot2_header_start))
+
+ .align 8
+ .short 0
+ .short 0
+ .long 8
+multiboot2_header_end:
+
+.code32
+_start:
+ cli
+
+ mov %ebx, multiboot2_info_ptr
+ mov $boot_stack_top, %esp
+
+ call setup_page_tables
+ call enable_long_mode
+
+ lgdt gdt64_pointer
+ jmp $0x08, $long_mode_start
+
+setup_page_tables:
+ # PML4[0] -> L3 (identity map first 512GB)
+ mov $page_table_l3, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l4)
+
+ # PML4[256] -> L3_high (higher-half at 0xFFFF800000000000)
+ mov $page_table_l3_high, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l4 + 2048)
+
+ # Setup L3 entries for identity mapping (first 4GB)
+ mov $page_table_l2_0, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l3)
+
+ mov $page_table_l2_1, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l3 + 8)
+
+ mov $page_table_l2_2, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l3 + 16)
+
+ mov $page_table_l2_3, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l3 + 24)
+
+ # Setup L3_high entries (map first 4GB to higher-half too)
+ mov $page_table_l2_high_0, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l3_high)
+
+ mov $page_table_l2_high_1, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l3_high + 8)
+
+ mov $page_table_l2_high_2, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l3_high + 16)
+
+ mov $page_table_l2_high_3, %eax
+ or $0b111, %eax
+ mov %eax, (page_table_l3_high + 24)
+
+ # Map 4GB identity (low)
+ mov $page_table_l2_0, %edi
+ mov $0x00000000, %edx
+ mov $0b10000111, %esi
+ call map_l2_table
+
+ mov $page_table_l2_1, %edi
+ mov $0x40000000, %edx
+ mov $0b10000111, %esi
+ call map_l2_table
+
+ mov $page_table_l2_2, %edi
+ mov $0x80000000, %edx
+ mov $0b10000111, %esi
+ call map_l2_table
+
+ mov $page_table_l2_3, %edi
+ mov $0xC0000000, %edx
+ mov $0b10000111, %esi
+ call map_l2_table
+
+ # Map 4GB to higher-half (same physical memory, different virtual addresses)
+ mov $page_table_l2_high_0, %edi
+ mov $0x00000000, %edx
+ mov $0b10000111, %esi
+ call map_l2_table
+
+ mov $page_table_l2_high_1, %edi
+ mov $0x40000000, %edx
+ mov $0b10000111, %esi
+ call map_l2_table
+
+ mov $page_table_l2_high_2, %edi
+ mov $0x80000000, %edx
+ mov $0b10000111, %esi
+ call map_l2_table
+
+ mov $page_table_l2_high_3, %edi
+ mov $0xC0000000, %edx
+ mov $0b10000111, %esi
+ call map_l2_table
+
+ ret
+
+map_l2_table:
+ push %ebx
+ push %ecx
+ push %edx
+
+ mov %edx, %ebx
+ mov $0, %ecx
+
+.map_loop:
+ mov %ebx, %eax
+ or %esi, %eax
+
+ mov %eax, (%edi,%ecx,8)
+ movl $0, 4(%edi,%ecx,8)
+
+ add $0x200000, %ebx
+
+ inc %ecx
+ cmp $512, %ecx
+ jne .map_loop
+
+ pop %edx
+ pop %ecx
+ pop %ebx
+ ret
+
+enable_long_mode:
+ mov $page_table_l4, %eax
+ mov %eax, %cr3
+
+ mov %cr4, %eax
+ or $(1 << 5), %eax
+ mov %eax, %cr4
+
+ mov $0xC0000080, %ecx
+ rdmsr
+ or $(1 << 8), %eax
+ wrmsr
+
+ mov %cr0, %eax
+ or $(1 << 31), %eax
+ mov %eax, %cr0
+
+ ret
+
+.code64
+long_mode_start:
+ mov $0x10, %ax
+ mov %ax, %ds
+ mov %ax, %es
+ mov %ax, %fs
+ mov %ax, %gs
+ mov %ax, %ss
+
+ mov $stack_top, %rsp
+
+ xor %rdi, %rdi
+ mov multiboot2_info_ptr(%rip), %edi
+
+ call mirai
+
+halt:
+ hlt
+ jmp halt
+
+.section .data
+.align 4096
+page_table_l4:
+ .skip 4096
+page_table_l3:
+ .skip 4096
+page_table_l2_0:
+ .skip 4096
+page_table_l2_1:
+ .skip 4096
+page_table_l2_2:
+ .skip 4096
+page_table_l2_3:
+ .skip 4096
+page_table_l3_high:
+ .skip 4096
+page_table_l2_high_0:
+ .skip 4096
+page_table_l2_high_1:
+ .skip 4096
+page_table_l2_high_2:
+ .skip 4096
+page_table_l2_high_3:
+ .skip 4096
+
+.align 16
+gdt64:
+ .quad 0
+ .quad 0x00AF9A000000FFFF
+ .quad 0x00AF92000000FFFF
+gdt64_pointer:
+ .word gdt64_pointer - gdt64 - 1
+ .quad gdt64
+
+multiboot2_info_ptr:
+ .long 0
+
+.section .bss
+.align 16
+boot_stack_bottom:
+ .skip 4096
+boot_stack_top:
+
+stack_bottom:
+ .skip 16384
+stack_top: \ No newline at end of file
diff --git a/boot.old/boot64.s b/boot.old/boot64.s
new file mode 100644
index 0000000..6ee4e85
--- /dev/null
+++ b/boot.old/boot64.s
@@ -0,0 +1,40 @@
+.code64
+.section .text
+.global setup_page_tables_64
+
+setup_page_tables_64:
+ push %rbx
+ push %rcx
+ push %rdx
+
+ mov %rdi, %rax
+ shr $39, %rax
+ and $0x1FF, %rax
+
+ mov %rdi, %rbx
+ shr $30, %rbx
+ and $0x1FF, %rbx
+
+ mov %rdi, %rcx
+ shr $21, %rcx
+ and $0x1FF, %rcx
+
+ mov %cr3, %rdx
+
+ mov (%rdx,%rax,8), %rax
+ and $~0xFFF, %rax
+
+ mov (%rax,%rbx,8), %rax
+ and $~0xFFF, %rax
+
+ mov %rdi, %rdx
+ and $~0x1FFFFF, %rdx
+ or $0x8B, %rdx
+ mov %rdx, (%rax,%rcx,8)
+
+ invlpg (%rdi)
+
+ pop %rdx
+ pop %rcx
+ pop %rbx
+ ret \ No newline at end of file
diff --git a/boot.old/grub/grub.cfg b/boot.old/grub/grub.cfg
new file mode 100644
index 0000000..3540af0
--- /dev/null
+++ b/boot.old/grub/grub.cfg
@@ -0,0 +1,30 @@
+set timeout=5
+set default=0
+set esp='hd0,gpt1'
+set themedir=($esp)/boot/grub/themes/akiba
+
+# Load font from ESP
+loadfont $themedir/f/akiba.pf2
+
+set gfxmode=800x600x32
+insmod all_video
+insmod gfxterm
+insmod gfxmenu
+insmod png
+terminal_output gfxterm
+
+set theme=$themedir/theme.txt
+
+insmod part_gpt
+insmod part_msdos
+insmod fat
+insmod afs
+
+# Switch to the AFS partition
+set root='hd0,gpt2'
+
+menuentry "Akiba" {
+ echo "Loading kernel from AFS partition..."
+ multiboot2 /system/akiba/mirai.kernel
+ boot
+} \ No newline at end of file
diff --git a/boot.old/grub/themes/akiba/f/akiba.pf2 b/boot.old/grub/themes/akiba/f/akiba.pf2
new file mode 100644
index 0000000..a85f589
--- /dev/null
+++ b/boot.old/grub/themes/akiba/f/akiba.pf2
Binary files differ
diff --git a/boot.old/grub/themes/akiba/frame_n.png b/boot.old/grub/themes/akiba/frame_n.png
new file mode 100644
index 0000000..7e1c8da
--- /dev/null
+++ b/boot.old/grub/themes/akiba/frame_n.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/frame_ne.png b/boot.old/grub/themes/akiba/frame_ne.png
new file mode 100644
index 0000000..0fb2223
--- /dev/null
+++ b/boot.old/grub/themes/akiba/frame_ne.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/frame_nw.png b/boot.old/grub/themes/akiba/frame_nw.png
new file mode 100644
index 0000000..48385f4
--- /dev/null
+++ b/boot.old/grub/themes/akiba/frame_nw.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/frame_s.png b/boot.old/grub/themes/akiba/frame_s.png
new file mode 100644
index 0000000..5402576
--- /dev/null
+++ b/boot.old/grub/themes/akiba/frame_s.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/frame_se.png b/boot.old/grub/themes/akiba/frame_se.png
new file mode 100644
index 0000000..3d66a61
--- /dev/null
+++ b/boot.old/grub/themes/akiba/frame_se.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/frame_sw.png b/boot.old/grub/themes/akiba/frame_sw.png
new file mode 100644
index 0000000..d37754e
--- /dev/null
+++ b/boot.old/grub/themes/akiba/frame_sw.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/inbox_c.png b/boot.old/grub/themes/akiba/inbox_c.png
new file mode 100644
index 0000000..6bf7e35
--- /dev/null
+++ b/boot.old/grub/themes/akiba/inbox_c.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/inbox_e.png b/boot.old/grub/themes/akiba/inbox_e.png
new file mode 100644
index 0000000..02f320a
--- /dev/null
+++ b/boot.old/grub/themes/akiba/inbox_e.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/inbox_w.png b/boot.old/grub/themes/akiba/inbox_w.png
new file mode 100644
index 0000000..8cc5c54
--- /dev/null
+++ b/boot.old/grub/themes/akiba/inbox_w.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/select_c.png b/boot.old/grub/themes/akiba/select_c.png
new file mode 100644
index 0000000..5664fa3
--- /dev/null
+++ b/boot.old/grub/themes/akiba/select_c.png
Binary files differ
diff --git a/boot.old/grub/themes/akiba/theme.txt b/boot.old/grub/themes/akiba/theme.txt
new file mode 100644
index 0000000..7c935ff
--- /dev/null
+++ b/boot.old/grub/themes/akiba/theme.txt
@@ -0,0 +1,65 @@
+title-text: ""
+desktop-color: "#000000"
+terminal-font: "VGA Regular 16"
+
+#menu
++ boot_menu {
+ left = 50%-284
+ top = 50%-62
+ width = 568
+ height = 124
+ item_font = "Akiba"
+ selected_item_font = "Akiba"
+ icon_width = 4
+ item_height = 20
+ item_padding = 0
+ item_icon_space = 0
+ item_spacing = 1
+ selected_item_pixmap_style = "select_*.png"
+ scrollbar = true
+ scrollbar_width = 0
+ item_color = "#ffffff"
+ selected_item_color = "#ffffff"
+
+ menu_pixmap_style = "inbox_*.png"
+}
+
+# "Welcome to Akiba Boot Menu"
++ canvas {
+
+ left = 50%-284
+ top = 50%-62-56
+ width = 568
+ height = 56
+
+ + label { left = 0 top = 22 width = 100% height = 16 color = "white" align = "center" text = "Welcome to Akiba Boot Menu" font = "Akiba" }
+
+ + image { file = "frame_s.png" left = 8 top = 100%-12 width = 100%-16 height = 12 }
+ + image { file = "frame_nw.png" left = 0 top = 0 }
+ + image { file = "frame_n.png" left = 8 top = 0 width = 100%-16 height = 12 }
+ + image { file = "frame_ne.png" left = 100%-8 top = 0 }
+ + image { file = "inbox_e.png" left = 100%-16 top = 12 width = 16 height = 100%-12 }
+ + image { file = "inbox_w.png" left = 0 top = 12 width = 16 height = 100%-12 }
+ + image { file = "inbox_c.png" left = 16 top = 12 width = 100%-32 height = 100%-24 }
+}
+
+# "UP and DOWN to move selection ..."
++ canvas {
+
+ left = 50%-284
+ top = 50%+62
+ width = 568
+ height = 73
+
+ + label { left = 0 top = 21 width = 100% height = 16 color = "white" align = "center" text = "UP and DOWN to move selection" font = "Akiba" }
+ + label { left = 0 top = 39 width = 100% height = 16 color = "white" align = "center" text = "ENTER to boot from selected device" font = "Akiba" }
+
+ + image { file = "frame_n.png" left = 8 top = 0 width = 100%-16 height = 12 }
+ + image { file = "inbox_e.png" left = 100%-16 top = 0 width = 16 height = 100%-12 }
+ + image { file = "frame_se.png" left = 100%-8 top = 100%-12 }
+ + image { file = "frame_s.png" left = 8 top = 100%-12 width = 100%-16 height = 12 }
+ + image { file = "frame_sw.png" left = 0 top = 100%-12 }
+ + image { file = "inbox_w.png" left = 0 top = 0 width = 16 height = 100%-12 }
+ + image { file = "inbox_c.png" left = 16 top = 12 width = 100%-32 height = 100%-24 }
+
+}