kandi X-RAY | edk2 Summary
kandi X-RAY | edk2 Summary
EDK II
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of edk2
edk2 Key Features
edk2 Examples and Code Snippets
Community Discussions
Trending Discussions on edk2
QUESTION
I'm coding a small OS kernel which is supposed to have a driver for the Intel's xHC (extensible host controller). I got to a point where I can actually generate Port Status Change Events by resetting the root hub ports. I'm using QEMU for virtualization.
I ask QEMU to emulate a USB mouse and a USB keyboard which it seems to do because I actually get 2 Port Status Change Events when I reset all root hub ports. I get these events on the Event Ring of interrupter 0.
The problem is I can't find out why I'm not getting interrupts generated on these events.
I'm posting a complete reproducible example here. Bootloader.c is the UEFI app that I launch from the OVMF shell by typing fs0:bootloader.efi
. Bootloader.c is compiled with the EDK2 toolset. I work on Linux Ubuntu 20. Sorry for the long code.
The file main.cpp is a complete minimal reproducible example of my kernel. All the OS is compiled and launched with the 3 following scripts:
compile
...ANSWER
Answered 2021-Apr-26 at 06:13I finally got it working by inverting the MSI-X table structure found on osdev.org. I decided to completely reinitialize the xHC after leaving the UEFI environment as it could leave it in an unknown state. Here's the xHCI code for anyone wondering the same thing as me:
QUESTION
Upon deciding to write a simple "Hello World!" program in EDK2, I stumbled upon the following problem:
As I am using a serial connection for debugging, the output of the debug functions like DebugPrint successfully get redirected to my serial terminal (PuTTY in this case), well sort of.
After compiling an executing the following program inside an UEFI shell, I simply get an empty line as a result. But after executing the same binary again, the line gets successfully printed in all it's beauty.
This is the source code of the program i ran:
...ANSWER
Answered 2021-Apr-01 at 12:42After a lot of fiddling around I realised, that I manually specified the entry point to my main-function (efi_main
), which should instead point to _ModuleEntryPoint
when using the UefiDriverEntryPoint library from EDK2.
This solved my problem instantly :)
QUESTION
Currently I am trying to use the C standard library in my EDK2 project. As my Visual Studio 2019 did not automatically add the necessary include directories, I manually added the following folders to my include directories:
...ANSWER
Answered 2021-Apr-01 at 11:08I settled on implementing the functions I needed from the stdlib myself, as @user123 proposed, in order to solve this problem and save me a lot of time.
QUESTION
I want to learn more about firmware developement. I already know how to write assembly programs for the old BIOS and now I wanted to start with UEFI. I managed to compile and emulate a Hello World program, and now I was trying to write a program which displays on the screen the current time using the Runtime Service GetTime(). However when I use this function the program hangs, as if it wasn't installed during PI. Here is the code:
...ANSWER
Answered 2020-Dec-12 at 14:54I think you missed to initialize RT.
QUESTION
I have heard its a conventional practice to store program dependent files in /usr/share/application-folder
in linux. So I'm trying to do it in my c program in a function called load_interface_files()
for example. I am not sure if this is a good practice or not, I've heard about creating configuration files for this kind of issues.
Anyways, here's the the code I wrote to make a directory in /usr/share
.
ANSWER
Answered 2020-Dec-01 at 04:25use ls -ld /usr/share
to see what the permissions on the directory are (without -d
, you get the contents and their permissions).
Use code like:
QUESTION
I have a Windows 10 Pro virtual machine using KVM. It is set up through virt-manager using the latest version of libvirt and QEMU. All of this is running on Manjaro Linux 20. Manjaro defaults to using PulseAudio for its audio output (at least for Manjaro 20). I was wondering if there is a way to use PulseAudio with libvirt/QEMU/KVM to have an audio pass-through from the guest OS to the host. Meaning that anything that is playing in the Guest OS will need to be heard through the default output device in Manjaro Linux. First, I tried setting environment variables to set it up, but that didn't work, and it also is deprecated past QEMU 4.1 (I am using 5.1.) Then, I tried using this tutorial, which ended up somehow bricking Manjaro, and I had to reinstall. I am currently using the default Spice server through virt-manager. I have heard that the Spice server introduces lots of overhead, and I can't afford that. I need every CPU cycle, and if PulseAudio is already running, I may as well use it. My libvirt XML config WITHOUT the Spice server is as follows:
...ANSWER
Answered 2020-Oct-28 at 19:08This is more of a comment, really...
I don't use libvirt
myself, but as far as I can tell there aren't any audio devices in your config.
Here are the qemu
command line options I use for guest (Win10 and others) audio output to PulseAudio output on -machine q35
:
QUESTION
I am trying to create a efi app by manually compiling and linking the source code with MS's VC compiler and MS's Linker.
The source code compiles fine but I get a linker error:
...ANSWER
Answered 2020-Oct-15 at 08:51You likely need to add gEfiShellProtocolGuid to the [Protocols] section of your application's INF file:
QUESTION
I am a novice in C and trying to amend and compile an EDK2 EFI program.
The program portion I want to change has a function MsgLog
which takes a Char16 *
variable and uses this to write to a log file.
The current code has this
...ANSWER
Answered 2020-Sep-06 at 07:42SPrint (myVariable, 255, L" : ABC");
is wrong. myVariable
is NULL
- you can't write to a NULL
pointer. You have to actually allocate memory for the string if you want to use SPrint
. For more information review your knowledge about pointers and about snprintf
standard C function. The second argument to SPrint
is actually the size of allocated memory - you allocated no memory, so the 255
is just invalid.
QUESTION
Hi I'm using edk2 to write a boot service for a kernel and need to apply AllocatePages
service to apply memory with type as EfiConventionalMemory.
However, it returns an error code of EFI_INVALID_PARAMETER.
I looked into the source code from git, the actual function is as follow:
...ANSWER
Answered 2020-Sep-03 at 21:45The memory type parameter specifies the type the memory should have after allocation. Obviously the memory cannot be free after allocation, so that’s why EfiConventionalMemory is an invalid parameter.
The source of memory for the allocation is always EfiConventionalMemory.
Typically you would use BootServicesData as the requested memory type.
QUESTION
I want to know when I need to free a pointer that is returned from EFI functions
...ANSWER
Answered 2020-Jun-30 at 11:38You have to look into the specification, if you are responsible to free the pointer there is a note.
For your LocateHandleBuffer example:
Buffer
A pointer to the buffer to return the requested array of handles that support Protocol. This buffer is allocated with a call to the Boot Service EFI_BOOT_SERVICES.AllocatePool(). It is the caller's responsibility to call the Boot Service EFI_BOOT_SERVICES.FreePool() when the caller no longer requires the contents of Buffer."
You can use the BlockIO protocols after you free the buffer, you are not freeing the handle instances (which would be a very bad idea), instead you are freeing an array of them.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install edk2
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page