简体   繁体   English

如何从源代码构建 Shim

[英]How to build Shim from source

I'm trying to build shim from source but i'm getting the following error.我正在尝试从源代码构建shim ,但出现以下错误。

ld -o shimx64.so --hash-style=sysv -nostdlib -znocombreloc -T /home/john/git/shim/elf_x86_64_efi.lds -shared -Bsymbolic -L/usr/lib64/gnuefi -L/usr/lib64 -LCryptlib -LCryptlib/OpenSSL /usr/lib64/gnuefi/crt0-efi-x86_64.o --build-id=sha1  --no-undefined shim.o mok.o netboot.o cert.o replacements.o tpm.o version.o errlog.o Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a lib/lib.a -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a --end-group /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a
ld: cannot find /usr/lib64/gnuefi/crt0-efi-x86_64.o: No such file or directory
ld: cannot find -lefi
ld: cannot find -lgnuefi
make: *** [Makefile:92: shimx64.so] Error 1

Any help would be much appreciated, thanks.任何帮助将不胜感激,谢谢。

My environment我的环境

System系统

  • Ubuntu 20.04.1 LTS Ubuntu 20.04.1 LTS

Packages套餐

  • build-essential
  • make
  • gnu-efi

Update更新

Thomas answer helped me build but when running托马斯的回答帮助我建立,但在运行时

make EFIDIR=/boot/efi install

I get the following error我收到以下错误

gcc -Og -g3 -Wall -Werror -Wextra -o buildid /home/john/git/shim/buildid.c -lelf
/home/john/git/shim/buildid.c:15:10: fatal error: libelf.h: No such file or directory
   15 | #include <libelf.h>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:117: buildid] Error 1

Tried adding the same variables as per Thomas answer but did not work.尝试按照 Thomas 的答案添加相同的变量,但没有奏效。

Looking at the file list of the gnu-efi package, I see:查看gnu-efi package 的文件列表,我看到:

/usr/lib/crt0-efi-x86_64.o (not /usr/lib64/gnuefi/crt0-efi-x86_64.o)
/usr/lib/libefi.a (not in /usr/lib64)
/usr/lib/libgnuefi.a (not in /usr/lib64)

I think you need to set LIBDIR=/usr/lib and EFI_PATH=/usr/lib during make , rather than the defaults which are /usr/lib64 (set here ) and /usr/lib64/gnuefi (set here ).我认为您需要在make期间设置LIBDIR=/usr/libEFI_PATH=/usr/lib ,而不是/usr/lib64在此处设置)和/usr/lib64/gnuefi在此处设置)的默认设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM