Skip to content

Commit 0ee20ab

Browse files
authored
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
1 parent 5f3f6ec commit 0ee20ab

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

phreaknet.sh

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# PhreakScript
44
# (C) 2021-2024 Naveen Albert, PhreakNet, and others - https://github.com/InterLinked1/phreakscript ; https://portal.phreaknet.org ; https://docs.phreaknet.org
5-
# v1.2.0 (2024-11-03)
5+
# v1.2.1 (2024-12-30)
66

77
# Setup (as root):
88
# cd /usr/local/src
@@ -13,6 +13,7 @@
1313
# phreaknet install
1414

1515
## Begin Change Log:
16+
# 2024-12-30 1.2.1 DAHDI Linux: Work around compilation failure for newer kernels
1617
# 2024-11-03 1.2.0 Asterisk: Install Asterisk 22 by default
1718
# 2024-10-16 1.1.8 wanpipe: Installation procedure improvements
1819
# 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() {
19511952

19521953
# if KSRC/KVERS env vars are set, they will automatically propagate to children
19531954
$AST_MAKE -j$(nproc) $DAHDI_CFLAGS
1955+
if [ $? -ne 0 ]; then
1956+
if [ -f drivers/dahdi/vpmadt032_loader/vpmadt032_x86_64.o_shipped ]; then
1957+
# If this is PHREAKSCRIPT-61, apply temporary workaround for newer kernels failing with:
1958+
# No rule to make target 'vpmadt032_loader/vpmadt032_x86_64.o', needed by 'dahdi_vpmadt032_loader.o'.
1959+
#
1960+
# On newer kernels, there seems to be some kind of issue (not sure with what, exactly)
1961+
# where vpmadt032_x86_64.o doesn't exist. On older kernels, it's generated by a COPY:
1962+
# COPY /usr/src/dahdi-linux-3.4.0/drivers/dahdi/vpmadt032_loader/vpmadt032_x86_64.o
1963+
#
1964+
# This is likely an issue somewhere in the DAHDI Linux build system, possibly drivers/dahdi/Kbuild...
1965+
# But until this issue is fixed, just manually copy the file at this point so compilation can continue.
1966+
ARCH=$( uname -m )
1967+
# This logic is from drivers/dahdi/Kbuild
1968+
if [ "$ARCH" = "i386" ]; then
1969+
MY_DAHDI_ARCH=x86_32
1970+
else
1971+
if [ "$ARCH" = "x86_64" ]; then
1972+
MY_DAHDI_ARCH=x86_64
1973+
else
1974+
grep "CONFIG_X86_32=y" /boot/config-$(uname -r)
1975+
if [ $? -eq 0 ]; then
1976+
MY_DAHDI_ARCH=x86_32
1977+
else
1978+
MY_DAHDI_ARCH=x86_64
1979+
fi
1980+
fi
1981+
fi
1982+
printf "Detected DAHDI_ARCH: '%s'\n" "$MY_DAHDI_ARCH"
1983+
echoerr "Manually performing COPY for 'vpmadt032_${MY_DAHDI_ARCH}.o'"
1984+
printf "COPY %s %s\n" drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o_shipped drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o
1985+
cp -n drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o_shipped drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o
1986+
fi
1987+
$AST_MAKE -j$(nproc) $DAHDI_CFLAGS
1988+
fi
19541989
if [ $? -ne 0 ]; then
19551990
die "DAHDI Linux compilation failed, aborting install"
19561991
fi
@@ -3095,6 +3130,9 @@ elif [ "$cmd" = "make" ]; then
30953130
# phreaknet install
30963131

30973132
assert_root
3133+
if [ "$FILE_PATH" = "/usr/local/sbin/phreaknet" ]; then
3134+
die "PhreakScript is already installed, to reinstall, execute 'make' using the new script, e.g. ./phreaknet.sh make"
3135+
fi
30983136
ln -nsf $FILE_PATH /usr/local/sbin/phreaknet
30993137
if [ $? -eq 0 ]; then
31003138
echo "PhreakScript added to path."

0 commit comments

Comments
 (0)