From 22826f0f164d48ceef18343d9e9c2a6eb3de4230 Mon Sep 17 00:00:00 2001 From: Jan-Simon Moeller Date: Mon, 18 Oct 2021 14:06:49 +0200 Subject: WIP: rm appfw Signed-off-by: Jan-Simon Moeller Change-Id: I6a90dae780a8eca7d684b5842c3af3ee55ebc509 --- .../0001-Disable-sllin-driver-debug-log.patch | 27 ++++ .../sllin/files/0001_update_makefile.patch | 21 +++ .../files/0002_fix_null_operation_check.patch | 176 +++++++++++++++++++++ ...llow-recent-kernels-newer-4.11.x-to-build.patch | 69 ++++++++ .../files/0004-Fix-build-with-5.9-kernel.patch | 48 ++++++ .../recipes-kernel/sllin/files/lin_config.conf | 10 ++ .../recipes-kernel/sllin/files/sllin-demo.service | 14 ++ .../recipes-kernel/sllin/files/start_lin_demo.sh | 59 +++++++ _to_remove/recipes-kernel/sllin/sllin.bb | 45 ++++++ 9 files changed, 469 insertions(+) create mode 100644 _to_remove/recipes-kernel/sllin/files/0001-Disable-sllin-driver-debug-log.patch create mode 100644 _to_remove/recipes-kernel/sllin/files/0001_update_makefile.patch create mode 100644 _to_remove/recipes-kernel/sllin/files/0002_fix_null_operation_check.patch create mode 100644 _to_remove/recipes-kernel/sllin/files/0003-Allow-recent-kernels-newer-4.11.x-to-build.patch create mode 100644 _to_remove/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch create mode 100644 _to_remove/recipes-kernel/sllin/files/lin_config.conf create mode 100644 _to_remove/recipes-kernel/sllin/files/sllin-demo.service create mode 100755 _to_remove/recipes-kernel/sllin/files/start_lin_demo.sh create mode 100644 _to_remove/recipes-kernel/sllin/sllin.bb (limited to '_to_remove/recipes-kernel/sllin') diff --git a/_to_remove/recipes-kernel/sllin/files/0001-Disable-sllin-driver-debug-log.patch b/_to_remove/recipes-kernel/sllin/files/0001-Disable-sllin-driver-debug-log.patch new file mode 100644 index 000000000..99d6183ab --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0001-Disable-sllin-driver-debug-log.patch @@ -0,0 +1,27 @@ +From 04ffb4b8f828c19e914987e271aaf3aa7eab28bf Mon Sep 17 00:00:00 2001 +From: Yuichi Kusakabe +Date: Thu, 29 Nov 2018 22:12:00 +0900 +Subject: [PATCH] Disable sllin driver debug log + +Signed-off-by: Yuichi Kusakabe +--- + sllin/sllin.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 77b2cb8..133d6e9 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -41,7 +41,9 @@ + * Funded by: Volkswagen Group Research + */ + ++#if 0 + #define DEBUG 1 /* Enables pr_debug() printouts */ ++#endif + + #include + #include +-- +2.7.4 + diff --git a/_to_remove/recipes-kernel/sllin/files/0001_update_makefile.patch b/_to_remove/recipes-kernel/sllin/files/0001_update_makefile.patch new file mode 100644 index 000000000..7db57802b --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0001_update_makefile.patch @@ -0,0 +1,21 @@ +diff --git a/sllin/Makefile b/sllin/Makefile +index 8ae7510..037846f 100644 +--- a/sllin/Makefile ++++ b/sllin/Makefile +@@ -1,10 +1,11 @@ + obj-m += sllin.o +-KPATH=/lib/modules/$(shell uname -r)/build ++KPATH=$(KERNEL_SRC) + #KPATH=/mnt/data/_dokumenty_/_w_/_dce_can_/src/can-benchmark/kernel/build/shark/3.0.4 + #KPATH=/mnt/data/_dokumenty_/_w_/_dce_can_/src/can-benchmark/kernel/build/shark/2.6.36 +- ++SRC := $(shell pwd) + all: +- make -C ${KPATH} M=$(PWD) modules +- ++ make -C ${KPATH} M=$(SRC) modules ++modules_install: ++ make -C ${KPATH} M=$(SRC) modules_install + clean: +- make -C ${KPATH} M=$(PWD) clean ++ make -C ${KPATH} M=$(SRC) clean diff --git a/_to_remove/recipes-kernel/sllin/files/0002_fix_null_operation_check.patch b/_to_remove/recipes-kernel/sllin/files/0002_fix_null_operation_check.patch new file mode 100644 index 000000000..896e2680d --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0002_fix_null_operation_check.patch @@ -0,0 +1,176 @@ +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 2db896f..2969448 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -869,7 +869,6 @@ static int sllin_send_tx_buff(struct sllin *sl) + #else + remains = sl->tx_lim - sl->tx_cnt; + #endif +- + res = tty->ops->write(tty, sl->tx_buff + sl->tx_cnt, remains); + if (res < 0) + goto error_in_write; +@@ -916,10 +915,25 @@ static int sllin_send_break(struct sllin *sl) + unsigned long break_baud; + int res; + ++ netdev_dbg(sl->dev, "%s()# invoke.\n", __func__); ++ if (tty == NULL) { ++ netdev_dbg(sl->dev, "%s() tty == NULL.\n", __func__); ++ sl->lin_state = SLSTATE_IDLE; ++ return -1; ++ } ++ if (tty->ops == NULL) { ++ netdev_dbg(sl->dev, "%s() tty->ops == NULL.\n", __func__); ++ sl->lin_state = SLSTATE_IDLE; ++ return -1; ++ } + break_baud = ((sl->lin_baud * 2) / 3); + sltty_change_speed(tty, break_baud); + +- tty->ops->flush_buffer(tty); ++ if (tty->ops->flush_buffer) { ++ tty->ops->flush_buffer(tty); ++ } else { ++ netdev_dbg(sl->dev, "%s() tty->ops->flush_buffer is NULL.\n", __func__); ++ } + sl->rx_cnt = SLLIN_BUFF_BREAK; + + sl->rx_expect = SLLIN_BUFF_BREAK + 1; +@@ -943,6 +957,17 @@ static int sllin_send_break(struct sllin *sl) + unsigned long usleep_range_min; + unsigned long usleep_range_max; + ++ netdev_dbg(sl->dev, "%s() invoke.\n", __func__); ++ if (tty == NULL) { ++ netdev_dbg(sl->dev, "%s() tty == NULL.\n", __func__); ++ sl->lin_state = SLSTATE_IDLE; ++ return -1; ++ } ++ if (tty->ops == NULL) { ++ netdev_dbg(sl->dev, "%s() tty->ops == NULL.\n", __func__); ++ sl->lin_state = SLSTATE_IDLE; ++ return -1; ++ } + break_baud = ((sl->lin_baud * 2) / 3); + sl->rx_cnt = SLLIN_BUFF_BREAK; + sl->rx_expect = SLLIN_BUFF_BREAK + 1; +@@ -950,21 +975,31 @@ static int sllin_send_break(struct sllin *sl) + + /* Do the break ourselves; Inspired by + http://lxr.linux.no/#linux+v3.1.2/drivers/tty/tty_io.c#L2452 */ +- retval = tty->ops->break_ctl(tty, -1); +- if (retval) +- return retval; ++ if (tty->ops->break_ctl) { ++ retval = tty->ops->break_ctl(tty, -1); ++ if (retval) ++ return retval; ++ } else { ++ netdev_dbg(sl->dev, "%s() tty->ops->break_ctl is NULL.\n", __func__); ++ } + + /* udelay(712); */ + usleep_range_min = (1000000l * SLLIN_SAMPLES_PER_CHAR) / break_baud; + usleep_range_max = usleep_range_min + 50; + usleep_range(usleep_range_min, usleep_range_max); + +- retval = tty->ops->break_ctl(tty, 0); ++ if(tty->ops->break_ctl) { ++ retval = tty->ops->break_ctl(tty, 0); ++ } + usleep_range_min = (1000000l * 1 /* 1 bit */) / break_baud; + usleep_range_max = usleep_range_min + 30; + usleep_range(usleep_range_min, usleep_range_max); + +- tty->ops->flush_buffer(tty); ++ if ( tty->ops->flush_buffer) { ++ tty->ops->flush_buffer(tty); ++ } else { ++ netdev_dbg(sl->dev, "%s() tty->ops->flush_buffer is NULL.\n", __func__); ++ } + + sl->tx_cnt = SLLIN_BUFF_SYNC; + +@@ -1028,6 +1063,12 @@ static int sllin_kwthread(void *ptr) + int lin_dlc; + u8 lin_data_buff[SLLIN_DATA_MAX]; + ++ if (sl == NULL) { ++ pr_err("sllin: sl is NULL\n"); ++ } ++ if (sl->dev == NULL) { ++ pr_err("sllin: sl->dev is NULL\n"); ++ } + + if ((sl->lin_state == SLSTATE_IDLE) && sl->lin_master && + sl->id_to_send) { +@@ -1036,6 +1077,7 @@ static int sllin_kwthread(void *ptr) + } + } + ++ netdev_dbg(sl->dev, "sllin_kthread \n"); + wait_event_killable(sl->kwt_wq, kthread_should_stop() || + test_bit(SLF_RXEVENT, &sl->flags) || + test_bit(SLF_TXEVENT, &sl->flags) || +@@ -1046,6 +1088,7 @@ static int sllin_kwthread(void *ptr) + (sl->lin_state == SLSTATE_RESPONSE_WAIT)) + && test_bit(SLF_MSGEVENT, &sl->flags))); + ++ netdev_dbg(sl->dev, "sllin_kthread \n"); + if (test_and_clear_bit(SLF_RXEVENT, &sl->flags)) { + netdev_dbg(sl->dev, "sllin_kthread RXEVENT\n"); + } +@@ -1078,21 +1121,25 @@ static int sllin_kwthread(void *ptr) + sl->lin_state = SLSTATE_IDLE; + } + ++ netdev_dbg(sl->dev, "sllin_kthread: lin_state <%08x>\n",sl->lin_state); + switch (sl->lin_state) { + case SLSTATE_IDLE: + if (!test_bit(SLF_MSGEVENT, &sl->flags)) + break; +- ++ if (sl->tx_req_skb == NULL) ++ netdev_dbg(sl->dev, "sl->tx_req_skb == NULL\n"); ++ if (sl->tx_req_skb->data == NULL) ++ netdev_dbg(sl->dev, "sl->tx_req_skb->data == NULL\n"); + cf = (struct can_frame *)sl->tx_req_skb->data; + + /* SFF RTR CAN frame -> LIN header */ + if (cf->can_id & CAN_RTR_FLAG) { + struct sllin_conf_entry *sce; + +- netdev_dbg(sl->dev, "%s: RTR SFF CAN frame, ID = %x\n", +- __func__, cf->can_id & LIN_ID_MASK); + + sce = &sl->linfr_cache[cf->can_id & LIN_ID_MASK]; ++ netdev_dbg(sl->dev, "%s: RTR SFF CAN frame, ID = %x dlc=%d\n", ++ __func__, cf->can_id & LIN_ID_MASK, sce->dlc); + spin_lock_irqsave(&sl->linfr_lock, flags); + + /* Is there Slave response in linfr_cache to be sent? */ +@@ -1114,8 +1161,8 @@ static int sllin_kwthread(void *ptr) + spin_unlock_irqrestore(&sl->linfr_lock, flags); + + } else { /* SFF NON-RTR CAN frame -> LIN header + LIN response */ +- netdev_dbg(sl->dev, "%s: NON-RTR SFF CAN frame, ID = %x\n", +- __func__, (int)cf->can_id & LIN_ID_MASK); ++ netdev_dbg(sl->dev, "%s: NON-RTR SFF CAN frame, ID = %x\n dlc=%d", ++ __func__, (int)cf->can_id & LIN_ID_MASK, cf->can_dlc); + + lin_data = cf->data; + lin_dlc = cf->can_dlc; +@@ -1140,6 +1187,7 @@ static int sllin_kwthread(void *ptr) + hrtimer_start(&sl->rx_timer, + ktime_add(ktime_get(), sl->rx_timer_timeout), + HRTIMER_MODE_ABS); ++ netdev_dbg(sl->dev, "sllin_kthread: SLSTATE finish\n"); + break; + + case SLSTATE_BREAK_SENT: +@@ -1654,3 +1702,4 @@ static void __exit sllin_exit(void) + + module_init(sllin_init); + module_exit(sllin_exit); ++ diff --git a/_to_remove/recipes-kernel/sllin/files/0003-Allow-recent-kernels-newer-4.11.x-to-build.patch b/_to_remove/recipes-kernel/sllin/files/0003-Allow-recent-kernels-newer-4.11.x-to-build.patch new file mode 100644 index 000000000..c8f2f9268 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0003-Allow-recent-kernels-newer-4.11.x-to-build.patch @@ -0,0 +1,69 @@ +From fcebb8f510bbb5c681f1f9af4506b4de241837dd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= +Date: Wed, 31 Oct 2018 20:48:20 +0000 +Subject: [PATCH] Allow recent kernels newer 4.11.x to build +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +API changes enforce porting. + +Signed-off-by: Jan-Simon Möller +--- + sllin/sllin.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 2969448..7e17127 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -56,7 +56,12 @@ + #include + #include + #include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) + #include ++#else ++#include ++#endif + #include + #include + #include +@@ -447,7 +451,9 @@ static int sll_open(struct net_device *dev) + static void sll_free_netdev(struct net_device *dev) + { + int i = dev->base_addr; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9) + free_netdev(dev); ++#endif + sllin_devs[i] = NULL; + } + +@@ -460,7 +466,12 @@ static const struct net_device_ops sll_netdev_ops = { + static void sll_setup(struct net_device *dev) + { + dev->netdev_ops = &sll_netdev_ops; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9) + dev->destructor = sll_free_netdev; ++#else ++ dev->needs_free_netdev = true; ++ dev->priv_destructor = sll_free_netdev; ++#endif + + dev->hard_header_len = 0; + dev->addr_len = 0; +@@ -1685,8 +1696,10 @@ static void __exit sllin_exit(void) + sl = netdev_priv(dev); + if (sl->tty) { + netdev_dbg(sl->dev, "tty discipline still running\n"); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9) + /* Intentionally leak the control block. */ + dev->destructor = NULL; ++#endif + } + + unregister_netdev(dev); +-- +2.13.7 + diff --git a/_to_remove/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch b/_to_remove/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch new file mode 100644 index 000000000..f3bcda9fe --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/0004-Fix-build-with-5.9-kernel.patch @@ -0,0 +1,48 @@ +Use sched_set_fifo on newer kernels + +The 5.9 kernel removed the export of sched_setscheduler, use +the new sched_set_fifo API if building on 5.9 or newer. There +is a slight difference in resulting priority level, the new +API will yield a priority of 50 instead of the explicit value +of 40 being used with sched_setscheduler, but this should not +be an issue. + +Upstream-Status: Inappropriate [no upstream] +Signed-off-by: Scott Murray + +--- +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 133d6e9..92c52ad 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -1059,14 +1059,20 @@ static int sllin_kwthread(void *ptr) + { + struct sllin *sl = (struct sllin *)ptr; + struct tty_struct *tty = sl->tty; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) + struct sched_param schparam = { .sched_priority = 40 }; ++#endif + int tx_bytes = 0; /* Used for Network statistics */ + unsigned long flags; + int lin_id; + struct sllin_conf_entry *sce; + + netdev_dbg(sl->dev, "sllin_kwthread started.\n"); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) + sched_setscheduler(current, SCHED_FIFO, &schparam); ++#else ++ sched_set_fifo(current); ++#endif + + clear_bit(SLF_ERROR, &sl->flags); + sltty_change_speed(tty, sl->lin_baud); +@@ -1274,8 +1280,8 @@ slstate_response_wait: + sl->lin_state = SLSTATE_RESPONSE_WAIT_BUS; + } + } ++ fallthrough; + +- /* Be aware, no BREAK here */ + case SLSTATE_RESPONSE_WAIT_BUS: + if (sl->rx_cnt < sl->rx_expect) + continue; diff --git a/_to_remove/recipes-kernel/sllin/files/lin_config.conf b/_to_remove/recipes-kernel/sllin/files/lin_config.conf new file mode 100644 index 000000000..9775b8b39 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/lin_config.conf @@ -0,0 +1,10 @@ + + + + + + + 33 + + + diff --git a/_to_remove/recipes-kernel/sllin/files/sllin-demo.service b/_to_remove/recipes-kernel/sllin/files/sllin-demo.service new file mode 100644 index 000000000..e3e7432f3 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/sllin-demo.service @@ -0,0 +1,14 @@ +[Unit] +Description=LIN demo configuration +ConditionPathExists=/dev/ttyUSB0 +After=afm-system-daemon.service +Before=can-dev-mapping-helper.service + +[Service] +Type=forking +PIDFile=/run/lin_config/lin_config.pid +ExecStart=/usr/bin/start_lin_demo.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/_to_remove/recipes-kernel/sllin/files/start_lin_demo.sh b/_to_remove/recipes-kernel/sllin/files/start_lin_demo.sh new file mode 100755 index 000000000..c7627ca74 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/files/start_lin_demo.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +# Attach serial LIN->CAN bridge and set up LIN polling +if [ -c /dev/ttyUSB0 ]; then + sleep 1 + /usr/bin/lin_config -c /etc/lin_config.conf -a sllin:/dev/ttyUSB0 + mkdir -p /run/lin_config/ + pidof lin_config > /run/lin_config/lin_config.pid + sleep 1 +else + ip link add dev sllin0 type vcan +fi +ip link set sllin0 up + +# Initialize HVAC controller +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 02A# +usleep 100000 +cansend sllin0 02B# +usleep 100000 +cansend sllin0 032#F0F8FFFFFFFFFFFF +usleep 100000 +cansend sllin0 032#F0F8FFFFFFFFFFFF +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 030# +usleep 100000 +cansend sllin0 02D# +usleep 100000 +cansend sllin0 02C# +usleep 100000 +cansend sllin0 02D# +usleep 100000 +cansend sllin0 02C# +usleep 100000 + diff --git a/_to_remove/recipes-kernel/sllin/sllin.bb b/_to_remove/recipes-kernel/sllin/sllin.bb new file mode 100644 index 000000000..cc72b3095 --- /dev/null +++ b/_to_remove/recipes-kernel/sllin/sllin.bb @@ -0,0 +1,45 @@ +DESCRIPTION = "slLIN driver module" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://sllin.c;beginline=7;endline=37;md5=6408e14dba951f8cbe3c2a003a0d89d2" + +inherit module systemd + +DEPENDS = "virtual/kernel" + +SRC_URI = "git://github.com/trainman419/linux-lin.git;protocol=https" +SRCREV = "155d885e8ccc907a56f6c86c4b159fac27ef6fec" +S = "${WORKDIR}/git/sllin" + +PV = "0.1+git${SRCPV}" + +SRC_URI:append = " \ + file://0001_update_makefile.patch;pnum=2 \ + file://0002_fix_null_operation_check.patch;pnum=2 \ + file://0003-Allow-recent-kernels-newer-4.11.x-to-build.patch;pnum=2 \ + file://0001-Disable-sllin-driver-debug-log.patch;pnum=2 \ + file://0004-Fix-build-with-5.9-kernel.patch;pnum=2 \ + file://sllin-demo.service \ + file://start_lin_demo.sh \ + file://lin_config.conf \ +" + +KERNEL_MODULE_AUTOLOAD:append = " sllin" +KERNEL_MODULE_PROBECONF:append = " sllin" + +SLLINBAUDRATE ??= "9600" +module_conf_sllin = "options sllin baudrate=${SLLINBAUDRATE}" + +SYSTEMD_SERVICE:${PN} = "sllin-demo.service" + +do_install:append () { + install -d 644 ${D}/${bindir} + install -m 755 ${WORKDIR}/start_lin_demo.sh ${D}/${bindir}/start_lin_demo.sh + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/sllin-demo.service ${D}${systemd_system_unitdir}/ + install -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/lin_config.conf ${D}${sysconfdir}/ +} + +FILES:${PN} += "${bindir}/start_lin_demo.sh ${sysconfdir}/lin_config.conf" + +RDEPENDS:${PN} += "lin-config" -- cgit 1.2.3-korg