2

I'm new to Linux Kernel programming, and am pretty stuck with (what I think is) the last step in building my bootable image.

For some background, we are trying to upload a complete OS image onto the hardened PPC440 processor inside a Virtex 5 FPGA via JTAG. We are moving from a deprecated OS to a Xilinx custom Linux kernel with ongoing support. The required file for this upload is a single ELF containing the entire operating system and its applications, which (we believe) consists of a bootloader, kernel, device tree, and ramdisk image.

We have had some success with the build using ELDK, which does produce the correct file and runs on the processor; however, support for ELDK is limited, and it includes old libraries (libc 2.6, for example) and aging utilities. It would be better for maintainability to build in a more up-to-date toolchain and programs.

Skipping a few steps, we are able to build what we think are the core components of the ELF. We have u-boot for our bootloader, a kernel zImage, the compiled device tree blob, and a ramdisk image with all our necessary libraries.

What I am struggling to understand is how to wrap these up into one file. u-boot contains a utility mkimage that allows you to concatenate the latter three items and load them with one command from the u-boot prompt, but clearly it's possible to concatenate all four, since ELDK does produce a single file with (we believe) all of those pieces inside.

Does anyone know what I'm missing here? Is this concatenation step simple, or we off track?

Thanks!

  • Are you sure the single file you need to upload is an ELF, and not some kind of storage image? I'm not familiar with the Virtex 5, but that sounds like a really strange way to do it. That said, the GNU binutils package has tools like objcopy which you can use to copy files into section of an ELF. If you can edit the question with links to any documentation about why this has to be an ELF file and what its structure is supposed to be, that would help. – dirkt Jan 24 '18 at 20:47
  • I shouldn't have specified ELF. I only said so because that is the file type we've up until now been uploading. If you have any other suggestions, I'm fully open to them. Unfortunately, there is no documentation I'm aware of on the subject. This setup was all homebrew before me, and nobody documented. – dustinwerran Jan 25 '18 at 9:27
  • Without knowing how the uploading works, what files are needed for it, and why it's made this particular way it's difficult to answer this question ... – dirkt Jan 25 '18 at 17:06
0

I've been able to answer the question. When making the linux kernel, you only need specify the target as the following: simpleImage.initrd.[device-tree-name]. This tells the Makefiles to wrap the zImage, ramdisk image (must be named ramdisk.image.gz and placed in arch/[your-arch]/boot) and your dts (must be named device-tree-name and placed in arch/[your-arch]/boot/dts). It will also automatically compile your .dts into a .dtc for you during the make.

Note this output ELF does not include a bootloader. That will need to be handled separately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.