From 0ee20ab67b1f3203cfab4cbdb70c92f6cac03048 Mon Sep 17 00:00:00 2001 From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com> Date: Mon, 30 Dec 2024 16:07:23 -0500 Subject: [PATCH] DAHDI Linux: Work around missing target for vpmadt032. (#58) In the most recent kernels, compilation has been failing due to an issue where dahdi_vpmadt032_loader.o fails to build because of a missing rule to make target vpmadt032_loader/vpmadt032_x86_64.o. Until a proper fix can be found for this issue, we can work around this by manually performing the COPY that was previously being done by Makefile rules. This entails copying the appropriate version of the object file, depending on our architecture. PHREAKSCRIPT-61 #close --- phreaknet.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/phreaknet.sh b/phreaknet.sh index 7da3519..984670f 100755 --- a/phreaknet.sh +++ b/phreaknet.sh @@ -2,7 +2,7 @@ # PhreakScript # (C) 2021-2024 Naveen Albert, PhreakNet, and others - https://github.com/InterLinked1/phreakscript ; https://portal.phreaknet.org ; https://docs.phreaknet.org -# v1.2.0 (2024-11-03) +# v1.2.1 (2024-12-30) # Setup (as root): # cd /usr/local/src @@ -13,6 +13,7 @@ # phreaknet install ## Begin Change Log: +# 2024-12-30 1.2.1 DAHDI Linux: Work around compilation failure for newer kernels # 2024-11-03 1.2.0 Asterisk: Install Asterisk 22 by default # 2024-10-16 1.1.8 wanpipe: Installation procedure improvements # 2024-09-19 1.1.7 DAHDI: Slipstream critical build fixes, fix build issues on various distros and kernels @@ -1951,6 +1952,40 @@ install_dahdi() { # if KSRC/KVERS env vars are set, they will automatically propagate to children $AST_MAKE -j$(nproc) $DAHDI_CFLAGS + if [ $? -ne 0 ]; then + if [ -f drivers/dahdi/vpmadt032_loader/vpmadt032_x86_64.o_shipped ]; then + # If this is PHREAKSCRIPT-61, apply temporary workaround for newer kernels failing with: + # No rule to make target 'vpmadt032_loader/vpmadt032_x86_64.o', needed by 'dahdi_vpmadt032_loader.o'. + # + # On newer kernels, there seems to be some kind of issue (not sure with what, exactly) + # where vpmadt032_x86_64.o doesn't exist. On older kernels, it's generated by a COPY: + # COPY /usr/src/dahdi-linux-3.4.0/drivers/dahdi/vpmadt032_loader/vpmadt032_x86_64.o + # + # This is likely an issue somewhere in the DAHDI Linux build system, possibly drivers/dahdi/Kbuild... + # But until this issue is fixed, just manually copy the file at this point so compilation can continue. + ARCH=$( uname -m ) + # This logic is from drivers/dahdi/Kbuild + if [ "$ARCH" = "i386" ]; then + MY_DAHDI_ARCH=x86_32 + else + if [ "$ARCH" = "x86_64" ]; then + MY_DAHDI_ARCH=x86_64 + else + grep "CONFIG_X86_32=y" /boot/config-$(uname -r) + if [ $? -eq 0 ]; then + MY_DAHDI_ARCH=x86_32 + else + MY_DAHDI_ARCH=x86_64 + fi + fi + fi + printf "Detected DAHDI_ARCH: '%s'\n" "$MY_DAHDI_ARCH" + echoerr "Manually performing COPY for 'vpmadt032_${MY_DAHDI_ARCH}.o'" + printf "COPY %s %s\n" drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o_shipped drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o + cp -n drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o_shipped drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o + fi + $AST_MAKE -j$(nproc) $DAHDI_CFLAGS + fi if [ $? -ne 0 ]; then die "DAHDI Linux compilation failed, aborting install" fi @@ -3095,6 +3130,9 @@ elif [ "$cmd" = "make" ]; then # phreaknet install assert_root + if [ "$FILE_PATH" = "/usr/local/sbin/phreaknet" ]; then + die "PhreakScript is already installed, to reinstall, execute 'make' using the new script, e.g. ./phreaknet.sh make" + fi ln -nsf $FILE_PATH /usr/local/sbin/phreaknet if [ $? -eq 0 ]; then echo "PhreakScript added to path."