lumine
UEFI x86_64 bootloader for linux kernel images
commit c4dd8ac0
rewrite-zig HEAD
| author | dragsbruh <dragsbruh@protonmail.com> |
|---|---|
| date | 2026-07-23 13:59:32 +0530 |
| committer | dragsbruh <dragsbruh@protonmail.com> (2026-07-23 14:09:09 +0530) |
| tree | 620e6ce8a490c8d3d16f273e44eb915505f1457b |
| parent | 2e9e9c67 |
fix: linux boot on aarch64
+13 -21
README.md modified +0 -1
diff --git a/README.md b/README.md index 8a409c3b1cdece10b751f00e91249243a057ed4a..d16595704939895e009999533f4f524f0de3fe06 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ ## features > [!WARNING] > - lumine is yet somewhat incomplete, for a bootloader with a similar concept, see [limine](https://github.com/Limine-Bootloader/limine/) -> - aarch64 support is secondary, and as of writing this aarch64 for linux is broken. > - docs are written primarily for `x86_64`, just replace `BOOTX64` with `BOOTAA64` and the rest should be equivalent. > - linux kernels should be built with efi stub, as linux boot protocol is not yet implemented. this should be enabled by default on most distributions.
build.zig modified +2 -4
diff --git a/build.zig b/build.zig index cea0536f7c90a2686f7d717078419ac7e7f93ce5..7a6987f9c422aedff328b3eb65725b890547766d 100644 --- a/build.zig +++ b/build.zig @@ -61,10 +61,8 @@ const qemu_exe = b.option([]const u8, "qemu", "overide qemu executable") orelse b.fmt("qemu-system-{t}", .{cpu_arch}); const qemu_cmd = b.addSystemCommand(&.{ qemu_exe, "-m", "512M", "-no-reboot", "-no-shutdown" }); - const no_serial = b.option(bool, "no-serial", "dont add stdio serial commands") orelse false; - if (!no_serial) { - qemu_cmd.addArgs(&.{ "-serial", "mon:stdio", "-nographic" }); - } + const no_graphic = b.option(bool, "no-graphic", "disable graphical output") orelse false; + if (no_graphic) qemu_cmd.addArgs(&.{ "-serial", "mon:stdio", "-nographic" }); switch (cpu_arch) { .aarch64 => qemu_cmd.addArgs(&.{ "-M", "virt", "-cpu", "cortex-a57", "-device", "ramfb" }),
res/lumine.zon modified +1 -1
diff --git a/res/lumine.zon b/res/lumine.zon index 41e24a873fb13a333003729ebcc6601a97b4361a..50c86ee563f9b00ef6fed8a76596c30f18dd6c3d 100644 --- a/res/lumine.zon +++ b/res/lumine.zon @@ -5,7 +5,7 @@ .kernel_path = .{ .boot = "/linux/vmlinuz" }, .initrd_paths = .{ .{ .boot = "/linux/initrd" }, }, - .kernel_cmdline = "console=ttyS0", + .kernel_cmdline = "console=tty0", }, }, }
src/boot/linux/Initrd.zig modified +2 -1
diff --git a/src/boot/linux/Initrd.zig b/src/boot/linux/Initrd.zig index 00e791528a3b2aba78e6a1072aac43a38a09577a..66b9ff879c26a0249c978c896e848a6326748545 100644 --- a/src/boot/linux/Initrd.zig +++ b/src/boot/linux/Initrd.zig @@ -1,9 +1,10 @@ const std = @import("std"); const uefi = std.os.uefi; -const log = std.log; const Path = @import("../../Config.zig").Path; const luefi = @import("../../luefi.zig"); + +const log = std.log.scoped(.initrd); const Initrd = @This();
src/boot/linux/Kernel.zig modified +8 -14
diff --git a/src/boot/linux/Kernel.zig b/src/boot/linux/Kernel.zig index aa81937646b142858473612e5447d953d530b419..987d6b0672198de033d34d1e1e6fd40966d3aba1 100644 --- a/src/boot/linux/Kernel.zig +++ b/src/boot/linux/Kernel.zig @@ -28,21 +28,15 @@ pub fn start(self: Kernel, cmdline: []const u8) !uefi.Status { const allocator = uefi.pool_allocator; const boot_svc = uefi.system_table.boot_services.?; - if (builtin.target.cpu.arch == .x86_64) { - const cmdline_utf16 = try std.unicode.utf8ToUtf16LeAllocZ(allocator, cmdline); - defer allocator.free(cmdline_utf16); + const cmdline_utf16 = try std.unicode.utf8ToUtf16LeAllocZ(allocator, cmdline); + defer allocator.free(cmdline_utf16); - const handle, const loaded = try luefi.loadImage(self.img_buffer); - defer luefi.unloadImage(handle); + const handle, const loaded = try luefi.loadImage(self.img_buffer); + defer luefi.unloadImage(handle); - loaded.load_options = @ptrCast(cmdline_utf16); - loaded.load_options_size = @intCast(cmdline_utf16.len * @sizeOf(u16)); + loaded.load_options = @ptrCast(cmdline_utf16); + loaded.load_options_size = @intCast(cmdline_utf16.len * @sizeOf(u16)); - const exit_data = try boot_svc.startImage(handle); - try exit_data.code.err(); - return .aborted; - } else { - log.err("this architecture doesnt support linux boot", .{}); - return error.UnsupportedArchitecture; - } + const exit_data = try boot_svc.startImage(handle); + return exit_data.code; }