Skip to content

Commit c1134b3

Browse files
author
pswbuild
committed
Synchronize code for OnePlus CPH2745_16.0.3.501(EX01) CPH2747_16.0.3.501(EX01) PLK110_16.0.3.503(CN01)
Based on QCOM release TAG: kernel/build:AU_LINUX_KERNEL.PLATFORM.5.0.R1.00.00.00.099.064 platform/vendor/nxp/opensource/driver:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.089 platform/vendor/opensource/camera-devicetree:AU_TECHPACK_CAMERA.LA.6.0.R1.00.00.00.000.061 platform/vendor/opensource/camera-kernel:AU_TECHPACK_CAMERA.LA.6.0.R1.00.00.00.000.061 platform/vendor/opensource/dataipa:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.078 platform/vendor/opensource/display-devicetree:AU_TECHPACK_DISPLAY.LA.6.0.R1.00.00.00.000.071 platform/vendor/opensource/display-drivers:AU_TECHPACK_DISPLAY.LA.6.0.R1.00.00.00.000.071 platform/vendor/opensource/eva-devicetree:AU_TECHPACK_CV.LA.3.0.R1.00.00.00.000.034 platform/vendor/opensource/eva-kernel:AU_TECHPACK_CV.LA.3.0.R1.00.00.00.000.034 platform/vendor/opensource/mm-devicetree:AU_TECHPACK_DISPLAY.LA.6.0.R1.00.00.00.000.071 platform/vendor/opensource/mm-drivers:AU_TECHPACK_DISPLAY.LA.6.0.R1.00.00.00.000.071 platform/vendor/opensource/mmrm-devicetree:AU_TECHPACK_VIDEO_HANDSET.LA.1.0.R1.00.00.00.000.061 platform/vendor/opensource/mmrm-driver:AU_TECHPACK_VIDEO_HANDSET.LA.1.0.R1.00.00.00.000.061 platform/vendor/opensource/synx-kernel:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.078 platform/vendor/opensource/video-devicetree:AU_TECHPACK_VIDEO_HANDSET.LA.1.0.R1.00.00.00.000.059 platform/vendor/proprietary/mm-devicetree:AU_TECHPACK_DISPLAY.LA.6.0.R1.00.00.00.000.071 platform/vendor/qcom-opensource/bt-devicetree:AU_TECHPACK_BTFM.LA.2.0.R1.00.00.00.000.031 platform/vendor/qcom-opensource/bt-kernel:AU_TECHPACK_BTFM.LA.2.0.R1.00.00.00.000.031 platform/vendor/qcom-opensource/data-devicetree:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.078 platform/vendor/qcom-opensource/data-kernel:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.102 platform/vendor/qcom-opensource/devicetree:AU_LINUX_KERNEL.PLATFORM.5.0.R1.00.00.00.099.064 platform/vendor/qcom-opensource/eSE-devicetree:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.078 platform/vendor/qcom-opensource/nfc-devicetree:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.089 platform/vendor/qcom-opensource/synx-devicetree:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.097 platform/vendor/qcom-opensource/wlan/fw-api:AU_TECHPACK_WLAN.LA.2.0.R3.00.00.00.000.037 platform/vendor/qcom-opensource/wlan/platform:AU_TECHPACK_WLAN.LA.2.0.R3.00.00.00.000.037 platform/vendor/qcom-opensource/wlan/qca-wifi-host-cmn:AU_TECHPACK_WLAN.LA.2.0.R3.00.00.00.000.037 platform/vendor/qcom-opensource/wlan/qcacld-3.0:AU_TECHPACK_WLAN.LA.2.0.R3.00.00.00.000.037 platform/vendor/qcom-opensource/wlan/utils/sigma-dut:AU_TECHPACK_WLAN.LA.2.0.R3.00.00.00.000.037 platform/vendor/qcom-opensource/wlan/wlan-devicetree:AU_TECHPACK_WLAN.LA.2.0.R3.00.00.00.000.037 platform/vendor/qcom-proprietary/display-devicetree:AU_TECHPACK_DISPLAY.LA.6.0.R1.00.00.00.000.071 platform/vendor/qcom/opensource/audio-devicetree:AU_TECHPACK_AUDIO_HANDSET.LA.11.0.R1.00.00.00.000.046 platform/vendor/qcom/opensource/audio-kernel-ar:AU_TECHPACK_AUDIO_HANDSET.LA.11.0.R1.00.00.00.000.046 platform/vendor/qcom/opensource/datarmnet:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.078 platform/vendor/qcom/opensource/datarmnet-ext:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.097 platform/vendor/qcom/opensource/dsp-devicetree:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.089 platform/vendor/qcom/opensource/dsp-kernel:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.078 platform/vendor/qcom/opensource/graphics-devicetree:AU_TECHPACK_GRAPHICS.LA.16.0.R1.00.00.00.000.038 platform/vendor/qcom/opensource/graphics-kernel:AU_TECHPACK_GRAPHICS.LA.16.0.R1.00.00.00.000.038 platform/vendor/qcom/opensource/securemsm-kernel:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.078 platform/vendor/qcom/opensource/spu-kernel:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.102 platform/vendor/st/opensource/driver:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.089 platform/vendor/st/opensource/eSE-driver:AU_LINUX_ANDROID_LA.VENDOR.16.2.0.R1.11.00.00.1277.078
1 parent c368834 commit c1134b3

308 files changed

Lines changed: 36602 additions & 51124 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

kernel_platform/build/kernel/android/merge_dtbs.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,19 @@ def apply_overlay_check(base, dtbo):
498498
if dtbo > base:
499499
cmd = ['ufdt_apply_overlay', base.filename, dtbo.filename, '/dev/null']
500500
logging.debug(' '.join(cmd))
501-
subprocess.run(cmd, check=True)
501+
try:
502+
subprocess.run(cmd, check=True, capture_output=True, text=True)
503+
except subprocess.CalledProcessError as e:
504+
# Re-raise with more context
505+
raise RuntimeError(
506+
'Failed to apply overlay {} to {}: {}\nCommand: {}\nStderr: {}'.format(
507+
dtbo.filename, base.filename, e, ' '.join(cmd), e.stderr
508+
)
509+
) from e
510+
except FileNotFoundError:
511+
raise RuntimeError(
512+
'ufdt_apply_overlay command not found. Please ensure it is installed and in PATH.'
513+
)
502514
else:
503515
return
504516

@@ -568,6 +580,14 @@ def main():
568580
futures[future] = (base, dtbo, idx + 1)
569581
for future in as_completed(futures):
570582
base, dtbo, task_id = futures[future]
583+
try:
584+
future.result() # This will raise any exception that occurred
585+
logging.debug('Overlay check {}/{} passed: {} -> {}'.format(
586+
task_id, total_checks, base.filename, dtbo.filename))
587+
except Exception as e:
588+
logging.error('Overlay check {}/{} failed: {} -> {}: {}'.format(
589+
task_id, total_checks, base.filename, dtbo.filename, str(e)))
590+
raise e
571591

572592
if __name__ == "__main__":
573593
main()

kernel_platform/build/kernel/android/prepare_vendor.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,9 @@ if [ -n "${ANDROID_PRODUCT_OUT}" ] && [ -n "${ANDROID_BUILD_TOP}" ]; then
551551
# goes through w/o any issues.
552552
if [ -d "${ANDROID_BUILD_TOP}/bazel-cache" ]; then
553553
chmod -R 0777 "${ANDROID_BUILD_TOP}/bazel-cache"
554-
find "${ANDROID_BUILD_TOP}/bazel-cache" \( -name Android.mk -o -name Android.bp \) -delete
554+
#ifdef OPLUS_EDIT
555+
find "${ANDROID_BUILD_TOP}/bazel-cache" -maxdepth 4 \( -name "*.mk" -o -name Android.bp \) -delete
556+
#end
555557
fi
556558

557559
if [ -d "${ROOT_DIR}/bazel-cache" ]; then
@@ -664,6 +666,11 @@ fi
664666
# remove bazel dir to avoid build issues
665667
rm -rf ${ANDROID_BUILD_TOP}/kernel_platform/out/bazel
666668

669+
if [ -f ${ANDROID_KP_OUT_DIR}/dist/vmlinux_oki ]; then
670+
mv ${ANDROID_KP_OUT_DIR}/dist/vmlinux ${ANDROID_KP_OUT_DIR}/dist/vmlinux_gki
671+
mv ${ANDROID_KP_OUT_DIR}/dist/vmlinux_oki ${ANDROID_KP_OUT_DIR}/dist/vmlinux
672+
fi
673+
667674
if [ ! -d "${ANDROID_BUILD_TOP}/out" ];then
668675
mkdir -p ${ANDROID_BUILD_TOP}/out
669676
fi

kernel_platform/build/kernel/kleaf/impl/kernel_build.bzl

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,20 +1167,6 @@ def _create_kbuild_mixed_tree_legacy(ctx):
11671167
kbuild_mixed_tree = ctx.actions.declare_directory("{}_kbuild_mixed_tree".format(ctx.label.name))
11681168
returned_inputs = depset([kbuild_mixed_tree])
11691169
base_kernel_files = base_kernel_utils.get_base_kernel(ctx)[KernelBuildMixedTreeInfo].files
1170-
gki_restore_cmd = ""
1171-
gki_path = ctx.configuration.default_shell_env.get("PREBUILT_BOOTIMAGE_PATH", "")
1172-
prebuilt_bootimage = ctx.configuration.default_shell_env.get("OPLUS_USE_PREBUILT_BOOTIMAGE", "")
1173-
target_build_variant = ctx.configuration.default_shell_env.get("TARGET_BUILD_VARIANT", "")
1174-
if prebuilt_bootimage not in ("ogki", "no" , "oki") and target_build_variant != "userdebug":
1175-
gki_restore_cmd = """
1176-
input="$(realpath ${KBUILD_MIXED_TREE})"
1177-
root_dir=$(echo "$input" | sed -n 's|\\(.*source/vnd\\).*|\\1|p')
1178-
vmlinux_src=$(realpath "${root_dir}/${gki_path}")
1179-
vmlinux_dest="${KBUILD_MIXED_TREE}/vmlinux"
1180-
if [ -f ${vmlinux_src} ]; then
1181-
cp -f "$(readlink -m "$vmlinux_src")" "$vmlinux_dest"
1182-
fi
1183-
"""
11841170
kbuild_mixed_tree_command = hermetic_tools.setup + """
11851171
# Restore GKI artifacts for mixed build
11861172
export KBUILD_MIXED_TREE=$(realpath {kbuild_mixed_tree})
@@ -1189,14 +1175,10 @@ def _create_kbuild_mixed_tree_legacy(ctx):
11891175
for base_kernel_file in {base_kernel_files}; do
11901176
cp -a -t ${{KBUILD_MIXED_TREE}} $(readlink -m ${{base_kernel_file}})
11911177
done
1192-
gki_path={gki_path}
1193-
{gki_restore_cmd}
11941178
""".format(
11951179
# This to_list() is acceptable because GKI's outs/module_outs is a small list
11961180
base_kernel_files = " ".join([file.path for file in base_kernel_files.to_list()]),
11971181
kbuild_mixed_tree = kbuild_mixed_tree.path,
1198-
gki_restore_cmd = gki_restore_cmd,
1199-
gki_path = gki_path,
12001182
)
12011183
debug.print_scripts(ctx, kbuild_mixed_tree_command, what = "kbuild_mixed_tree")
12021184
ctx.actions.run_shell(

kernel_platform/build/kernel/kleaf/impl/kernel_env.bzl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ def _get_build_config_inputs_impl(_subrule_ctx, *, srcs, build_config):
162162
_get_build_config_inputs = subrule(implementation = _get_build_config_inputs_impl)
163163

164164
def _kernel_env_impl(ctx):
165+
prebuilt_bootimage = ctx.configuration.default_shell_env.get("OPLUS_USE_PREBUILT_BOOTIMAGE", "")
166+
target_build_variant = ctx.configuration.default_shell_env.get("TARGET_BUILD_VARIANT", "")
165167
kconfig_ext = ctx.file.kconfig_ext
166168
dtstree_makefile = None
167169
dtstree_srcs = depset()
@@ -200,6 +202,17 @@ def _kernel_env_impl(ctx):
200202
""".format(
201203
kconfig_ext = kconfig_ext.path,
202204
)
205+
206+
if prebuilt_bootimage:
207+
command += """
208+
export OPLUS_USE_PREBUILT_BOOTIMAGE={prebuilt_bootimage}
209+
""".format(prebuilt_bootimage=prebuilt_bootimage)
210+
211+
if target_build_variant:
212+
command += """
213+
export TARGET_BUILD_VARIANT={target_build_variant}
214+
""".format(target_build_variant=target_build_variant)
215+
203216
if dtstree_makefile:
204217
command += """
205218
export DTSTREE_MAKEFILE={dtstree}

kernel_platform/oplus/bazel/oplus_modules.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def define_oplus_ddk_modules(target, msm_target, variant):
111111
"//vendor/oplus/kernel/storage:storage_log",
112112
"//vendor/oplus/kernel/storage:ufs-oplus-dbg",
113113
"//vendor/oplus/kernel/storage:oplus_file_record",
114+
"//vendor/oplus/kernel/storage/oplus_overlayfs:oplus_overlay",
114115
"//vendor/oplus/kernel/synchronize:oplus_lock_torture",
115116
"//vendor/oplus/kernel/synchronize:oplus_locking_strategy",
116117
"//vendor/oplus/kernel/touchpanel/kernelFwUpdate/bazel:oplus_bsp_fw_update",
@@ -155,6 +156,9 @@ def define_oplus_ddk_modules(target, msm_target, variant):
155156
"//vendor/oplus/sensor/kernel/qcom:oplus_sensor_interact",
156157
"//vendor/oplus/sensor/kernel/qcom:oplus_sensor_ir_core",
157158
"//vendor/oplus/sensor/kernel/qcom:oplus_sensor_kookong_ir_spi",
159+
"//vendor/oplus/kernel/nfc:oplus_nfc",
160+
"//vendor/oplus/kernel/nfc:oplus_network_nfc_thn31",
161+
"//vendor/oplus/kernel/patch:oplus_patch",
158162
]
159163

160164
#conditional_build modules

kernel_platform/oplus/config/modules.vendor_boot.list.oplus

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ cpufreq_bouncing.ko
2222
oplus_bsp_task_overload.ko
2323
oplus_mdmfeature.ko
2424
oplus_wq_dynamic_priority.ko
25+
oplus_bsp_bootmode.ko
26+
oplus_ftm_mode.ko
27+
oplusboot.ko
28+
oplus_charger_present.ko

kernel_platform/oplus/tools/abi_gki_oki_check.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ def generate_ack_abi(args, ack, output_dir):
2828
return process, generate_abi_aarch64_oplus
2929

3030

31+
def check_btf_data(args, ack, vmlinux, output_dir):
32+
btf_h = "{}/btf_{}.h".format(output_dir, ack)
33+
btf_h_command = "{} btf dump file {} format c > {}".format(args.bpftool, vmlinux, btf_h)
34+
process = subprocess.Popen(btf_h_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
35+
print("btf_h_command {}".format(btf_h_command))
36+
return process, btf_h_command
37+
38+
3139
def dump_modversions(ack_path, ko_modversions_full):
3240
ko_files = find_ko_files(ack_path)
3341
command = "modprobe --dump-modversions {} *.ko to {}".format(ack_path, ko_modversions_full)
@@ -54,6 +62,8 @@ def generate_abis_modversions(args, acks, output_dir):
5462
if os.path.exists(ack_vmlinux):
5563
process, command = generate_ack_abi(args, ack, ack_path)
5664
processes.append((process, command))
65+
process, command = check_btf_data(args, ack, ack_vmlinux, ack_path)
66+
processes.append((process, command))
5767

5868
process, command = dump_modversions(ack_path, ko_modversions_full)
5969
processes.append((process, command))
@@ -165,15 +175,18 @@ def compare_same_line_files(base_file, new_file, output_file):
165175
print("error", exc)
166176

167177

168-
def copy_log_files_to_dest(src, dest, exclude_patterns=None):
178+
def copy_log_files_to_dest(src=None, dest=None, exclude_patterns=None):
169179
print("Copy build log from {} to {} exclude{}".format(src, dest, exclude_patterns))
170180
print("You can find log in {} or in {} ".format(src, dest))
171181
print("For more information, please refer to the documentation link:")
172182
print("检查是否缺少符号,检查是否破坏KMI,检查是否能够进入recovery\n如需帮助,请阅读如下指导文档:")
173183
print("")
174184

185+
if src is None or dest is None:
186+
return
187+
175188
if not os.path.exists(src):
176-
raise ValueError("src dir {} not exists".format(src))
189+
return
177190

178191
if not os.path.exists(dest):
179192
os.makedirs(dest)
@@ -408,7 +421,7 @@ def parse_cmd_args():
408421
parser.add_argument('--full_kernel_version', type=str, help='linux kernel full version', default="")
409422
parser.add_argument('--vendor', type=str, help='vendor', default="qcom")
410423
parser.add_argument('--extract_symbols', type=str, help='extract_symbols', default="")
411-
424+
parser.add_argument('-b', '--bpftool', type=str, help='bpftool', default=get_resource_path('bpftool'))
412425
parser.add_argument('-z', '--lz4', type=str, help='lz4 process tool', default=get_resource_path('lz4'))
413426
parser.add_argument('-n', '--unpack_bootimg', type=str, help='boot unpack tool',
414427
default=get_resource_path('unpack_bootimg'))
@@ -701,11 +714,13 @@ def ddk_ko_check(args, output_dir):
701714
print("\nddk ko check end...")
702715

703716
def symbols_crc_check(acks, output_dir):
717+
btf_hashs = []
704718
for ack in acks:
705719
print("\ngenerate {} ko modversions".format(ack))
706720
ack_path = str(pathlib.Path(output_dir) / ack)
707721
ack_log = str(pathlib.Path(log_dir) / ack)
708722
ack_vmlinux = str(pathlib.Path(ack_path) / 'vmlinux')
723+
btf_h = "{}/{}/btf_{}.h".format(output_dir, ack, ack)
709724

710725
if not os.path.exists(ack_vmlinux):
711726
print("path:{} not exist ignore".format(ack_vmlinux))
@@ -752,11 +767,23 @@ def symbols_crc_check(acks, output_dir):
752767

753768
print("check {} ko modversions".format(ack))
754769
compare_symbols_modversions(ko_modversions_remove_spaces, modversions_duplicates_sort, symvers_ko_result)
755-
check_current_status(symvers_ko_result, ack_path, ack_log, exclude_file, False)
756-
770+
check_current_status(symvers_ko_result, ack_path, ack_log, exclude_file)
771+
btf_hash = common.calculate_file_md5(btf_h)
772+
btf_hashs.append(btf_hash)
757773
print("copy log to dest...")
758774
copy_log_files_to_dest(ack_path, ack_log, exclude_file)
759775

776+
unique_hashes = set(btf_hashs)
777+
if len(unique_hashes) > 1:
778+
print("check btf fail,you can check log in out/oplus/*ki/btf_*ki.h or LOGDIR/abi/*ki/btf_*ki.h \n"
779+
"please check the md5 of btf_*ki.h is same or not.")
780+
for btf_hash in unique_hashes:
781+
print("btf_hash: {}\n".format(btf_hash))
782+
copy_log_files_to_dest()
783+
else:
784+
print("check btf success...")
785+
786+
760787

761788
def find_numeric_modules_filter(directory):
762789
numeric_suffixes = []
3.18 MB
Binary file not shown.

kernel_platform/oplus/tools/common.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import gzip
2+
import hashlib
23
import shutil
34
import os
45
import subprocess
@@ -813,3 +814,24 @@ def upload_files_to_server(user, password, local_dir, paths, remote_address):
813814
else:
814815
print("prebuilt mode")
815816
upload_file(local_path, remote_path)
817+
818+
def calculate_file_md5(file_path):
819+
"""
820+
Calculate the MD5 value of a single file.
821+
822+
:param file_path: Path to the file
823+
:return: MD5 value of the file as a string. Returns None if the file does not exist or
824+
an error occurs while reading.
825+
"""
826+
if not os.path.isfile(file_path):
827+
return None
828+
829+
try:
830+
md5 = hashlib.md5()
831+
with open(file_path, 'rb') as f:
832+
for chunk in iter(lambda: f.read(4096), b""):
833+
md5.update(chunk)
834+
return md5.hexdigest()
835+
except Exception as e:
836+
print("Error reading file {}: {}".format(file_path, e))
837+
return None

kernel_platform/qcom/opensource/devicetree/oplus/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
CANOE_BASE_DTB += ../qcom/canoe.dtb ../qcom/canoe-v2.dtb ../qcom/canoe-tp.dtb ../qcom/canoe-tp-v2.dtb
1+
CANOE_BASE_DTB += ../qcom/canoe.dtb ../qcom/canoe-v2.dtb ../qcom/canoe-tp.dtb ../qcom/canoe-tp-v2.dtb ../qcom/alor.dtb \
2+
../qcom/alor-interposer.dtb ../qcom/alor-interposer-v2.dtb ../qcom/alorp.dtb
23
CANOE_APQ_BASE_DTB += ../qcom/canoep.dtb ../qcom/canoep-v2.dtb ../qcom/canoep-tp.dtb ../qcom/canoep-tp-v2.dtb
34

45
CANOE_BOARDS += \

0 commit comments

Comments
 (0)