Skip to content

Commit

Permalink
DAHDI Tools: Fix truncation warning.
Browse files Browse the repository at this point in the history
* dahdi_cfg: Apply slipstreamed patch to fix compiler warning.

DAHTOOL-2 #close
  • Loading branch information
InterLinked1 committed Dec 30, 2024
1 parent 5f3f6ec commit c059a6f
Showing 1 changed file with 44 additions and 3 deletions.
47 changes: 44 additions & 3 deletions 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 @@ -1885,7 +1886,7 @@ install_dahdi() {
git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/69.diff" # PR 69: DEFINE_SEMAPHORE for RHEL

# Not yet merged
git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/32.patch" # PR 32, not yet merged
git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/32.patch" # PR 32: xpp: Fix 32-bit builds

# Fix or skip compilation of the XPP driver for 32-bit
OS_ARCH=$( uname -m )
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 All @@ -1968,6 +2003,9 @@ install_dahdi() {
# fix static inline function get_ver (GitHub dahdi-tools #11)
phreak_fuzzy_patch "dahdi_tools_inline_get_ver.diff"

# Not yet merged
git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-tools/pull/22.diff" # PR 22 (dahdi_cfg: fix truncation warning)

# hearpulsing
if [ "$EXTRA_FEATURES" = "1" ]; then
if [ "$HEARPULSING" = "1" ]; then
Expand All @@ -1976,7 +2014,7 @@ install_dahdi() {
fi

autoreconf -i && [ -f config.status ] || ./configure --with-dahdi=../linux # https://issues.asterisk.org/jira/browse/DAHTOOL-84
./configure
./configure # Both configures are needed!
$AST_MAKE -j$(nproc) $DAHDI_CFLAGS
if [ $? -ne 0 ]; then
die "DAHDI Tools compilation failed, aborting install"
Expand Down Expand Up @@ -3095,6 +3133,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 c059a6f

Please sign in to comment.