ghaerr / elks

Embeddable Linux Kernel Subset - Linux for 8086
Other
1.02k stars 108 forks source link

elf.c:34:18: error: use of undeclared identifier 'LIBELF_ARCH' #1763

Closed anchorz closed 9 months ago

anchorz commented 11 months ago

after make menuconfig; make clean; make

the build process stops at cd lib/elftoolchain-0.7.1/libelf; do gcc -Wall -I/Users/jayne/Development/ws-git/elks/include -I/Users/jayne/Development/ws-git/elks/elks/include -I/Users/jayne/Development/ws-git/elks/elks/tools/elf2elks/lib/elftoolchain-0.7.1/libelf -I/Users/jayne/Development/ws-git/elks/elks/tools/elf2elks/lib/elftoolchain-0.7.1/common -DKERNEL -c -I. -I../common "$src"; done;

elf.c:34:18: error: use of undeclared identifier 'LIBELF_ARCH' .libelf_arch = LIBELF_ARCH, ^ elf.c:35:22: error: use of undeclared identifier 'LIBELF_BYTEORDER' .libelf_byteorder = LIBELF_BYTEORDER, ^ elf.c:36:19: error: use of undeclared identifier 'LIBELF_CLASS' .libelf_class = LIBELF_CLASS, ^

anchorz commented 11 months ago

I dont know myself how to use the files.That may help:

_libelf_config.h

if defined(amd64)

define LIBELF_ARCH EM_X86_64

define LIBELF_BYTEORDER ELFDATA2LSB

define LIBELF_CLASS ELFCLASS64

elif defined(i386)

define LIBELF_ARCH EM_386

define LIBELF_BYTEORDER ELFDATA2LSB

define LIBELF_CLASS ELFCLASS32

+#elif defined(aarch64) +#define LIBELF_ARCH EM_AARCH64 +#define LIBELF_BYTEORDER ELFDATA2LSB +#define LIBELF_CLASS ELFCLASS64

endif

anchorz commented 11 months ago

after that fix i can get the image: qemu-system-x86_64 -drive format=raw,file=image/fd1440.img,if=floppy

ghaerr commented 11 months ago

Hello @anchorz,

Thanks for the fix for building elf2elks on M1. I'll look into add this as a patch to the build, since the elf2elks source is pulled from a specific external commit rather than being held resident in this repository.

Thank you!

anchorz commented 11 months ago

can you just simply add the patch in ELKS repository?

ghaerr commented 11 months ago

can you just simply add the patch in ELKS repository?

Yes, thank you. I plan to do that.