UEFI BootLoader - bootloader

I am looking at developing a simple (to start with) UEFI Boot loader to load a ELF image, and was wondering if anyone had a good entry point into maybe any existing projects, or examples that I can use to get started out with.
In addition I was wondering if any one had any experience in getting virtual box to run an EFI application. I have set up a VM with EFI mother board but can seam to create an EFI System Partition for it to load out of (without using an OS), all I can achieve is the UEFI command line.

You might try taking a look at the GRUB or elilo source code. These are also good because they support loading ELF images. You might also look to the EDK2, there is a lot of good code there, and it's easy to build EFI executable images with it.
When referencing the UEFI, I also like to use Phoenix's wiki. I find the boot services entry to be especially useful.
Hope this helps at least a little!

I recently became interested in bootloaders too. I'm still a newbie in this field, but I found this interesting step-by-step tutorial to code a "Hello World" bootloader. Hope it gives you or anyone else with the same question a starting point for developing your bootloader.

GRUB installation on UEFI is possible by means of grub-mkimage. ELF binaries are known to be similarly masqueraded as complying UEFI's PE32+ requirement. If some C developers will refactor the code as done by https://www.kernel.org/doc/Documentation/efi-stub.txt and then generalize mkimage's that code as a separate tool for the sake of multibooters without PE32+ kernel loaders for every OS...
Just imagine
ld -b input-format -o <output>.efi --oformat=output-format objfile ...

Related

What is a kernel image? Why is it mandatory in Embedded?

Now I'm working in a Yocto project. So, I heard this word called "image". What is that and why do we need that, and how does it take place in Embedded Projects?
There are more things named images when it comes to the embedded world in general, and the Yocto Project specifically.
First, there are kernel images, as you named in the post title. This is a binary form of the operating system core, nicknamed the kernel, that a bootloader can use to start the OS. In a YP context, this will almost always be a Linux kernel. The expression image there literally means one file that is the executable form of the Linux kernel. the same wording is used by the Linux Kernel devs too, by the way.
Secondly, there are Operating System images. Now those are a little bit specific to the embedded world, as you usually do not run an interactive installation of, say, Ubuntu, Debian or such, but prepare everything to be copied onto the target device in one go. This prepared form is also called image, as explained by Gino in the first answer.
Those OS images are not exactly mandatory: you can totally run an embedded system off a standard Linux distribution - given sufficient hardware support. Reversely, you can also run a desktop computer or even a cloud server on an image, and many people do this for a variety of reasons.
In a nutshell, the main purpose of the Yocto Project technology is to produce these images.
Thirdly, for mostly smaller, non-Linuxy embedded systems, the term image often refers to the binary blob that the toolchain outputs. While the technical details are vastly different, it is probably sufficient to just think of it as "the second meaning, but without Linux" to get the mindset started.
It is explained in the Yocto Software Overview documentation:
Image: A binary form of a Linux distribution (operating system)
intended to be loaded onto a device.
There is a more detailed explanation on the "images" produced by the build system in the Yocto Project Overview and Concepts Manual > Images section:
The images produced by the build system are compressed forms of the
root filesystem and are ready to boot on a target device.

LWJGL on ARM (Minecraft on BBB)

Still chasing that white whale of running Minecraft on an BBB, I eventually came to the conclusion that the major issue was twofold. First, Minecraft has a dependency on the Lightweight Java Games Library, or LWJGL, and it does not have an ARM version to reference when it's downloading the run environment. Second, Minecraft's launcher doesn't allow you to reference specific jars in the boot up process, meaning that any version of LWJGL and it's accessories that could be ported to ARM would also have to pass the sha checks. Granted, those could be fudged, but I'm at a bit of a loss on how to proceed since I seem to be in uncharted territory. Anyone have any pieces of advice or suggestions on where to go from here?
I have found some information here for LWJGL for ARM:
http://www.raspberrypi.org/forums/viewtopic.php?f=34&t=19532
This brought me to 2 places:
More info on running ARM LWJGL: http://www.trimslice.com/forum/viewtopic.php?f=48&t=393
And, what appears to be precompiled LWJGL for ARM: http://openjdk.gudinna.com/lwjgl-es/
I have yet to test anything, but it's a step in the direction. I am new to a lot of this myself, so we'll see where it goes.
I am also in the same boat, trying to do the same thing.
All I know for sure so far:
JWJGL is built for x86, so it can't run on ARM processor - we would need to recompile for ARM.
There is a checksum when you do replace the LWJGL library, which triggers minecraft to replace the file with the x86 version.
I had an idea that, in order to get around the checksum issue, if someone with the know how could make a mod that also included the LWJGL for ARM. In this manner, as I understand it, getting MC to run on BBB would be as simple as copying over a mod.
Sorry I couldn't help further. I'll keep an eye on this post and I'll let you know what I find out.

Linux on Dragonboard APQ8074

I have a DragonBoard APQ8074 with SnapDragon 800. I am able to successfully build Android and run some OpenCL related apps on this.
I am currently trying to build a linux kernel and load either Ubuntu or Fedora on this board.
It wouldbe really helpful if anyone could point me to suitable posts or guides.
I did look into Freedreno, it is really a good starting point, but i am still unable to understand the part of initrd/ramdisk img file.
Also the bootloader (similar to u-boot i assume), i am not clear which parts of it i need to update, if at all necessary.
Thanks in advance.
regard,
Anup.
This might help http://whiteboard.ping.se/Android/Android. There's a few sections there that might be handy. I also found this other article that helped me understand intrd and intramfs a bit better if that helps. http://www.linux.com/learn/linux-career-center/114923-the-kernel-newbie-corner-qinitrdq-and-qinitramfsq-some-unfinished-business

Customizing linux kernel for new board

I'm porting/customizing linux kernel for our board. I will base on atmel evolution board configuration, and I need to overwrite some startup routines and add our drivers.
Is there any document, link, forum where I can get information how to make it in Linux way ?
Which files can I overwrite, and which shall I create from scratch ?
Is this a Board Support Package question ?
Thank you
I doubt that there is short and simple answer to your question. To accomplish this task you should more or less good understand Linux as distribution (kernel + boot scripts + user space software) work together and how make them be a friends.
I could recommend you book, which I found extremely useful as embedded Linux engineer: Embedded Linux Primer: A Practical Real-World Approach (2nd Edition) I am quite confident it will answer most of your questions.
I think that's it. Short, nice, fresh:
http://free-electrons.com/blog/elce-2012-slides-porting-linux-to-new-arm-soc/

How to debug hacked Linux Kernel code

I am newbie in this filed.
I don't have no good way to debug it. Just build it, reboot and run.
Any hint is very appreciated!
Depending on what you are hacking, it might be better to use UML (User Mode Linux). If you're messing with non-hardware dependent code, then I think it will help a great deal.
UML allows you to compile the kernel as an ordinary user mode program, and run it as any other application on your system. Because it runs like a regular application, you can very easily debug it with gdb, or any other debugger of choice.
Here's a good start for UML
I'd recommend you to start from reading 4th chapter ("Debugging Techniques") of classical Linux Device Drivers book.

Resources