Limine Bare Bones: Difference between revisions

Jump to navigation Jump to search
Since the Limine terminal is deprecated, don't use it.
[unchecked revision][unchecked revision]
mNo edit summary
(Since the Limine terminal is deprecated, don't use it.)
Line 38:
// be made volatile or equivalent.
 
static volatile struct limine_terminal_requestlimine_framebuffer_request terminal_requestframebuffer_request = {
.id = LIMINE_TERMINAL_REQUESTLIMINE_FRAMEBUFFER_REQUEST,
.revision = 0
};
Line 98:
 
return 0;
}
 
// Our quick and dirty strlen() implementation.
size_t strlen(const char *str) {
size_t ret = 0;
while (*str++) {
ret++;
}
return ret;
}
 
Line 121 ⟶ 112:
// linker script accordingly.
void _start(void) {
// Ensure we got a terminalframebuffer.
if (terminal_requestframebuffer_request.response == NULL
|| terminal_requestframebuffer_request.response->terminal_countframebuffer_count < 1) {
hcf();
}
 
// Fetch the first framebuffer.
// We should now be able to call the Limine terminal to print out
struct limine_framebuffer *framebuffer = framebuffer_request.response->framebuffers[0];
// a simple "Hello World" to screen.
const char *hello_msg = "Hello World";
 
// Note: we assume the framebuffer model is RGB with 32-bit pixels.
struct limine_terminal *terminal = terminal_request.response->terminals[0];
for (size_t i = 0; i < 100; i++) {
terminal_request.response->write(terminal, hello_msg, strlen(hello_msg));
uint32_t *fb_ptr = framebuffer->address;
fb_ptr[i * (framebuffer->pitch / 4) + i] = 0xffffff;
}
 
// We're done, just hang...
Line 139 ⟶ 132:
 
</source>
 
'''Note:''' Using the Limine terminal requires that the kernel maintains some state as described in the specification (https://github.com/limine-bootloader/limine/blob/trunk/PROTOCOL.md#x86_64-1).
 
===linker.ld===
Line 442 ⟶ 433:
==Conclusions==
 
If everything above has been completed successfully, you should now have a bootable ISO or hard drive/USB image containing your 64-bit higher half Limine protocol-compliant kernel and Limine to boot it. Once the kernel is successfully booted, you should see "Helloa World"line printed on screen from the top left corner.
 
== See Also ==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu