1

I am trying to compile efivar-0.23 for my LFS, but when I untar it end run the following command:

make libdir="/usr/lib/" bindir="/usr/bin/" mandir="/usr/share/man/" includedir=/usr/include/" V=1 -j1

I get an error, that NVME_IOCTL_ID is undeclared. I have looked through the whole internet for the answer, but the only thing I have found, is that I need to patch the file. I have found several patches, but nothing helps (maybe I am installing them incorrectly..). This is the last patch that I have tried: http://patchwork.openembedded.org/patch/117073/.

I have entered the untared efivar directory and have executed: patch -Np1 ../efivar.patch, but it was doing anything. It was like it is doing something, but nothing happened.

I have tried to patch < ../efivar.patch from the untared directory, but then the system started asking questions...

System: File to patch:
Me: Makefile
System: patching file Makefile
Hunk #1 FAILED at 12.
1 out of 1 hunk FAILED -- saving rejects to file Makefile.rej
The next patch would delete the file efivar-drop-options-not-supported-by-lower-version-gcc.patch,
which does not exist! Assume -R? [n]
Me: y
System: patching file efivar-drop-options-not-supported-by-lower-version-gcc.patch
The next patch would delete the file efivar_0.21.bb,
which does not exist! Assume -R? [n]
Me: y
patching file efivar_0.21.bb
patching file efivar_0.23.bb

I have tried different combinations of answers and different patches. I have also typed manualy in the files needed to be patched to be sure it containes what is needed (cause I am unsure if this patching works).

So basically I am at the same point with undeclared variable and a lot of time wasted not knowing what to do.. Any ideas?

  • 1
    What's your kernel's version? Or more precisely, the version of whatever you have in LFS to provide /usr/include/linux/nvme_ioctl.h? That's where NVME_IOCTL_ID is defined. – Stephen Kitt Apr 24 '16 at 13:10
  • @StephenKitt Kernel - linux-4.4.2; LFS - 7.9; efivar-0.23. And by the way, I dont have that file. I have only nvme.h and nvram.h. Should I rename the first one? Is that the problem?? But if I rename it, wont it break the system?? – New Face Apr 24 '16 at 13:15
2

efivar version 0.23 needs a patch to work with kernel headers from 4.4 (and later kernels), because the header defining NVME_IOCTL_ID changed (it was renamed from nvme.h to nvme_ioctl.h).

To build efivar on your system, you'll need the "Workaround rename of linux/nvme.h" patch. To apply that, go into the directory containing the efivar source code (with the 0.23 source, and no changes), and run

curl https://github.com/rhinstaller/efivar/commit/3a0ae7189fe96355d64dc2daf91cf85282773c66.patch | patch -p1

Then you should be able to build efivar correctly with kernel 4.4 headers.

Given that you have an nvme.h header file though, you'll probably still have problems with NVME_IOCTL_ID at this point. You can apply another patch which avoids using it altogether, "libefiboot: rework NVME so we get EUI right and don't need kernel headers" (this patch requires the previous one):

curl https://github.com/rhinstaller/efivar/commit/8910f45c27fadba0904f707e7c40ad80bf828f7e.patch | patch -p1

With these two patches you can build efivar regardless of where (and whether) your kernel headers define NVME_IOCTL_ID.

| improve this answer | |
  • I was about to say, the problem with the OE recipe in the question's first link is that it's not efivar-0.23. It's actually 0.23-15-g01abee4, which includes the second patch you mention. – sourcejedi Apr 24 '16 at 13:31
  • @sourcejedi Which first link? The openembedded one? – Stephen Kitt Apr 24 '16 at 13:34
  • If the OP was building 01abee4 the NVME_IOCTL_ID error wouldn't occur since the source at that point no longer contains any mention of it... – Stephen Kitt Apr 24 '16 at 13:35
  • Exactly. I meant the OE recipe is misleading because it doesn't apply to 0.23, the version the OP was actually building. The recipe is called "update to 0.23" and it says "Upstream removed the use of the nvme headers completely, so no more conflicts." The reason the recipe works (despite removing the blacklist line) is that it fetches the revision 01abee4. – sourcejedi Apr 24 '16 at 13:46
  • @StephenKitt Thank you Soo freakin much! So much thank you! I have spend the hole damn day running in circles with this problem... You are not an IT professional, you are just magick! Thanks so f**ckin much!! – New Face Apr 24 '16 at 13:47

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.