From 4597357bfa3d3228aac82b798928f83897a38b4d Mon Sep 17 00:00:00 2001 From: Sergey Lisov Date: Fri, 29 Dec 2023 16:33:46 +0300 Subject: [PATCH] samsung-a6lte: add WiFi and Bluetooth on mainline (MR 4665) Also adds Bluetooth support on the downstream kernel. [ci:skip-build] Already built fine on CI in MR --- device/testing/device-samsung-a6lte/APKBUILD | 29 +++++++++++++++---- ...msung-a6lte-downstream-quirks.post-install | 4 +++ .../device-samsung-a6lte.post-install | 2 -- .../etc-init.d-hciattach-ttySAC0 | 27 +++++++++++++++++ .../linux-postmarketos-exynos7870/APKBUILD | 24 ++++++++------- .../config-exynos7870.aarch64 | 17 ++++++++--- device/testing/linux-samsung-a6lte/APKBUILD | 6 ++-- .../config-samsung-a6lte.aarch64 | 10 +++++-- .../uncomment-rfcomm-in-makefile.patch | 11 +++++++ 9 files changed, 104 insertions(+), 26 deletions(-) create mode 100644 device/testing/device-samsung-a6lte/device-samsung-a6lte-downstream-quirks.post-install create mode 100644 device/testing/device-samsung-a6lte/etc-init.d-hciattach-ttySAC0 create mode 100644 device/testing/linux-samsung-a6lte/uncomment-rfcomm-in-makefile.patch diff --git a/device/testing/device-samsung-a6lte/APKBUILD b/device/testing/device-samsung-a6lte/APKBUILD index a5a06c602..c0ea6a4c3 100644 --- a/device/testing/device-samsung-a6lte/APKBUILD +++ b/device/testing/device-samsung-a6lte/APKBUILD @@ -2,13 +2,14 @@ pkgname=device-samsung-a6lte pkgdesc="Samsung Galaxy A6 2018" pkgver=0.5 -pkgrel=4 +pkgrel=5 url="https://postmarketos.org" license="MIT" arch="aarch64" options="!check !archcheck" depends=" alsa-utils + bootmac mkbootimg postmarketos-base samsungipcd @@ -17,13 +18,15 @@ depends=" replaces=" lightdm pipewire-media-session - udev-init-scripts-openrc " makedepends="devicepkg-dev" install="$pkgname.post-install" source=" + $pkgname.post-install + $pkgname-downstream-quirks.post-install deviceinfo etc-conf.d-samsungipcd + etc-init.d-hciattach-ttySAC0 etc-init.d-udev-settle etc-init.d-wlan0-up etc-lightdm-lightdm.conf @@ -38,6 +41,7 @@ subpackages=" $pkgname-kernel-downstream:kernel_downstream $pkgname-kernel-mainline:kernel_mainline $pkgname-nonfree-firmware:nonfree_firmware + $pkgname-downstream-quirks:downstream_quirks " # pulseaudio does not seem to work on this device. Will use pipewire-pulse instead. @@ -50,7 +54,6 @@ build() { package() { devicepkg_package $startdir $pkgname install -Dm644 etc-conf.d-samsungipcd "$pkgdir"/etc/conf.d/samsungipcd - install -Dm755 etc-init.d-udev-settle "$pkgdir"/etc/init.d/udev-settle install -Dm755 etc-init.d-wlan0-up "$pkgdir"/etc/init.d/wlan0-up install -Dm644 etc-lightdm-lightdm.conf "$pkgdir"/etc/lightdm/lightdm.conf install -Dm644 etc-NetworkManager-conf.d-swlan0-unmanaged.conf "$pkgdir"/etc/NetworkManager/conf.d/swlan0-unmanaged.conf @@ -62,13 +65,13 @@ package() { } kernel_downstream() { - pkgdesc="Working: display, touchscreen, wifi, audio, cellular" + pkgdesc="Working: display, touchscreen, wifi, bluetooth, audio, cellular" depends="linux-samsung-a6lte msm-fb-refresher pipewire pipewire-pulse" devicepkg_subpackage_kernel $startdir $pkgname $subpkgname } kernel_mainline() { - pkgdesc="Close-to-mainline WIP (display and touchscreen works)" + pkgdesc="Close-to-mainline WIP. Working: display, touchscreen, wifi, bluetooth" depends="linux-postmarketos-exynos7870 mesa-dri-simpledrm" devicepkg_subpackage_kernel $startdir $pkgname $subpkgname } @@ -79,9 +82,25 @@ nonfree_firmware() { mkdir "$subpkgdir" } +downstream_quirks() { + pkgdesc="Hacks to make the downstream kernel work" + depends="bluez-deprecated" + install_if="$pkgname-kernel-downstream" + replaces="bootmac udev-init-scripts-openrc" + install="$subpkgname.post-install" + install -Dm755 etc-init.d-udev-settle "$subpkgdir"/etc/init.d/udev-settle + install -Dm755 etc-init.d-hciattach-ttySAC0 "$subpkgdir"/etc/init.d/hciattach-ttySAC0 + # we run bootmac ourselves and don't want it to trigger from the udev rule + # so remove the rule + install -Dm755 /dev/null "$subpkgdir"/usr/lib/udev/rules.d/90-bootmac.rules +} + sha512sums=" +e787dd30a667fd886a46bb0b670bd2771a8fc78fddc39bb86405fdda6024bc1211b82f89664b7cfc622adf2968b9cd09b0eb3d2ed607148bf3549dd783e6f752 device-samsung-a6lte.post-install +9c0f939c97582d9c03fb62386527569b7f08dd6c8350c8ac6cf9f70d6d5da61d5fc95997b413c4fdb671379ab35caedb631b9af33c7a1e8f3388b3fb56d9b435 device-samsung-a6lte-downstream-quirks.post-install d5f9631b0753abc70b83dcba2eba1d7191bba979ab3ad404401abbe4f4326068d610b49d4482d16115ac9d8c36006753caf794aebed06413497f9f3c37bb9ffa deviceinfo 3e5bb764529010d2b6b1f2759a7799f665d140aebcee2dd63433e68cd4282e09b5d3b34fb7c21e737595b406501e7f02ece4592651c60e4c2b9419de4aedb438 etc-conf.d-samsungipcd +5e23fd88baa4694ef48ec9590f948e11101be1e472c626f88011a182534a16520eb00c95a10ea77a773123892036188e2e0783540f3b8f8fe158da5e06568e02 etc-init.d-hciattach-ttySAC0 203b832a7080d5f1351c5e024e444f9fe509f6e0fd4b376a60c7d73359b7e356863a4f15caf9b2e4e733dc44d2971722083e7c69ca94a012eb004b4b8ded9d09 etc-init.d-udev-settle 7caddfe4659c969a33adcc27a760bc78d4f70ca4b7a4a5ec28a6411c12f3e6dd6d427b59f75976a737a5fe0f09806f8b6d65798f6358bd1e1954ad2a28fbfdc8 etc-init.d-wlan0-up 861270c6bc0b2a3e6cd389c21c8c895e62de8cf8bec6fcf23c178f8cbaae855d62b0ee98692671ab4f518d84cb43dd0b2fe46f5a609f65af6a6c06e0fdbb6d0c etc-lightdm-lightdm.conf diff --git a/device/testing/device-samsung-a6lte/device-samsung-a6lte-downstream-quirks.post-install b/device/testing/device-samsung-a6lte/device-samsung-a6lte-downstream-quirks.post-install new file mode 100644 index 000000000..ce3d4c7cd --- /dev/null +++ b/device/testing/device-samsung-a6lte/device-samsung-a6lte-downstream-quirks.post-install @@ -0,0 +1,4 @@ +#!/bin/sh + +rc-update add wlan0-up sysinit +rc-update add hciattach-ttySAC0 default diff --git a/device/testing/device-samsung-a6lte/device-samsung-a6lte.post-install b/device/testing/device-samsung-a6lte/device-samsung-a6lte.post-install index 9eb9d6d43..93541d50a 100644 --- a/device/testing/device-samsung-a6lte/device-samsung-a6lte.post-install +++ b/device/testing/device-samsung-a6lte/device-samsung-a6lte.post-install @@ -5,5 +5,3 @@ if ! grep -q /efs /etc/fstab; then mkdir -p /efs echo "/dev/disk/by-partlabel/EFS /efs auto ro 0 0" >> /etc/fstab fi - -rc-update add wlan0-up sysinit diff --git a/device/testing/device-samsung-a6lte/etc-init.d-hciattach-ttySAC0 b/device/testing/device-samsung-a6lte/etc-init.d-hciattach-ttySAC0 new file mode 100644 index 000000000..fecf21e5c --- /dev/null +++ b/device/testing/device-samsung-a6lte/etc-init.d-hciattach-ttySAC0 @@ -0,0 +1,27 @@ +#!/sbin/openrc-run + +description="Run hciattach on ttySAC0 to enable bcm43xx bluetooth" + +depend () { + before rfkill + before bluetooth +} + +start () { + ebegin "Starting hciattach-ttySAC0" + # we need to unlock an rfkill to be able to use bluetootch + if [[ -d /sys/bus/platform/drivers/bcm43xx_bluetooth/bluetooth ]]; then + rfkill unblock 0 + # blocking and unblocking this rfkill requires restarting hciattach + # unregister it, so that the UI does not attempt to toggle it + # hciuart driver provides its own rfkill switch, so bluetooth can still be disabled + echo bluetooth > /sys/bus/platform/drivers/bcm43xx_bluetooth/unbind + fi + # if hci0 is already present, this means that the service is being restarted, we can just ignore it + if ! [[ -d /sys/class/bluetooth/hci0 ]]; then + # on the vendor kernel we have to do a manual hciattach + # since we unregistered the rfkill, we won't be able to restart, so this cannot be a "real" service + hciattach /dev/ttySAC0 bcm43xx 3000000 flow nosleep "$(bootmac -gb)" + fi + eend $? +} diff --git a/device/testing/linux-postmarketos-exynos7870/APKBUILD b/device/testing/linux-postmarketos-exynos7870/APKBUILD index 0a57c078e..f38cfc0c5 100644 --- a/device/testing/linux-postmarketos-exynos7870/APKBUILD +++ b/device/testing/linux-postmarketos-exynos7870/APKBUILD @@ -1,7 +1,7 @@ # Kernel config based on defconfig pkgname=linux-postmarketos-exynos7870 -pkgver=6.3.9 +pkgver=6.6.8 pkgrel=0 pkgdesc="Close-to-mainline kernel for Samsung Galaxy A6 2018" arch="aarch64" @@ -20,21 +20,23 @@ makedepends=" perl " -_patches_repo="https://gitlab.com/sleirsgoevy/a6lte-mainline" -_patches_repo_commit="a3d286c155a70e8075d611cffe17c579360b5d9b" +_patches_owner="exynos7870-mainline" +_patches_repo="mainline-patches" +_patches_commit="79fdca89077a3798ffde3eabd85c0336dd76194d" _config="config-$_flavor.aarch64" +_dts_list="exynos7870-a6lte" # Source source=" linux-$pkgver.tar.gz::https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$pkgver.tar.gz $_config - patches-$_patches_repo_commit.tar.gz::$_patches_repo/-/archive/master/a6lte-mainline-$_patches_repo_commit.tar.gz + patches-$_patches_commit.tar.gz::https://gitlab.com/$_patches_owner/$_patches_repo/-/archive/$_patches_commit/$_patches_repo-$_patches_commit.tar.gz " builddir="$srcdir/linux-$pkgver" _outdir="." prepare() { default_prepare - for i in "$srcdir"/a6lte-mainline-*/patches/*; do + for i in "$srcdir"/$_patches_repo-*/patches/*; do patch -p1 < "$i" done cp "$srcdir"/$_config .config @@ -46,9 +48,9 @@ build() { KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" # Build out-of-tree devicetrees - rm -f "$srcdir/"a6lte-mainline-*/*-minimal-dts.dts - for i in "$srcdir/"a6lte-mainline-*/*.dts; do - scripts/dtc/dtc "$i" -o "$_outdir/arch/$_carch/boot/dts/$(basename -s .dts "$i").dtb" + rm -f "$srcdir/"$_patches_repo-*/*-minimal-dts.dts + for i in $_dts_list; do + scripts/dtc/dtc "$srcdir/"$_patches_repo-*/$i.dts -o "$_outdir/arch/$_carch/boot/dts/$i.dtb" done # Master DTB (deviceinfo_bootimg_qcdt) @@ -78,7 +80,7 @@ package() { } sha512sums=" -e5f98f9e60b3020f5177585e0c7812932afc06f788d572c122eb1cc3343f876a4cc8d99f06a7834aa8f8821b4340b9c475c15d07f5322e11d25622813306bf50 linux-6.3.9.tar.gz -867187f7dab4a103b6cf015f7d231a1ea930646e8176c8b9a5f70b95d5fa793fa1321cfdd52d8b19e64a2f91c6d2f2c6e07228b59b454096566b318f17f33959 config-exynos7870.aarch64 -9e50e192402671ac003a4f1725b62cd4f3ad97909fdfb2f60f89498659b5f94850ccec7348d9fb32eee053f5a08657c17d1390229215671d9069107e52cec4cf patches-a3d286c155a70e8075d611cffe17c579360b5d9b.tar.gz +ce7ff29dd73f5302a9717c139c308b2c2bfc6d572cad52ff69e041f30d21eec039c59ff6c851bcb37e457daba95505e5a8be983ceb33000349f7ce2283d24bc7 linux-6.6.8.tar.gz +e108b3516dd9212db0e50821e98f84d7c9dc26f9a012a15afeaa8f3c94e75632a2ef3d1db810756009cd5acfbdb53b24a014962773c82a7165b33c34271b5496 config-exynos7870.aarch64 +04f3a6d5777847915af792d42251a99260d14ae891afeebf45d5427f2f88231875e964814d6def165164fc2e04ad3ca18207820260d135324a4e4b2de1c12afd patches-79fdca89077a3798ffde3eabd85c0336dd76194d.tar.gz " diff --git a/device/testing/linux-postmarketos-exynos7870/config-exynos7870.aarch64 b/device/testing/linux-postmarketos-exynos7870/config-exynos7870.aarch64 index ebdd80cc6..62dec80a1 100644 --- a/device/testing/linux-postmarketos-exynos7870/config-exynos7870.aarch64 +++ b/device/testing/linux-postmarketos-exynos7870/config-exynos7870.aarch64 @@ -2,9 +2,9 @@ # Automatically generated file; DO NOT EDIT. # Linux/arm64 6.3.9 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="aarch64-unknown-linux-gnu-gcc (GCC) 12.2.0" +CONFIG_CC_VERSION_TEXT="aarch64-unknown-linux-gnu-gcc (GCC) 12.3.0" CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=120200 +CONFIG_GCC_VERSION=120300 CONFIG_CLANG_VERSION=0 CONFIG_AS_IS_GNU=y CONFIG_AS_VERSION=24000 @@ -2644,8 +2644,17 @@ CONFIG_MDIO_BUS_MUX_MMIOREG=y CONFIG_PCS_XPCS=m # end of PCS device drivers -# CONFIG_PPP is not set +CONFIG_PPP=m +# CONFIG_PPP_BSDCOMP is not set +# CONFIG_PPP_DEFLATE is not set +# CONFIG_PPP_FILTER is not set +# CONFIG_PPP_MPPE is not set +# CONFIG_PPP_MULTILINK is not set +# CONFIG_PPPOE is not set +CONFIG_PPP_ASYNC=m +CONFIG_PPP_SYNC_TTY=m # CONFIG_SLIP is not set +CONFIG_SLHC=m CONFIG_USB_NET_DRIVERS=y # CONFIG_USB_CATC is not set # CONFIG_USB_KAWETH is not set @@ -3051,7 +3060,7 @@ CONFIG_HW_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=16 +CONFIG_LEGACY_PTY_COUNT=256 CONFIG_LEGACY_TIOCSTI=y CONFIG_LDISC_AUTOLOAD=y diff --git a/device/testing/linux-samsung-a6lte/APKBUILD b/device/testing/linux-samsung-a6lte/APKBUILD index 2fe05b836..882689ee6 100644 --- a/device/testing/linux-samsung-a6lte/APKBUILD +++ b/device/testing/linux-samsung-a6lte/APKBUILD @@ -3,7 +3,7 @@ pkgname=linux-samsung-a6lte pkgver=3.18.140 -pkgrel=2 +pkgrel=3 pkgdesc="Samsung Galaxy A6 2018 kernel fork" arch="aarch64" _carch="arm64" @@ -41,6 +41,7 @@ source=" decon-fb-colors.patch firmware-paths-fix.patch disable-boot-mode-check.patch + uncomment-rfcomm-in-makefile.patch linux3.7to4.5-ARM64-remove-Sun-Solaris-style-flag-on-section.patch " builddir="$srcdir/$_repository-$_commit" @@ -73,11 +74,12 @@ package() { sha512sums=" c2cc5190c480de4ac2d376827c5c56a542c6644d3dbeb47956d0b90c5570b246872ecedbf5655ac5564c9f61190d23567a4c496bb4235c46f6bd7a6d8addcc68 linux-samsung-a6lte-981969320c1cdc214cf8a1a357fab642f401a5d1.tar.gz -d8239ea119c45e71047ab064fc8846a77a8e744867377ac6676a962df72cb8ad7c0f470c3cb2d840566f22d8550cf18ce337b207cfc7171468b8b378d834a12a config-samsung-a6lte.aarch64 +f4c7c1a34cee55cb05cfa086564a2a09b9143b0dfd1909ff9ea2baf8cb78d13f6c18107ed4381c19aab851d274db957fa82fb0555992c1bd0772077a61dff7fa config-samsung-a6lte.aarch64 2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch 3f65a690e48f913fcb980718fae4dc03c29a6dc86eecb1e2af644488ad415de326a61d840399fb69915cbc5d56d5586f2df2287b3e7323a2927ae73a3b1b1373 zram-zs-create-pool-null.patch 5bd204239a5daff9f990757178398707ae5ec64f823ed9ec72a8d50ebe6d5f0a3cc9743e0d775094da4b3a7566f1ccceb56f39f3b0234d08ca05e537d86271ec decon-fb-colors.patch e1409844c46869ffe6ac9e028c3f38868120b6fd38dcf52ca7c1fdb98e90d2717d72ed52f7f41d3b4a18862a5b7210b6921c5c635d91cbb2a5772b55d5f1b4fb firmware-paths-fix.patch 1e705ff6f256b93986adba4c1f296b2d47be48986490d6a1130fc57126a462b2adfb4f51d3717ef70e91d0b42eb54a33b0d29f85d0c0bb9bf1498bb80c1bb7c1 disable-boot-mode-check.patch +cd41a79406341cb72b4d569b21b2af3bbba4fcedd891a73b3273d5e9561466d5b99c424ce29bac83650298fc51d53b5cb65037a644f622a7e287ec38d30af66f uncomment-rfcomm-in-makefile.patch 75545ccd0082a119b9ad95fcef3523c939a5c946f8f3a5c3dde15cee1502f6c1011050a0ad5359426f018bb7ceea1c97a28c7665941bc89f365c8d11065ce0f6 linux3.7to4.5-ARM64-remove-Sun-Solaris-style-flag-on-section.patch " diff --git a/device/testing/linux-samsung-a6lte/config-samsung-a6lte.aarch64 b/device/testing/linux-samsung-a6lte/config-samsung-a6lte.aarch64 index 4f96ddece..239a0cd2e 100644 --- a/device/testing/linux-samsung-a6lte/config-samsung-a6lte.aarch64 +++ b/device/testing/linux-samsung-a6lte/config-samsung-a6lte.aarch64 @@ -975,7 +975,8 @@ CONFIG_NET_FLOW_LIMIT=y # CONFIG_CAN is not set # CONFIG_IRDA is not set CONFIG_BT=y -# CONFIG_BT_RFCOMM is not set +CONFIG_BT_RFCOMM=y +CONFIG_BT_RFCOMM_TTY=y # CONFIG_BT_BNEP is not set CONFIG_BT_HIDP=y @@ -984,7 +985,12 @@ CONFIG_BT_HIDP=y # # CONFIG_BT_HCIBTUSB is not set # CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIUART is not set +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART_BCSP is not set +# CONFIG_BT_HCIUART_ATH3K is not set +# CONFIG_BT_HCIUART_LL is not set +CONFIG_BT_HCIUART_3WIRE=y # CONFIG_BT_HCIBCM203X is not set # CONFIG_BT_HCIBPA10X is not set # CONFIG_BT_HCIBFUSB is not set diff --git a/device/testing/linux-samsung-a6lte/uncomment-rfcomm-in-makefile.patch b/device/testing/linux-samsung-a6lte/uncomment-rfcomm-in-makefile.patch new file mode 100644 index 000000000..2940059ee --- /dev/null +++ b/device/testing/linux-samsung-a6lte/uncomment-rfcomm-in-makefile.patch @@ -0,0 +1,11 @@ +--- linux-3.18-samsung-mod/net/bluetooth/Makefile 2023-12-21 03:06:56.384146361 +0300 ++++ linux-3.18-samsung/net/bluetooth/Makefile 2023-12-25 05:41:55.756105376 +0300 +@@ -3,7 +3,7 @@ + # + + obj-$(CONFIG_BT) += bluetooth.o ++obj-$(CONFIG_BT_RFCOMM) += rfcomm/ +-#obj-$(CONFIG_BT_RFCOMM) += rfcomm/ + #obj-$(CONFIG_BT_BNEP) += bnep/ + obj-$(CONFIG_BT_CMTP) += cmtp/ + #obj-$(CONFIG_BT_HIDP) += hidp/