samsung-zanin: new device (Samsung Galaxy Chat) (!496)

The phone boots pmOS, and the basic functionalities are ready.

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Federico Amedeo Izzo 2019-07-16 17:46:49 +02:00 committed by Oliver Smith
parent 5ccbcf999d
commit 3dd4d8f220
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
11 changed files with 3459 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-samsung-zanin"
pkgdesc="Samsung Galaxy Chat"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="postmarketos-base linux-samsung-zanin 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
}
sha512sums="814ef8a67770bf4acb91bb8ccf8e76c11391b26cb2ec331cfc8e327c45d9368090410e81c45f7fe336894ac18e6153018be555f7733cd0c05bc69a67e109e993 deviceinfo
27a2263ce1dc96de8ac3a2ff6fc8d19c1ae591c883ff201637c5b8dfbbb07d807200853fa51de7d9ee1d0126ceb3a35a6787da53fd25389bbbb78c126eb049a3 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 Chat"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-zanin"
deviceinfo_date="2012"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="armv7"
# Device related
deviceinfo_keyboard="true"
deviceinfo_external_storage="true"
deviceinfo_screen_width="240"
deviceinfo_screen_height="320"
deviceinfo_dev_touchscreen="/dev/input/event7"
deviceinfo_dev_touchscreen_calibration="1 0 0 0 1 0"
deviceinfo_dev_keyboard="/dev/input/event4"
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_kernel_cmdline=""
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base="0x82000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="4096"
deviceinfo_flash_heimdall_partition_kernel=""
deviceinfo_flash_heimdall_partition_system=""

View File

@ -0,0 +1,6 @@
#!/bin/sh
# set framebuffer resolution
echo 240,640 > /sys/class/graphics/fb0/virtual_size

View File

@ -0,0 +1,49 @@
From aeea3592a13bf12861943e44fc48f1f270941f8d Mon Sep 17 00:00:00 2001
From: Behan Webster <behanw@converseincode.com>
Date: Wed, 24 Sep 2014 01:06:46 +0100
Subject: [PATCH] ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h
With compilers which follow the C99 standard (like modern versions of gcc and
clang), "extern inline" does the wrong thing (emits code for an externally
linkable version of the inline function). In this case using static inline
and removing the NULL version of return_address in return_address.c does
the right thing.
Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/include/asm/ftrace.h | 2 +-
arch/arm/kernel/return_address.c | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index 39eb16b0066f2..bfe2a2f5a644e 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -45,7 +45,7 @@ void *return_address(unsigned int);
#else
-extern inline void *return_address(unsigned int level)
+static inline void *return_address(unsigned int level)
{
return NULL;
}
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index fafedd86885dd..f6aa84d5b93c9 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -63,11 +63,6 @@ void *return_address(unsigned int level)
#warning "TODO: return_address should use unwind tables"
#endif
-void *return_address(unsigned int level)
-{
- return NULL;
-}
-
#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
EXPORT_SYMBOL_GPL(return_address);

View File

@ -0,0 +1,51 @@
This fixes compilation with ANDROID_PARANOID_NETWORK disabled. Without this
patch, compilation breaks with:
/home/pmos/build/src/android_kernel_samsung_latona-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78/security/commoncap.c:
In function 'cap_capable':
/home/pmos/build/src/android_kernel_samsung_latona-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78/security/commoncap.c:91:40:
error: 'AID_NET_RAW' undeclared (first use in this function)
if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW))
^~~~~~~~~~~
/home/pmos/build/src/android_kernel_samsung_latona-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78/security/commoncap.c:91:40:
note: each undeclared identifier is reported only once for each function it
appears in
/home/pmos/build/src/android_kernel_samsung_latona-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78/security/commoncap.c:93:42:
error: 'AID_NET_ADMIN' undeclared (first use in this function)
if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN))
---
From e9a85c71afa38ee304e71c86ca7d74ed4658318c Mon Sep 17 00:00:00 2001
From: Tushar Behera <tushar.behera@linaro.org>
Date: Mon, 26 Mar 2012 16:54:15 +0530
Subject: [PATCH] security: Add proper checks for Android specific capability
checks
Commit b641072 ("security: Add AID_NET_RAW and AID_NET_ADMIN capability
check in cap_capable().") introduces additional checks for AID_NET_xxx
macros. Since the header file including those macros are conditionally
included, the checks should also be conditionally executed.
Change-Id: Iaec5208d5b95a46b1ac3f2db8449c661e803fa5b
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
---
security/commoncap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/security/commoncap.c b/security/commoncap.c
index 897af00e477..0051ac2d058 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -80,10 +80,12 @@ int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,
int cap, int audit)
{
+#ifdef CONFIG_ANDROID_PARANOID_NETWORK
if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW))
return 0;
if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN))
return 0;
+#endif
for (;;) {
/* The creator of the user namespace has all caps. */

View File

@ -0,0 +1,33 @@
diff --git a/drivers/media/video/camdrv_ss.h b/drivers/media/video/camdrv_ss.h
index c0638a87..028ce393 100755
--- a/drivers/media/video/camdrv_ss.h
+++ b/drivers/media/video/camdrv_ss.h
@@ -165,6 +165,7 @@ enum camdrv_ss_cam_light {
CAM_HIGH_LIGHT,
};
+struct camdrv_ss_state *to_state(struct v4l2_subdev *sd);
struct camdrv_ss_sensor_cap {
/************************/
@@ -187,7 +188,6 @@ struct camdrv_ss_sensor_cap {
int delay_duration;
-
/*******************/
/* FUNCTION POINTERS */
/******************/
diff --git a/drivers/media/video/camdrv_ss_sr200pc20m.c b/drivers/media/video/camdrv_ss_sr200pc20m.c
index 8d34aad4..e0798aa0 100755
--- a/drivers/media/video/camdrv_ss_sr200pc20m.c
+++ b/drivers/media/video/camdrv_ss_sr200pc20m.c
@@ -60,8 +60,6 @@
#endif
static DEFINE_MUTEX(af_cancel_op);
-extern struct camdrv_ss_state *to_state(struct v4l2_subdev *sd);
-
extern int camdrv_ss_i2c_set_config_register(struct i2c_client *client,
regs_t reg_buffer[],

View File

@ -0,0 +1,22 @@
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 1b0a6c7c..1a73e29b 100755
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -1138,8 +1138,16 @@ int gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
dev_warn(&g->dev,
"using random %s ethernet address\n", "self");
+ 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);
- printk(KERN_DEBUG "usb: set unique host mac\n");
#else
#if 0 //We use the fixed host MAC address for USB logging.
if (get_ether_addr(dev_addr, net->dev_addr))

View File

@ -0,0 +1,75 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/cyanogenmod_zanin_defconfig
# from repository <https://github.com/samshit-bcm/android_kernel_zanin>
pkgname="linux-samsung-zanin"
pkgver=3.0.101
pkgrel=0
pkgdesc="Samsung Galaxy Chat kernel fork"
arch="armv7"
_carch="arm"
_flavor="samsung-zanin"
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"
# Compiler: latest GCC from Alpine
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source
_repository="android_kernel_rhea"
_commit="8224116dca7de79d181c0761468f569e6ac3505e"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/bcm216xx/${_repository}/archive/${_commit}.tar.gz
$_config
gcc7-give-up-on-ilog2-const-optimizations.patch
gcc8-fix-put-user.patch
00_fix_return_address.patch
03_fix_paranoid_network_disabled.patch
04_fix_undefined_reference_to_to_state.patch
05_usb_gadget_set_random_rndis_host_MAC_address.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"
}
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
}
sha512sums="1c62313451ff2a04ab9259a4b2c954388a360f45f20af90d05e9cfe73d31f49fc4847f24c1742c89a45f1646e1d27999fc6f5bd224baba7046b07ab324e7baae linux-samsung-zanin-8224116dca7de79d181c0761468f569e6ac3505e.tar.gz
d2b82792d879c9f560cdb67b368572c9339bdd8a3b13bd1ba77f70b7998577af575cb93bcf16d12c1a6d13c742488045ea36f88520bc24ece6d8ee823210a072 config-samsung-zanin.armv7
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
ea1d3b5a234fa565e3c1a792de48f4fc4e6023d281d303c8e319c7ef28edc5739ab0e4dea0139a41f0a5c7d03e27921ccaa214fd0ac5c72245a094ce60128864 00_fix_return_address.patch
df62e03666313bb03d9a455eac875f170a55d378b6e56b847c1c6ff1ce5cfafcfdf1d7605754ca3c684840ea00357f9ec4c6621f6ff77377132a484b9258f6f7 03_fix_paranoid_network_disabled.patch
bbe9bfd32c887f2af09c96e0d5bad15276b12edb7012d4bd4bb7c374c84a94bf5820310c6dda0238fa6f95cda6d2e1244a4583435fae2b8d19082d9d48629360 04_fix_undefined_reference_to_to_state.patch
612947ab3f10ab60f06c3fe8fa87e5eba4675b577dc589b1d5d8f400ab8f3e7f1f97dee8d5b38b53d2485b4f1219a66ee292541e24a46daf6254e88cd8fe039f 05_usb_gadget_set_random_rndis_host_MAC_address.patch"

File diff suppressed because it is too large Load Diff

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