Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/out/
.DS_Store
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# 3917JR_kernel
3917JR_GPL_SOURCECODE
# Yulong / Coolpad 3917JR kernel

这是 Rakuten BIG s(Yulong / Coolpad 3917JR,设备代号 `gaea`)Linux 4.19.81 内核源码的社区归档与可编译重建分支。

原始 Yulong GPL 仓库缺少 `coolpad/`,并把 `techpack/camera`、`techpack/display`、`techpack/video` 留成了无法解析的 gitlink。本分支用同代公开 SM7250 4.19 源码恢复这些构建依赖,保留来源和补丁记录,并加入 DroidSpaces 所需的 namespace、cgroup 与网络配置。

## 当前状态

- 已恢复 camera / display / video techpack 的公开源码。
- 已补齐恢复显示子树所需的公开 DRM 接口。
- 已加入最小 `coolpad/` 构建骨架;缺失的私有 OEM 驱动不会伪装成原厂源码。
- 已保存从实机 `boot_a` 提取的内核配置,以及重建和 DroidSpaces 配置片段。
- 已启用 PID、UTS、IPC namespace、System V IPC、device cgroup、devtmpfs、veth 等 DroidSpaces 依赖。
- 已用 Android Clang `r365631c` 和 AArch64 GNU ld 完整编译出 ARM64 `Image`;哈希和配置核验见 [构建验证记录](reconstruction/BUILD_VERIFICATION.md)。
- 当前产物仍未在真机启动验证,请先阅读 [重建说明](reconstruction/README.zh-CN.md)。

## 构建

建议使用 Yulong 构建配置对应的 Android Clang `r365631c`,并安装 AArch64 GNU binutils(构建脚本调用 `aarch64-linux-gnu-ld`;旧版 `ld.lld` 链接此树时会发生尺寸溢出):

```bash
export TOOLCHAIN=/path/to/clang-r365631c
./reconstruction/scripts/build.sh
```

默认输出目录是 `out/gaea-reconstructed`。脚本会从实机配置开始,应用重建与 DroidSpaces 配置片段,验证关键选项,再构建 arm64 `Image`。

请在 Linux 或区分大小写的文件系统中 checkout 和构建。内核树包含 Linux 正常但 macOS / Windows 默认文件系统会冲突的大小写文件名;macOS 上建议使用区分大小写的 APFS 卷或 Linux 容器卷。

## 重要限制

这不是泄露的 Yulong 私有源码,也不是已经证明可刷入的成品内核。Pixelworks Iris3、部分指纹 / NFC / OEMInfo / 电源复位等厂商驱动没有可验证的同版本公开来源,安全基线中保持关闭。不要在没有原始分区备份和可用恢复路径的情况下刷写。

详细来源、恢复方法与已知缺口见:

- [重建与验证说明](reconstruction/README.zh-CN.md)
- [构建验证记录](reconstruction/BUILD_VERIFICATION.md)
- [源码来源与许可](reconstruction/SOURCES.md)
- [配置片段](reconstruction/configs)
- [恢复补丁记录](reconstruction/patches)
11 changes: 11 additions & 0 deletions msm-4.19/coolpad/arch/product_list/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
menu "Yulong product compatibility"

config YULONG_PRODUCT
bool "Yulong product support"
default y

config BOARD_GAEA
bool "Yulong gaea (3917JR)"
default y

endmenu
1 change: 1 addition & 0 deletions msm-4.19/coolpad/drivers/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Minimal compatibility layer for the vendor tree omitted from the GPL archive.
8 changes: 8 additions & 0 deletions msm-4.19/coolpad/drivers/input/fingerprint/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config INPUT_FINGERPRINT
bool "Yulong fingerprint compatibility"
default n

config GOODIX_GW9558_FINGERPRINT
bool "Goodix GW9558 fingerprint compatibility"
depends on INPUT_FINGERPRINT
default n
3 changes: 3 additions & 0 deletions msm-4.19/coolpad/drivers/input/misc/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config YL_PMIC_INPUT_LOGGING
bool "Yulong PMIC input logging compatibility"
default n
7 changes: 7 additions & 0 deletions msm-4.19/coolpad/drivers/input/touchscreen/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config YL_TOUCHSCREEN_HAL
bool "Yulong touchscreen HAL compatibility"
default n

config YL_TOUCHSCREEN_FT3518
bool "Yulong FT3518 compatibility"
default n
30 changes: 30 additions & 0 deletions msm-4.19/coolpad/drivers/misc/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
config BOOTREASON
bool "Yulong boot reason compatibility"
default n

config YL_PSTORE_SSR_REASON
bool "Yulong SSR reason compatibility"
default n

config YL_RESERVED_RAM
bool "Yulong reserved RAM compatibility"
default n

config YL_RESERVED_RAM_BASE
hex "Yulong reserved RAM base"
depends on YL_RESERVED_RAM
default 0x9b800000

config OEMINFO
bool "Yulong OEM info compatibility"
default n

config OEMINFO_DEV_BLK_PATH
string "Yulong OEM info block path"
depends on OEMINFO
default "/dev/block/by-name/params"

config OEMINFO_DEV_BLK_SIZE
int "Yulong OEM info block size"
depends on OEMINFO
default 4096
11 changes: 11 additions & 0 deletions msm-4.19/coolpad/drivers/nfc/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
config YL_NFC_NXP_SN100F
bool "Yulong NXP SN100F compatibility"
default n

config YL_NFC_PN553_DEVICES
bool "Yulong PN553 compatibility"
default n

config YL_NFC_PN54X_DEVICES
bool "Yulong PN54x compatibility"
default n
8 changes: 8 additions & 0 deletions msm-4.19/coolpad/drivers/pixelworks/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config PXLW_IRIS3
bool "Pixelworks Iris3 compatibility"
default n

config PXLW_IRIS3_PLATFORM_7250
bool "Pixelworks Iris3 SM7250 compatibility"
depends on PXLW_IRIS3
default n
11 changes: 11 additions & 0 deletions msm-4.19/coolpad/drivers/power/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
config YL_POWER_RESET
bool "Yulong power reset compatibility"
default n

config YL_REBOOT_STRESS_TEST
bool "Yulong reboot stress compatibility"
default n

config YL_DLOAD_MODE
bool "Yulong download mode compatibility"
default n
1 change: 1 addition & 0 deletions msm-4.19/coolpad/fs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# The Yulong filesystem extension tree was not included in the GPL archive.
1 change: 1 addition & 0 deletions msm-4.19/coolpad/sound/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# The Yulong sound extension tree was not included in the GPL archive.
3 changes: 3 additions & 0 deletions msm-4.19/coolpad/sound/soc/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config SND_SOC_PA_CAL
bool "Yulong speaker amplifier calibration compatibility"
default n
3 changes: 2 additions & 1 deletion msm-4.19/drivers/gpu/drm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \
drm_encoder.o drm_mode_object.o drm_property.o \
drm_plane.o drm_color_mgmt.o drm_print.o \
drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \
drm_syncobj.o drm_lease.o drm_writeback.o drm_client.o
drm_syncobj.o drm_lease.o drm_writeback.o drm_client.o \
drm_notifier_mi.o

drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
drm-$(CONFIG_DRM_VM) += drm_vm.o
Expand Down
24 changes: 24 additions & 0 deletions msm-4.19/drivers/gpu/drm/drm_mipi_dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* MIPI DSI Bus
*
* Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd.
* Copyright (C) 2020 XiaoMi, Inc.
* Andrzej Hajda <a.hajda@samsung.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
Expand Down Expand Up @@ -1070,6 +1071,29 @@ int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
}
EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);

/**
* mipi_dsi_dcs_set_display_brightness_big_endian() - sets the brightness value of the
* display with big endian, high byte to 1st parameter, low byte to 2nd parameter
* @dsi: DSI peripheral device
* @brightness: brightness value
*
* Return: 0 on success or a negative error code on failure.
*/
int mipi_dsi_dcs_set_display_brightness_big_endian(struct mipi_dsi_device *dsi,
u16 brightness)
{
u8 payload[2] = { brightness >> 8, brightness & 0xff};
ssize_t err;

err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
payload, sizeof(payload));
if (err < 0)
return err;

return 0;
}
EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness_big_endian);

/**
* mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
* of the display
Expand Down
57 changes: 57 additions & 0 deletions msm-4.19/drivers/gpu/drm/drm_notifier_mi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
* Copyright (C) 2020 XiaoMi, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/

#include <linux/notifier.h>

static BLOCKING_NOTIFIER_HEAD(mi_drm_notifier_list);

/**
* mi_drm_register_client - register a client notifier
* @nb: notifier block to callback on events
*
* This function registers a notifier callback function
* to msm_drm_notifier_list, which would be called when
* received unblank/power down event.
*/
int mi_drm_register_client(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&mi_drm_notifier_list, nb);
}
EXPORT_SYMBOL(mi_drm_register_client);

/**
* mi_drm_unregister_client - unregister a client notifier
* @nb: notifier block to callback on events
*
* This function unregisters the callback function from
* msm_drm_notifier_list.
*/
int mi_drm_unregister_client(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&mi_drm_notifier_list, nb);
}
EXPORT_SYMBOL(mi_drm_unregister_client);

/**
* mi_drm_notifier_call_chain - notify clients of drm_events
* @val: event MSM_DRM_EARLY_EVENT_BLANK or MSM_DRM_EVENT_BLANK
* @v: notifier data, inculde display id and display blank
* event(unblank or power down).
*/
int mi_drm_notifier_call_chain(unsigned long val, void *v)
{
return blocking_notifier_call_chain(&mi_drm_notifier_list, val, v);
}
EXPORT_SYMBOL(mi_drm_notifier_call_chain);
2 changes: 1 addition & 1 deletion msm-4.19/drivers/platform/msm/gsi/gsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2649,7 +2649,7 @@ static void __gsi_read_channel_scratch(unsigned long chan_hdl,
gsi_ctx->per.ee));
}

static union __packed gsi_channel_scratch __gsi_update_mhi_channel_scratch(
static union gsi_channel_scratch __gsi_update_mhi_channel_scratch(
unsigned long chan_hdl, struct __packed gsi_mhi_channel_scratch mscr)
{
union __packed gsi_channel_scratch scr;
Expand Down
3 changes: 3 additions & 0 deletions msm-4.19/include/drm/drm_bridge.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2016 Intel Corporation
* Copyright (C) 2020 XiaoMi, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
Expand Down Expand Up @@ -294,6 +295,8 @@ struct drm_bridge {
const struct drm_bridge_funcs *funcs;
/** @driver_private: pointer to the bridge driver's internal context */
void *driver_private;
struct mutex lock;
bool is_dsi_drm_bridge;
};

void drm_bridge_add(struct drm_bridge *bridge);
Expand Down
3 changes: 3 additions & 0 deletions msm-4.19/include/drm/drm_mipi_dsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* MIPI DSI Bus
*
* Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd.
* Copyright (C) 2020 XiaoMi, Inc.
* Andrzej Hajda <a.hajda@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -284,6 +285,8 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline);
int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
u16 brightness);
int mipi_dsi_dcs_set_display_brightness_big_endian(struct mipi_dsi_device *dsi,
u16 brightness);
int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
u16 *brightness);

Expand Down
60 changes: 60 additions & 0 deletions msm-4.19/include/drm/drm_notifier_mi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
* Copyright (C) 2020 XiaoMi, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/

#ifndef _DRM_NOTIFIER_MI_H_
#define _DRM_NOTIFIER_MI_H_

#include <linux/notifier.h>
//#include <linux/msm_drm_notify.h>

enum {
/* panel: power on */
MSM_DRM_BLANK_UNBLANK,
/* panel: power off */
MSM_DRM_BLANK_POWERDOWN,
};

enum msm_drm_display_id {
/* primary display */
MSM_DRM_PRIMARY_DISPLAY,
/* external display */
MSM_DRM_EXTERNAL_DISPLAY,
MSM_DRM_DISPLAY_MAX
};

/* A hardware display blank change occurred */
#define MI_DRM_EVENT_BLANK 0x01
/* A hardware display blank early change occurred */
#define MI_DRM_EARLY_EVENT_BLANK 0x02

enum {
MI_DRM_BLANK_UNBLANK = 0,
MI_DRM_BLANK_LP1,
MI_DRM_BLANK_LP2,
MI_DRM_BLANK_STANDBY,
MI_DRM_BLANK_SUSPEND,
MI_DRM_BLANK_POWERDOWN,
};

struct mi_drm_notifier {
enum msm_drm_display_id id;
void *data;
};

int mi_drm_register_client(struct notifier_block *nb);
int mi_drm_unregister_client(struct notifier_block *nb);
int mi_drm_notifier_call_chain(unsigned long val, void *v);

#endif /*_DRM_NOTIFIER_MI_H*/
1 change: 1 addition & 0 deletions msm-4.19/include/uapi/drm/msm_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ struct drm_msm_power_ctrl {
#define DRM_EVENT_LTM_HIST 0X80000008
#define DRM_EVENT_LTM_WB_PB 0X80000009
#define DRM_EVENT_LTM_OFF 0X8000000A
#define DRM_EVENT_TOUCH 0X8000000B

#define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param)
#define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new)
Expand Down
5 changes: 5 additions & 0 deletions msm-4.19/kernel/cgroup/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -3684,6 +3684,11 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,
spin_unlock_irq(&cgroup_file_kn_lock);
}

if (cft->ss && (cgrp->root->flags & CGRP_ROOT_NOPREFIX) && !(cft->flags & CFTYPE_NO_PREFIX)) {
snprintf(name, CGROUP_FILE_NAME_MAX, "%s.%s", cft->ss->name, cft->name);
kernfs_create_link(cgrp->kn, name, kn);
}

return 0;
}

Expand Down
Loading