ovmf: take out of the repo by downloading
This commit is contained in:
parent
5a49a466d2
commit
3630de865c
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ debug_disk
|
|||||||
bochsout.txt
|
bochsout.txt
|
||||||
*.hdd
|
*.hdd
|
||||||
loopback_device
|
loopback_device
|
||||||
|
tools/OVMF.fd
|
||||||
|
13
build.zig
13
build.zig
@ -512,19 +512,6 @@ pub fn build(b_arg: *Build) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (os == .linux) {
|
|
||||||
const generate_command = b.addSystemCommand(&.{ "dot", "-Tpng" });
|
|
||||||
generate_command.addFileSourceArg(FileSource.relative("capabilities.dot"));
|
|
||||||
generate_command.addArg("-o");
|
|
||||||
const png = generate_command.addOutputFileArg("capabilities.png");
|
|
||||||
|
|
||||||
const visualize_command = b.addSystemCommand(&.{"xdg-open"});
|
|
||||||
visualize_command.addFileSourceArg(png);
|
|
||||||
|
|
||||||
const dot_command = b.step("dot", "TEMPORARY: (developers only) Generate a graph and visualize it");
|
|
||||||
dot_command.dependOn(&visualize_command.step);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Options = struct {
|
const Options = struct {
|
||||||
|
4
build.zig.zon
Normal file
4
build.zig.zon
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.{
|
||||||
|
.name = "birth",
|
||||||
|
.version = "0.1.0",
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"architecture": "x86_64",
|
"architecture": "x86_64",
|
||||||
"bootloader": "rise",
|
"bootloader": "rise",
|
||||||
"boot_protocol": "bios",
|
"boot_protocol": "uefi",
|
||||||
"execution_environment": "qemu",
|
"execution_environment": "qemu",
|
||||||
"optimize_mode": "Debug",
|
"optimize_mode": "Debug",
|
||||||
"execution_type": "emulated",
|
"execution_type": "emulated",
|
||||||
|
@ -157,7 +157,7 @@ const MemoryMap = extern struct {
|
|||||||
|
|
||||||
pub fn next(memory_map: *MemoryMap) !?bootloader.MemoryMapEntry {
|
pub fn next(memory_map: *MemoryMap) !?bootloader.MemoryMapEntry {
|
||||||
if (memory_map.offset < memory_map.size) {
|
if (memory_map.offset < memory_map.size) {
|
||||||
const entry = @as(*MemoryDescriptor, @ptrCast(@alignCast(@alignOf(MemoryDescriptor), memory_map.buffer[memory_map.offset..].ptr))).*;
|
const entry = @as(*MemoryDescriptor, @ptrCast(@alignCast(memory_map.buffer[memory_map.offset..].ptr))).*;
|
||||||
memory_map.offset += memory_map.descriptor_size;
|
memory_map.offset += memory_map.descriptor_size;
|
||||||
const result = bootloader.MemoryMapEntry{
|
const result = bootloader.MemoryMapEntry{
|
||||||
.region = PhysicalMemoryRegion.new(.{
|
.region = PhysicalMemoryRegion.new(.{
|
||||||
@ -295,7 +295,7 @@ const Initialization = struct {
|
|||||||
.x86_64 => .{
|
.x86_64 => .{
|
||||||
.rsdp = for (system_table.configuration_table[0..system_table.number_of_table_entries]) |configuration_table| {
|
.rsdp = for (system_table.configuration_table[0..system_table.number_of_table_entries]) |configuration_table| {
|
||||||
if (configuration_table.vendor_guid.eql(ConfigurationTable.acpi_20_table_guid)) {
|
if (configuration_table.vendor_guid.eql(ConfigurationTable.acpi_20_table_guid)) {
|
||||||
break @as(*ACPI.RSDP.Descriptor1, @ptrCast(@alignCast(@alignOf(ACPI.RSDP.Descriptor1), configuration_table.vendor_table)));
|
break @as(*ACPI.RSDP.Descriptor1, @ptrCast(@alignCast(configuration_table.vendor_table)));
|
||||||
}
|
}
|
||||||
} else return Error.rsdp_not_found,
|
} else return Error.rsdp_not_found,
|
||||||
},
|
},
|
||||||
|
@ -70,7 +70,7 @@ pub const Protocol = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn cast(comptime ProtocolT: type, ptr: ?*anyopaque) *ProtocolT {
|
fn cast(comptime ProtocolT: type, ptr: ?*anyopaque) *ProtocolT {
|
||||||
return @as(*ProtocolT, @ptrCast(@alignCast(@alignOf(ProtocolT), ptr)));
|
return @as(*ProtocolT, @ptrCast(@alignCast(ptr)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@ pub const ArrayListAligned = std.ArrayListAligned;
|
|||||||
|
|
||||||
pub const time = std.time;
|
pub const time = std.time;
|
||||||
|
|
||||||
|
pub const http = std.http;
|
||||||
|
pub const Uri = std.Uri;
|
||||||
|
|
||||||
// Build imports
|
// Build imports
|
||||||
pub const build = std.build;
|
pub const build = std.build;
|
||||||
|
|
||||||
|
@ -130,7 +130,40 @@ pub fn main() anyerror!void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (arguments_result.configuration.boot_protocol) {
|
switch (arguments_result.configuration.boot_protocol) {
|
||||||
.uefi => try argument_list.appendSlice(&.{ "-bios", "tools/OVMF_CODE-pure-efi.fd" }),
|
.uefi => {
|
||||||
|
const ovmf_path = "tools/OVMF.fd";
|
||||||
|
if (host.cwd().openFile(ovmf_path, .{})) |file_descriptor| {
|
||||||
|
file_descriptor.close();
|
||||||
|
} else |_| {
|
||||||
|
const url = "https://retrage.github.io/edk2-nightly/bin/RELEASEX64_OVMF.fd";
|
||||||
|
const uri = try host.Uri.parse(url);
|
||||||
|
|
||||||
|
var http_client = host.http.Client{ .allocator = wrapped_allocator.zigUnwrap() };
|
||||||
|
defer http_client.deinit();
|
||||||
|
|
||||||
|
var request_headers = host.http.Headers{ .allocator = wrapped_allocator.zigUnwrap() };
|
||||||
|
defer request_headers.deinit();
|
||||||
|
|
||||||
|
var request = try http_client.request(.GET, uri, request_headers, .{});
|
||||||
|
defer request.deinit();
|
||||||
|
|
||||||
|
try request.start();
|
||||||
|
try request.wait();
|
||||||
|
|
||||||
|
if (request.response.status != .ok) return error.ResponseNotOk;
|
||||||
|
const content_length = request.response.content_length orelse return error.OutOfMemory;
|
||||||
|
|
||||||
|
const buffer = try wrapped_allocator.zigUnwrap().alloc(u8, content_length);
|
||||||
|
const read_byte_count = try request.readAll(buffer);
|
||||||
|
if (read_byte_count != buffer.len) {
|
||||||
|
return error.OutOfMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
try host.cwd().writeFile(ovmf_path, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
try argument_list.appendSlice(&.{ "-bios", ovmf_path });
|
||||||
|
},
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ pub export fn start(scheduler: *arch.Scheduler, arg_init: bool) callconv(.C) nor
|
|||||||
}
|
}
|
||||||
assert(scheduler.common.generic.disabled);
|
assert(scheduler.common.generic.disabled);
|
||||||
scheduler.initDisabled();
|
scheduler.initDisabled();
|
||||||
@panic("TWTQWD");
|
|
||||||
// command_buffer = Syscall(.cpu, .get_command_buffer).blocking(&command_buffer) catch @panic("Unable to get command buffer");
|
// command_buffer = Syscall(.cpu, .get_command_buffer).blocking(&command_buffer) catch @panic("Unable to get command buffer");
|
||||||
|
Syscall(.cpu, .shutdown).blocking({}) catch unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export fn riseInitializeDisabled(scheduler: *arch.Scheduler, arg_init: bool) callconv(.C) noreturn {
|
// export fn riseInitializeDisabled(scheduler: *arch.Scheduler, arg_init: bool) callconv(.C) noreturn {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user