我正在尝试为Silicom Bypass Controller构建一个端口。我怀疑我的Makefile
不完整,但我不确定。我应该根据错误为ld
添加一些内容吗?
在SSP_UNSAFE= yes
中添加Makefile
会让我超越原始错误。不确定这是否是最好的方法。使用SSP_CFLAGS
添加对默认-fstack-protector
的支持似乎会导致此问题。这是否需要在源代码中修复?
生成文件:
PORTNAME= silicom_bpctl
PORTVERSION= 3.10.5
PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://pkg.insecure-it.com/distfiles/
MAINTAINER= me@myemail.com
COMMENT= Silicom Bypass Controller utility (Zero Power Fail-Open for IPS)
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/license
SUB_FILES= pkg-message
SSP_UNSAFE= yes
.include <bsd.port.mk>
pkg-plist文件:
boot/kernel/bpmod.ko
bin/bpctl_util
:/usr/local/poudriere/ports/default/sysutils/silicom_bpctl % sudo make stage
===> License GPLv2 accepted by the user
===> silicom_bpctl-3.10.5_1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by silicom_bpctl-3.10.5_1 for building
===> Extracting for silicom_bpctl-3.10.5_1
=> SHA256 Checksum OK for silicom_bpctl-3.10.5.tar.gz.
===> Patching for silicom_bpctl-3.10.5_1
===> Configuring for silicom_bpctl-3.10.5_1
===> Building for silicom_bpctl-3.10.5_1
--- _sub.all ---
===> driver (all)
--- objwarn ---
--- /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5/driver/@ ---
--- /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5/driver/machine ---
--- opt_bdg.h ---
--- objwarn ---
Warning: Object directory not changed from original /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5/driver
--- opt_bdg.h ---
:> opt_bdg.h
--- /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5/driver/@ ---
@ -> /usr/src/sys
--- /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5/driver/machine ---
machine -> /usr/src/sys/amd64/include
--- pci_if.h ---
--- bus_if.h ---
--- device_if.h ---
--- pci_if.h ---
awk -f @/tools/makeobjops.awk @/dev/pci/pci_if.m -h
--- bus_if.h ---
awk -f @/tools/makeobjops.awk @/kern/bus_if.m -h
--- device_if.h ---
awk -f @/tools/makeobjops.awk @/kern/device_if.m -h
--- bp_mod.o ---
cc -O2 -pipe -fstack-protector -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I. -I@ -I@/contrib/altq -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -std=iso9899:1999 -Qunused-arguments -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -c bp_mod.c -o bp_mod.o
--- bpmod.ko ---
ld -fstack-protector -d -warn-common -r -d -o bpmod.ko bp_mod.o
ld: -f may not be used without -shared
*** [bpmod.ko] Error code 1
make[2]: stopped in /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5/driver
1 error
make[2]: stopped in /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5/driver
*** [_sub.all] Error code 2
make[1]: stopped in /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5
1 error
make[1]: stopped in /usr/local/poudriere/ports/default/sysutils/silicom_bpctl/work/silicom_bpctl-3.10.5
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1
Stop.
make: stopped in /usr/local/poudriere/ports/default/sysutils/silicom_bpctl
仅make
和sudo make install
手动安装此实用程序非常简单。
make
:
~/silicom/bp_ctl-3.10.5 % make
===> driver (all)
Warning: Object directory not changed from original /usr/home/arozar/silicom/bp_ctl-3.10.5/driver
@ -> /usr/src/sys
machine -> /usr/src/sys/amd64/include
awk -f @/tools/makeobjops.awk @/kern/device_if.m -h
awk -f @/tools/makeobjops.awk @/kern/bus_if.m -h
awk -f @/tools/makeobjops.awk @/dev/pci/pci_if.m -h
:> opt_bdg.h
cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I. -I@ -I@/contrib/altq -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -std=iso9899:1999 -Qunused-arguments -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -c bp_mod.c
ld -d -warn-common -r -d -o bpmod.ko bp_mod.o
:> export_syms
awk -f /sys/conf/kmod_syms.awk bpmod.ko export_syms | xargs -J% objcopy % bpmod.ko
objcopy --strip-debug bpmod.ko
===> util (all)
cc -O2 -pipe bpctl_util.c -o bpctl_util
bpctl_util.c:1096:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
printf(bp_cap_array[i].desc);
^~~~~~~~~~~~~~~~~~~~
bpctl_util.c:2617:30: warning: format specifies type 'char *' but the argument has type 'int *' [-Wformat]
printf("Name\t\t\t%s\n", bpctl_cmd.data);
~~ ^~~~~~~~~~~~~~
bpctl_util.c:2635:46: warning: format specifies type 'char *' but the argument has type 'int *' [-Wformat]
printf("\n\tName\t\t\t%s\n", bpctl_cmd.data);
~~ ^~~~~~~~~~~~~~
3 warnings generated.
sudo make install
:
~/silicom/bp_ctl-3.10.5 % sudo make install
===> driver (install)
install -o root -g wheel -m 555 bpmod.ko /boot/kernel
kldxref /boot/kernel
===> util (install)
install bpctl_util /bin
现在安装失败必须是pkg-plist
文件:
:/usr/local/poudriere/ports/default/sysutils/silicom-bpctl % sudo make stage
===> License GPLv2 accepted by the user
===> silicom-bpctl-3.10.5_1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by silicom-bpctl-3.10.5_1 for building
===> Extracting for silicom-bpctl-3.10.5_1
=> SHA256 Checksum OK for silicom-bpctl-3.10.5.tar.gz.
===> Patching for silicom-bpctl-3.10.5_1
===> Configuring for silicom-bpctl-3.10.5_1
===> Building for silicom-bpctl-3.10.5_1
--- _sub.all ---
===> driver (all)
--- objwarn ---
--- /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/silicom-bpctl-3.10.5/driver/@ ---
--- /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/silicom-bpctl-3.10.5/driver/machine ---
--- opt_bdg.h ---
--- objwarn ---
Warning: Object directory not changed from original /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/silicom-bpctl-3.10.5/driver
--- opt_bdg.h ---
:> opt_bdg.h
--- /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/silicom-bpctl-3.10.5/driver/@ ---
@ -> /usr/src/sys
--- /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/silicom-bpctl-3.10.5/driver/machine ---
machine -> /usr/src/sys/amd64/include
--- pci_if.h ---
--- bus_if.h ---
--- device_if.h ---
--- pci_if.h ---
awk -f @/tools/makeobjops.awk @/dev/pci/pci_if.m -h
--- bus_if.h ---
awk -f @/tools/makeobjops.awk @/kern/bus_if.m -h
--- device_if.h ---
awk -f @/tools/makeobjops.awk @/kern/device_if.m -h
--- bp_mod.o ---
cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I. -I@ -I@/contrib/altq -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -std=iso9899:1999 -Qunused-arguments -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -c bp_mod.c -o bp_mod.o
--- bpmod.ko ---
ld -d -warn-common -r -d -o bpmod.ko bp_mod.o
:> export_syms
awk -f /sys/conf/kmod_syms.awk bpmod.ko export_syms | xargs -J% objcopy % bpmod.ko
objcopy --strip-debug bpmod.ko
===> util (all)
--- bpctl_util ---
cc -O2 -pipe bpctl_util.c -o bpctl_util
bpctl_util.c:1096:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
printf(bp_cap_array[i].desc);
^~~~~~~~~~~~~~~~~~~~
bpctl_util.c:2617:30: warning: format specifies type 'char *' but the argument has type 'int *' [-Wformat]
printf("Name\t\t\t%s\n", bpctl_cmd.data);
~~ ^~~~~~~~~~~~~~
bpctl_util.c:2635:46: warning: format specifies type 'char *' but the argument has type 'int *' [-Wformat]
printf("\n\tName\t\t\t%s\n", bpctl_cmd.data);
~~ ^~~~~~~~~~~~~~
3 warnings generated.
===> Staging for silicom-bpctl-3.10.5_1
===> Generating temporary packing list
===> driver (install)
install -o root -g wheel -m 555 bpmod.ko /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/stage/boot/kernel
install: /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/stage/boot/kernel: No such file or directory
*** Error code 71
Stop.
make[2]: stopped in /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/silicom-bpctl-3.10.5/driver
*** Error code 1
Stop.
make[1]: stopped in /usr/local/poudriere/ports/default/sysutils/silicom-bpctl/work/silicom-bpctl-3.10.5
*** Error code 1
Stop.
make: stopped in /usr/local/poudriere/ports/default/sysutils/silicom-bpctl
答案 0 :(得分:3)
请勿在pkg-plist文件中对非/usr/local
路径进行硬编码。
/%%KMODDIR%%/yourdriver.ko
应该是在plist文件中指定驱动程序的方式 - 否则,您的端口不支持暂存。
如果您不知道登台的作用,它会将端口内部安装到临时目录,对碰巧安装的所有文件进行编目,并将其与软件包列表进行比较。
创建暂存是为了考虑端口安装的每个文件,否则pkg-plist可能无法列出端口make install
实际安装的文件;现在卸载已被破坏,因为它会留下文件。
您可能需要创建中间目录,尤其是支持登台。在nvidia-driver
的Makefile中达到峰值在这方面很有用:
pre-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/${MODULESDIR}/drivers \
${STAGEDIR}${PREFIX}/${MODULESDIR}/extensions