Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,145 @@
From aa74fa2fb5acf54bd46ad4c1b10e0a23a2cb3d25 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Thu, 4 Nov 2021 18:45:11 +0100
Subject: [PATCH] fix build with 32-bits kernel
Use div_s64 or div_s64_rem to fix the following build failure on 32-bits
kernels:
ERROR: modpost: "__divdi3" [/home/fabrice/buildroot/output/build/dahdi-linux-5c840cf43838e0690873e73409491c392333b3b8/drivers/dahdi/xpp/xpp_usb.ko] undefined!
ERROR: modpost: "__udivdi3" [/home/fabrice/buildroot/output/build/dahdi-linux-5c840cf43838e0690873e73409491c392333b3b8/drivers/dahdi/xpp/xpp_usb.ko] undefined!
ERROR: modpost: "__moddi3" [/home/fabrice/buildroot/output/build/dahdi-linux-5c840cf43838e0690873e73409491c392333b3b8/drivers/dahdi/xpp/xpp.ko] undefined!
ERROR: modpost: "__divdi3" [/home/fabrice/buildroot/output/build/dahdi-linux-5c840cf43838e0690873e73409491c392333b3b8/drivers/dahdi/xpp/xpp.ko] undefined!
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Upstream: https://github.com/asterisk/dahdi-linux/pull/32
---
drivers/dahdi/xpp/xbus-core.c | 9 ++++++---
drivers/dahdi/xpp/xbus-pcm.c | 4 ++--
drivers/dahdi/xpp/xbus-sysfs.c | 2 +-
drivers/dahdi/xpp/xframe_queue.c | 15 ++++++++++-----
drivers/dahdi/xpp/xpp_usb.c | 2 +-
5 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c
index fc4ce7b..b1d1fd7 100644
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -1754,11 +1754,14 @@ out:
static void xbus_fill_proc_queue(struct seq_file *sfile, struct xframe_queue *q)
{
+ s64 msec = 0;
+ s32 rem = 0;
+
+ msec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
seq_printf(sfile,
- "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%lld ms\n",
+ "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%d ms\n",
q->name, q->steady_state_count, q->count, q->max_count,
- q->worst_count, q->overflows, q->worst_lag_usec / 1000,
- q->worst_lag_usec % 1000);
+ q->worst_count, q->overflows, msec, rem);
xframe_queue_clearstats(q);
}
diff --git a/drivers/dahdi/xpp/xbus-pcm.c b/drivers/dahdi/xpp/xbus-pcm.c
index 8bb2fe7..e690ce7 100644
--- a/drivers/dahdi/xpp/xbus-pcm.c
+++ b/drivers/dahdi/xpp/xbus-pcm.c
@@ -129,7 +129,7 @@ static int xpp_ticker_step(struct xpp_ticker *ticker, const ktime_t t)
usec = ktime_us_delta(ticker->last_sample,
ticker->first_sample);
ticker->first_sample = ticker->last_sample;
- ticker->tick_period = usec / ticker->cycle;
+ ticker->tick_period = div_s64(usec, ticker->cycle);
cycled = 1;
}
ticker->count++;
@@ -497,7 +497,7 @@ static void send_drift(xbus_t *xbus, int drift)
XBUS_DBG(SYNC, xbus,
"%sDRIFT adjust %s (%d) (last update %lld seconds ago)\n",
(disable_pll_sync) ? "Fake " : "", msg, drift,
- msec_delta / MSEC_PER_SEC);
+ div_s64(msec_delta, MSEC_PER_SEC));
if (!disable_pll_sync)
CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, SYNC_MODE_PLL,
drift);
diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
index d8c11dc..35180d9 100644
--- a/drivers/dahdi/xpp/xbus-sysfs.c
+++ b/drivers/dahdi/xpp/xbus-sysfs.c
@@ -249,7 +249,7 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
/*
* Calculate lost ticks time
*/
- seconds = ktime_ms_delta(now, di->last_lost_tick) / 1000;
+ seconds = div_s64(ktime_ms_delta(now, di->last_lost_tick), 1000);
minutes = seconds / 60;
seconds = seconds % 60;
hours = minutes / 60;
diff --git a/drivers/dahdi/xpp/xframe_queue.c b/drivers/dahdi/xpp/xframe_queue.c
index e986083..8e5e508 100644
--- a/drivers/dahdi/xpp/xframe_queue.c
+++ b/drivers/dahdi/xpp/xframe_queue.c
@@ -35,15 +35,18 @@ static void __xframe_dump_queue(struct xframe_queue *q)
int i = 0;
char prefix[30];
ktime_t now = ktime_get();
+ s64 msec = 0;
+ s32 rem = 0;
printk(KERN_DEBUG "%s: dump queue '%s' (first packet in each frame)\n",
THIS_MODULE->name, q->name);
list_for_each_entry_reverse(xframe, &q->head, frame_list) {
xpacket_t *pack = (xpacket_t *)&xframe->packets[0];
s64 usec = ktime_us_delta(now, xframe->kt_queued);
+ msec = div_s64_rem(usec, 1000, &rem);
- snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03lld msec",
- i++, usec / 1000, usec % 1000);
+ snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03d msec",
+ i++, msec, rem);
dump_packet(prefix, pack, 1);
}
}
@@ -52,6 +55,8 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe)
{
int ret = 1;
static int overflow_cnt;
+ s64 msec = 0;
+ s32 rem = 0;
if (unlikely(q->disabled)) {
ret = 0;
@@ -60,11 +65,11 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe)
if (q->count >= q->max_count) {
q->overflows++;
if ((overflow_cnt++ % 1000) < 5) {
- NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%lld ms\n",
+ msec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
+ NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%d ms\n",
q->name, q->steady_state_count, q->count,
q->max_count, q->worst_count, q->overflows,
- q->worst_lag_usec / 1000,
- q->worst_lag_usec % 1000);
+ msec, rem);
__xframe_dump_queue(q);
}
ret = 0;
diff --git a/drivers/dahdi/xpp/xpp_usb.c b/drivers/dahdi/xpp/xpp_usb.c
index 1a591b1..3741457 100644
--- a/drivers/dahdi/xpp/xpp_usb.c
+++ b/drivers/dahdi/xpp/xpp_usb.c
@@ -882,7 +882,7 @@ static void xpp_send_callback(struct urb *urb)
usec = 0; /* System clock jumped */
if (usec > xusb->max_tx_delay)
xusb->max_tx_delay = usec;
- i = usec / USEC_BUCKET;
+ i = div_s64(usec, USEC_BUCKET);
if (i >= NUM_BUCKETS)
i = NUM_BUCKETS - 1;
xusb->usb_tx_delay[i]++;
--
2.33.0

View File

@@ -0,0 +1,230 @@
From 497f11466688d9e76a7b68ffdd2c3859279f5fce Mon Sep 17 00:00:00 2001
From: Pushkar Singh <psingh@sangoma.com>
Date: Thu, 4 Apr 2024 01:15:01 +0530
Subject: [PATCH] Fix compilation issue for 6.8.y/6.9.y kernel
Upstream: https://github.com/asterisk/dahdi-linux/commit/497f11466688d9e76a7b68ffdd2c3859279f5fce
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
drivers/dahdi/dahdi-base.c | 40 ++++++++++++++---------------
drivers/dahdi/dahdi_dynamic.c | 4 +--
drivers/dahdi/dahdi_dynamic_eth.c | 4 +--
drivers/dahdi/dahdi_dynamic_ethmf.c | 2 +-
drivers/dahdi/dahdi_transcode.c | 2 +-
drivers/dahdi/xpp/card_global.c | 2 +-
6 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index b96f72b1..87177a69 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -4359,7 +4359,7 @@ static int dahdi_ioctl_getparams(struct file *file, unsigned long data)
param.pulsebreaktime = chan->pulsebreaktime;
param.pulseaftertime = chan->pulseaftertime;
param.spanno = (chan->span) ? chan->span->spanno : 0;
- strlcpy(param.name, chan->name, sizeof(param.name));
+ strscpy(param.name, chan->name, sizeof(param.name));
param.chanpos = chan->chanpos;
param.sigcap = chan->sigcap;
/* Return current law */
@@ -4447,8 +4447,8 @@ static int dahdi_ioctl_spanstat(struct file *file, unsigned long data)
spaninfo.spanno = s->spanno; /* put the span # in here */
spaninfo.totalspans = span_count();
- strlcpy(spaninfo.desc, s->desc, sizeof(spaninfo.desc));
- strlcpy(spaninfo.name, s->name, sizeof(spaninfo.name));
+ strscpy(spaninfo.desc, s->desc, sizeof(spaninfo.desc));
+ strscpy(spaninfo.name, s->name, sizeof(spaninfo.name));
spaninfo.alarms = s->alarms; /* get alarm status */
spaninfo.rxlevel = s->rxlevel; /* get rx level */
spaninfo.txlevel = s->txlevel; /* get tx level */
@@ -4475,18 +4475,18 @@ static int dahdi_ioctl_spanstat(struct file *file, unsigned long data)
spaninfo.lineconfig = s->lineconfig;
spaninfo.irq = 0;
spaninfo.linecompat = s->linecompat;
- strlcpy(spaninfo.lboname, dahdi_lboname(s->lbo),
+ strscpy(spaninfo.lboname, dahdi_lboname(s->lbo),
sizeof(spaninfo.lboname));
if (s->parent->manufacturer) {
- strlcpy(spaninfo.manufacturer, s->parent->manufacturer,
+ strscpy(spaninfo.manufacturer, s->parent->manufacturer,
sizeof(spaninfo.manufacturer));
}
if (s->parent->devicetype) {
- strlcpy(spaninfo.devicetype, s->parent->devicetype,
+ strscpy(spaninfo.devicetype, s->parent->devicetype,
sizeof(spaninfo.devicetype));
}
if (s->parent->location) {
- strlcpy(spaninfo.location, s->parent->location,
+ strscpy(spaninfo.location, s->parent->location,
sizeof(spaninfo.location));
}
if (s->spantype) {
@@ -4505,11 +4505,11 @@ static int dahdi_ioctl_spanstat(struct file *file, unsigned long data)
const char *st = dahdi_spantype2str(s->spantype);
switch (s->spantype) {
case SPANTYPE_DIGITAL_BRI_NT:
- strlcpy(spaninfo.spantype, "NT",
+ strscpy(spaninfo.spantype, "NT",
sizeof(spaninfo.spantype));
break;
case SPANTYPE_DIGITAL_BRI_TE:
- strlcpy(spaninfo.spantype, "TE",
+ strscpy(spaninfo.spantype, "TE",
sizeof(spaninfo.spantype));
break;
default:
@@ -4519,7 +4519,7 @@ static int dahdi_ioctl_spanstat(struct file *file, unsigned long data)
* so no backward compatibility for this
* broken interface.
*/
- strlcpy(spaninfo.spantype, st,
+ strscpy(spaninfo.spantype, st,
sizeof(spaninfo.spantype));
break;
}
@@ -4568,10 +4568,10 @@ static int dahdi_ioctl_spanstat_v1(struct file *file, unsigned long data)
spaninfo_v1.spanno = s->spanno; /* put the span # in here */
spaninfo_v1.totalspans = 0;
spaninfo_v1.totalspans = span_count();
- strlcpy(spaninfo_v1.desc,
+ strscpy(spaninfo_v1.desc,
s->desc,
sizeof(spaninfo_v1.desc));
- strlcpy(spaninfo_v1.name,
+ strscpy(spaninfo_v1.name,
s->name,
sizeof(spaninfo_v1.name));
spaninfo_v1.alarms = s->alarms;
@@ -4593,25 +4593,25 @@ static int dahdi_ioctl_spanstat_v1(struct file *file, unsigned long data)
spaninfo_v1.lineconfig = s->lineconfig;
spaninfo_v1.irq = 0;
spaninfo_v1.linecompat = s->linecompat;
- strlcpy(spaninfo_v1.lboname,
+ strscpy(spaninfo_v1.lboname,
dahdi_lboname(s->lbo),
sizeof(spaninfo_v1.lboname));
if (s->parent->manufacturer) {
- strlcpy(spaninfo_v1.manufacturer, s->parent->manufacturer,
+ strscpy(spaninfo_v1.manufacturer, s->parent->manufacturer,
sizeof(spaninfo_v1.manufacturer));
}
if (s->parent->devicetype) {
- strlcpy(spaninfo_v1.devicetype, s->parent->devicetype,
+ strscpy(spaninfo_v1.devicetype, s->parent->devicetype,
sizeof(spaninfo_v1.devicetype));
}
- strlcpy(spaninfo_v1.location, s->parent->location,
+ strscpy(spaninfo_v1.location, s->parent->location,
sizeof(spaninfo_v1.location));
if (s->spantype) {
- strlcpy(spaninfo_v1.spantype,
+ strscpy(spaninfo_v1.spantype,
dahdi_spantype2str(s->spantype),
sizeof(spaninfo_v1.spantype));
}
@@ -5285,7 +5285,7 @@ static int dahdi_ioctl_attach_echocan(unsigned long data)
* always use it instead of any configured software
* echocan. This matches the behavior in dahdi 2.4.1.2
* and earlier releases. */
- strlcpy(ae.echocan, hwec_def_name, sizeof(ae.echocan));
+ strscpy(ae.echocan, hwec_def_name, sizeof(ae.echocan));
} else if (strcasecmp(ae.echocan, hwec_def_name) != 0) {
chan_dbg(GENERAL, chan,
@@ -5384,7 +5384,7 @@ static int dahdi_ioctl_get_version(unsigned long data)
bool have_hwec = dahdi_any_hwec_available();
memset(&vi, 0, sizeof(vi));
- strlcpy(vi.version, dahdi_version, sizeof(vi.version));
+ strscpy(vi.version, dahdi_version, sizeof(vi.version));
spin_lock(&ecfactory_list_lock);
list_for_each_entry(cur, &ecfactory_list, list) {
const char * const ec_name = cur->ec->get_name(NULL);
@@ -5640,7 +5640,7 @@ static int ioctl_dahdi_dial(struct dahdi_chan *chan, unsigned long data)
rv = -EBUSY;
break;
}
- strlcpy(chan->txdialbuf + strlen(chan->txdialbuf), tdo->dialstr,
+ strscpy(chan->txdialbuf + strlen(chan->txdialbuf), tdo->dialstr,
DAHDI_MAX_DTMF_BUF - strlen(chan->txdialbuf));
if (!chan->dialing) {
chan->dialing = 1;
diff --git a/drivers/dahdi/dahdi_dynamic.c b/drivers/dahdi/dahdi_dynamic.c
index b1df408d..be58aff8 100644
--- a/drivers/dahdi/dahdi_dynamic.c
+++ b/drivers/dahdi/dahdi_dynamic.c
@@ -622,8 +622,8 @@ static int _create_dynamic(struct dahdi_dynamic_span *dds)
}
/* Setup parameters properly assuming we're going to be okay. */
- strlcpy(d->dname, dds->driver, sizeof(d->dname));
- strlcpy(d->addr, dds->addr, sizeof(d->addr));
+ strscpy(d->dname, dds->driver, sizeof(d->dname));
+ strscpy(d->addr, dds->addr, sizeof(d->addr));
d->timing = dds->timing;
snprintf(d->span.name, sizeof(d->span.name), "DYN/%s/%s",
dds->driver, dds->addr);
diff --git a/drivers/dahdi/dahdi_dynamic_eth.c b/drivers/dahdi/dahdi_dynamic_eth.c
index 0209489b..c7a293dd 100644
--- a/drivers/dahdi/dahdi_dynamic_eth.c
+++ b/drivers/dahdi/dahdi_dynamic_eth.c
@@ -292,12 +292,12 @@ static int ztdeth_create(struct dahdi_dynamic *dyn, const char *addr)
memset(z, 0, sizeof(struct ztdeth));
/* Address should be <dev>/<macaddr>[/subaddr] */
- strlcpy(tmp, addr, sizeof(tmp));
+ strscpy(tmp, addr, sizeof(tmp));
tmp2 = strchr(tmp, '/');
if (tmp2) {
*tmp2 = '\0';
tmp2++;
- strlcpy(z->ethdev, tmp, sizeof(z->ethdev));
+ strscpy(z->ethdev, tmp, sizeof(z->ethdev));
} else {
printk(KERN_NOTICE "Invalid TDMoE address (no device) '%s'\n", addr);
kfree(z);
diff --git a/drivers/dahdi/dahdi_dynamic_ethmf.c b/drivers/dahdi/dahdi_dynamic_ethmf.c
index 73290d8d..f7c067fb 100644
--- a/drivers/dahdi/dahdi_dynamic_ethmf.c
+++ b/drivers/dahdi/dahdi_dynamic_ethmf.c
@@ -573,7 +573,7 @@ static int ztdethmf_create(struct dahdi_dynamic *dyn, const char *addr)
z->rcvbuf = kmalloc(bufsize, GFP_KERNEL);
/* Address should be <dev>/<macaddr>/subaddr */
- strlcpy(src, addr, sizeof(src));
+ strscpy(src, addr, sizeof(src));
/* replace all / with space; otherwise kernel sscanf does not work */
src_ptr = src;
while (*src_ptr) {
diff --git a/drivers/dahdi/dahdi_transcode.c b/drivers/dahdi/dahdi_transcode.c
index 6021aac2..7645e2f1 100644
--- a/drivers/dahdi/dahdi_transcode.c
+++ b/drivers/dahdi/dahdi_transcode.c
@@ -329,7 +329,7 @@ static long dahdi_tc_getinfo(unsigned long data)
return -ENOSYS;
}
- strlcpy(info.name, tc->name, sizeof(info.name));
+ strscpy(info.name, tc->name, sizeof(info.name));
info.numchannels = tc->numchannels;
info.srcfmts = tc->srcfmts;
info.dstfmts = tc->dstfmts;
diff --git a/drivers/dahdi/xpp/card_global.c b/drivers/dahdi/xpp/card_global.c
index 9e679bbc..064edbb3 100644
--- a/drivers/dahdi/xpp/card_global.c
+++ b/drivers/dahdi/xpp/card_global.c
@@ -342,7 +342,7 @@ int parse_chip_command(xpd_t *xpd, char *cmdline)
XBUS_DBG(GENERAL, xbus, "Dropped packet. Disconnected.\n");
return -EBUSY;
}
- strlcpy(buf, cmdline, MAX_PROC_WRITE); /* Save a copy */
+ strscpy(buf, cmdline, MAX_PROC_WRITE); /* Save a copy */
if (buf[0] == '#' || buf[0] == ';')
XPD_DBG(REGS, xpd, "Note: '%s'\n", buf);
if ((p = strchr(buf, '#')) != NULL) /* Truncate comments */

View File

@@ -0,0 +1,82 @@
From ce9de5d1bf9d21c088b01ce9da6f7ff02b0d863d Mon Sep 17 00:00:00 2001
From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
Date: Mon, 23 Sep 2024 08:04:54 -0400
Subject: [PATCH] xpp, sysfs: Use const struct device_device if needed.
Kernel commit d69d804845985c29ab5be5a4b3b1f4787893daf8
changed struct device_driver to be const, so make the
arguments const on kernels 6.11 and newer.
Resolves: #63
Upstream: https://github.com/asterisk/dahdi-linux/pull/64
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
drivers/dahdi/dahdi-sysfs-chan.c | 4 ++++
drivers/dahdi/dahdi-sysfs.c | 4 ++++
drivers/dahdi/xpp/xbus-sysfs.c | 8 ++++++++
3 files changed, 16 insertions(+)
diff --git a/drivers/dahdi/dahdi-sysfs-chan.c b/drivers/dahdi/dahdi-sysfs-chan.c
index 09d7317..35b7bd4 100644
--- a/drivers/dahdi/dahdi-sysfs-chan.c
+++ b/drivers/dahdi/dahdi-sysfs-chan.c
@@ -220,7 +220,11 @@ static void chan_release(struct device *dev)
chan_dbg(DEVICES, chan, "SYSFS\n");
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
+static int chan_match(struct device *dev, const struct device_driver *driver)
+#else
static int chan_match(struct device *dev, struct device_driver *driver)
+#endif /* LINUX_VERSION_CODE */
{
struct dahdi_chan *chan;
diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c
index 7477ebc..246514c 100644
--- a/drivers/dahdi/dahdi-sysfs.c
+++ b/drivers/dahdi/dahdi-sysfs.c
@@ -42,7 +42,11 @@ module_param(tools_rootdir, charp, 0444);
MODULE_PARM_DESC(tools_rootdir,
"root directory of all tools paths (default /)");
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
+static int span_match(struct device *dev, const struct device_driver *driver)
+#else
static int span_match(struct device *dev, struct device_driver *driver)
+#endif /* LINUX_VERSION_CODE */
{
return 1;
}
diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
index 177048b..f78a15e 100644
--- a/drivers/dahdi/xpp/xbus-sysfs.c
+++ b/drivers/dahdi/xpp/xbus-sysfs.c
@@ -397,7 +397,11 @@ static struct attribute *xbus_dev_attrs[] = {
ATTRIBUTE_GROUPS(xbus_dev);
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
+static int astribank_match(struct device *dev, const struct device_driver *driver)
+#else
static int astribank_match(struct device *dev, struct device_driver *driver)
+#endif /* LINUX_VERSION_CODE */
{
DBG(DEVICES, "SYSFS MATCH: dev->bus_id = %s, driver->name = %s\n",
dev_name(dev), driver->name);
@@ -771,7 +775,11 @@ static DEVICE_ATTR_READER(refcount_xpd_show, dev, buf)
return len;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
+static int xpd_match(struct device *dev, const struct device_driver *driver)
+#else
static int xpd_match(struct device *dev, struct device_driver *driver)
+#endif /* LINUX_VERSION_CODE */
{
struct xpd_driver *xpd_driver;
xpd_t *xpd;
--
2.39.5

View File

@@ -0,0 +1,38 @@
From 96a67c8e51997a18bfc0942416b815057e279caf Mon Sep 17 00:00:00 2001
From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
Date: Tue, 8 Jul 2025 18:35:56 -0400
Subject: [PATCH] kernel.h: Add wrappers for del_timer and del_timer_sync.
del_timer[_sync] was renamed to timer_delete[_sync] in kernel
commit bb663f0f3c396c6d05f6c5eeeea96ced20ff112e, and the
compatibility wrappers were removed completely in kernel commit
8fa7292fee5c5240402371ea89ab285ec856c916. Add the wrappers
back on newer kernels to allow compilation.
Resolves: #91
Upstream: https://github.com/asterisk/dahdi-linux/commit/67d909a8a73364d6fa47bbf8baf314175c94f546
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
include/dahdi/kernel.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index ab129a8..ddd3eb4 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -62,6 +62,11 @@
#define netif_napi_add netif_napi_add_weight
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
+#define del_timer timer_delete
+#define del_timer_sync timer_delete_sync
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
#include <linux/pci.h>
#include <linux/dma-mapping.h>
--
2.55.0

View File

@@ -0,0 +1,186 @@
From fc3748466d96fa465fe665403b73d6f4f75c124b Mon Sep 17 00:00:00 2001
From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
Date: Fri, 21 Feb 2025 21:42:19 -0500
Subject: [PATCH] Kbuild: Use ccflags-y instead of EXTRA_CFLAGS.
ccflags-y was added to the kernel back in 2007, in commit
f77bf01425b11947eeb3b5b54. Recent kernel commit
dbd83ea09699390892e5efecddd74ae43a00f071 has now completely
removed the deprecated EXTRA_CFLAGS.
Comments in Kbuild and the Makefile for the oct612x library were
added back when it was created in 2013 in commit f65299e8b2e6ffb0b07089759f8c4ff33a695c09
to use the newer ccflags-y based on the kernel version,
but the change was never made to conditionally move away
from the EXTRA_CFLAGS.
Now that the older way no longer exists, always use ccflags-y.
Resolves: #76
Upstream: https://github.com/asterisk/dahdi-linux/commit/9d5b120cb5573d39bcd9e3d8a7b212e25ab5c2c4
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
drivers/dahdi/Kbuild | 4 ++--
drivers/dahdi/oct612x/Kbuild | 5 +----
drivers/dahdi/oct612x/Makefile | 5 +----
drivers/dahdi/voicebus/Kbuild | 4 ++--
drivers/dahdi/wcb4xxp/Kbuild | 2 +-
drivers/dahdi/wct4xxp/Kbuild | 6 +++---
drivers/dahdi/wctc4xxp/Kbuild | 4 ++--
drivers/dahdi/wctdm24xxp/Kbuild | 2 +-
drivers/dahdi/xpp/Kbuild | 4 ++--
9 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/drivers/dahdi/Kbuild b/drivers/dahdi/Kbuild
index cd0365b..9c9355a 100644
--- a/drivers/dahdi/Kbuild
+++ b/drivers/dahdi/Kbuild
@@ -75,13 +75,13 @@ CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(src) -Wno-format-truncation
BAD_KERNELS_VERS := 22 34 34.0.1 34.0.2
BAD_KERNELS := $(foreach ver,$(BAD_KERNELS_VERS),2.6.9-$(ver).EL 2.6.9-$(ver).ELsmp)
ifneq (,$(filter $(KVERS),$(BAD_KERNELS)))
-EXTRA_CFLAGS+=-Drw_lock_t=rwlock_t
+ccflags-y+=-Drw_lock_t=rwlock_t
endif
# A number of Fedora 10 (9 also?) kernels backported hrtimer to 2.6.27
# as part of an ALSA backport. TODO: Any better way to detect that?
ifeq (1,$(shell fgrep -q ' hrtimer_set_expires' include/linux/hrtimer.h 2>/dev/null && echo 1))
-EXTRA_CFLAGS+=-DHAVE_HRTIMER_ACCESSORS=1
+ccflags-y+=-DHAVE_HRTIMER_ACCESSORS=1
endif
ifeq (1,$(shell fgrep -q 'wait_for_completion_timeout' include/linux/completion.h 2>/dev/null && echo 1))
diff --git a/drivers/dahdi/oct612x/Kbuild b/drivers/dahdi/oct612x/Kbuild
index ac53fe7..5015f7e 100644
--- a/drivers/dahdi/oct612x/Kbuild
+++ b/drivers/dahdi/oct612x/Kbuild
@@ -24,9 +24,6 @@ octapi_files = octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o \
apilib/llman/octapi_llman.o \
oct612x-user.o
-# TODO: ccflags was added in 2.6.24 in commit f77bf01425b11947eeb3b5b54. This
-# should be changed to a conditional compilation based on the Kernel Version.
-# ccflags-y := -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
-EXTRA_CFLAGS = -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
+ccflags-y := -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_OCT612X) := oct612x.o
oct612x-objs := $(octapi_files)
diff --git a/drivers/dahdi/oct612x/Makefile b/drivers/dahdi/oct612x/Makefile
index 5d29143..d01997b 100644
--- a/drivers/dahdi/oct612x/Makefile
+++ b/drivers/dahdi/oct612x/Makefile
@@ -23,8 +23,5 @@ octapi_files = octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o \
apilib/largmath/octapi_largmath.o \
apilib/llman/octapi_llman.o
-# TODO: ccflags was added in 2.6.24 in commit f77bf01425b11947eeb3b5b54. This
-# should be changed to a conditional compilation based on the Kernel Version.
-# ccflags-y := -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
-EXTRA_CFLAGS = -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
+ccflags-y := -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
lib-y := $(octapi_files)
diff --git a/drivers/dahdi/voicebus/Kbuild b/drivers/dahdi/voicebus/Kbuild
index 3bf9640..45026d9 100644
--- a/drivers/dahdi/voicebus/Kbuild
+++ b/drivers/dahdi/voicebus/Kbuild
@@ -8,10 +8,10 @@ ifneq ($(HOTPLUG_FIRMWARE),yes)
dahdi_voicebus-objs += $(FIRM_DIR)/dahdi-fw-vpmoct032.o
$(warning WARNING: You are compiling firmware into voicebus.ko which is not available under the terms of the GPL. It may be a violation of the GPL to distribute the resulting image since it combines both GPL and non-GPL work. You should consult a lawyer of your own before distributing such an image.)
else
- EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
+ ccflags-y+=-DHOTPLUG_FIRMWARE
endif
-EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+ccflags-y += -I$(src)/.. -Wno-undef
$(obj)/$(FIRM_DIR)/dahdi-fw-vpmoct032.o: $(obj)/voicebus.o
$(MAKE) -C $(obj)/$(FIRM_DIR) dahdi-fw-vpmoct032.o
diff --git a/drivers/dahdi/wcb4xxp/Kbuild b/drivers/dahdi/wcb4xxp/Kbuild
index 80606bf..59ffc8d 100644
--- a/drivers/dahdi/wcb4xxp/Kbuild
+++ b/drivers/dahdi/wcb4xxp/Kbuild
@@ -1,6 +1,6 @@
obj-m += wcb4xxp.o
-EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+ccflags-y += -I$(src)/.. -Wno-undef
wcb4xxp-objs := base.o
diff --git a/drivers/dahdi/wct4xxp/Kbuild b/drivers/dahdi/wct4xxp/Kbuild
index cf01ccf..eeeb2f6 100644
--- a/drivers/dahdi/wct4xxp/Kbuild
+++ b/drivers/dahdi/wct4xxp/Kbuild
@@ -2,16 +2,16 @@ obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT4XXP) += wct4xxp.o
FIRM_DIR := ../firmware
-EXTRA_CFLAGS += -I$(src)/.. -I$(src)/../oct612x/ $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
+ccflags-y += -I$(src)/.. -I$(src)/../oct612x/ $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
# The OCT612X source files are from a vendor drop and we do not want to edit
# them to make this warning go away. Therefore, turn off the
# unused-but-set-variable warning for this driver.
-EXTRA_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
+ccflags-y += $(call cc-option, -Wno-unused-but-set-variable)
ifeq ($(HOTPLUG_FIRMWARE),yes)
- EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
+ ccflags-y+=-DHOTPLUG_FIRMWARE
endif
wct4xxp-objs := base.o vpm450m.o
diff --git a/drivers/dahdi/wctc4xxp/Kbuild b/drivers/dahdi/wctc4xxp/Kbuild
index 9f97498..2f1bfbf 100644
--- a/drivers/dahdi/wctc4xxp/Kbuild
+++ b/drivers/dahdi/wctc4xxp/Kbuild
@@ -2,10 +2,10 @@ obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTC4XXP) += wctc4xxp.o
FIRM_DIR := ../firmware
-EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+ccflags-y += -I$(src)/.. -Wno-undef
ifeq ($(HOTPLUG_FIRMWARE),yes)
- EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
+ ccflags-y+=-DHOTPLUG_FIRMWARE
endif
wctc4xxp-objs := base.o
diff --git a/drivers/dahdi/wctdm24xxp/Kbuild b/drivers/dahdi/wctdm24xxp/Kbuild
index 22cc71a..c9d96b7 100644
--- a/drivers/dahdi/wctdm24xxp/Kbuild
+++ b/drivers/dahdi/wctdm24xxp/Kbuild
@@ -1,5 +1,5 @@
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM24XXP) += wctdm24xxp.o
-EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+ccflags-y += -I$(src)/.. -Wno-undef
wctdm24xxp-objs := base.o xhfc.o
diff --git a/drivers/dahdi/xpp/Kbuild b/drivers/dahdi/xpp/Kbuild
index e46a9d7..02d3149 100644
--- a/drivers/dahdi/xpp/Kbuild
+++ b/drivers/dahdi/xpp/Kbuild
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS = $(XPP_LOCAL_CFLAGS) \
+ccflags-y = $(XPP_LOCAL_CFLAGS) \
-DDEBUG \
-DPOLL_DIGITAL_INPUTS \
-DDEBUG_PCMTX \
@@ -32,7 +32,7 @@ xpd_echo-objs += card_echo.o
xpp_mmap-objs += mmapbus.o mmapdrv.o
ifeq (y,$(PARPORT_DEBUG))
-EXTRA_CFLAGS += -DDEBUG_SYNC_PARPORT
+ccflags-y += -DDEBUG_SYNC_PARPORT
obj-m += parport_debug.o
endif
--
2.55.0

View File

@@ -0,0 +1,35 @@
From 13e360f1bc65dba29ba22c46f30ba868bea9805d Mon Sep 17 00:00:00 2001
From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
Date: Sat, 12 Jul 2025 17:52:40 -0400
Subject: [PATCH] kernel.h: Add wrapper for renamed from_timer function.
from_timer was renamed to timer_container_of in kernel commit
41cb08555c4164996d67c78b3bf1c658075b75f1 as part of updates to
the timer APIs. Add a compatibility wrapper for kernels >= 6.16.0.
Resolves: #95
Upstream: https://github.com/asterisk/dahdi-linux/commit/0d864e9f97ba22e340380ce24a1bd366ca33ebc2
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
include/dahdi/kernel.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index ddd3eb4..01fe113 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -58,6 +58,10 @@
#include <linux/poll.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
+#define from_timer timer_container_of
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
#define netif_napi_add netif_napi_add_weight
#endif
--
2.55.0

View File

@@ -0,0 +1,15 @@
config BR2_PACKAGE_DAHDI_LINUX
bool "dahdi-linux"
depends on BR2_LINUX_KERNEL
help
DAHDI (Digium/Asterisk Hardware Device Interface) is the open
source device interface technology used to control Digium and
other legacy telephony interface cards.
DAHDI Linux is the open source device driver framework used to
interface Asterisk with telephony hardware.
https://github.com/asterisk/dahdi-linux
comment "dahdi-linux needs a Linux kernel to be built"
depends on !BR2_LINUX_KERNEL

View File

@@ -0,0 +1,25 @@
# From http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-3.3.0.sha256
sha256 f9528a82b5e88c1d92d737efd65bd571bef2cd1b1b44d43b857a76e38e01a7c0 dahdi-linux-3.3.0.tar.gz
# Firmware files have no upstream hash, so sha56 locally computed
sha256 3ff26cf80555fd7470b43a87c51d03c1db2a75abcd4561d79f69b6c48298e4a1 dahdi-fwload-vpmadt032-1.25.0.tar.gz
sha256 d5b6ab6851e431afcfec2ecc39d95fa88fe3939ffdb2e3d4f28a43cabf30e95b dahdi-fw-a4a-a0017.tar.gz
sha256 e039af8bec36407b74e1dd9ebdd49ba077469eda79d4e6093721ed2836d4536f dahdi-fw-a4b-d001e.tar.gz
sha256 5064f9877b8aec99b19fd57988216fe1a9c0b7c07853dd3b32b5a55ab7b418e6 dahdi-fw-a8a-1d0017.tar.gz
sha256 09a8992786309e025aa60b400a2c7d21226ac9bb6f1b66f562a5e7e9dc892b03 dahdi-fw-a8b-1f001e.tar.gz
sha256 449ab3fd03d55d808e999efb7677cd04de202b92c9fcb039539a7e48a39a80f5 dahdi-fw-hx8-2.06.tar.gz
sha256 7a006073202d67e45f1d5ff1e9c6e8663e6056cef9dc4c5abae86a1018db349c dahdi-fw-oct6114-032-1.05.01.tar.gz
sha256 56bac1f2024c76ecf9b6f40992eeea29a1fbee676bb2a37a058179bacfbb1c91 dahdi-fw-oct6114-064-1.05.01.tar.gz
sha256 e1146749d205c41603b9b76852c3f8104dac233d0025d700db24504d10c99775 dahdi-fw-oct6114-128-1.05.01.tar.gz
sha256 5fe5036a2766cf0e8a968b0c58b700507d86e1cde9296ca437170cc626a9c79c dahdi-fw-oct6114-256-1.05.01.tar.gz
sha256 11dd8d009809e41fc9a3a36766f59ff73d29075eede5b8724331d9a6e5259774 dahdi-fw-tc400m-MR6.12.tar.gz
sha256 511c1966295a20df673bb87af30245f0ad165efd6ccb92b4d8ed535ca7f5ac65 dahdi-fw-te133-7a001e.tar.gz
sha256 99f7c410bf47d2a5ae687d717e51448ce5b52aca902830bf39bffe683150fa2d dahdi-fw-te134-780017.tar.gz
sha256 c8f55d57cc0bf332e8d96cdf9ff6dd0e322f33581e1efc24c2b9a0e0c5eb7ee4 dahdi-fw-te435-13001e.tar.gz
sha256 0980f4a8d191c6872aa27d971758046f0e7827ac161549f2cc1b0eeab0ae9333 dahdi-fw-te436-10017.tar.gz
sha256 5b823e25828e2c1c6548886ad408b2e31dbc8cd17170c52592792d9c754a199c dahdi-fw-te820-1.76.tar.gz
sha256 6b199cf836f150f9cb35f763f0f502fb52cfa2724a449b500429c746973904ad dahdi-fw-vpmoct032-1.12.0.tar.gz
# License files, locally computed
sha256 fa5fc1d1eec39532ea517518eeefd7b6e3c14341a55e5880a0e2a49eee47a5b7 LICENSE
sha256 ec60b993835e2c6b79e6d9226345f4e614e686eb57dc13b6420c15a33a8996e5 LICENSE.LGPL

View File

@@ -0,0 +1,93 @@
################################################################################
#
# dahdi-linux
#
################################################################################
DAHDI_LINUX_VERSION = 3.3.0
DAHDI_LINUX_SITE = \
http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases
# We need to download all those firmware blobs ourselves, otherwise
# dahdi-linux will try to download them at install time.
DAHDI_LINUX_FW_SITE = http://downloads.digium.com/pub/telephony/firmware/releases
DAHDI_LINUX_FW_FILES = \
dahdi-fwload-vpmadt032-1.25.0.tar.gz \
dahdi-fw-oct6114-032-1.05.01.tar.gz \
dahdi-fw-oct6114-064-1.05.01.tar.gz \
dahdi-fw-oct6114-128-1.05.01.tar.gz \
dahdi-fw-oct6114-256-1.05.01.tar.gz \
dahdi-fw-tc400m-MR6.12.tar.gz \
dahdi-fw-hx8-2.06.tar.gz \
dahdi-fw-vpmoct032-1.12.0.tar.gz \
dahdi-fw-te820-1.76.tar.gz \
dahdi-fw-te133-7a001e.tar.gz \
dahdi-fw-te134-780017.tar.gz \
dahdi-fw-a8b-1f001e.tar.gz \
dahdi-fw-a8a-1d0017.tar.gz \
dahdi-fw-a4b-d001e.tar.gz \
dahdi-fw-a4a-a0017.tar.gz \
dahdi-fw-te435-13001e.tar.gz \
dahdi-fw-te436-10017.tar.gz
DAHDI_LINUX_EXTRA_DOWNLOADS = \
$(patsubst %,$(DAHDI_LINUX_FW_SITE)/%,$(DAHDI_LINUX_FW_FILES))
# dahdi-linux claims to be GPLv2 with parts LGPLv2.1 (not 'or later'),
# but there are the so-called firmware files (downloaded above) for
# which the license is unclear: the header claims to be GPLv2, the
# 'loader-wrapper' claims to be GPLv2, but there are two so-called
# 'firmware' binary-only .o blobs for which the license is not
# explicited, which look like they end up as part of a kernel module,
# and for which the source is nowhere to be found on the upstream site
# (they are only for x86/x86_64, but we still list them unconditionally).
DAHDI_LINUX_LICENSE = GPL-2.0, LGPL-2.1, unknown (firmware files)
DAHDI_LINUX_LICENSE_FILES = LICENSE LICENSE.LGPL
DAHDI_LINUX_INSTALL_STAGING = YES
DAHDI_LINUX_MODULE_SUBDIRS = drivers/dahdi
DAHDI_LINUX_MODULE_MAKE_OPTS = \
KSRC=$(LINUX_DIR) \
KVERS=$(LINUX_VERSION_PROBED) \
DAHDI_BUILD_ALL=m \
DAHDI_INCLUDE=$(@D)/include \
INSTALL_MOD_DIR=dahdi
define DAHDI_LINUX_EXTRACT_FW
$(foreach f,$(DAHDI_LINUX_FW_FILES),\
cp $(DAHDI_LINUX_DL_DIR)/$(f) $(@D)/drivers/dahdi/firmware/$(f)$(sep))
endef
DAHDI_LINUX_POST_EXTRACT_HOOKS += DAHDI_LINUX_EXTRACT_FW
define DAHDI_LINUX_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_CRC_CCITT)
endef
# Need to pass the same options as for building the modules, because
# it wants to scan Linux' .config file to check whether some options
# are set or not (like CONFIG_FW_LOADER).
define DAHDI_LINUX_CONFIGURE_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
$(DAHDI_LINUX_MODULE_MAKE_OPTS) \
prereq
endef
define DAHDI_LINUX_INSTALL_STAGING_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
$(DAHDI_LINUX_MODULE_MAKE_OPTS) \
DESTDIR=$(STAGING_DIR) \
install-include
endef
define DAHDI_LINUX_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
$(DAHDI_LINUX_MODULE_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) \
install-firmware \
install-xpp-firm
endef
$(eval $(kernel-module))
$(eval $(generic-package))