Skip to content

Commit

Permalink
DAHDI Linux: Work around missing target for vpmadt032. (#58)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
InterLinked1 authored Dec 30, 2024
1 parent 5f3f6ec commit 0ee20ab
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion phreaknet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down

0 comments on commit 0ee20ab

Please sign in to comment.