From 630c9c2af9a5c52251644090ecc51d57bb2ff44e Mon Sep 17 00:00:00 2001 From: knuxify Date: Fri, 20 Mar 2020 14:53:06 +0100 Subject: [PATCH] samsung-lt01wifi: updates (!1081) - Proper WiFi support (building modules, firmware package) - Architecture change to armv7 - Fix no MAC address on USB networking [ci:skip-build]: already built successfully in CI --- .../testing/device-samsung-lt01wifi/APKBUILD | 23 ++++++++-- .../device-samsung-lt01wifi/deviceinfo | 2 +- .../device-samsung-lt01wifi/modprobe.conf | 1 + .../device-samsung-lt01wifi/modules-load.conf | 1 + ...andom-rndis-host-MAC-address-to-prev.patch | 42 +++++++++++++++++++ .../testing/linux-samsung-lt01wifi/APKBUILD | 20 +++++---- ...fi.armhf => config-samsung-lt01wifi.armv7} | 6 +-- firmware/firmware-samsung-lt01wifi/APKBUILD | 25 +++++++++++ 8 files changed, 104 insertions(+), 16 deletions(-) create mode 100644 device/testing/device-samsung-lt01wifi/modprobe.conf create mode 100644 device/testing/device-samsung-lt01wifi/modules-load.conf create mode 100644 device/testing/linux-samsung-lt01wifi/0001-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch rename device/testing/linux-samsung-lt01wifi/{config-samsung-lt01wifi.armhf => config-samsung-lt01wifi.armv7} (99%) create mode 100644 firmware/firmware-samsung-lt01wifi/APKBUILD diff --git a/device/testing/device-samsung-lt01wifi/APKBUILD b/device/testing/device-samsung-lt01wifi/APKBUILD index 4fdcf6df4..c7a7e44e3 100644 --- a/device/testing/device-samsung-lt01wifi/APKBUILD +++ b/device/testing/device-samsung-lt01wifi/APKBUILD @@ -3,14 +3,17 @@ pkgname="device-samsung-lt01wifi" pkgdesc="Samsung Galaxy Tab 3 8.0" pkgver=0.1 -pkgrel=3 +pkgrel=4 url="https://postmarketos.org" license="MIT" -arch="armhf" +arch="armv7" options="!check !archcheck" depends="postmarketos-base linux-samsung-lt01wifi mkbootimg mesa-dri-swrast" makedepends="devicepkg-dev" -source="deviceinfo" +subpackages="$pkgname-nonfree-firmware:nonfree_firmware" +source="deviceinfo + modules-load.conf + modprobe.conf" build() { devicepkg_build $startdir $pkgname @@ -18,7 +21,19 @@ build() { package() { devicepkg_package $startdir $pkgname + + install -Dm644 "$srcdir"/modules-load.conf \ + "$pkgdir"/etc/modules-load.d/00-$pkgname.conf + install -Dm644 "$srcdir"/modprobe.conf \ + "$pkgdir"/etc/modprobe.d/dhd.conf } +nonfree_firmware() { + pkgdesc="Wifi firmware" + depends="firmware-samsung-lt01wifi" + mkdir "$subpkgdir" +} -sha512sums="9e761d1403c28745b7e416bf80eb9025be45739c95091be0cbac2355cf915116efee37d5e5497e6658ae583a47518f879a623e4302f23c11f013d343bf00d2f2 deviceinfo" +sha512sums="991e38af2ddbf67ca7e9045c8dcc3b0fbf6312dfeb8d83d612c7781f6e332dc92a4e0ef5a8d5822e4ae9de247c150ac9335942355a69e0e0d2a574dcff918919 deviceinfo +af036fe35011db078379dbb2e8c16c86546f0a4fcb3d1bcee3502bb1ea5b38f3ec5a9fa8cd1ca8ed8b89592a7f572d6072781289845303e0bf85fc2de4ead9fb modules-load.conf +594d6059ba1b06bce65538d26ce80cf2ce840786605b86e993ffaef858837507c033c0f95b7bcd9914ae7ea3cd2a9e43e32ec879db7c908219ad62d38b4e426a modprobe.conf" diff --git a/device/testing/device-samsung-lt01wifi/deviceinfo b/device/testing/device-samsung-lt01wifi/deviceinfo index 1ae1f4335..d81e3180e 100644 --- a/device/testing/device-samsung-lt01wifi/deviceinfo +++ b/device/testing/device-samsung-lt01wifi/deviceinfo @@ -8,7 +8,7 @@ deviceinfo_codename="samsung-lt01wifi" deviceinfo_year="2013" deviceinfo_dtb="" deviceinfo_modules_initfs="" -deviceinfo_arch="armhf" +deviceinfo_arch="armv7" # Device related deviceinfo_keyboard="false" diff --git a/device/testing/device-samsung-lt01wifi/modprobe.conf b/device/testing/device-samsung-lt01wifi/modprobe.conf new file mode 100644 index 000000000..0f26c9b69 --- /dev/null +++ b/device/testing/device-samsung-lt01wifi/modprobe.conf @@ -0,0 +1 @@ +options dhd op_mode=0 nvram_path=/lib/firmware/postmarketos/nvram_net.txt firmware_path=/lib/firmware/postmarketos/bcmdhd_sta.bin diff --git a/device/testing/device-samsung-lt01wifi/modules-load.conf b/device/testing/device-samsung-lt01wifi/modules-load.conf new file mode 100644 index 000000000..46b277676 --- /dev/null +++ b/device/testing/device-samsung-lt01wifi/modules-load.conf @@ -0,0 +1 @@ +dhd diff --git a/device/testing/linux-samsung-lt01wifi/0001-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch b/device/testing/linux-samsung-lt01wifi/0001-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch new file mode 100644 index 000000000..d3d4ed9d1 --- /dev/null +++ b/device/testing/linux-samsung-lt01wifi/0001-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch @@ -0,0 +1,42 @@ +From 2e32a401ea5df22ab899f4da3e5e1b448b2df51a Mon Sep 17 00:00:00 2001 +From: Alexey Min +Date: Thu, 7 Mar 2019 17:25:48 +0300 +Subject: [PATCH 5/6] usb_gadget: set random rndis host MAC address to prevent + zero address + +This fixes zero host MAC: + +rndis0: MAC f6:45:91:9b:4e:43 +rndis0: HOST MAC 00:00:00:00:00:00 + +and allows devive to automatically obtain IP addrest on PC host side +zero MAC address prevented interface from autoconfiguring +--- + drivers/usb/gadget/u_ether.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c +index 72c4a992594..c0fc0698697 100644 +--- a/drivers/usb/gadget/u_ether.c ++++ b/drivers/usb/gadget/u_ether.c +@@ -1075,8 +1075,16 @@ int gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN], + "using random %s ethernet address\n", "self"); + + #ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE +- memcpy(dev->host_mac, ethaddr, ETH_ALEN); +- printk(KERN_DEBUG "usb: set unique host mac\n"); ++ if ((ethaddr[0] == 0x00) && (ethaddr[1] == 0x00) && ++ (ethaddr[2] == 0x00) && (ethaddr[3] == 0x00) && ++ (ethaddr[4] == 0x00) && (ethaddr[5] == 0x00)) { ++ printk(KERN_DEBUG "%s: no unique host MAC was set, generate random\n", __func__); ++ /* we can use random_ether_addr() from include/linux/etherdevice.h */ ++ random_ether_addr(ethaddr); ++ } else { ++ printk(KERN_DEBUG "%s: set unique host mac\n", __func__); ++ } ++ memcpy(dev->host_mac, ethaddr, ETH_ALEN); + #else + if (get_ether_addr(host_addr, dev->host_mac)) + dev_warn(&g->dev, +-- +2.21.0 diff --git a/device/testing/linux-samsung-lt01wifi/APKBUILD b/device/testing/linux-samsung-lt01wifi/APKBUILD index 911b0d3f4..072102659 100644 --- a/device/testing/linux-samsung-lt01wifi/APKBUILD +++ b/device/testing/linux-samsung-lt01wifi/APKBUILD @@ -3,9 +3,9 @@ pkgname="linux-samsung-lt01wifi" pkgver=3.0.31 -pkgrel=0 +pkgrel=1 pkgdesc="Samsung Galaxy Tab 3 8.0 kernel fork" -arch="armhf" +arch="armv7" _carch="arm" _flavor="samsung-lt01wifi" url="https://kernel.org" @@ -20,6 +20,7 @@ _config="config-$_flavor.$arch" source=" $pkgname-$_commit.tar.gz::https://github.com/gr8nole/$_repository/archive/$_commit.tar.gz $_config + 0001-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch gcc7-give-up-on-ilog2-const-optimizations.patch gcc8-fix-put-user.patch " @@ -34,18 +35,21 @@ build() { unset LDFLAGS make ARCH="$_carch" CC="${CC:-gcc}" \ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" + make ARCH="$_carch" CC="${CC:-gcc}" CFLAGS_MODULE="-fno-pic" \ + KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" modules } package() { downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" + + # External modules install + make ARCH="$_carch" CC="${CC:-gcc}" \ + KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \ + INSTALL_MOD_PATH="$pkgdir" modules_install } -#sha512sums="43c9a5cfe9a6f66d7fbdec04ea6a04c06864d2f6140f458fba7bcde7a871d0128d5f1bf45724923c6e7fc592863a1a0a01a067dd6255b5f7ee0dbef46958140c linux-samsung-lt01wifi-6ad0b18a63deacaebbc3d12751c3230cedbf7335.tar.gz -#86dafa426c54fb813e29295eeac1afca53049546a326311965d886ec93cf0b18130f143804105e7fbdf9f82abca3e94bdce23ef777031522acc6e1078156d701 config-samsung-lt01wifi.armhf -#77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch -#197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch -#ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch" sha512sums="43c9a5cfe9a6f66d7fbdec04ea6a04c06864d2f6140f458fba7bcde7a871d0128d5f1bf45724923c6e7fc592863a1a0a01a067dd6255b5f7ee0dbef46958140c linux-samsung-lt01wifi-6ad0b18a63deacaebbc3d12751c3230cedbf7335.tar.gz -85d01f93463c67805ee88975379d6a71da2a31bbf56252f899121888c313ee375950e0fbcd78a50738f1e160c68c07dac2e3060dc9708eff10a459e0b8764025 config-samsung-lt01wifi.armhf +44137afbcbd6228d0938454b3ac1819fd2f56656db0a5d109c727a37b5d9733af186e43416ce9253e551dcd27be48fed29d7272db2f007a2cabdf6c634503aa7 config-samsung-lt01wifi.armv7 +df6e20ac3c29cee1aa652a78cd5270bc785e824bcd5a9cd25e0681be506bf6a7547683fca1fc4170b175fa649602bddc98c34beb094ea59e8273aeb8f9703807 0001-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch 77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch 197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch" diff --git a/device/testing/linux-samsung-lt01wifi/config-samsung-lt01wifi.armhf b/device/testing/linux-samsung-lt01wifi/config-samsung-lt01wifi.armv7 similarity index 99% rename from device/testing/linux-samsung-lt01wifi/config-samsung-lt01wifi.armhf rename to device/testing/linux-samsung-lt01wifi/config-samsung-lt01wifi.armv7 index 474466eb7..ce0db4cb2 100644 --- a/device/testing/linux-samsung-lt01wifi/config-samsung-lt01wifi.armhf +++ b/device/testing/linux-samsung-lt01wifi/config-samsung-lt01wifi.armv7 @@ -38,7 +38,7 @@ CONFIG_IRQ_WORK=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-kerNoleCM14.1" +CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y @@ -1461,8 +1461,8 @@ CONFIG_BCM4334=m # CONFIG_BCM4354 is not set # CONFIG_BCM43241 is not set CONFIG_BROADCOM_WIFI=y -CONFIG_BCMDHD_FW_PATH="/system/etc/wifi/bcmdhd_sta.bin" -CONFIG_BCMDHD_NVRAM_PATH="/system/etc/wifi/nvram_net.txt" +CONFIG_BCMDHD_FW_PATH="/lib/firmware/postmarketos/bcmdhd_sta.bin" +CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/postmarketos/nvram_net.txt" CONFIG_BROADCOM_WIFI_RESERVED_MEM=y # CONFIG_WIFI_BROADCOM_COB is not set CONFIG_WLAN_REGION_CODE=100 diff --git a/firmware/firmware-samsung-lt01wifi/APKBUILD b/firmware/firmware-samsung-lt01wifi/APKBUILD new file mode 100644 index 000000000..f67f5507f --- /dev/null +++ b/firmware/firmware-samsung-lt01wifi/APKBUILD @@ -0,0 +1,25 @@ +# Maintainer: knuxify +# Contributor: knuxify +pkgname=firmware-samsung-lt01wifi +pkgver=0.1 +pkgrel=0 +_commit="38ea48dbc6a683874aaf3376b63fc97ff3823459" +pkgdesc="Samsung Galaxy Tab 3 8.0 (SM-T310) Firmware" +url="https://github.com/gr8nole/proprietary_vendor_samsung" +arch="armv7" +license="proprietary" +source="$pkgname-$_commit.tar.gz::https://github.com/gr8nole/proprietary_vendor_samsung/archive/$_commit.tar.gz" +options="!check !strip !archcheck !spdx" +builddir="$srcdir/proprietary_vendor_samsung-$_commit" + +package() { + # Wifi + install -Dm644 lt01wifi/proprietary/system/etc/wifi/bcmdhd_sta.bin_b2 \ + "$pkgdir"/lib/firmware/postmarketos/bcmdhd_sta.bin_b2 + install -Dm644 lt01wifi/proprietary/system/etc/wifi/bcmdhd_sta.bin_b2 \ + "$pkgdir"/lib/firmware/postmarketos/bcmdhd_sta.bin + install -Dm644 lt01wifi/proprietary/system/etc/wifi/nvram_net.txt \ + "$pkgdir"/lib/firmware/postmarketos/nvram_net.txt +} + +sha512sums="33500dccd81d9f4ee8735f2f91e056913f0abb538248244512405f42156dd663b4337f97226fcadc1ed772c56590380cc7a6a8735a6fed46c62b8ac61424d684 firmware-samsung-lt01wifi-38ea48dbc6a683874aaf3376b63fc97ff3823459.tar.gz"