2

I've been trying to compile a linux kernel on my own machine with the source linux-6.0-rc5, which is the latest. Everything goes well yet something haunts me. When I get the Image file under arch/riscv/boot and use a file command to view it, I found it looks like:

Image: MS-DOS executable PE32+ executable (EFI application) RISC-V 64-bit (stripped to external PDB), for MS Windows

Yet in my mind it should be of data type since objcopy -O binary -S should have trunked all other informations.

I've filed the vmlinux file and get

vmlinux: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), statically linked, BuildID[sha1]=432bf8175b2c7de8404f27f5f395fdb20479f263, with debug_info, not stripped

when I retry with a newly build C program with the same type, using the objcopy as the one that have been done to vmlinux, I get the correct data type.

Manually objcopying vmlinux is getting the same result as PE Executable, so it's impossible that make system has done extra changes.

The thing done with the vmlinux to get Image is

riscv64-linux-gnu-objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux arch/linux/boot/Image

as we can see with --just-print options on make.

I'm wondering if I've misread the meaning of the line objcopy or the result of file command.

1 Answer 1

1

That's because the boot image is a UEFI executable whose format is Portable Executable (a.k.a Windows exe).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.