I've just started to study UEFI development, as a playground I've got a custom AARCH64 platform with EDK2-based sources provided for building full firmware image (to be burned into flash).
"Hello world" in DXE driver is already done, so I've selected a practical task: to include iPXE into firmware to avoid chain loading.
The idea is to build iPXE EFI application and put it into firmware volume.
Then I hope to be able to call it from UEFI shell, the final step is to add it to boot manager.
And here I stuck: I can't find any information on how to add EFI application to FV.
Please advise if it possible at all and where to read about it.
Thank you!
Okay, the solution was close in this inf file: https://github.com/tianocore/edk2-non-osi/blob/master/Drivers/Realtek/Bus/Usb/UsbNetworking/RtkUsbUndiDxe.inf
I've put pre-compiled ipxe.efi and now it's included in firmware volume.
Related
I am using Petalinux, built with Yocto SDK. I want to automatically install my kernel module and make the devices available in /dev/*.
With KERNEL_MODULE_AUTOLOAD+="modulename" I can see the appropriate entries in /etc/modules-load.d/ as well as entries in /sys/class/misc/** , but not in /dev/*. Is there something I am missing?
Well, the structure of Yocto has nothing to do with the creation of device nodes. Either your driver does that for you (upon loading / probing), or you had some script that made them earlier. As long as your module has been loaded upon boot, you've got KERNEL_MODULE_AUTOLOAD correctly. If the module gets loaded, but you're not getting any device nodes automatically (and you got that before) you'll need to investigate what has changed in your system. (Versions of kernel and eg mdev/udev etc)
Can an EFI application be automatically loaded and executed before BDS phase, just after all the DXE drivers have been loaded?
If I include the application in .fdf file just after the DXE drivers, will it be automatically loaded and executed ?
This question is very board and I will only scratch the surface with my answer. Please read documentation that I mentioned to get more information.
If you have full source code of UEFI firmware for your hardware then you can add UEFI module to be executed before BDS phase. Otherwise you can affect only boot order (which is right before calling ExitBootServices) by adding UEFI Application using bcfg shell command, pleas check this question.
If you want to execute code before BDS it have to be DXE module (ie. DRIVER, RUNTIME_DRIVER). There are many module types that can be used and exact depend on your use case. More about module types you can find in Appendix G of INF file specification.
Adding to FDF file is not enough for code to be executed. FDF file describe only flash layout: how and where each binary would be placed in final flash image. To add DXE driver you also have to add your INF file to platform DSC file. Next thing is to have correct [Depex] section in INF, which can be as simple as:
[Depex]
TRUE
Last thing that you have to understand is DXE Dispatcher. Each boot DXE Dispatcher iterate over know image list and and call EFI_DRIVER_BINDING_SUPPORTED function (defined by EFI_DRIVER_BINDING_PROTOCOL). This method should check if supported hardware is available in platform. If EFI_DRIVER_BINDING_SUPPORTED return success then other driver binding method will be called (EFI_DRIVER_BINDING_START), which starts device. Entry point should be used only for protocol registration, starting device in entry point is not recommended.
Useful resources:
EDK II Specifications - specs for various file types (INF, FDF, DSC, DEC, etc.)
Developer Resources - Drivers Writers Guide and Drivers Wizard.
EDK2 sourceforge - repository of very useful resources about EDK2
I'm currently working on a project on STM32F4 and I'm using Eclipse. I've got some problems with the program - it seems to have a random behavior - sometimes it works fine, other times it has some errors. Sometimes when I try do debug with breakpoints I get the beautiful HardFault Handler and it really messes with my brains.
Sorry for the little off-topic paragraph, just wanted to let you know why I decided to use printing to a log file at some key moments in the program so I can see in which states and in which functions does the problem occur. I'm debugging through a JTAG interface with Eclipse (gdb) and I need to know if there is an easy method integrated in Eclipse that may help me use fprintf-like functions inside my program to write to a file on the disk.
If no, any other solutions?
Thanks
I do not like to connect the debug output log to the Jtag communication port because the log will not be available after development.
I usually build an SystemLog library that can send the log messages through any medium that is available (UART, USB, Ethernet or SDCARD). That's what I'd recommend you to do. It will help you through the development, and the support team on the event of any failure on field.
If stdlib is available in your project you should use the snprintf family functions to build your SystemLog.
Also, you can integrate the log output to the eclipse console by calling a serial console communicator (if you use UART) on you makefile, in this case, your makefile will have to flash the target as well.
so what I'm trying to do is utilize a simple Qt application IN eclipse without using the eclipse QT plugin by linking the required libraries through the GCC C++ Linker. However, I have been unable to locate the exact name of the library to use, or which libraries will be necessary. I've located the path of the Qt library my application seems to be accessing, but I continue to get an error when building that just says "-lqt" doesn't exist/can't find, etc.
The reason I'm doing this is because I'm building a simple game in OGRE for a project at the uni and wanted to use a Qt application for the GUI. Well, I didn't necessarily want too, but our professor wishes us to do so. Please don't suggest that I simply embed an Ogre widgit into my Qt application as this isn't an opti
Any ideas?
Thanks <3
Well, if you are using CMake then it should take care of everything provided that you instructed it to do so. phb provided a link to even better instructions.
First step is to instruct the CMake that we need Qt for our project. This is done with (you can specify individual parts that are needed as well):
find_package(Qt4 REQUIRED)
If Qt is not found in the typical locations (e.g. QTDIR is not set) - cmake will fail.
You also have to instruct CMake to use Qt include paths and set certain compiler definitions:
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
Finally, for each target you need to tell that you'd like to link with Qt libraries:
target_link_libraries(foo ${QT_LIBRARIES})
You might also want to process your headers and will have to process the user interface files with moc. For the details please refer to the provided links.
In addition to provided links you can have a look at the comments at the top of FindQt4.cmake file.
I understand that Apple doesn't support using dynamic libraries in iPhone applications. But we are working on a in-house application and we have a unique requirement to use the dynamic libraries. Our requirement is to load a dynamic library as part of "iPhone" application start up. I read that DYLD_INSERT_LIBRARIES is meant for this purpose. So I edited the Info.plist and added below entry.
LSEnvironment
DYLD_INSERT_LIBRARIES
#executable_path/sample.dylib
But it does not seem to be working. Can you please let me know your thoughts ? Really appreciate your help in this regard.
Thanks
--Neo
I've found a way to successfully add LC_LOAD_DYLIB load command to a MachO binary using optool.
$ optool install -c load -p "#executable_path/<dylib_path>" -t <executable>
$ otool -L <executable>
When building optool, make sure that build setting OTHER_LDFLAGS includes -ObjC.
optool does not seem to be able to successfully add load commands for arm64 architectures, so you may want to remove arm64 from the binary
$ lipo <input_file> -remove arm64 -output <output_file>
Edit:
There is an open pull request with support for arm64.
I also working on the same problems for last few days. I also didn't succeed to do it the way you try. So I try to launch my app from another app using this link:
Dynamic Library injection
,unfortunately Apple Block running multiple tasks (even on iphone simulators) but you can try maybe you will have more luck. I know its not a answer you expect but maybe it will give you some way to think. Please share if you have some progress.
You "could" load a binary at runtime and you can manipulate xcode settings to make it compile dylibs for iOS. See this answer:
https://stackoverflow.com/a/10509453/784387
Happy to be corrected, but dylibs are not supported and will not work. You need to get the code for the libraries and compile them into a static lib for the arm6/7 architecture. Then you can easily include these libs. There are plenty of examples of static libs and XCode also provides targets for building them.