• Iced Raktajino@startrek.website
    link
    fedilink
    arrow-up
    14
    ·
    3 days ago

    That’s basically what EFI booting does.

    Initramfs’s main purpose is to load enough of a system to be able to load/boot the kernel and everything else from the hard disk. It’s also used for more complex boot scenarios such as loading LUKS and providing a password prompt if the root partition is encrypted.

    • Björn Tantau@swg-empire.de
      link
      fedilink
      arrow-up
      7
      ·
      3 days ago

      This has absolutely nothing to do with EFI booting and the kernel does not sit in the initramfs. With EFI the bootloader is just an executable in a FAT32 partition. The kernel is its own file either on the same partition or on one readable by the bootloader. The initramfs is also a single file and contains additional kernel modules and like you said programs like LUKS.

      I’m questioning the single file for initramfs concept.

      • Scoopta@programming.dev
        link
        fedilink
        arrow-up
        16
        ·
        edit-2
        3 days ago

        The reason for initramfs is because if you build your block or filesystem drivers as modules the kernel can’t boot without loading the modules and can’t load the modules without said modules and therefore causing a chicken and egg problem. Reading a folder without all necessary boot drivers just isn’t possible. That’s why the bootloader is responsible for loading initramfs into system memory, the kernel can read it with 0 drivers required. Getting rid of it can be done but ALL of your boot drivers need to be statically linked into the kernel image so that the kernel doesn’t need any modules to get the rootfs mounted. Ironically EFI can be used to obsolete initramfs in theory since the kernel can read data from the ESP without any drivers being required so putting modules in a folder on the ESP would work for EFI enabled systems

        • Björn Tantau@swg-empire.de
          link
          fedilink
          arrow-up
          5
          ·
          3 days ago

          Thanks. I remember the big fat reminders to not forget to include the correct filesystem drivers when building your own kernel. Back before Mr Reiser decided to become a murderer.