Reading the Spec & Hello World | UEFI Dev (in C)

Поділитися
Вставка
  • Опубліковано 3 лип 2024
  • Skimming over the first few chapters of the UEFI spec and starting an empty efi application for hello world (again), to officially start the actual EFI dev videos. These will tend to be more in-depth than the intro video, but future things may not have as much spec reading... or will they?
    Misc links:
    uefi.org/specifications (uefi & other specifications)
    en.wikipedia.org/wiki/Portabl...
    en.wikipedia.org/wiki/X86_cal... (this is what EFIAPI is in the programs)
    UEFI Programming playlist:
    • UEFI Programming in C
    Git Repo:
    github.com/queso-fuego/uefi-dev
    Repo state at the start of this video:
    git clone --recurse-submodules github.com/queso-fuego/uefi-dev
    cd uefi-dev
    git checkout cd684e1f656314d26919b35db438db7fc81e7dc8
    Repo state at the end of this video:
    git checkout a8e6966f77aed1794d05e7c1be4aa67af57d3483
    Notes:
    - This is the 1st render from Davinci Resolve that isn't mp4 h.264 AAC. Videos going forward should be h.265/HEVC, Quicktime/.mov, with Linear PCM (24bit) audio, using GPU hardware encoding (AMD 7700XT as of this video).
    I tried AV1 renders, but they didn't fully utilize the gpu, while h.265 did. This video took ~50%
    of realtime to render, or 45min for a 90min video. It was ~40% gpu use from AMD's adrenalin stats. AV1 was 200% realtime, or 3 hours, and used 14-18% gpu.
    That's no good, though overnight renders are normally OK.
    Maybe it's a gpu driver issue, windows, davinci resolve, cosmic rays, idk.
    But at similar settings to h.264 for CQP 16, using h.265 should be just as fast rendering and have lower file sizes for the same or better quality. Linear PCM is uncompressed audio compared to AAC, but I'm not sure if that comes across on youtube at all.
    - Why would you load a driver at runtime from an EFI application?
    To do something not natively supported or documented by UEFI. One use case could be using file systems other than what's defined by UEFI, which is namely/only FAT. If you want to use NTFS, EXT4, BTRFS, etc. then you need a driver that can work with that filesystem, and you can write those drivers and load them with your EFI applications.
    For example, Rufus does this to make bootable UEFI images with NTFS, iirc.
    - For paging, I will probably not do what I said, but will set up 4 or 5 level paging in a "kernel loader" section of the OS loader program. Else paging has to be set up anyway in the OS/kernel, most likely in the entry point code. The kernel will have to know and maintain the virtual memory map and keep that map in memory somewhere, but it doesn't necessarily need to set up paging.
    Hopefully leaving some setup code to the OS loader can simplify parts of the kernel.
    - The "unused linker input" warnings from clang were due to the .c to .o file compilation. Since I had the 2 linker flag lines as part of CFLAGS for clang, they were being run when compiling, and are useless until linking the .o file to the final executable.
    This was fixed later by using CFLAGS and LDFLAGS separately.
    - Sometime after this video, after updating rufus, it no longer worked to write .vhd files to a USB drive.
    Mounting the vhd in Windows had rufus see it fine, and you could select the disk image partitions with the correct size and other info, but it couldn't "see" the partitions on the disk image file itself.
    I changed later to write .hdd extension files with rufus, or .img, as needed. Raw image files work the same here, but you don't get to mount them or do other .vhd things unless you use OSFMount or other software (or you can use dd on an OS that actually works...).
    Next video:
    - More text output, changing text colors, other stuff
    Join the Community Discord: / discord
    Contact:
    queso_fuego.srht.site/contact.html
    - Let me know if there's anything specific you'd like to see!
    Questions about setup/software/etc.?
    Check the FAQ: queso_fuego.srht.site/about.html
    Outline:
    0:00:00 intro, make sure stuff still works
    0:03:11 new efi.c file, skim UEFI spec ch.1
    0:09:02 skim UEFI spec ch.2
    0:16:47 efi.h file, add data types
    0:35:55 skim UEFI spec ch.2
    0:42:51 add object dependencies to makefile with -MMD
    0:46:49 basic EFI_MAIN entry point
    0:50:30 skim UEFI spec ch.2
    0:53:55 skim UEFI spec ch.3
    0:56:57 skim UEFI spec ch.4, finally the actual entry point
    0:59:41 EFI_TABLE_HEADER and EFI_SYSTEM_TABLE
    1:06:30 SIMPLE_TEXT_OUTPUT_PROTOCOL
    1:12:12 reset console output, clear screen, write string
    1:24:37 build disk image and run qemu from makefile
    1:29:29 yes, it works on hardware! also what's next & outro
    Music credits:
    Winter Night by Sakura Girl | / sakuragirl_official
    Music promoted by www.chosic.com/free-music/all/
    Creative Commons CC BY 3.0
    creativecommons.org/licenses/...
    #uefidev #cprogramming #helloworld
  • Наука та технологія

КОМЕНТАРІ • 6

  • @gaius_enceladus
    @gaius_enceladus 7 місяців тому

    This is *great!* A really good intro demo! Many thanks!

  • @samborms
    @samborms 5 місяців тому

    thanks for your videos, I follow this serie since the beginning, I made the example from the first video, on my raspberry pi and works, thank you very much for make this channel

  • @dfrayt
    @dfrayt 9 місяців тому +3

    Just found your channel yesterday, lucky me! It's nice to have someone other than Tsoding Daily to watch while I procrastinate on my own projects. I never leave comments but wanted to say I like your stuff. Have a great day!

    • @QuesoFuego
      @QuesoFuego  9 місяців тому +2

      Thanks! I watch Tsoding as well, he's been a great inspiration

  • @yingchiahung
    @yingchiahung 3 місяці тому

    謝謝!