@@ -912,9 +912,14 @@ install_prereq() {
912
912
PREREQ_PACKAGES=" "
913
913
RHEL_MAJOR_VERSION_8=0
914
914
printf " Installing prerequisites for %s..." " $OS_DIST_INFO "
915
+ # Even if we are just installing DAHDI (without Asterisk), $CHAN_DAHDI should be set to 1 at this point.
915
916
# libnewt-dev is needed for newt, which dahdi_tool requires. If it's not available, it won't get built.
917
+ # dwarves is needed for pahole, which DAHDI Linux install needs for BTF generation
916
918
if [ " $PAC_MAN " = " apt-get" ]; then
917
- PREREQ_PACKAGES=" $PREREQ_PACKAGES git patch gcc pkg-config autoconf automake m4 libtool build-essential libnewt-dev"
919
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES git patch gcc pkg-config autoconf automake m4 libtool build-essential"
920
+ if [ " $CHAN_DAHDI " = " 1" ]; then
921
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES libnewt-dev dwarves"
922
+ fi
918
923
if [ " $1 " = " 1" ]; then
919
924
PREREQ_PACKAGES=" $PREREQ_PACKAGES curl subversion libcurl4-openssl-dev"
920
925
if [ " $ENHANCED_INSTALL " = " 1" ]; then
@@ -933,26 +938,38 @@ install_prereq() {
933
938
if [ -f /etc/redhat-release ] && [ " $RHEL_MAJOR_VERSION " = " 8" ]; then # RHEL or Rocky Linux major version 8
934
939
RHEL_MAJOR_VERSION_8=1
935
940
fi
936
- PREREQ_PACKAGES=" $PREREQ_PACKAGES git patch gcc gcc-c++ pkg-config autoconf automake m4 libtool newt-devel"
941
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES git patch gcc gcc-c++ pkg-config autoconf automake m4 libtool"
942
+ if [ " $CHAN_DAHDI " = " 1" ]; then
943
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES newt-devel dwarves"
944
+ fi
937
945
if [ " $1 " = " 1" ]; then
938
946
PREREQ_PACKAGES=" $PREREQ_PACKAGES subversion libuuid-devel libxml2-devel sqlite-devel"
939
947
if [ $RHEL_MAJOR_VERSION_8 -eq 0 ]; then
940
948
PREREQ_PACKAGES=" $PREREQ_PACKAGES libedit-devel" # Required on Fedora, may fail initially on Rocky Linux 8.9
941
949
fi
942
950
fi
943
951
elif [ " $PAC_MAN " = " zypper" ]; then
944
- PREREQ_PACKAGES=" $PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++ newt-devel"
952
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++"
953
+ if [ " $CHAN_DAHDI " = " 1" ]; then
954
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES newt-devel dwarves"
955
+ fi
945
956
if [ " $1 " = " 1" ]; then
946
957
# TODO Some of these should be in Asterisk's install_prereq script
947
958
PREREQ_PACKAGES=" $PREREQ_PACKAGES libedit-devel libuuid-devel libxml2-devel sqlite3-devel"
948
959
fi
949
960
elif [ " $PAC_MAN " = " pacman" ]; then
950
- PREREQ_PACKAGES=" $PREREQ_PACKAGES git make patch gcc pkg-config autoconf automake m4 libtool libnewt"
961
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES git make patch gcc pkg-config autoconf automake m4 libtool"
962
+ if [ " $CHAN_DAHDI " = " 1" ]; then
963
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES libnewt pahole"
964
+ fi
951
965
if [ " $1 " = " 1" ]; then
952
966
PREREQ_PACKAGES=" $PREREQ_PACKAGES subversion libedit"
953
967
fi
954
968
elif [ " $PAC_MAN " = " pkg" ]; then
955
- PREREQ_PACKAGES=" $PREREQ_PACKAGES git gmake newt"
969
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES git gmake"
970
+ if [ " $CHAN_DAHDI " = " 1" ]; then
971
+ PREREQ_PACKAGES=" $PREREQ_PACKAGES newt dwarves"
972
+ fi
956
973
if [ " $1 " = " 1" ]; then
957
974
PREREQ_PACKAGES=" $PREREQ_PACKAGES curl subversion e2fsprogs-libuuid sqlite3 xmlstarlet libsysinfo"
958
975
if [ " $ENHANCED_INSTALL " = " 1" ]; then
@@ -1674,6 +1691,28 @@ install_dahdi() {
1674
1691
fi
1675
1692
fi
1676
1693
1694
+ # Avoid "Skipping BTF generation for ... due to unavailability of vmlinux"
1695
+ # Worked around by copying vmlinux to another location:
1696
+ if [ -f /sys/kernel/btf/vmlinux ]; then
1697
+ cp /sys/kernel/btf/vmlinux /usr/lib/modules/` uname -r` /build/
1698
+ else
1699
+ echoerr " Couldn't find vmlinux... BTF generation may be skipped during driver install..."
1700
+ fi
1701
+
1702
+ # Fix missing resolve_btfids
1703
+ # https://github.com/aircrack-ng/rtl8188eus/issues/263#issuecomment-1715699688
1704
+ # Fixed by commenting out lines 61-63
1705
+ KERNEL_MM=$( uname -r | cut -d' .' -f1-2 )
1706
+ KBUILD_DIR=" /usr/lib/linux-kbuild-${KERNEL_MM} "
1707
+ MODFINAL_FILE=" ${KBUILD_DIR} /scripts/Makefile.modfinal"
1708
+ if [ -f " $MODFINAL_FILE " ]; then
1709
+ sed -n 61,63p $MODFINAL_FILE
1710
+ phreak_tree_patch $MODFINAL_FILE " modfinal.diff"
1711
+ sed -n 61,63p $MODFINAL_FILE
1712
+ else
1713
+ echoerr " Could not determine path to Makefile.modfinal"
1714
+ fi
1715
+
1677
1716
# Requests to downloads.digium.com usually use IPv4, but sometimes use IPv6
1678
1717
# This is problematic on GitHub Action Runners, which have IPv6 disabled,
1679
1718
# and won't let you enable it
@@ -3454,6 +3493,7 @@ elif [ "$cmd" = "freepbx" ]; then
3454
3493
install_freepbx
3455
3494
elif [ " $cmd " = " dahdi" ]; then
3456
3495
assert_root
3496
+ CHAN_DAHDI=1 # This is used by the pre-req install process to install DAHDI-specific prereqs.
3457
3497
install_prereq 0 # Install basic build requirements
3458
3498
install_dahdi
3459
3499
elif [ " $cmd " = " wanpipe" ]; then
0 commit comments