samsung-a40: new device

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6916

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Dan 2025-07-24 07:43:34 +02:00 committed by Pablo Correa Gómez
parent a62beeff2a
commit 40d43a3731
No known key found for this signature in database
GPG key ID: 7A342565FF635F79
18 changed files with 6141 additions and 0 deletions

View file

@ -0,0 +1,25 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-samsung-a40
pkgdesc="Samsung Galaxy A40"
pkgver=2
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="linux-samsung-a40 mkbootimg postmarketos-base rsyslog samsung-a40-headers firmware-samsung-a40"
makedepends="devicepkg-dev"
source="deviceinfo initfs-hook.sh"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
8f78219b70cc39061f536c61dd06ceda35a17fbe9dd005e7f2eae93c170ed7ebabcab590f6206772cb92d29e325e612cb7d6e599a5243323d60467de13f3780b deviceinfo
04445194a5245d08fcf1b425bff1d8dd6a8fdacafdc151223634299a35f1eb20fbd733979b58bcfd854e16fde02629c28453f840d6c9dc34fc15d4fcc8aa4302 initfs-hook.sh
"

View file

@ -0,0 +1,37 @@
# 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 A40"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-a40"
deviceinfo_year="2019"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="2340"
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_kernel_cmdline="androidboot.selinux=permissive"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_offset_base="0x10000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0xf0000000"
deviceinfo_flash_offset_second="0xf0000000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_heimdall_partition_kernel="boot"
deviceinfo_flash_heimdall_partition_rootfs="system"
# Samsung Electronics Co., Ltd
deviceinfo_usb_idVendor="0x04e8"
# Galaxy (MTP)
deviceinfo_usb_idProduct="0x6860"

View file

@ -0,0 +1,28 @@
#!/bin/sh
# This is a trimmed down version of setup_usb_network_configfs from
# pmOS's init_functions.sh
# See: https://www.kernel.org/doc/Documentation/usb/gadget_configfs.txt
CONFIGFS=/config/usb_gadget
SYS=/sys/class/android_usb/android0
# Create an usb gadet configuration
mkdir $CONFIGFS/g1 || echo "initfs-hook: Couldn't create $CONFIGFS/g1"
# Create rndis function.
mkdir $CONFIGFS/g1/functions/rndis.usb0 \
|| echo "initfs-hook: Couldn't create $CONFIGFS/g1/functions/rndis.usb0"
# Create configuration instance for the gadget
mkdir $CONFIGFS/g1/configs/c.1 \
|| echo "initfs-hook: Couldn't create $CONFIGFS/g1/configs/c.1"
# Link the rndis instance to the configuration
ln -s $CONFIGFS/g1/functions/rndis.usb0 $CONFIGFS/g1/configs/c.1 \
|| echo "initfs-hook: Couldn't symlink rndis.usb0"
echo "0" >"$SYS/enable"
echo "$(ls /sys/class/udc)" > $CONFIGFS/g1/UDC || echo " Couldn't write UDC"
echo "rndis" >"$SYS/functions"
echo "1" >"$SYS/enable"

View file

@ -0,0 +1,58 @@
pkgname=firmware-samsung-a40
pkgver=1
pkgrel=0
pkgdesc="Firmware for the Samsung Galaxy A40"
url="https://github.com/resulknad/firmware-samsung-a40.git"
arch="aarch64"
license="proprietary"
options="!check !archcheck !strip !spdx !tracedeps pmb:cross-native"
# Source
_commit="510164047b8ed394ff7c735ecccf81bf7d4a4ad6"
source="$pkgname-$_commit.tar.gz"
_url="https://github.com/resulknad/firmware-samsung-a40"
source="$pkgname-$_commit.tar.gz::$_url/archive/$_commit.tar.gz"
package() {
#VENDOR FILES
cd "$srcdir/firmware-samsung-a40-$_commit/firmware/"
install -Dm644 APBargeIn_AUDIO_SLSI.bin \
"$pkgdir"/lib/firmware/postmarketos/APBargeIn_AUDIO_SLSI.bin
install -Dm644 AP_AUDIO_SLSI.bin \
"$pkgdir"/lib/firmware/postmarketos/AP_AUDIO_SLSI.bin
install -Dm644 calliope_dram.bin \
"$pkgdir"/lib/firmware/postmarketos/calliope_dram.bin
install -Dm644 calliope_sram.bin \
"$pkgdir"/lib/firmware/postmarketos/calliope_sram.bin
install -Dm644 fimc_is_lib.bin \
"$pkgdir"/lib/firmware/postmarketos/fimc_is_lib.bin
install -Dm644 fimc_is_rta.bin \
"$pkgdir"/lib/firmware/postmarketos/fimc_is_rta.bin
install -Dm644 mfc_fw.bin \
"$pkgdir"/lib/firmware/postmarketos/mfc_fw.bin
install -Dm644 setfile_2p6.bin \
"$pkgdir"/lib/firmware/postmarketos/setfile_2p6.bin
install -Dm644 setfile_2x5.bin \
"$pkgdir"/lib/firmware/postmarketos/setfile_2x5.bin
install -Dm644 setfile_5e9.bin \
"$pkgdir"/lib/firmware/postmarketos/setfile_5e9.bin
install -Dm644 Tfa9896.cnt \
"$pkgdir"/lib/firmware/postmarketos/Tfa9896.cnt
#WIFI FIRMWARE
cd "$srcdir/firmware-samsung-a40-$_commit/etc/wifi/"
install -Dm644 mx \
"$pkgdir"/lib/firmware/postmarketos/mx140/mx
install -Dm644 mx140.bin \
"$pkgdir"/lib/firmware/postmarketos/mx140/mx140.bin
install -Dm644 mx140_bt.hcf \
"$pkgdir"/lib/firmware/postmarketos/mx140/mx140_bt.hcf
install -Dm644 mx140_wlan.hcf \
"$pkgdir"/lib/firmware/postmarketos/mx140/mx140_wlan.hcf
install -Dm644 mx140_wlan_t.hcf \
"$pkgdir"/lib/firmware/postmarketos/mx140/mx140_wlan_t.hcf
}
sha512sums="
c1b76ac47a5d774a789c7af524ccbb38aa6ecd51f80e758deb2263510a53b24363026163fe29f41b699fb47e81c735bc13d1f6252f7538db374ea307b9a999ff firmware-samsung-a40-510164047b8ed394ff7c735ecccf81bf7d4a4ad6.tar.gz
"

View file

@ -0,0 +1,119 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/pmos-a40_defconfig
pkgname=linux-samsung-a40
pkgver=4.4.177
pkgrel=0
pkgdesc="Samsung Galaxy A40 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="samsung-a40"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="bash bc bison devicepkg-dev flex openssl-dev perl gcc6"
subpackages="samsung-a40-headers"
# Compiler: GCC 6 (doesn't boot when compiled with newer versions)
if [ "${CC:0:5}" != "gcc6-" ]; then
CC="gcc6-$CC"
HOSTCC="gcc6-gcc"
CROSS_COMPILE="gcc6-$CROSS_COMPILE"
fi
# Source
_repository="linux-samsung-a30"
_commit="5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://gitlab.com/faveoled/$_repository/-/archive/$_commit/$_repository-$_commit.tar.gz
fix-check-lxdialog.patch
makefiles_fix.patch
linux4.2-gcc10-extern_YYLOC_global_declaration.patch
rem_android_ifdef.patch
ifdef_exynos_fimc_is2.patch
ifdef_knox_ncm_nf_conntrack_core_c.patch
ifdef_knox_ncm_sock_c.patch
ifdef_knox_ncm_udp_c.patch
decon_fix.patch
dont_skip_initramfs.patch
skip_abox_itmon_notifier.patch
use-pmos-fw-loc.patch
$_config
"
builddir="$srcdir/linux-samsung-a30-$_commit"
_outdir="out"
prepare() {
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
objcopy -I binary -O ihex firmware/exynos7885_acpm_fvp.fw firmware/exynos7885_acpm_fvp.fw.ihex
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
# Build headers
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" headers_install
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
}
headers() {
pkgdesc="Headers and scripts for building modules for $_flavor kernel"
provides="linux-headers=$pkgver-r$pkgrel"
replaces="linux-headers"
cd "$builddir"
# Install sanitized kernel headers to standard location
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
INSTALL_HDR_PATH="$subpkgdir/usr" headers_install
# Install Samsung MFC headers with HEVC support and dependencies
mkdir -p "$subpkgdir/usr/include/linux"
# Install Samsung's V4L2 extensions (dependencies)
cp include/uapi/linux/videodev2_exynos_media.h \
"$subpkgdir/usr/include/linux/"
cp include/uapi/linux/videodev2_exynos_camera.h \
"$subpkgdir/usr/include/linux/"
# Install Samsung MFC media header with HEVC support
cp drivers/media/platform/exynos/mfc/exynos_mfc_media.h \
"$subpkgdir/usr/include/linux/"
# Install ION headers (Android DMA buffer allocator)
cp include/uapi/linux/ion.h \
"$subpkgdir/usr/include/linux/"
cp include/linux/exynos_ion.h \
"$subpkgdir/usr/include/linux/"
# Remove .install files
find "$subpkgdir/usr" -name '.install' -delete
find "$subpkgdir/usr" -name '..install.cmd' -delete
}
sha512sums="
76be6d88311496b07918bfdb07b4af5623c890e0b2dc5e923258444dfda825ec0e1222d4af52a11b27905916c9ea1662214355163e63f2f8f93a78f95cac4f77 linux-samsung-a40-5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d.tar.gz
182be3c596b9cc267ac108d7cf03fc8c328ccc6b36770800e4dcedea8d1bb65e3f5eacf590c2948f58b1418cc60a1670ba77dde8c259e428d158c31b6e1dbaf5 fix-check-lxdialog.patch
65da43ce42dfc9eff3e0c2c2c367b6ca9e45786ddec8c3949b8f4095927288cd19f6722e859c72f98299621c3bf4280547f6009babb7de47df210aa44d0497d8 makefiles_fix.patch
eaf2e61fcb508cdd239b8fed209d2a09ecac77287f6b46d003918fdf1c6fa2ee63f7390f3ff7c49029b8ed6cbcdd81c7e9a4b1ece9f5060b6fc84e322bd47f41 linux4.2-gcc10-extern_YYLOC_global_declaration.patch
fa1c3e4bdf0a7d5647ec5cf28c02f3082dea51c463309bd1626d4ee2cc4413a6641d0f108decc2c7a243891422bb0f5f835d3ac495f1cfb21a0e41dc7afb8ceb rem_android_ifdef.patch
fc32c1499cf2964605d6815086ae9b58db3e30e52f383fd4d58035b8ff84ba4cf1e77b3f88a11d96f1aeb5d324817f057adb334504339113d47be1296f6c2398 ifdef_exynos_fimc_is2.patch
fcd83fcc045430767cf87babf44c598f3d983c7a376864ba1d896e5993009d50b5e8148ff5461db640f77ea857dc151cf54f0ab4d39c82d12fa01c7cec2d4398 ifdef_knox_ncm_nf_conntrack_core_c.patch
6aaabe87793670a9cecca1f9bcbcb781745bea33ce73d5e71fe5080e83b085afa4e102c769ba3767d62f2059c59be03b71b3907fa2c5bc57451249da48a9311d ifdef_knox_ncm_sock_c.patch
3b793b97c99e14c448c3a91ccb79c474c7869c5896eac18f1e54cb73b0e3f79fcc0422652d98eaf54692cbd073173539e1ba27b1ba0f1dfdb6be80b111501aab ifdef_knox_ncm_udp_c.patch
88a5ef18d9eb31e6d80317925907651229529cd41f8b181b61c14ff56b340341c8ff5c95ab0dd9562b9575d4e206623e7dc039a9eb6b34c455165878df63cd86 decon_fix.patch
53df4a36ba45032c752fb8730f9ada88e6b7990b6afd8ff977dce88128ed5a155531023687094243e61d78e4be9396d5e8b168cbfd09197ef9a6917cf5df0959 dont_skip_initramfs.patch
ce5928e9237931c6aa181be29c9ecd4f66e8330a5d36a2dbd0032909b6677083593e281f33e2059f7b5f8ef7372fc506a3d47323bde1877416b5152998aaed7b skip_abox_itmon_notifier.patch
382e70e8cfc50a7942f469c9377cdfaf76c4888ba75b6a45ad7effbbdbe2d3e7d925f6e30e52ceb204bdc685c683e2c9cb4df75309623c33f51709949c0f1532 use-pmos-fw-loc.patch
b35bcc84ef600bd9fcbb3c839a106f5c34eaa16fc8c87a6d95161f24532987d975d92983e4439f7fa971dea942f6c58f8820b860be397d893bc1a636cfda48e2 config-samsung-a40.aarch64
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,157 @@
Subject: [PATCH] decon fix
---
Index: drivers/video/fbdev/exynos/dpu_7885/decon_core.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/drivers/video/fbdev/exynos/dpu_7885/decon_core.c b/drivers/video/fbdev/exynos/dpu_7885/decon_core.c
--- a/drivers/video/fbdev/exynos/dpu_7885/decon_core.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/drivers/video/fbdev/exynos/dpu_7885/decon_core.c (date 1644158930000)
@@ -703,11 +703,15 @@
return ret;
}
+int decon_set_vsync_int(struct fb_info *info, bool active);
+extern int needs_pan;
+
static int decon_blank(int blank_mode, struct fb_info *info)
{
struct decon_win *win = info->par;
struct decon_device *decon = win->decon;
int ret = 0;
+ struct fb_info *fb_info;
decon_info("%s + blank_mode: %d, decon-%d %s mode: %dtype (0: DSI, 1: eDP, 2:DP, 3: WB)\n",
__func__, blank_mode,
@@ -741,6 +745,10 @@
goto blank_exit;
}
atomic_set(&decon->ffu_flag, 2);
+
+ needs_pan = true;
+ fb_info = decon->win[decon->dt.dft_win]->fbinfo;
+ decon_set_vsync_int(fb_info, true);
break;
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
@@ -2152,18 +2160,6 @@
return ret;
}
-static ssize_t decon_fb_read(struct fb_info *info, char __user *buf,
- size_t count, loff_t *ppos)
-{
- return 0;
-}
-
-static ssize_t decon_fb_write(struct fb_info *info, const char __user *buf,
- size_t count, loff_t *ppos)
-{
- return 0;
-}
-
int decon_release(struct fb_info *info, int user)
{
struct decon_win *win = info->par;
@@ -2217,12 +2213,12 @@
.fb_blank = decon_blank,
.fb_setcolreg = decon_setcolreg,
.fb_fillrect = cfb_fillrect,
+ .fb_copyarea = cfb_copyarea,
+ .fb_imageblit = cfb_imageblit,
#ifdef CONFIG_COMPAT
.fb_compat_ioctl = decon_compat_ioctl,
#endif
.fb_ioctl = decon_ioctl,
- .fb_read = decon_fb_read,
- .fb_write = decon_fb_write,
.fb_pan_display = decon_pan_display,
.fb_mmap = decon_mmap,
.fb_release = decon_release,
@@ -2532,6 +2528,7 @@
}
fbinfo->fix.type = FB_TYPE_PACKED_PIXELS;
+ fbinfo->fix.visual = FB_VISUAL_TRUECOLOR,
fbinfo->fix.accel = FB_ACCEL_NONE;
fbinfo->var.activate = FB_ACTIVATE_NOW;
fbinfo->var.vmode = FB_VMODE_NONINTERLACED;
@@ -2846,7 +2843,7 @@
decon->bts.ops->bts_update_qos_disp(decon, decon->dt.disp_freq);
decon_to_init_param(decon, &p);
-#if !defined(BRINGUP_DECON_BIST)
+#if 0// !defined(BRINGUP_DECON_BIST)
if (decon_reg_init(decon->id, decon->dt.out_idx[0], &p) < 0)
goto decon_init_done;
#else
@@ -2879,7 +2876,7 @@
set_bit(decon->dt.dft_idma, &decon->prev_used_dpp);
memset(&config, 0, sizeof(struct decon_win_config));
config.dpp_parm.addr[0] = fbinfo->fix.smem_start;
- config.format = DECON_PIXEL_FORMAT_BGRA_8888;
+ config.format = DECON_PIXEL_FORMAT_ARGB_8888;
config.src.w = fbinfo->var.xres;
config.src.h = fbinfo->var.yres;
config.src.f_w = fbinfo->var.xres;
@@ -2922,10 +2919,11 @@
call_panel_ops(dsim, displayon, dsim);
decon_reg_start(decon->id, &psr);
decon_wait_for_vsync(decon, VSYNC_TIMEOUT_MSEC);
+ decon_set_vsync_int(fbinfo, true);
if (decon_reg_wait_update_done_and_mask(decon->id, &psr,
SHADOW_UPDATE_TIMEOUT) < 0)
decon_err("%s: wait_for_update_timeout\n", __func__);
-#if !defined(BRINGUP_DECON_BIST)
+#if 0 //!defined(BRINGUP_DECON_BIST)
decon_init_done:
#endif
decon->state = DECON_STATE_INIT;
Index: drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c b/drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c
--- a/drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c (date 1644158930000)
@@ -353,6 +353,8 @@
}
static DEVICE_ATTR(vsync, S_IRUGO, decon_show_vsync, NULL);
+int needs_pan = false;
+
static int decon_vsync_thread(void *data)
{
struct decon_device *decon = data;
@@ -363,6 +365,20 @@
!ktime_equal(timestamp, decon->vsync.timestamp) &&
decon->vsync.active);
+ struct decon_mode_info psr;
+
+ if (needs_pan) {
+ //Verrrry hacky and bad... plox gib better solution
+ struct fb_info *fb_info = decon->win[decon->dt.dft_win]->fbinfo;
+ struct fb_var_screeninfo *var = &fb_info->var;
+ usleep_range(200000, 201000);
+ decon_pan_display(var, fb_info);
+ needs_pan = false;
+ }
+
+ decon_to_psr_info(decon, &psr);
+ decon_reg_start(decon->id, &psr);
+
if (!ret)
sysfs_notify(&decon->dev->kobj, NULL, "vsync");
}
@@ -692,7 +708,7 @@
break;
case 24:
case 32:
- config.format = DECON_PIXEL_FORMAT_ABGR_8888;
+ config.format = DECON_PIXEL_FORMAT_ARGB_8888;
shift = 4;
break;
default:

View file

@ -0,0 +1,25 @@
Subject: [PATCH] dont_skip_initramfs
---
Index: init/initramfs.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/init/initramfs.c b/init/initramfs.c
--- a/init/initramfs.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/init/initramfs.c (date 1740665050412)
@@ -620,13 +620,7 @@
static int __init populate_rootfs(void)
{
char *err;
-
- if (do_skip_initramfs) {
- if (initrd_start)
- free_initrd();
- return default_rootfs();
- }
-
+
err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
if (err)
panic("%s", err); /* Failed to decompress INTERNAL initramfs */

View file

@ -0,0 +1 @@
../../.shared-patches/linux/fix-check-lxdialog.patch

View file

@ -0,0 +1,37 @@
Index: drivers/leds/leds-s2mu106.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/drivers/leds/leds-s2mu106.c b/drivers/leds/leds-s2mu106.c
--- a/drivers/leds/leds-s2mu106.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/drivers/leds/leds-s2mu106.c (date 1644158930000)
@@ -1058,6 +1058,7 @@
int create_flash_sysfs(void)
{
+#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS2
int err = -ENODEV;
if (IS_ERR_OR_NULL(camera_class)) {
@@ -1080,7 +1081,7 @@
pr_err("flash_sysfs: failed to create device file, %s\n",
dev_attr_rear_torch_flash.attr.name);
}
-
+#endif
return 0;
}
@@ -1166,8 +1167,10 @@
{
device_remove_file(flash_dev, &dev_attr_rear_flash);
device_remove_file(flash_dev, &dev_attr_rear_torch_flash);
+#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS2
device_destroy(camera_class, 0);
class_destroy(camera_class);
+#endif
mutex_destroy(&g_fled_data->lock);
return 0;
}

View file

@ -0,0 +1,95 @@
Subject: [PATCH] ifdef knox ncm nf_conntrack_core.c
---
Index: net/netfilter/nf_conntrack_core.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
--- a/net/netfilter/nf_conntrack_core.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/net/netfilter/nf_conntrack_core.c (date 1644158930000)
@@ -52,9 +52,11 @@
#include <net/netfilter/nf_nat.h>
#include <net/netfilter/nf_nat_core.h>
#include <net/netfilter/nf_nat_helper.h>
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
#include <net/ncm.h>
/* END_OF_KNOX_NPA */
+#endif
#define NF_CONNTRACK_VERSION "0.5.0"
@@ -252,7 +254,7 @@
static void nf_ct_add_to_dying_list(struct nf_conn *ct)
{
struct ct_pcpu *pcpu;
-
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
del_timer(&ct->npa_timeout);
/* send dying conntrack entry to collect data */
@@ -260,7 +262,7 @@
knox_collect_conntrack_data(ct, NCM_FLOW_TYPE_CLOSE, 10);
}
/* END_OF_KNOX_NPA */
-
+#endif
/* add this conntrack to the (per cpu) dying list */
ct->cpu = smp_processor_id();
pcpu = per_cpu_ptr(nf_ct_net(ct)->ct.pcpu_lists, ct->cpu);
@@ -429,7 +431,7 @@
return true;
}
EXPORT_SYMBOL_GPL(nf_ct_delete);
-
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
/* Use this function only if struct nf_conn->timeout is of type struct timer_list */
static void death_by_timeout_npa(unsigned long ul_conntrack)
@@ -450,13 +452,15 @@
return;
}
/* END_OF_KNOX_NPA */
-
+#endif
static void death_by_timeout(unsigned long ul_conntrack)
{
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
struct nf_conn *tmp = (struct nf_conn *)ul_conntrack;
atomic_set(&tmp->intermediateFlow, 0);
del_timer(&tmp->npa_timeout);
+#endif
/* END_OF_KNOX_NPA */
nf_ct_delete((struct nf_conn *)ul_conntrack, 0, 0);
}
@@ -863,10 +867,11 @@
gfp_t gfp, u32 hash)
{
struct nf_conn *ct;
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
struct timespec open_timespec;
/* END_OF_KNOX_NPA */
-
+#endif
if (unlikely(!nf_conntrack_hash_rnd)) {
init_nf_conntrack_hash_rnd();
/* recompute the hash as nf_conntrack_hash_rnd is initialized */
@@ -894,6 +899,7 @@
goto out;
spin_lock_init(&ct->lock);
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
/* initialize the conntrack structure members when memory is allocated */
if (ct != NULL) {
@@ -916,6 +922,7 @@
atomic_set(&ct->intermediateFlow, 0);
}
/* END_OF_KNOX_NPA */
+#endif
ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode.pprev = NULL;
ct->tuplehash[IP_CT_DIR_REPLY].tuple = *repl;

View file

@ -0,0 +1,88 @@
Subject: [PATCH] ifdef knox ncm sock.c
---
Index: net/core/sock.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/net/core/sock.c b/net/core/sock.c
--- a/net/core/sock.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/net/core/sock.c (date 1644158930000)
@@ -148,11 +148,13 @@
#include <net/busy_poll.h>
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
#include <linux/sched.h>
#include <linux/pid.h>
#include <net/ncm.h>
/* END_OF_KNOX_NPA */
+#endif
static DEFINE_MUTEX(proto_list_mutex);
static LIST_HEAD(proto_list);
@@ -671,6 +673,7 @@
return ret;
}
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
/** The function sets the domain name associated with the socket. **/
static int sock_set_domain_name(struct sock *sk, char __user *optval,
@@ -758,7 +761,7 @@
out:
return ret;
}
-
+#endif
/* END_OF_KNOX_NPA */
static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool)
@@ -808,7 +811,7 @@
if (optname == SO_BINDTODEVICE)
return sock_setbindtodevice(sk, optval, optlen);
-
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
if (optname == SO_SET_DOMAIN_NAME)
return sock_set_domain_name(sk, optval, optlen);
@@ -817,6 +820,7 @@
if (optname == SO_SET_DNS_PID)
return sock_set_dns_pid(sk, optval, optlen);
/* END_OF_KNOX_NPA */
+#endif
if (optlen < sizeof(int))
return -EINVAL;
@@ -1567,7 +1571,7 @@
struct proto *prot, int kern)
{
struct sock *sk;
-
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
struct pid *pid_struct = NULL;
struct task_struct *task = NULL;
@@ -1578,10 +1582,11 @@
int parent_returnValue = -1;
char full_parent_process_name[PROCESS_NAME_LEN_NAP] = {0};
/* END_OF_KNOX_NPA */
-
+#endif
sk = sk_prot_alloc(prot, priority | __GFP_ZERO, family);
if (sk) {
sk->sk_family = family;
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
/* assign values to members of sock structure when npa flag is present */
sk->knox_uid = current->cred->uid.val;
@@ -1624,6 +1629,7 @@
}
}
}
+#endif
/* END_OF_KNOX_NPA */
/*
* See comment in struct sock definition to understand

View file

@ -0,0 +1,82 @@
Subject: [PATCH] ifdef knox ncm udp.c
---
Index: net/ipv4/udp.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
--- a/net/ipv4/udp.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/net/ipv4/udp.c (date 1644158930000)
@@ -113,9 +113,11 @@
#include <trace/events/skb.h>
#include <net/busy_poll.h>
#include "udp_impl.h"
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
#include <net/ncm.h>
/* END_OF_KNOX_NPA */
+#endif
struct udp_table udp_table __read_mostly;
EXPORT_SYMBOL(udp_table);
@@ -1804,6 +1806,7 @@
if (sk) {
struct dst_entry *dst = skb_dst(skb);
int ret;
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
struct nf_conn *ct = NULL;
enum ip_conntrack_info ctinfo;
@@ -1811,10 +1814,11 @@
char srcaddr[INET6_ADDRSTRLEN_NAP];
char dstaddr[INET6_ADDRSTRLEN_NAP];
/* END_OF_KNOX_NPA */
+#endif
if (unlikely(sk->sk_rx_dst != dst))
udp_sk_rx_dst_set(sk, dst);
-
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
/* function to handle open flows with incoming udp packets */
if (check_ncm_flag()) {
@@ -1866,6 +1870,7 @@
}
}
}
+#endif
// KNOX NPA - END
ret = udp_queue_rcv_skb(sk, skb);
@@ -1885,12 +1890,14 @@
sk = __udp4_lib_lookup_skb(skb, uh->source, uh->dest, udptable);
if (sk) {
int ret;
+#ifdef CONFIG_KNOX_NCM
/* START_OF_KNOX_NPA */
struct nf_conn *ct = NULL;
enum ip_conntrack_info ctinfo;
struct nf_conntrack_tuple *tuple = NULL;
char srcaddr[INET6_ADDRSTRLEN_NAP];
char dstaddr[INET6_ADDRSTRLEN_NAP];
+#endif
/* END_OF_KNOX_NPA */
if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
@@ -1898,6 +1905,7 @@
inet_compute_pseudo);
/* START_OF_KNOX_NPA */
+#ifdef CONFIG_KNOX_NCM
/* function to handle open flows with incoming udp packets */
if (check_ncm_flag()) {
if ( (sk) && (sk->sk_protocol == IPPROTO_UDP) ) {
@@ -1948,6 +1956,7 @@
}
}
}
+#endif
// KNOX NPA - END
ret = udp_queue_rcv_skb(sk, skb);

View file

@ -0,0 +1 @@
../../.shared-patches/linux/linux4.2-gcc10-extern_YYLOC_global_declaration.patch

View file

@ -0,0 +1,44 @@
diff --git a/Makefile b/Makefile
index 849aba7c4..5dc9bfc70 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,8 @@ NAME = Blurry Fish Butt
# o Look for make include files relative to root of kernel src
MAKEFLAGS += -rR --include-dir=$(CURDIR)
+export ANDROID_MAJOR_VERSION=o
+
# Avoid funny character set dependencies
unexport LC_ALL
LC_COLLATE=C
@@ -256,7 +258,7 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= $(SUBARCH)
-CROSS_COMPILE ?=$(srctree)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
+CROSS_COMPILE ?=
# Architecture as present in compile.h
UTS_MACHINE := $(ARCH)
@@ -302,7 +304,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
-HOSTCC = gcc
+HOSTCC = ccache gcc
HOSTCXX = g++
HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
HOSTCXXFLAGS = -O2
diff --git a/firmware/Makefile b/firmware/Makefile
index be4d8f834..dfed7f0b0 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -171,7 +171,7 @@ fw-shipped-$(CONFIG_TOUCHSCREEN_IST3038H) += tsp_imagis/ist3038h_a40.fw tsp_imag
fw-shipped-$(CONFIG_TOUCHSCREEN_HIMAX_INCELL) += tsp_himax/hx83112a_m20lte.fw tsp_himax/hx83102d_a20e.fw tsp_himax/hx83102d_a20e_al.fw
fw-shipped-$(CONFIG_TOUCHSCREEN_HIMAX_CHIPSET) += tsp_himax/hx83102p_gta4s.fw
-TSPFIRMWARE_DIRECTORY = firmware/tsp_zinitix
+TSPFIRMWARE_DIRECTORY = $(srctree)/firmware/tsp_zinitix
ifeq ($(shell test -d $(TSPFIRMWARE_DIRECTORY) && echo yes),yes)
fw-shipped-$(CONFIG_TOUCHSCREEN_ZINITIX_ZT75XX) += tsp_zinitix/zt7538_xcover4s.fw
fw-shipped-$(CONFIG_TOUCHSCREEN_ZINITIX_ZT75XX_TCLM) += tsp_zinitix/zt7548_a6.fw tsp_zinitix/zt7548_feel2.fw tsp_zinitix/zt7548_a40.fw tsp_zinitix/zt7548_a20.fw tsp_zinitix/zt7548_a40s.fw tsp_zinitix/zt7548_m10s.fw

View file

@ -0,0 +1,25 @@
Subject: [PATCH] rem android ifdef
---
Index: drivers/usb/gadget/function/f_conn_gadget.ioctl.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/drivers/usb/gadget/function/f_conn_gadget.ioctl.h b/drivers/usb/gadget/function/f_conn_gadget.ioctl.h
--- a/drivers/usb/gadget/function/f_conn_gadget.ioctl.h (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/drivers/usb/gadget/function/f_conn_gadget.ioctl.h (date 1644158930000)
@@ -25,8 +25,6 @@
CONN_GADGET_IOCTL_BIND_STATUS_UNBIND = 2
};
-#if defined(__ANDROID__)||defined(__TIZEN__)
-
enum {
CONN_GADGET_IOCTL_NR_0 = 0,
CONN_GADGET_IOCTL_NR_1,
@@ -43,5 +41,3 @@
#define CONN_GADGET_IOCTL_BIND_GET_STATUS _IOR(CONN_GADGET_IOCTL_MAGIC_SIG, CONN_GADGET_IOCTL_NR_2, int)
#define CONN_GADGET_IOCTL_MAX_NR CONN_GADGET_IOCTL_NR_MAX
#endif
-
-#endif

View file

@ -0,0 +1,28 @@
Subject: [PATCH] skip abox_itmon_notifier
---
Index: sound/soc/samsung/abox/abox.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sound/soc/samsung/abox/abox.c b/sound/soc/samsung/abox/abox.c
--- a/sound/soc/samsung/abox/abox.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/sound/soc/samsung/abox/abox.c (date 1740664990038)
@@ -5591,17 +5591,6 @@
static int abox_itmon_notifier(struct notifier_block *nb,
unsigned long action, void *nb_data)
{
- struct abox_data *data = container_of(nb, struct abox_data, itmon_nb);
- struct device *dev = &data->pdev->dev;
- struct itmon_notifier *itmon_data = nb_data;
-
- if (itmon_data && itmon_data->dest && (strncmp("ABOX", itmon_data->dest,
- sizeof("ABOX") - 1) == 0)) {
- dev_info(dev, "%s(%lu)\n", __func__, action);
- data->enabled = false;
- return NOTIFY_OK;
- }
-
return NOTIFY_DONE;
}

View file

@ -0,0 +1,52 @@
Subject: [PATCH] use-pmos-fw-loc
---
Index: drivers/misc/samsung/scsc/mx140_file.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/drivers/misc/samsung/scsc/mx140_file.c b/drivers/misc/samsung/scsc/mx140_file.c
--- a/drivers/misc/samsung/scsc/mx140_file.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/drivers/misc/samsung/scsc/mx140_file.c (date 1740664879089)
@@ -21,13 +21,9 @@
#define SCSC_MULTI_RF_CHIP_ID /* Select FW by RF chip ID, not rev */
-#if defined(CONFIG_SCSC_CORE_FW_LOCATION) && !defined(CONFIG_SCSC_CORE_FW_LOCATION_AUTO)
#define MX140_FW_BASE_DIR_SYSTEM_ETC_WIFI CONFIG_SCSC_CORE_FW_LOCATION
#define MX140_FW_BASE_DIR_VENDOR_ETC_WIFI CONFIG_SCSC_CORE_FW_LOCATION
-#else
-#define MX140_FW_BASE_DIR_SYSTEM_ETC_WIFI "/system/etc/wifi"
-#define MX140_FW_BASE_DIR_VENDOR_ETC_WIFI "/vendor/etc/wifi"
-#endif
+
/* Paths for vendor utilities, used when CONFIG_SCSC_CORE_FW_LOCATION_AUTO=n */
#define MX140_EXE_DIR_VENDOR "/vendor/bin" /* Oreo */
@@ -521,26 +517,6 @@
/* Set to kernel segment. */
set_fs(get_ds());
- /* If /system isn't present, assume platform isn't ready yet */
- r = vfs_stat("/system", &stat);
- if (r != 0) {
- SCSC_TAG_ERR(MX_FILE, "/system not mounted yet\n");
- r = -EAGAIN;
- goto done;
- }
-
- /* If /vendor isn't present, assume platform isn't ready yet.
- * Android M and N still have /vendor, though we don't use it.
- */
- r = vfs_stat("/vendor", &stat);
- if (r != 0) {
- SCSC_TAG_ERR(MX_FILE, "/vendor not mounted yet\n");
- r = -EAGAIN;
- goto done;
- }
-
- /* Now partitions are mounted, so let's see what's in them. */
-
/* Try /vendor partition (post-Oreo) */
strlcpy(base_dir, MX140_FW_BASE_DIR_VENDOR_ETC_WIFI, sizeof(base_dir));
fw_base_dir = MX140_FW_BASE_DIR_VENDOR_ETC_WIFI;