Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAHDI Linux: Fix minor nonworking parts of installation. #49

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions patches/modfinal.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- /usr/lib/linux-kbuild-6.1/scripts/Makefile.modfinal.orig 2024-11-09 17:26:54.648766021 -0500
+++ /usr/lib/linux-kbuild-6.1/scripts/Makefile.modfinal 2024-11-09 17:27:00.900879469 -0500
@@ -58,9 +58,9 @@
# Re-generate module BTFs if either module's .ko or vmlinux changed
$(modules): %.ko: %.o %.mod.o $(ARCH_MODULE_LDS) $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE
+$(call if_changed_except,ld_ko_o,vmlinux)
-ifdef CONFIG_DEBUG_INFO_BTF_MODULES
- +$(if $(newer-prereqs),$(call cmd,btf_ko))
-endif
+#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
+# +$(if $(newer-prereqs),$(call cmd,btf_ko))
+#endif

targets += $(modules) $(modules:.ko=.mod.o)

50 changes: 45 additions & 5 deletions phreaknet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -912,9 +912,14 @@ install_prereq() {
PREREQ_PACKAGES=""
RHEL_MAJOR_VERSION_8=0
printf "Installing prerequisites for %s..." "$OS_DIST_INFO"
# Even if we are just installing DAHDI (without Asterisk), $CHAN_DAHDI should be set to 1 at this point.
# libnewt-dev is needed for newt, which dahdi_tool requires. If it's not available, it won't get built.
# dwarves is needed for pahole, which DAHDI Linux install needs for BTF generation
if [ "$PAC_MAN" = "apt-get" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc pkg-config autoconf automake m4 libtool build-essential libnewt-dev"
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc pkg-config autoconf automake m4 libtool build-essential"
if [ "$CHAN_DAHDI" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES libnewt-dev dwarves"
fi
if [ "$1" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES curl subversion libcurl4-openssl-dev"
if [ "$ENHANCED_INSTALL" = "1" ]; then
Expand All @@ -933,26 +938,38 @@ install_prereq() {
if [ -f /etc/redhat-release ] && [ "$RHEL_MAJOR_VERSION" = "8" ]; then # RHEL or Rocky Linux major version 8
RHEL_MAJOR_VERSION_8=1
fi
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc gcc-c++ pkg-config autoconf automake m4 libtool newt-devel"
PREREQ_PACKAGES="$PREREQ_PACKAGES git patch gcc gcc-c++ pkg-config autoconf automake m4 libtool"
if [ "$CHAN_DAHDI" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES newt-devel dwarves"
fi
if [ "$1" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES subversion libuuid-devel libxml2-devel sqlite-devel"
if [ $RHEL_MAJOR_VERSION_8 -eq 0 ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES libedit-devel" # Required on Fedora, may fail initially on Rocky Linux 8.9
fi
fi
elif [ "$PAC_MAN" = "zypper" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++ newt-devel"
PREREQ_PACKAGES="$PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++"
if [ "$CHAN_DAHDI" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES newt-devel dwarves"
fi
if [ "$1" = "1" ]; then
# TODO Some of these should be in Asterisk's install_prereq script
PREREQ_PACKAGES="$PREREQ_PACKAGES libedit-devel libuuid-devel libxml2-devel sqlite3-devel"
fi
elif [ "$PAC_MAN" = "pacman" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES git make patch gcc pkg-config autoconf automake m4 libtool libnewt"
PREREQ_PACKAGES="$PREREQ_PACKAGES git make patch gcc pkg-config autoconf automake m4 libtool"
if [ "$CHAN_DAHDI" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES libnewt pahole"
fi
if [ "$1" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES subversion libedit"
fi
elif [ "$PAC_MAN" = "pkg" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES git gmake newt"
PREREQ_PACKAGES="$PREREQ_PACKAGES git gmake"
if [ "$CHAN_DAHDI" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES newt dwarves"
fi
if [ "$1" = "1" ]; then
PREREQ_PACKAGES="$PREREQ_PACKAGES curl subversion e2fsprogs-libuuid sqlite3 xmlstarlet libsysinfo"
if [ "$ENHANCED_INSTALL" = "1" ]; then
Expand Down Expand Up @@ -1674,6 +1691,28 @@ install_dahdi() {
fi
fi

# Avoid "Skipping BTF generation for ... due to unavailability of vmlinux"
# Worked around by copying vmlinux to another location:
if [ -f /sys/kernel/btf/vmlinux ]; then
cp /sys/kernel/btf/vmlinux /usr/lib/modules/`uname -r`/build/
else
echoerr "Couldn't find vmlinux... BTF generation may be skipped during driver install..."
fi

# Fix missing resolve_btfids
# https://github.com/aircrack-ng/rtl8188eus/issues/263#issuecomment-1715699688
# Fixed by commenting out lines 61-63
KERNEL_MM=$( uname -r | cut -d'.' -f1-2 )
KBUILD_DIR="/usr/lib/linux-kbuild-${KERNEL_MM}"
MODFINAL_FILE="${KBUILD_DIR}/scripts/Makefile.modfinal"
if [ -f "$MODFINAL_FILE" ]; then
sed -n 61,63p $MODFINAL_FILE
phreak_tree_patch $MODFINAL_FILE "modfinal.diff"
sed -n 61,63p $MODFINAL_FILE
else
echoerr "Could not determine path to Makefile.modfinal"
fi

# Requests to downloads.digium.com usually use IPv4, but sometimes use IPv6
# This is problematic on GitHub Action Runners, which have IPv6 disabled,
# and won't let you enable it
Expand Down Expand Up @@ -3454,6 +3493,7 @@ elif [ "$cmd" = "freepbx" ]; then
install_freepbx
elif [ "$cmd" = "dahdi" ]; then
assert_root
CHAN_DAHDI=1 # This is used by the pre-req install process to install DAHDI-specific prereqs.
install_prereq 0 # Install basic build requirements
install_dahdi
elif [ "$cmd" = "wanpipe" ]; then
Expand Down
Loading