[ipxe-devel] src/util/get-pci-ids version.h, asm/linkage.h and generated/timeconst.h: No such file or directory

Geert Stappers stappers at stappers.nl
Sat Apr 30 17:33:31 UTC 2022


Hello,


The iPXE source tree has a script named src/util/get-pci-ids
that doesn't work for me.  I seek your advice to get it working.


I have three errors.  The first error is that my Linux source tree
has no `include/linux/version.h`

<error1text>
$ ./get-pci-ids /usr/src/linux/torvalds
Could not find /usr/src/linux/torvalds/include/linux/version.h.
/usr/src/linux/torvalds is probably no Linux kernel source tree.
$
</errror1text>

Based upon
<screenshot>
$ git log -- src/util/get-pci-ids
commit c3b4860ce3fb25b907a2ca3e46955df34c0ae9fd
Author: Michael Brown <mcb30 at ipxe.org>
Date:   Fri Jul 20 19:55:45 2012 +0100

    [legal] Update FSF mailing address in GPL licence texts
    
    Suggested-by: Daniel P. Berrange <berrange at redhat.com>
    Signed-off-by: Michael Brown <mcb30 at ipxe.org>

commit 3d6123e69ab879c72ff489afc5bf93ef0b7a94ce
Author: Michael Brown <mcb30 at etherboot.org>
Date:   Tue Mar 8 18:53:11 2005 +0000

    Initial revision
$
</screenshot>
I assumed that the script is outdated, hence I tried this change:
<fix_attempt>
$ git diff
diff --git a/src/util/get-pci-ids b/src/util/get-pci-ids
index 42466221..1550677d 100755
--- a/src/util/get-pci-ids
+++ b/src/util/get-pci-ids
@@ -47,8 +47,8 @@ if($#ARGV >= 0) {
        exit 1;
 }
 
-unless(-f "$kernel_src/include/linux/version.h") {
-       print STDERR "Could not find $kernel_src/include/linux/version.h.\n";
+unless(-f "$kernel_src/include/linux/vermagic.h") {
+       print STDERR "Could not find $kernel_src/include/linux/vermagic.h.\n";
        print STDERR "$kernel_src is probably no Linux kernel source tree.\n";
        exit 1;
 }
@@ -64,7 +64,7 @@ my $cpp="gcc -E";
 my @drivers = split /\s+/, `find $kernel_src/drivers/net -name '*.c' | sort`;
 
 # Kernel version
-my $version = `grep UTS_RELEASE $kernel_src/include/linux/version.h`;
+my $version = `grep UTS_RELEASE $kernel_src/include/linux/vermagic.h`;
 chomp $version;
 $version =~ s/\s*#define\s+UTS_RELEASE\s+"(\S+)".*$/$1/g;
 
</fix_attempt>


<error2text>
$ src/util/get-pci-ids /usr/src/linux/torvalds 2>&1 | head -n 25
# PCI vendor/device ids extracted from Linux 	UTS_RELEASE " "							\ on x86_64 at Sat Apr 30 16:44:35 2022
In file included from /usr/src/linux/torvalds/include/linux/kernel.h:8,
                 from /usr/src/linux/torvalds/include/linux/list.h:9,
                 from /usr/src/linux/torvalds/include/linux/module.h:12,
                 from /usr/src/linux/torvalds/drivers/net/appletalk/cops.c:51:
/usr/src/linux/torvalds/include/linux/linkage.h:8:10: fatal error: asm/linkage.h: No such file or directory
    8 | #include <asm/linkage.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
In file included from /usr/src/linux/torvalds/include/linux/kernel.h:8,
                 from /usr/src/linux/torvalds/include/linux/list.h:9,
                 from /usr/src/linux/torvalds/include/linux/module.h:12,
                 from /usr/src/linux/torvalds/drivers/net/appletalk/ipddp.c:26:
/usr/src/linux/torvalds/include/linux/linkage.h:8:10: fatal error: asm/linkage.h: No such file or directory
    8 | #include <asm/linkage.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
In file included from /usr/src/linux/torvalds/include/linux/kernel.h:8,
                 from /usr/src/linux/torvalds/include/linux/list.h:9,
                 from /usr/src/linux/torvalds/include/linux/module.h:12,
                 from /usr/src/linux/torvalds/drivers/net/appletalk/ltpc.c:209:
/usr/src/linux/torvalds/include/linux/linkage.h:8:10: fatal error: asm/linkage.h: No such file or directory
    8 | #include <asm/linkage.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
$ 
</error2text>


That was "debugged" with
<print_command>
--- a/src/util/get-pci-ids
+++ b/src/util/get-pci-ids
@@ -82,6 +83,7 @@ foreach $driver (@drivers) {
 
        # Preprocess to expand macros
        my $command = "$cpp $cflags -I" . dirname($driver) . " $driver";
+       print "command: $command \n";
        open  DRIVER, "$command |" or die "Could not execute\n\"$command\".\n";
 
        # Extract the pci_device_id structure
</print_command>

<fix_attempt2>
@@ -56,6 +56,8 @@ unless(-f "$kernel_src/include/linux/version.h") {
 # Flags that are needed to preprocess the drivers.
 # Some drivers need optimization
 my $cflags="-D__KERNEL__ -I$kernel_src/include -I$kernel_src/net/inet -O2";
+$cflags .= " -I$kernel_src/arch/x86/include";
+$cflags .= " -I$kernel_src/arch/riscv/include";
 
 # The C preprocessor. It needs to spit out the preprocessed source on stdout.
 my $cpp="gcc -E";
</fix_attempt2>


Now I'm stuck at
<error3text>
In file included from /usr/src/linux/torvalds/include/linux/ktime.h:25:
/usr/src/linux/torvalds/include/linux/jiffies.h:13:10: fatal error: generated/timeconst.h: No such file or directory
   13 | #include <generated/timeconst.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
</error3text>

What do you suggest to do next to get this fixed?

 
Groeten
Geert Stappers
-- 
Silence is hard to parse


More information about the ipxe-devel mailing list