samsung-a5y17lte: new device (Samsung A5 2017) (!510)

[ci:skip-build]: already built successfully in CI.
This commit is contained in:
Dzmitry Sankouski 2019-02-28 14:47:15 +03:00 committed by Oliver Smith
parent 212b3c8643
commit 1c335b552e
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
9 changed files with 4619 additions and 0 deletions

View file

@ -0,0 +1,26 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-samsung-a5y17lte"
pkgdesc="Samsung Galaxy A5 (2017)"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-samsung-a5y17lte mkbootimg mesa-dri-swrast msm-fb-refresher"
makedepends="devicepkg-dev"
source="deviceinfo initfs-hook.sh"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/initfs-hook.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh
}
sha512sums="6e067f910b89948c5eec9d9b2df677c085f6f322a111ee98731951b9a80e153a6ea12d8f9169919dbda03b7362ac191a78240d4b5fe39bcb13efc7fa23efa0eb deviceinfo
92effac4743fbcfc47461723eac7b088efb58574d76822293ba95d66edd4820886241173a84bed6a9095801d39311c29aeac409add53421bb2c5a6caf395226c initfs-hook.sh"

View file

@ -0,0 +1,35 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Samsung Galaxy A5 (2017)"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-a5y17lte"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="1920"
deviceinfo_dev_touchscreen=""
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_kernel_cmdline=""
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="true"
deviceinfo_flash_offset_base="0x10000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_heimdall_partition_kernel=""
deviceinfo_flash_heimdall_partition_system=""

View file

@ -0,0 +1,3 @@
# Blank and unblank
echo 1 > /sys/class/graphics/fb0/blank
echo 0 > /sys/class/graphics/fb0/blank

View file

@ -0,0 +1,44 @@
From 2e32a401ea5df22ab899f4da3e5e1b448b2df51a Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
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/function/u_ether.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index bf8b64d904c..9ce3ab6de34 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -1263,8 +1263,16 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
dev_warn(&g->dev,
"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))
--
2.21.0

View file

@ -0,0 +1,76 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/lineage-a5y17lte_defconfig
pkgname="linux-samsung-a5y17lte"
pkgver=3.18.14
pkgrel=0
pkgdesc="Samsung Galaxy A5 (2017) kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="samsung-a5y17lte"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev dtbtool-exynos"
# Compiler: latest GCC from Alpine
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source
_repository="android_kernel_samsung_universal7880"
_commit="9af43285ff43d74f3f40f910023e57dfad1c8e63"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/${_repository}/archive/${_commit}.tar.gz
$_config
gcc7-give-up-on-ilog2-const-optimizations.patch
gcc8-fix-put-user.patch
0007-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
disable_knox.patch
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch" "$HOSTCC"
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
dtbTool-exynos --pagesize 2048 --platform 0x50a6 --subtype 0x217584da \
-o "arch/arm64/boot/dtb.img" $(find "arch/arm64/boot/dts/" -name *a5y17lte*.dtb)
}
package() {
# kernel.release
install -D "$builddir/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
# zImage (find the right one)
cd "$builddir/arch/$_carch/boot"
_target="$pkgdir/boot/vmlinuz-$_flavor"
for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do
[ -e "$_zimg" ] || continue
msg "zImage found: $_zimg"
install -Dm644 "$_zimg" "$_target"
break
done
if ! [ -e "$_target" ]; then
error "Could not find zImage in $PWD!"
return 1
fi
# Master DTB (deviceinfo_bootimg_qcdt)
install -Dm644 "$builddir/arch/arm64/boot/dtb.img" \
"$pkgdir/boot/dt.img"
}
sha512sums="96794c6c5c91375a0110906c512644ccfb7c1d1f6e9275a0807e123bd8d02c93047856228298e38c9d24ddb663d58c33dbeaedb8f433cd54a07e4ae4e91ad243 linux-samsung-a5y17lte-9af43285ff43d74f3f40f910023e57dfad1c8e63.tar.gz
370d215158707ce674562a9d194c7827b1ba7adc808503ea60ace392a2bb3bf95e39828062947dd425a80041343cb12dd683e379dccbadfc88be94359065984b config-samsung-a5y17lte.aarch64
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
b5f7aed0d4c78fcd9ea6f65e11606c4d33004b45eed39017baa8b0a78db801396aa04ba7cd3a4a669c23f878f5462ae1b5f753e0e26b65c9962fd1e98855e524 0007-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
0ed3a870c33728b5337261770e8e8ea3d4135235339407d7e4d070d2f6aef5a866ad2012451b75aeeb813bd7d514c959d49d2f31a93ce95c0dbfc03275328a33 disable_knox.patch"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,33 @@
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 79c35a5b276..726588bc180 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -420,18 +420,6 @@ out_rcu_unlock:
goto out;
}
-/* START_OF_KNOX_NPA */
-/** The function is used to check if the ncm feature is enabled or not;
- * if enabled then collect the socket meta-data information;
- * if enabled then it calls knox_collect_socket_data function in ncm.c to record all the socket data; **/
-static void knox_collect_metadata(struct socket *sock)
-{
- if (check_ncm_flag()) {
- knox_collect_socket_data(sock);
- }
-}
-/* END_OF_KNOX_NPA */
-
/*
* The peer socket should always be NULL (or else). When we call this
* function we are destroying the object and from then on nobody
@@ -463,9 +451,6 @@ int inet_release(struct socket *sock)
if (sock_flag(sk, SOCK_LINGER) &&
!(current->flags & PF_EXITING))
timeout = sk->sk_lingertime;
- /* START_OF_KNOX_NPA */
- knox_collect_metadata(sock);
- /* END_OF_KNOX_NPA */
sock->sk = NULL;
sk->sk_prot->close(sk, timeout);
}

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc8-fix-put-user.patch