<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Operating Systems on </title>
    <link>https://blog.mauzy.net/tags/operating-systems/</link>
    <description>Recent content in Operating Systems on </description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 09 Oct 2024 07:07:07 +0100</lastBuildDate>
    <atom:link href="https://blog.mauzy.net/tags/operating-systems/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Further Reading and Concepts</title>
      <link>https://blog.mauzy.net/technology/furtherconcepts/</link>
      <pubDate>Wed, 09 Oct 2024 07:07:07 +0100</pubDate>
      <guid>https://blog.mauzy.net/technology/furtherconcepts/</guid>
      <description>&lt;h3 id=&#34;kernel-entry-point&#34;&gt;Kernel Entry Point&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(&lt;code&gt;_Start&lt;/code&gt; in your context)**: The kernel entry point is the specific memory address where the execution of the kernel begins. This address is typically defined in your kernel code, and the bootloader is designed to jump to this address after loading the kernel into memory. Once the control transfers to the kernel, it assumes control of the system&amp;rsquo;s resources and functions.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Bootloader&amp;rsquo;s Task Completion&lt;/strong&gt;: After loading the kernel into memory and transferring control to the kernel entry point, the bootloader&amp;rsquo;s task is essentially completed. It has done its job of loading the operating system kernel into memory and initializing the system. At this point, the bootloader doesn&amp;rsquo;t need to stay in memory anymore.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Where Does the Bootloader Go?&lt;/strong&gt;: After the kernel takes over, the bootloader doesn&amp;rsquo;t have a specific place it &amp;ldquo;goes&amp;rdquo; in memory. It simply ceases to execute because the CPU&amp;rsquo;s instruction pointer is now pointing to the kernel&amp;rsquo;s entry point. The bootloader code, which was previously in memory, is effectively overwritten by the kernel code as the kernel is loaded.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;abi&#34;&gt;ABI&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Application Binary Interface (ABI) is a set of rules and conventions that dictate how programs interact with a computer&amp;rsquo;s hardware and operating system. It defines things like data type sizes, calling conventions, and system call numbers. In essence, the ABI ensures that software components, like libraries and applications, can work seamlessly together by following a common set of rules regarding function calls, data structures, and system interactions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;vga-text-mode-and-bios-deprecated&#34;&gt;VGA Text Mode and BIOS Deprecated&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Older methods of interacting with the computer&amp;rsquo;s display, like VGA text mode and BIOS, are becoming obsolete on newer machines. These methods are being replaced with more modern techniques.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;uefi-and-framebuffers&#34;&gt;UEFI and Framebuffers&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;UEFI (Unified Extensible Firmware Interface) is the modern replacement for BIOS. It supports pixel buffers, which are essentially areas in memory where you can draw pixels directly on the screen. This is in contrast to the older VGA text mode, which dealt with characters on a grid.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;multiboot-flags-and-vesa-vbe&#34;&gt;Multiboot Flags and VESA VBE&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When you&amp;rsquo;re working on low-level programming tasks like creating an operating system, you can set up a framebuffer using techniques like Multiboot flags (a protocol used by bootloaders like GRUB) or VESA VBE (VESA Video BIOS Extensions) directly. These methods allow you to initialize a pixel buffer for drawing graphics.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;drawing-text-in-framebuffer-mode&#34;&gt;Drawing Text in Framebuffer Mode&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Unlike VGA text mode where characters are predefined, in a framebuffer, you have to draw each character (glyph) yourself. This means you need a font, which is essentially a set of bitmap images for each character. Most Linux distributions provide PC Screen Fonts that you can use. To display text, you&amp;rsquo;ll need functions similar to &lt;code&gt;terminal_putchar&lt;/code&gt; but adapted for drawing pixels instead of using predefined characters.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;implementation-details&#34;&gt;Implementation Details&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Even in framebuffer mode, you still need to manage things like the cursor position, handle line breaks, and implement scrolling, just like you would in VGA text mode. These concepts remain the same; it&amp;rsquo;s just the way you interact with the display that has changed.&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
    </item>
    <item>
      <title>Operating System Build</title>
      <link>https://blog.mauzy.net/technology/operating-system-build/</link>
      <pubDate>Thu, 28 Sep 2023 07:07:07 +0100</pubDate>
      <guid>https://blog.mauzy.net/technology/operating-system-build/</guid>
      <description>&lt;h1 id=&#34;setup&#34;&gt;Setup&lt;/h1&gt;&#xA;&lt;h2 id=&#34;using-windows-subsystem-for-linux-debian&#34;&gt;Using Windows Subsystem for Linux (Debian)&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Install list&#xA;&lt;ul&gt;&#xA;&lt;li&gt;gcc&lt;/li&gt;&#xA;&lt;li&gt;build-essential&lt;/li&gt;&#xA;&lt;li&gt;bison&lt;/li&gt;&#xA;&lt;li&gt;flex&lt;/li&gt;&#xA;&lt;li&gt;libgmp3-dev&lt;/li&gt;&#xA;&lt;li&gt;libmpc-dev&lt;/li&gt;&#xA;&lt;li&gt;libmpfr-dev&lt;/li&gt;&#xA;&lt;li&gt;texinfo&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Cross-Compiler&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;git clone https://github.com/lordmilko/i686-elf-tools&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;cd i686-elf-tools&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;./i686-elf-tools.sh linux&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;using-manjaro-vm&#34;&gt;Using Manjaro VM&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Dependencies&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GCC (existing release you wish to replace), or another system C compiler&lt;/li&gt;&#xA;&lt;li&gt;G++ (if building a version of GCC &amp;gt;= 4.8.0), or another system C++ compiler&lt;/li&gt;&#xA;&lt;li&gt;Make&lt;/li&gt;&#xA;&lt;li&gt;Bison&lt;/li&gt;&#xA;&lt;li&gt;Flex&lt;/li&gt;&#xA;&lt;li&gt;GMP&lt;/li&gt;&#xA;&lt;li&gt;MPFR&lt;/li&gt;&#xA;&lt;li&gt;MPC&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Download gcc and bin-utils to src and make them&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;booting-the-operating-system&#34;&gt;Booting the Operating System&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The bootloader, such as GRUB, used to start/load the operating system.&lt;/li&gt;&#xA;&lt;li&gt;The operating system needs to handle when the bootloader passes control to it.&lt;/li&gt;&#xA;&lt;li&gt;The kernel is passed a very minimal environment where the stack is not yet setup.&lt;/li&gt;&#xA;&lt;li&gt;Because there is no stack yet, we must make sure global variables are set correctly.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This is done in assembly&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;bootstrap-assembly&#34;&gt;Bootstrap Assembly&lt;/h1&gt;&#xA;&lt;p&gt;&lt;code&gt;i686-linux-gnu-as boot.s -o boot.o&lt;/code&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
