Skip to content

Commit d75f9c6

Browse files
committed
patches: Fix DAHDI Linux compilation on linux-next.
* Slipstream compilation fix for linux-next * Only apply modfinal.diff patch the first time.
1 parent 9566922 commit d75f9c6

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

phreaknet.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,8 @@ install_dahdi() {
18451845
sed -n 61,63p $MODFINAL_FILE
18461846
sed -n 61,63p $MODFINAL_FILE | grep "CONFIG_DEBUG_INFO_BTF_MODULES"
18471847
if [ $? -eq 0 ]; then
1848-
phreak_tree_patch $MODFINAL_FILE "modfinal.diff"
1848+
# The file only needs to be patched the first time, not on future installs
1849+
phreak_tree_patch_forward_only $MODFINAL_FILE "modfinal.diff"
18491850
sed -n 61,63p $MODFINAL_FILE
18501851
else
18511852
echoerr "Skipping modfinal patch, expected content differs on line 61"
@@ -1949,6 +1950,9 @@ install_dahdi() {
19491950
git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/69.diff" # PR 69: DEFINE_SEMAPHORE for RHEL
19501951
git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/32.patch" # PR 32: xpp: Fix 32-bit builds
19511952

1953+
# Not yet merged
1954+
git_custom_patch "https://patch-diff.githubusercontent.com/raw/asterisk/dahdi-linux/pull/77.diff"
1955+
19521956
# Fix or skip compilation of the XPP driver for 32-bit
19531957
# OS_ARCH=$( uname -m )
19541958
# printf "Detected architecture: %s\n" "$OS_ARCH"
@@ -2012,7 +2016,7 @@ install_dahdi() {
20122016
fi
20132017

20142018
# if KSRC/KVERS env vars are set, they will automatically propagate to children
2015-
$AST_MAKE -j$(nproc) $DAHDI_CFLAGS
2019+
$AST_MAKE $DAHDI_CFLAGS
20162020
if [ $? -ne 0 ]; then
20172021
if [ -f drivers/dahdi/vpmadt032_loader/vpmadt032_x86_64.o_shipped ]; then
20182022
# If this is PHREAKSCRIPT-61, apply temporary workaround for newer kernels failing with:
@@ -2045,7 +2049,7 @@ install_dahdi() {
20452049
printf "COPY %s %s\n" drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o_shipped drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o
20462050
cp -n drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o_shipped drivers/dahdi/vpmadt032_loader/vpmadt032_${MY_DAHDI_ARCH}.o
20472051
fi
2048-
$AST_MAKE -j$(nproc) $DAHDI_CFLAGS
2052+
$AST_MAKE $DAHDI_CFLAGS
20492053
fi
20502054
if [ $? -ne 0 ]; then
20512055
die "DAHDI Linux compilation failed, aborting install"
@@ -2231,6 +2235,17 @@ phreak_tree_patch() { # $1 = patched file, $2 = patch name
22312235
rm "/tmp/$2"
22322236
}
22332237

2238+
phreak_tree_patch_forward_only() { # $1 = patched file, $2 = patch name
2239+
printf "Applying forward patch %s to %s\n" "$2" "$1"
2240+
cp "$GIT_REPO_PATH/patches/$2" "/tmp/$2"
2241+
if [ $? -ne 0 ]; then
2242+
echoerr "Failed to copy patch: $2"
2243+
exit 2
2244+
fi
2245+
patch -u -N -b "$1" -i "/tmp/$2"
2246+
rm "/tmp/$2"
2247+
}
2248+
22342249
phreak_fuzzy_patch() {
22352250
printf "Applying patch %s to %s\n" "$1" "$1"
22362251
cp "$GIT_REPO_PATH/patches/$1" "/tmp/$1"

0 commit comments

Comments
 (0)