补档
由于 AKR 社区及其下载站已挂,于是在此处补档一个 Horizon Kernel 。
先前发布的版本是 B1 到 R17 ,由于旧的代码基本上都被 force push 掉了,因此只能补档一个之前不存在的 R18 版本。
R18 版本在 R17 的基础上进行了一些上游更新和稳定性改进,不过都是很早以前的修改了,具体细节已经记不清了。
另外还修复了 R17 上,设备温度高时可能导致部分处理器无负载的问题,这个是刚改的所以记得非常清楚。
还有,如果你还记得我当年说 R18 版本里会有什么,那确实是有的,我没忘,你找找。
下载:
- 一加 8 (氢/氧 11)
- 一加 8 (11 底包的类原生)
- 一加 8P (氢/氧 11)
- 一加 8P (11 底包的类原生)
- 一加 8T (氢/氧 11)
- 一加 8T (11 底包的类原生)
- 内核控制器(需要 root)
- 内核刷入器(需要 root)
用法:
先 root ,再用“内核刷入器”刷内核,有需要的话可以用“内核控制器”调节。
编译方法
首先,创建工作空间,获取内核本体代码:
$ mkdir workspace
$ cd workspace
$ git clone https://github.com/libxzr/android_kernel_oneplus_sm8250 -b oos11/final
然后,获取内核压缩包的代码:
$ git clone https://github.com/libxzr/AnyKernel3 -b op8/11
然后,获取编译工具链,此处推荐 Horizon Clang ,R18 版本是基于其 16.x 版本编译测试的。
工具链在解压后放在 workspace 的 clang 目录处,不可有额外的目录嵌套,即需要确保 workspace/clang/bin/clang
是编译器的可执行文件。
然后,获取内核本体中的 submodules:
$ cd android_kernel_oneplus_sm8250
$ git submodule init
$ git submodule update
参考的编译脚本:
horizon_build.sh
#!/bin/bash
set -e
DIR="$( cd "$( dirname "$0" )" &&cd ..&& pwd )"
source="$( cd "$( dirname "$0" )" && pwd )"
CLANG_PATH="${DIR}/clang"
args="-j$(nproc --all) \
O=out \
ARCH=arm64 \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=${CLANG_PATH}/bin/aarch64-linux-gnu- \
CC=${CLANG_PATH}/bin/clang \
CROSS_COMPILE_COMPAT=${CLANG_PATH}/bin/arm-linux-gnueabi- \
AR=${CLANG_PATH}/bin/llvm-ar \
NM=${CLANG_PATH}/bin/llvm-nm \
LLVM_AR=${CLANG_PATH}/bin/llvm-ar \
LLVM_NM=${CLANG_PATH}/bin/llvm-nm \
OBJCOPY=${CLANG_PATH}/bin/llvm-objcopy \
OBJDUMP=${CLANG_PATH}/bin/llvm-objdump \
STRIP=${CLANG_PATH}/bin/llvm-strip \
LD=${CLANG_PATH}/bin/ld.lld "
device="all"
clean="false"
action="build"
version="`date +"%m%d%H%M"`"
release="false"
print (){
case ${2} in
"red")
echo -e "\033[31m $1 \033[0m";;
"blue")
echo -e "\033[34m $1 \033[0m";;
"yellow")
echo -e "\033[33m $1 \033[0m";;
"purple")
echo -e "\033[35m $1 \033[0m";;
"sky")
echo -e "\033[36m $1 \033[0m";;
"green")
echo -e "\033[32m $1 \033[0m";;
*)
echo $1
;;
esac
}
input=${*}
for i in ${input}
do
case ${i} in
"op8")
device="op8";;
"op8p")
device="op8p";;
"op8t")
device="op8t";;
"all")
device="all";;
"--clean"|"-c"|"clean")
clean="true";;
*)
did="false"
if [[ $i =~ "-r=" ]];then
release="true"&&version="${i#*r=}"&&did="true"
fi
if [[ $i =~ "-v=" ]];then
version="${i#*v=}"&&did="true"
fi
if [ $did == "false" ]
then
print "Error input" red&&exit
fi
;;
esac
done
mkzip (){
if [ "${release}" == "true" ];then
zipname="(${1})Horizon-Kernel-R${version}.zip"
else
zipname="(${1})Horizon-Kernel-${version}.zip"
fi
cp -f out/arch/arm64/boot/Image.gz ${DIR}/AnyKernel3
#find ${source}/out/arch/arm64/boot/dts/vendor/qcom -name '*.dtb' -exec cat {} + > ${DIR}/AnyKernel3/dtb
cp ${source}/out/arch/arm64/boot/dts/vendor/qcom/kona-v2.1.dtb ${DIR}/AnyKernel3/dtb
#cp ${source}/out/arch/arm64/boot/dts/vendor/qcom/instantnoodle-t0.dtb ${DIR}/AnyKernel3/dtb
cp ${source}/out/arch/arm64/boot/dtbo.img ${DIR}/AnyKernel3
cd ${DIR}/AnyKernel3
zip -r "${zipname}" *
cp -f "${zipname}" ${DIR}
rm -f "${zipname}"
cd ${source}
print "All done.Find it at ${DIR}/$zipname" green
}
build_op8(){
print "Building Kernel for op8..." blue
make $args instantnoodle_defconfig&&make $args
mkzip "op8${1}"
}
build_op8p(){
print "Building Kernel for op8p..." blue
make $args instantnoodlep_defconfig&&make $args
mkzip "op8p${1}"
}
build_op8t(){
print "Building Kernel for op8t..." blue
make $args kebab_defconfig&&make $args
mkzip "op8t${1}"
}
bclean(){
rm -rf ${source}/out/arch/arm64/boot
}
clean(){
if [ "${clean}" == "true" ]
then
print "Doing cleanups" red
make ${args} mrproper
else
bclean
fi
}
if [ "${action}" == "build" ]
then
if [ $release == "true" ]
then
print "You are building a release version:R${version}" green
args+="LOCALVERSION=-R${version} "
else
print "You are building a snapshot version:${version}" yellow
args+="LOCALVERSION=-${version} "
fi
if [ ${device} == "all" ]
then
git reset --hard
clean
build_op8t "-OOS"
bclean
git apply lineage.diff
build_op8t "-Lineage"
git reset --hard
bclean
build_op8p "-OOS"
bclean
git apply lineage.diff
build_op8p "-Lineage"
git reset --hard
bclean
git apply lineage.diff
build_op8 "-Lineage"
git reset --hard
bclean
build_op8 "-OOS"
elif [ ${device} == "op8" ]
then
clean
build_op8
elif [ ${device} == "op8p" ]
then
clean
build_op8p
elif [ ${device} == "op8t" ]
then
clean
build_op8t
fi
fi
脚本要求的目录结构如下:
workspace
├── AnyKernel3
├── android_kernel_oneplus_sm8250
│ ├── horizon_build.sh
├── clang
│ ├── bin
│ │ ├── clang
workspace 的目录名称是无所谓的,只需要确保 AnyKernel3
和 clang
在内核源码文件夹的同级目录下即可,编译脚本则放在内核源码文件夹中。
然后在内核源码文件夹中执行命令即可:
# 编译所有机型/系统的版本
./horizon_build.sh
# 编译所有机型/系统的版本(干净编译)
./horizon_build.sh -c
# 编译一加 8 的版本(仅氢氧)
./horizon_build.sh op8
# 编译一加 8 的版本(仅氢氧)(干净编译)
./horizon_build.sh op8 -c
# 编译一加 8P 的版本(仅氢氧)
./horizon_build.sh op8p
# 编译一加 8P 的版本(仅氢氧)(干净编译)
./horizon_build.sh op8p -c
# 编译一加 8T 的版本(仅氢氧)
./horizon_build.sh op8t
# 编译一加 8T 的版本(仅氢氧)(干净编译)
./horizon_build.sh op8t -c
原帖
实际上并不是原帖,真正的原帖已经挂了找不到了,这是把 XDA 上的帖子部分重新翻译了回来。
这是一个聚焦于日常体验与功耗平衡的内核
特性:
- 基于 CAF "LA.UM.9.12.r1-12500-SMxx50.0" 版本重构 (实际上应该还要新一点,具体版本无从考证)
- 采用 Clang 14 + polly + O3 + A55 优化 进行编译
- 内联编译了所有内核模块
- 采用 lz4 作为 ZRAM 算法
- 移除大量调试代码与未使用驱动
- 支持使用 BBR 作为 TCP 拥塞控制算法(需要手动调整),默认采用 Westwood+ 算法
- 采用 fq_codel 作为默认流控算法
- 采用 128kB 的 IO 预读
- 采用 urandom 作为默认的熵生成器
- 采用 schedhorizon 作为默认的 CPU 调速器
- GPU 默认超频到 670 MHz
- Wireguard 支持
- CIFS 支持
- KCAL & Klapse 支持
- ......
上古更新日志:
R17
- Merge CAF LA.UM.9.12.r1-12500-SMxx50.0
- Update dts to LA.UM.9.12.r1-12000-SMxx50.0
- Update ion drivers
- Update simple lmk drivers
- touchscreen: Adapt PM QoS usage to incoherent OnePlus code
- Slightly optimize performance on scrolling
R16.3
- Rebase on CAF msm-4.19 and remove all upstream linux stable changes ( Rollback to 4.19.157 )
( This could solve at least deep sleep issue and avoid a lot of potential issue )
- Inline the spin lock function family to improve performance
- Correct capacity value of big cluster in energy model
R16.2
- Merge Linux 4.19.198
- Revert back to old scheduling policy
R16.1
- Merge CAF "LA.UM.9.12.r1-12200-SMxx50.QSSI12.0"
- Further optimize on scheduling
- May fix a wlan connection problem introduced in last build
R16
- Linux 4.19.197
- Merge CAF "LA.UM.9.12.r1-12000-SMxx50.0"
- Rework scheduling policy
- Optimize touchscreen latency and interrupt CPU usage
R15.1
- Linux 4.19.196
- Fix kernel panic when screen casting with "windows connect"
- Fix UI lagging and inaccurate network speed when a proxy is running in the background
( This dropped BBR and set Westwood as default congestion algorithm )
- Move back to Simple LMK as lowmemory killer
Controller Update
- Add a switch for BBR congestion algorithm for those who need it
R15
- Merge CAF "LA.UM.9.12.r1-11800-SMxx50.QSSI12.0"
- Fix random lags on R14.3
- Relax performance restrictions for schedhorizon
- Move to 10ms for WALT window size for faster response
- Cleanup and optimize fuel gauger driver
R14.3
- Linux 4.19.195
- Fix google photos video lag on custom ROMs
R14.2
- Linux 4.19.193
- Move back to userspace lmkd to improve multitasking experience
- Synchronize oneplus changes from oss
R14.1
- Fix kernel panic when using terminal
R14
- Merge CAF "LA.UM.9.12.r1-11500-SMxx50.0"
- Merge Linux 4.19.192
- Optimize camera launching speed
R13.3
- Fix kernel panic when subsystems crash
R13.2
- Merge Linux 4.19.191
- Fix modem unable to reset after a crash
- Cleanup some more oneplus codes
- Custom build: Synchronize changes with LineageOS kernel and apply new FOD patches
Note: If you are facing disappeared fod, just wait for your maintainer to update fod on the ROM side.
R13.1
- Merge Linux 4.19.190
- Fix zram compression algorithm not setting to lz4 on kebab
- Perform PID map reads on the little CPU cluster
R13
- Merge CAF "LA.UM.9.12.r1-11300-SMxx50.0"
- Implement fuse short circuit to improve i/o performance under /sdcard
- Ignore modem crash event
R12.4
- Merge Linux 4.19.186 187 188 189
- Fix unable to apply system update on kebab
- 20X optimize PID map reads
- Increase vmstat interval to reduce overhead
- Fix kernel warning when triggering tri-state-key
- Apply some backports to vmalloc & jump label
- Enable jump label for branch optimization
- Enable automatic compaction for ZRAM
- Upstream Simple LMK
- Some more I forgot
R12.3
- May fix some problems with pd charging
- Fix kernel panic when modem crash sometimes
R12.2
- Merge Linux 4.19.184 185
- Implement f2fs rapid gc from arter97
- Shorten auto-hiberate idle timer
- May fix kernel panic when modem crash sometimes
R12.1
- Fix random crash & reboot ( mostly happends on 8T )
R12
- Merge Linux 4.19.183
- Merge CAF "LA.UM.9.12.r1-11000-SMxx50.0"
- Update lots of codes from oneplus oss
- Enable UFS HPB feature
- Add support for custom ROMs
R11.2
- Merge Linux 4.19.180 181 182
- Add haptic level adjustment
- Add back 1.2GHz for big cluster
- Move to rewritten ashmem driver by sultan
R11.1
- Merge CAF "LA.UM.9.12.r1-10800-SMxx50.0"
- Merge Linux 4.19.179
- Fix SurfaceFlinger spams errors in logcat
R11
- Merge CAF "LA.UM.9.12.r1-10700-SMxx50.0"
( Including kernel, wlan and audio, video techpacks )
- Merge Linux 4.19.178
- Upstream lz4 zram algorithm
- Hardcode swappiness to 160 for more aggressive zram strategy
- Enable 4GB ZRAM
- Add back 691mhz for small cluster
- Prevent EAS from affecting cpuidle
- Apply some more optimization patches
R10.5
- Merge Linux 4.19.177
- Remove cpu cooling & devfreq cooling drivers
( Fix big cluster being limit at min freq sometimes when playing genshin impact )
- Improve deep sleep time under mobile data
- Apply some more optimization patches
R10.4
- Merge Linux 4.19.176
- Update kernel devicetree to "LA.UM.9.12.r1-10000-SMxx50.0"
- Add back lowest frequencies for big & prime cluster
- Fix broken energy model due to inappropriate optimizations
R10.3
- Merge Linux 4.19.175
- Update display panel commands from qssi-user-11-RP1A.201005.001-2102011801-release-keys
R10.2
- Fix cyberpunk theme
- Fix cloud service on hydrogen os
R10.1
- Merge Linux 4.19.174
- Cleanup and optimize defconfig
- Simplify dtbo building
- Reduce zip size ~ 30%
R10
- Merge CAF "LA.UM.9.12.r1-10300-SMxx50.0"
( Including kernel, wlan and audio, display techpacks )
- Cleanup unused debug codes in wlan drivers
- Don't allow userspace trigger process reclaim
- Remove cpuidle sleep_disable usage in haptic drivers, and remove sleep_disable node from userspace.
R9.3
- Merge Linux 4.19.173
- Ship builds with zips
R9.2.1
- Fix blurred screen and crashes on some Oneplus 8P when playing videos with MEMC on.
- Oneplus 8 Pro Only
R9.2
- Merge Linux 4.19.172
- Fix ufs workqueue overheads
- Optimize memcpy, memmove, memcmp, crc32, checksum, xor libraries
- Affine unbound workqueues to little CPUs by default
- Make the devfreq monitor workqueue high priority
- Add automatic memory compaction mechanism
- More I forgot
- Theres no change in dtbo compared to R9.1, so no need to update
R9.1
- Merge Linux 4.19.168 169 170 171
- Move to simplified frequency table
- Fix wifi not working on new Chinese version of Oneplus 8T
- Don't limit CPU frequency when gaming
- Optimize GPU scheduling under high refresh rate
- Theres no change in dtbo compared to R9, so no need to update
R9
- Merge CAF "LA.UM.9.12.r1-10000-SMxx50.0"
( Including kernel, wlan and audio, video, display techpacks )
- Merge Linux 4.19.166
- Merge Linux 4.19.167
- Add support for checking cpu voltage via kernel logs
- Theres no change in dtbo compared to R8.4, so no need to update
R8.4
- Merge Linux 4.19.165
- Disable ZRAM & SWAP
- Theres no change in dtbo compared to R8.3, so no need to update
R8.3
- Merge Linux 4.19.164
- Theres no change in dtbo compared to R8.2, so no need to update
R8.2
- Don't force run display & touchscreen irqs and threads on big cluster to save power
- Remove max boost for little cluster on switching apps to save power
- Introduce dynamic cpuset for display group, migrating tasks to big cluster on switching apps to improve smoothness
- Fix lags when little cluster is under heavy load
- Relax touchscreen cpu latency requirement to save power
- Relax UFS cpu latency requirement to save power
- Align CPU latency requirements with kona C-States
- Remove iowait boost from schedhorizon
- Don't force 4k buffer allocations for ION
- Update Magisk in the image to v21.2
- Fix force 240hz fails after exiting a game
- Theres no change in dtbo compared to R8.1, so no need to update
R8.1
- Merge CAF "LA.UM.9.12.r1-09500-SMxx50.0"
( Including kernel, wlan and audio, video, display techpacks )
- Build oneplus param read/write drivers, cyberpunk theme should work now
- Optimize pm_qos usage for touchscreen drivers on OP8 & OP8P
- Re-enable pm_qos usage for UFS drivers
- Use 100Hz timer frequency
- Never allow irq affine on more than one cpu
- Optimize pm_qos framework
- Optimize pm_qos usage for UFS drivers
- Optimize cpuidle framework
- Force run important display & touchscreen & lmk irqs and threads on big cluster
- Cleanup codes in kgsl & display techpack and optimize pm_qos usage
- Move to rewritten iommu & ion drivers
- ........... ( Check github for details )
- Theres no change in dtbo compared to R7.2, so no need to update
R7.2
- Merge Linux 4.19.163
- Theres no change in dtbo compared to R7.1, so no need to update
R7.1
- Merge Linux 4.19.162
- Re-enable lpm idle prediction
- Move to fq_codel qdisc
- Enable TCP ECN negotiation by default
- Don't force enable panel ULPS suspend
- Theres no change in dtbo compared to R7, so no need to update
R7
- Merge CAF "LA.UM.9.12.r1-09300-SMxx50.0"
( Including kernel and audio, display techpacks and wlan drivers )
- Merge Linux 4.19.161
- Build and enable vDSO32
Kernel Configuration | Android Open Source Project
source.android.com source.android.com
- Don't force offline big & prime cluster on screen off ( Fix fp reject and lags on AOD )
- Move back to mem deep sleep mode
- Don't force 240Hz touchpanel sample rate on Oneplus 8T & 8Pro ( But you can still enable it by writing 1 to /proc/touchpanel/force_game_switch_enable )
- Cleanup rx_wakelock codes in wlan drivers
- Force enable ULPS(Ultra Low Power State) and ULPS suspend for display panel
- Force allow panel phy power off on idle
- Re-align gpu idle timeout & input boost duration with display panel ULPS delay
- Enable Clang ThinLTO optimizations
- Lower the priority of f2fs gc task
- Disable expedited RCU grace periods for powersave
- Remove display ramdump memory region (free 8MB of RAM)
- Disable cpuidle idle prediction feature for powersave
- Implement fast refcount checking for arm64
- Prefetch operands to speed up atomic operations
- More I forgot
- Theres no change in dtbo compared to R6.4, so no need to update
R6.4
- Merge linux 4.19.160
- Theres no change in dtbo compared to R6.3, so no need to update
R6.3
- Merge linux 4.19.159
- Theres no change in dtbo compared to R6.2, so no need to update
R6.2
- Merge linux 4.19.158
- Move to s2idle deep sleep mode
- Apply some touchscreen drivers' simplifying and optimizations
- Theres no change in dtbo compared to R6.1, so no need to update
R6.1
- Update Proton Clang version
dtbo image has been updated:
- Fix random kernel panic caused by freeing too much reserved memory
R6
- Merge Linux 4.19.157
- Merge CAF “LA.UM.9.12.r1-09000-SMxx50.0”
( Include kernel, wlan and audio, video, display techpacks )
- Update wireguard to v1.0.20201112
- Merge Simple Lmk update
- Force 240Hz touchpanel sample rate for Oneplus 8 Pro & Oneplus 8T
- Touchpanel sample rate will no longer drop after switching to 60Hz screen refresh rate on Oneplus 8T & Oneplus 8Pro
- Update magisk to v21.1
dtbo image has been updated:
- Remove unused reserved memory regions (~12MB)
R5.5
- Merge Linux 4.19.156
- Move to Simple Lmk as lowmemorykiller
- Disable userspace lmkd
- Enable userspace CNTVCT_EL0 access for vDSO to accelerate request
- Theres no change in dtbo compared to R5.4, so no need to update.
R5.4
- Merge Linux 4.19.155
- Theres no change in dtbo compared to R5.3, so no need to update.
R5.3
- Fix cpu cores oscillationally on/off on aod fingerprint pressing
- Fix logic of screen on/off detection
- Improve speed of aod fingerprint
- Theres no change in dtbo compared to R5.2, so no need to update.
R5.2
- Optimize logic of "Optimize fingerprint speed on aod mode"
- Fix priority of fingerprint hal not changing successfully
- Optimize smoothness when entering recent apps
- Optimize smoothness when switching between apps
- Optimize app launching speed
- Theres no change in dtbo compared to R5.1, so no need to update.
R5.1
- Optimize fingerprint speed on aod mode
- Theres no change in dtbo compared to R5, so no need to update.
R5
- Merge Linux 4.19.154
- Fix camera on Oneplus 8T
- Speed up mremap by 20x on large regions
- Disable Privileged Access Never emulation, speed up syscalls 2x
- Theres no change in dtbo compared to R4, so no need to update.
R4
- Merge Linux 4.19.153
- Merge CAF "LA.UM.9.12.r1-08900-SMxx50.0"
( Including kernel and wifi drivers, audio, video, display techpacks )
- Update boot image base to OOS OB3 for OP8 & OP8P
- Camera on 8T havent been fixed on this build
- Theres no change in dtbo compared to R3, so no need to update.
R3
- Merge oneplus oss update
- Add support for Oneplus 8T
- Enable 1.2GHz input boost for big cluster
- Remove schedhorizon governor 1.6GHz(prime) 1.2GHz(big) efficient_freq
- Allow foreground apps migrate to big cluster on touch
- Relax boost duration on no input to 3s
UI Bench Result
- Jitter: ~0.3ms -> ~0.2ms
- Total duration: ~4ms -> ~3ms
- Dtbo image has been updated, reflashing is recommended
R2
- Merge Linux 4.19.152
- Merge CAF "LA.UM.9.12.r1-08600-SMxx50.0"
- Update wifi drivers to "LA.UM.9.12.r1-08600-SMxx50.0"
- Update display & video techpacks to "LA.UM.9.12.r1-08600-SMxx50.0"
- Theres no change in dtbo compared to R1.1, so no need to update.
R1.1
- Merge Linux 4.19.151
- Theres no change in dtbo compared to R1, so no need to update.
R1
- Stable release is here
( Coz no one reports bug to me lol )
- Merge Linux 4.19.150
- Enable ntfs & exfat drivers
- Theres no change on dtbo image compared to B2, so no need to update
B2
- Merge Linux 4.19.149
- Update audio & video & display techpacks to CAF "LA.UM.9.12.r1-08300-SMxx50.0"
- Add Klapse support
( Now you can turn brightness )
- Disable unused arm64 errata
- Disable wireless charging drivers for oneplus8
- Disbale iris drivers for oneplus8
- Start building dtbo image, flash it as you want.
( It could provide node /proc/touchpanel/glove_mode_enable for glove mode, you can write 1 to enable it )
B1
- Initial bring up
后记
COS 13 的内核还是有希望的,因为我原来觉得官核挺好的,结果现在又发现挺烂的。
大佬,快更新COS 13 的内核,等哭了😭
大佬,在编译这个内核的时候出现了glibc2.3和2.34的nof found,是缺了什么应用库了吗?
如果你用的是 Horizon Clang 的话,这可能和你系统的 glibc 版本有关系。Horizon Clang 是在 Ubuntu 22.04 + glibc 2.35 的环境下编译的,如果你的系统 / glibc 版本比这个要老,是有可能报错跑不起来的,可以考虑换个 Clang 。
哦哦原来如此,谢谢大佬,我编译的就是这个内核,我换一个系统看看
大佬,半个月过去了,COS 13的内核有消息了吗?😭
有自用的调试版本😋
大佬,大概还要多久才能等到😭
未知
佬,可以先发一份调试版本给我看吗?😘
大佬cos13的内核有消息了吗😳
又是等COS 13 的内核的一天😭
入职上班去了,内核上新时间未知😋
作者大大,最近想用c13官核做个kernelsu,听说oppo系列有的驱动源码和内核是分开的吗?是不是还要合并
可以参照
https://github.com/libxzr/android_kernel_oneplus_sm8250/commit/77bfb98f685b6007933ddb2bf1e0d444ca902366
AR drivers/built-in.a
make[1]: 离开目录“/root/workspace/android_kernel_oneplus_sm8250/out”
make: *** [Makefile:146:sub-make] 错误 2
老大。这个是什么问题呀
日志里没啥有效信息,建议多整点日志然后扔 pastebin 里。
老大你看一下
https://pastebin.com/M6dtsjya
/bin/sh: 1: python2: not found
make[2]: *** [../arch/arm64/boot/Makefile:74:arch/arm64/boot/dtbo.img] 错误 127
make[1]: *** [arch/arm64/Makefile:204:dtbo.img] 错误 2
make[1]: *** 正在等待未完成的任务....
解决:sudo apt install python2
感谢分享,已经集成Ksu了。
请问集成Ksu需要修改内核目录下哪个配置文件。
请参考 ksu 项目的相关文档
大大,这个错误是为什么?
```
aarch64-linux-gnu-ld: warning: .tmp_vmlinux1 has a LOAD segment with RWX permissions
security/selinux/avc.o: in function `avc_disable':
avc.c:(.text+0x1604): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
security/selinux/hooks.o: in function `selinux_set_mnt_opts':
hooks.c:(.text+0x400): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
hooks.c:(.text+0x48c): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
hooks.c:(.text+0x6e4): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
hooks.c:(.text+0x784): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
hooks.c:(.text+0x804): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
hooks.c:(.text+0x830): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
security/selinux/hooks.o: in function `may_context_mount_sb_relabel':
hooks.c:(.text+0xa14): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
hooks.c:(.text+0xa48): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
security/selinux/hooks.o: in function `may_context_mount_inode_relabel':
hooks.c:(.text+0xa88): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `selinux_state' defined in .bss.rtic section in security/selinux/hooks.o
hooks.c:(.text+0xabc): additional relocation overflows omitted from the output
make[1]: *** [/home/coconutat/Github/android_kernel_oneplus_Horizon/Makefile:1209: vmlinux] Error 1
make[1]: Leaving directory '/home/coconutat/Github/android_kernel_oneplus_Horizon/out'
```
试试
https://github.com/libxzr/android_kernel_oneplus_sm8250/commit/6243e0eadd883f9abb41b17a5c2265d1910224dd
感谢,已经成功。昨天看到Proton-Clang的issue里有这个类似的提交。再次感谢大大。
大大,我想尝试上游内核,然后去Merge 安卓通用内核。但是我看到它内核版本和现在内核差距挺大的。能不能像v4.19.157..v4.19.158这样子Merge或者Cherry-pick。我之前都是Cherry-pick Linux-stable的代码,但是我发现它不是属于给安卓设计的代码,我觉得不太好。能否给个教程或者建议,谢谢。
上游更新内核其实是个老大难问题了。
因为这里其实分为:
- 厂家认为稳定的代码。
- 高通认为稳定的代码。
- 谷歌认为稳定代码。
- linux 社区认为稳定的代码。
厂家开发版本时,会从高通那边拿一个 tag ,之后在上面完成开发/测试/交付,这个过程中 tag 一般是不会变的,即使有来自上游的必要补丁也会以增量的方式合入,不会因此而切换 base tag (为了确保每走一步都是在解决问题,而不会引入未知的新问题)。
高通那边也是同理,先从谷歌的 kernel/common 拉一份代码,在上面完成开发/测试/交付,非必要不切换基线代码以避免引入未知问题,上游如果有必要的修复也会选择直接 cherry-pick 对应补丁而非合并上游。当然,高通还是比厂商要积极一些,偶尔还是会合并 kernel/common 的,比如 4.19 就从 113 合并到了 157 ,之后就进入了半死不活的“LTS 状态”,只是自己修修补补不再合并 kernel/common 了。
谷歌那边相对与时俱进一些,其在 linux-stable 上引入了安卓相关修改后,仍然会定期合并上游,几乎是每个 stable 版本都合,但似乎只是合并和解决冲突,以及确保 ABI 稳定(如果是 GKI 的话),对质量倒似乎没什么保障(不知道他们内部有没有跑什么测试之类的,还是单纯的编译能过就行),因此 kernel/common 出问题的概率其实是挺高的,linux-stable 引入的问题到 kernel/common 这里也不一定过滤的掉,比如之前就有 linux-stable 引入的 binder 修改导致 display 挂掉的,照样顺利进了 kernel/common ,但这种东西很明显是进不了 CAF / CLO 的 tag 的,至少高通内部测试的时候一定会发现。
所以这么看过来,自己合并上游的时候可能面临以下冲突:
1、厂家修改和高通修改 / 谷歌修改 / linux 社区修改的冲突,作为第三方内核这个就不考虑了。
2、现有高通修改和上游谷歌修改的冲突。
3、现有高通修改和 linux 上游修改的冲突。
4、现有谷歌修改和 linux 上游修改的冲突。
其实就是在 2、3、4 之间选,看哪个更好解决。
直接合并谷歌的 kernel/common ,就要解决 2、3 ,但是不需要解决 4 。
直接合并 linux-stable 就要解决 3、4 ,但是不需要解决 2 。
所以,如果难以解决上游谷歌修改和现有高通修改之间的冲突,可以选择直接合并 linux-stable ,并参照 kernel/common 解决 linux 上游与谷歌代码之间的冲突。
如果难以解决 linux 上游修改和现有谷歌修改之间的冲突,可以选择直接合并 kernel/common ,但需要在没有参照的情况下自己解掉上游谷歌修改和现有高通修改之间的冲突。
按照我之前的经验,上游谷歌修改和现有高通修改之间的冲突是更难解决的,至少 fs 和加密那块看得我头大,所以我会选择合并 linux-stable ,当然现在情况可能有所不同了。
至于怎么合并,我的建议是,新手不要自己合并,可以尝试利用现有项目,比如 https://github.com/LineageOS/android_kernel_qcom_sm8250/commits/lineage-20/ ,这里就提供了既合并高通上游又合并 kernel/common 外加自己测试和修复 bug 的代码,对于快速合并上游来说非常完美,而且稳定性也有一定保障。
接下来回答你的问题,v4.19.157..v4.19.158 这样合并是可以的,每个版本都是有对应的发布 tag 的,可以在这里找到:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/refs
fetch 对应的 tag 然后一个一个向上合并就可以了。
至于合并 linux-stable 会不会不好,我觉得不至于,因为谷歌的 kernel/common 也是在一直合并 linux-stable 的。其实选择合并哪个上游,就是在“更新”和“更稳”之间抉择:
- 合并 CAF / CLO ,能够获得高通的最新代码,较为稳定,但没有新的 linux 版本,也没有谷歌的新修改。
- 合并 kernel/common ,能够获得谷歌和 linux 社区的最新代码,但可能与现有高通修改冲突,而且稳定性没有保障。
- 合并 linux-stable ,能够获得 linux 社区的最新代码,可能与现有高通修改冲突,但可以避开上游谷歌代码与现有高通代码之间的冲突,稳定性也没有保障(虽然社区认为它 stable 了)。
如果想要自己合的话,有几个建议:
1、步子不要迈太大,一次不要合太多,合完及时编译上机测试,及时发现明显的问题。
2、解决冲突不是二选一,更不是删掉冲突标记就完事。这个东西要读懂上下文代码,理解逻辑,理解怎么处理会发生什么事,才能决定下一步。当然,如果是自己玩玩那无所谓啦,毕竟经验有时候就是玩出来的。
3、处理冲突时,如果选择放弃上游更改,要完整的放弃。比如上游的 A commit 修改了 B、C、D 文件,其中 B 文件冲突了,很多人直接 git checkout b --ours 来放弃 B 的修改,但这是有问题的,因为 C、D 的修改还在那,理论上它们与 B 的修改是配套的,需要一起撤回。有时候不一起撤回不会有问题,有时候会导致编译错误,有时候会引入隐藏的问题,总之这个点需要特别注意。
4、合完出版本了要多多炫耀分享,这样才会有进步的动力 (●'◡'●)
别的暂时想不到了,就这样吧。
大佬,您好。我想问一下,有尝试过合并一加 9 cos14 的内核吗,我发现在编译的时候它的内核代码里有很多报错,不知道要怎么去合并。
没有,但是道理应该差不多。在他们内部内核应该是放在 AOSP 的整个源码树中,由主编译系统负责构建的,所以会依赖上很多内核源码树外的东西,这些东西独立跑内核的时候得补回来,类似于:
https://github.com/libxzr/android_kernel_oneplus_sm8250/commits/14d16b1ea371b9601cb807d24548d197b1ffe6ec/
对于 8350 来说,树外的内容有这两个仓库:
https://github.com/OnePlusOSS/android_kernel_modules_and_devicetree_oneplus_sm8350
https://github.com/OnePlusOSS/android_vendor_qcom_opensource_audio_kernel_sm8350
官方内核源码里没有配套的 defconfig 文件,想问一下大佬是怎么配置的
对于高通的 GKI 内核,运行 ./scripts/gki/generate_defconfig.sh 即可生成对应 defconfig ,比如 ./scripts/gki/generate_defconfig.sh lahaina-gki_defconfig 。
(运行这个命令可能需要预先 `sudo apt install gcc-aarch64-linux-gnu`)
GKI 内核比较特殊,它的 config 是由好几层 config fragments 叠加而成的,基本上
对于生成的 lahaina-qgki_defconfig:
- 底层是 gki_defconfig
- 向上是 vendor/lahaina_GKI.config(文件中的 =m 会被全部替换为 =y 来进行模块 inline)
- 再向上是 vendor/lahaina_QGKI.config
对于生成的 lahaina-gki_defconfig:
- 底层是 gki_defconfig
- 向上是 vendor/lahaina_GKI.config
至于 gki 和 qgki 的区别,可以看看这篇文章 https://techyminati.hashnode.dev/android-kernel-dev ,一般我们用的都是 qgki 。
官方内核源码里的对应 config 就是平台的对应 config ,sm8350 就是 lahaina ,oplus 的修改已经全部改在这些 config fragments 里面了。
有联系方式么,大佬
不私聊答疑,有问题直接在这里问,这样有相同问题的其它人也能通过搜索引擎找到这里,意义更大
大佬,我根据这个 https://github.com/libxzr/android_kernel_oneplus_sm8250/commits/14d16b1ea371b9601cb807d24548d197b1ffe6ec/ 成功合并了内核和驱动代码并最终编译完成,但是通过 magiskboot 对从手机分区 /dev/block/by-name/boot_a 提取出的镜像进行解包并替换编译生成的 Image ,重打包 boot_a.img 后,通过 flash flash boot_a new_boot.img 命令刷入设备中,但是无法开机。请问大佬如何查看日志进行调试呢
这种情况几乎没有调试方法,除非 pstore 工作正常然后能通过某种方式 warm reboot 启动到正常的系统,才能取得日志。
厂家那边一般是工程机,主板上带 UART 焊点的,那就可以直接读日志了。
不开机的原因可太多了,主要看卡第一屏还是第二屏吧。
第一屏(以及第一屏直接重启)
- avb 捣乱。
- 内核(dts 中的参数)与 bootloader 不匹配,典型的是 8 系从氢换底到 color 。
- 编译器不匹配,编译出的镜像本身是 broken 的。
- 关键基础框架/驱动的初始化失败(e.g. 合并上游时的 mismerge )。
- 关键 GKI 模块的加载失败(我没实际搞过 GKI ,但我估计这个可以是问题,见 https://blog.xzr.moe/archives/236/ )。
第二屏
- 一般均为内核侧初始化成功,但用户空间部分内容初始化失败。一般考虑是不是厂家修改没导全,如果做了 rebase ,考虑 CLO / CAF tag 是否可能与用户空间的 blobs 不匹配等,以及合并上游时是否可能存在 mismerge 。
- 内核模块的加载失败,参见 https://blog.xzr.moe/archives/236/ (仅限于非关键的模块)。
由于你编译的是官方代码,基本可以排除合并上游和手动修改等引入的问题,因此建议:
- 确保内核源码的分支与你的当前系统版本是匹配的。
- 禁用 avb 。
- 尝试编译现有的第三方内核,比如 https://github.com/arter97/android_kernel_oneplus_sm8350 ,这些东西别人已经踩完了坑,只要编译流程 & 编译器正确是必然能开机的。
- 尝试 inline 编译内核模块( config 中的 =m 改为 =y ),从而避免模块加载失败造成的问题。
- 使用 anykernel3 制作内核刷机包,辅助解包打包内核镜像 https://github.com/osm0sis/AnyKernel3 。虽然看起来你用 magiskboot 手动操作也没啥问题,但里面说不定有啥不对的地方呢?
大佬,有适合一加8+ksu编译好的内核或者详细的编译内核教程吗,几天了连没集成ksu的官核都编不出来,各种内核编译报错,人麻了
上面的评论区和酷安的评论区我记得都有很多成功集成 ksu 的案例,可以去问问
https://pastebin.com/gEBPDbFH
大佬这里编译失败是什么原因
关键词:unrecognized option '-EL'
修复:
https://github.com/kdrag0n/proton_zf6/commit/6e87fec9a3df5
https://github.com/kdrag0n/proton_zf6/commit/68acd6966ac98
Ref:
https://t.me/c/1160759313/71
但是,你这里报出问题的是 clang-9 ,而上面提及的问题发生在 clang-12 ,所以有可能这并不是一个合适的修复。
建议:
- 尝试上面的修复。
- 不行的话,更换编译器。
- 不管怎么样这个问题一定是编译器版本相关的。
大佬,我突然发现 https://github.com/OnePlusOSS/android_kernel_oneplus_sm8350 的代码好像是一加 9 氢氧 os 系统的内核代码。一加 9 ColorOS 系统的代码是在这儿吗 https://github.com/oppo-source/android_kernel_oppo_sm8350/
从安卓 12 开始就没有氢了,氧只是魔改的 color 了,所以 11 分支的代码是之前氢氧的,12 之后的分支就是 color 和氧的了。看一看源码根目录里有没有 OplusKernelEnvConfig.mk ,有的话就是 color / 换皮氧的代码。至于 oppo-source ,欧加的机子本质上用的是同一套代码,比如一加 8 拿 find x2 的代码也能开机,所以要说 color 的代码在那也没啥毛病。
大佬,我终于到一加 9 ColorOS13.1 的官方源码编译完成了,通过修补 boot 的方式刷入了设备中,但是发现电池不显示电量也不能充电,usb 可以正常连接。之后我又刷了其他系统版本的 ColorOS 13.1,也是同样的现象。想问一下是什么配置没配么
对了,sys/class/power_supply/ 目录是空的
注册在 power_supply 下面的驱动对应到源码中的 drivers/power ,可以重点关注一下这里的编译条件。
drivers/power/Makefile
```
$(warning $(CONFIG_OPLUS_CHG_OP9RT_PMIC_VOOCPHY))
ifeq ($(strip $(CONFIG_OPLUS_CHG_OP9RT_PMIC_VOOCPHY)), y)
obj-$(CONFIG_OPLUS_SM8350_CHARGER) += oplus/
else ifeq ($(strip $(CONFIG_CHG_FOR_OP9_PRO)), y)
obj-$(CONFIG_OPLUS_SM8350_CHARGER) += oplus_chg/
else
obj-$(CONFIG_OPLUS_SM8350_CHARGER) += oplus/
endif
```
根据 OplusKernelEnvConfig.mk 和 oplus_native_features.mk 的配置,它有时会编译该目录下的 oplus_chg/ ,有时又会去追踪一个软连接 oplus/ ,所以我觉得重点得先搞清楚当前源码触发的是哪个编译条件,是否与当前机型匹配,是否存在坏掉的链接(比如没有正确修复 oplus/ 的软链接)。
建议:到 out 目录下面看看编译产物,先观察一下这块东西有没有被编译进去。如果有问题又不想研究它的那堆变量的话,那可以把别的条件分支全删了只留一个需要的。
drivers/power/Makefile 内容如下:
'''
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_POWER_AVS) += avs/
obj-$(CONFIG_POWER_RESET) += reset/
obj-$(CONFIG_POWER_SUPPLY) += supply/
#ifdef OPLUS_FEATURE_CHG_BASIC
$(warning $(CONFIG_OPLUS_CHG_OP9RT_PMIC_VOOCPHY))
ifeq ($(strip $(CONFIG_OPLUS_CHG_OP9RT_PMIC_VOOCPHY)), y)
obj-$(CONFIG_OPLUS_SM8350_CHARGER) += oplus/
else ifeq ($(strip $(BRAND_SHOW_FLAG)), oneplus)
obj-$(CONFIG_OPLUS_SM8350_CHARGER) += oplus_chg/
else
obj-$(CONFIG_OPLUS_SM8350_CHARGER) += oplus/
endif
#endif
'''
ColorOS 系统需要的驱动是 oplus_chg,但是默认是 oplus。我尝试编译 oplus_chg 驱动,刷入手机后电量正常了。
感谢大佬!!
大佬,
请教一下。
关于官方最新的代码,https://github.com/OnePlusOSS/android_kernel_oneplus_sm8250/tree/oneplus/sm8250_u_14.0.0_op8t
编译出来的内核,在ColorOS14上 light sensor和magenet sensor都挂了, 这个可以从哪个地方排查问题?
这个是日志: https://pastebin.com/fa6yiYrG
从dmesg看出就是卡在 这HAL 上[ 24.700979] (4)[1:init]init: Control message: Could not find '[email protected]::ISensors/default' for ctl.interface_start from pid: 712 (/system/bin/hwservicemanager)
但是无法进一步查看到底是哪个地方出错了。
官方内核抓的日志(logcat),
正常应该是这样:
05-09 01:28:10.357 1218 1218 I HidlServiceManagement: Registered [email protected]::ISensors/default
05-09 01:28:10.359 1850 2595 W SensorService: mmc5603x Magnetometer Non-wakeup's max range 3000.000000000000 is not a multiple of the resolution 0.097599998116 - updated to 3000.028808593750
05-09 01:28:10.359 1850 2595 W SensorService: mmc5603x Magnetometer Wakeup's max range 3000.000000000000 is not a multiple of the resolution 0.097599998116 - updated to 3000.028808593750
05-09 01:28:10.359 1850 2595 W SensorService: mmc5603x Magnetometer-Uncalibrated Non-wakeup's max range 3000.000000000000 is not a multiple of the resolution 0.097599998116 - updated to 3000.028808593750
05-09 01:28:10.359 1850 2595 W SensorService: mmc5603x Magnetometer-Uncalibrated Wakeup's max range 3000.000000000000 is not a multiple of the resolution 0.097599998116 - updated to 3000.028808593750
05-09 01:28:10.359 1850 2595 I SensorService: pedometer Non-wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: pedometer Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: pedometer Non-wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: pedometer Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: pick_up_motion Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: device_orient Non-wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: device_orient Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: free_fall Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: sensor_logger Non-wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: amd_oplus Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: lux_aod Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: pedometer_minute Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: cmc_oplus Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: elevator_detect Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: oplus_activity_recognition Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: context_aware Non-wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 I SensorService: oca_detect Wakeup's reported power 0.000000 invalid, clamped to 0.001000
05-09 01:28:10.359 1850 2595 W SensorService: SensorDevice, reset all of them.
05-09 01:28:10.359 1850 2595 W SensorService: SensorDevice, reset bmi26x Accelerometer Non-wakeup hardware status.
05-09 01:28:10.364 1850 2595 W SensorService: SensorDevice, reset bmi26x Accelerometer Wakeup hardware status.
05-09 01:28:10.367 1850 2595 W SensorService: SensorDevice, reset mmc5603x Magnetometer Non-wakeup hardware status.
05-09 01:28:10.372 1850 2595 W SensorService: SensorDevice, reset mmc5603x Magnetometer Wakeup hardware status.
05-09 01:28:10.379 1850 2595 W SensorService: SensorDevice, reset Rotation Vector Non-wakeup hardware status.
DTBO.img 用了官方,也有问题。
望指教!
简单看了一下,感觉信息量有点不够。
找不到 android.hardware.sensors 的原因是 sensor hal 没有起来,只要你没有对系统本身进行修改,没有起来 = 起不来 = 可能启动时崩溃了,但是 dmesg 里并没有给出 sensor hal 起不来的原因,建议再去看看 logcat ,sensor hal 在启动时有没有打印些什么报错,如果没有的话,就怀疑是 native crash 了,可以去 /data/tombstones 下面看看能不能找到 sensor hal 的崩溃记录,里面应该能看到造成崩溃的 signal 之类的。
几种可能的情况:
- 找到了 sensor hal 在 logcat 中的错误打印,那就照着原因去修(比如报错缺什么内核节点那就看看能不能补上)。
- 找不到 sensor hal 的报错,但是有 tombstone ,而且退出信号比较无厘头,比如空指针的 SEGV 。这种就很棘手,本质上是欧加的工程师代码写太烂了,没处理好边界情况导致进程直接崩了,但是我们一时半会儿也很难摸出来这个“边界情况”到底是什么,只能祝好运了。
sensor hal 起不来可能是因为 oplus 特有 sensor 相关代码没有被正确编译,oplus 特有的 sensor 代码位于 android_kernel_modules_and_devicetree_oneplus_sm8250 仓库中的 vendor/oplus/sensor/kernel/qcom/sensor ,可以观察一下里面的 makefile 看看有没有可能因为错误的编译条件造成驱动缺失,上面的评论里有个修电量的,也许可以借鉴一下思路。从 vendor/qcom/proprietary/devicetree-4.19/19805/kona-19805-sensor.dtsi 可见环境光传感器和磁传感器都向 vendor/oplus/sensor/kernel/qcom/sensor/oplus_sensor_devinfo.c 进行的注册,所以 oplus_sensor_devinfo 是否工作正常也许是一个可以下手的地方。
感谢大佬回复。
昨天抓了原包内核的日志
发现和自编译的区别:
正常工作的:
[ 15.167125] (5)[2211:oplus_sensor_fb]adsp_value = 2, node_type=0
[ 15.167149] (6)[101:sensor_feedback]event_id =1000, count =0
[ 15.167151] (6)[101:sensor_feedback]sensor_list virt_sns = 0xfe, phy_sns = 0x7b
[ 15.167152] (6)[101:sensor_feedback]event_id =0, count =1
[ 15.167153] (6)[101:sensor_feedback]not find event_id =0, count =1
自编译的是:
[ 13.469343] (2)[101:sensor_feedback]event_id =1000, count =0
[ 13.469348] (2)[101:sensor_feedback]sensor_list virt_sns = 0x98, phy_sns = 0x58
[ 13.469351] (2)[101:sensor_feedback]event_id =1, count =1
[ 13.469356] (2)[101:sensor_feedback]payload1 =NULL$$EventField@@device_ps_init_fail$$FieldData@@2$$detailData@@0 0 0$$SensorName@@0x0
[ 13.469423] (6)[236:fb_flush] fb_kevent_send_to_user
[ 13.469424] (6)[236:fb_flush] data_len is 152
[ 13.469452] (2)[101:sensor_feedback]send oplus kevent fb
感觉这应该就是报错的原因。
对应的代码是:
static int parse_shr_info(struct sensor_fb_cxt *sensor_fb_cxt)
{
int ret = 0;
int count = 0;
uint16_t event_id = 0;
int index = 0;
unsigned char payload[1024] = {0x00};
int fb_len = 0;
unsigned char detail_buff[128] = {0x00};
for (count = 0; count < sensor_fb_cxt->adsp_event_counts; count ++) {
event_id = sensor_fb_cxt->fb_smem.event[count].event_id;
pr_info("event_id =%d, count =%d\n", event_id, count);
index = find_event_id(event_id);
if (index == -1) {
pr_info("not find event_id =%d, count =%d\n", event_id, count);
continue;
}
ret = procce_special_event_id(event_id, count, sensor_fb_cxt);
if (ret == 1) {
continue;
}
memset(payload, 0, sizeof(payload));
memset(detail_buff, 0, sizeof(detail_buff));
snprintf(detail_buff, sizeof(detail_buff), "%d %d %d",
sensor_fb_cxt->fb_smem.event[count].buff[0],
sensor_fb_cxt->fb_smem.event[count].buff[1],
sensor_fb_cxt->fb_smem.event[count].buff[2]);
fb_len += scnprintf(payload, sizeof(payload),
"NULL$$EventField@@%s$$FieldData@@%d$$detailData@@%s$$SensorName@@0x%x",
g_fb_conf[index].fb_field,
sensor_fb_cxt->fb_smem.event[count].count,
detail_buff,
sensor_fb_cxt->fb_smem.event[count].name);
pr_info("payload1 =%s\n", payload);
#if defined(CONFIG_OPLUS_FEATURE_FEEDBACK) || defined(CONFIG_OPLUS_FEATURE_FEEDBACK_MODULE)
oplus_kevent_fb(FB_SENSOR, g_fb_conf[index].fb_event_id, payload);
pr_info("send oplus kevent fb\n");
#endif
}
return ret;
}
官方的日志是,在循环的第二次获取的event_id 对应的是0, 而自编译的1, 就对应了 PS_INIT_FAIL_ID (PROXIMITY传感器初始化失败?)
这个event_id是通过read_data_from_share_mem, qcom_smem_get 获取到的,然后我就懵了。
不知道该怎么排查了。。
#define SMEM_SENSOR_FEEDBACK (128)
static int read_data_from_share_mem(struct sensor_fb_cxt *sensor_fb_cxt)
{
size_t smem_size = 0;
void *smem_addr = NULL;
struct fb_event_smem *fb_event = NULL;
smem_addr = qcom_smem_get(QCOM_SMEM_HOST_ANY,
SMEM_SENSOR_FEEDBACK,
&smem_size);
if (IS_ERR(smem_addr)) {
pr_err("unable to acquire smem SMEM_SENSOR_FEEDBACK entry\n");
return -1;
}
fb_event = (struct fb_event_smem *)smem_addr;
if (fb_event == ERR_PTR(-EPROBE_DEFER)) {
fb_event = NULL;
return -2;
}
memcpy((void *)&sensor_fb_cxt->fb_smem, (void *)fb_event, smem_size);
return 0;
}
这个是无解的,smem 是一块特殊的预留内存,用于 soc 片上组件之间的通信,adsp 可以理解为 cpu 之外的一个协处理器,一些要求低功耗且持续运行的任务会被 offload 上去,比如各种传感器还有熄屏语音唤醒之类的。
这里不知道是不是欧加改了 adsp 固件,adsp 会把传感器事件写在预留内存的特殊位置,然后内核在 adsp_notify 节点被写入的时候,会拉起 sensor_report_thread 线程去把传感器事件给读出来,然后发现有特殊事件的话就通过 oplus_kevent_fb 走 netlink socket 上报给用户空间的服务。所以原因只能是 adsp 上报的事件本身就有问题,或者其它原因间接导致了 adsp 的问题,这里的代码只牵扯到事件的上报,怎么修改都是无法解决根本问题的。所以,如果是 sensor 服务没有处理好那个事件上报导致 sensor 服务整个崩掉的话,那可以把 oplus_kevent_fb 屏蔽了试试,否则这里怎么修改应该都对问题的解决没有帮助。我觉得还是得先聚焦于 sensor 服务为什么会崩,去看看 sensor 服务本身有没有打印 logcat 或者 tombstone 吧。
非常感谢!
问题已解决
https://github.com/Rohail33/Realking_kernel_sm8250/commit/8b8be227f5eb2f9e01cc87136dfd02d420e5495f
适用于ColorOS 14.0 200+ 固件。
👍
git merge 合并提示拒绝合并无关历史怎么弄
这种一般是因为它确实是无关的,建议直接手动复制粘贴,或者用 git subtree / submodule 。
感谢大佬回复,已经知道这个问题怎么回事了,只有从GitHub上面拉取合并才不会出现提示无历史合并,还有一个问题想要问一下为什么跑出来的内核没有声音,内核是4.14谷歌上面也没查到怎么解决
主要关注一下 audio techpack 的编译情况?
可以尝试 inline 一下里面的模块之类的
https://github.com/libxzr/android_kernel_oneplus_sm8250/commit/5482271c756a16711973ff8608d9d11a0943e8ea
你好, 我自己编译小米手机的内核, 编译出来的内核体积比官方的内核体积小了很多(官方的:51M, 自己编译的:37M)
内核刷入后也无法开机(卡第一屏, 小米logo)
想请问一下这有可能是哪方面的原因.
谢谢
主要关注一下 techpack 之类的 out of tree 的东西,它们可能需要手动合并到源码树中,编译出来的产物才会是完整的