Hyper 移植

备注

!!!仅适用于marble!!!
将需要移植的HyperOS文件置于
DNA_HyperSuper项目中,再进行分解
需分解product system system_ext mi_ext四个分区
新版NFC页面修改在vendor分区的prop文件

超级壁纸有无
是否为支持机型的MIWallpaperOverlay.apk

设置启用小米澎湃AI
搜索.method public static isAiSupported()Z
清空改为0x1

相机启用实验室选项
搜索camera.lab.options
改为0x1
相机解锁4k60
c1.v0类(旧版) d1.u0类(新版) 搜索static s
寄存器后第一个0x0
改0x1 const/4 p0, 0x1
相机隐私政策
靠上行

1
https://privacy.mi.com/all/%s_%s

靠下行

1
https://privacy.mi.com/all/

小米预加载prop
系统启动时需要预启动的进程列表

1
persist.sys.prestart.proc

启用或禁用预加载机制,在系统启动时提前加载应用或服务

1
persist.sys.preload.enable

启用或禁用启动反馈机制,可能是与用户启动应用时的反馈相关

1
persist.sys.prestart.feedback.enable

启用或禁用预缓存机制,在启动时缓存某些数据或资源

1
persist.sys.precache.enable

启用或禁用应用程序 Dex 文件的预加载,提高应用启动速度

1
persist.sys.app_dexfile_preload.enable

一键移植Shell脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/bash

# ANSI颜色代码
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # 重置颜色

# 打印函数
print_msg() {
local color=$1
shift
echo -e "${color}$*${NC}"
}

print_error() {
print_msg "$RED" "$1"
}

print_success() {
print_msg "$GREEN" "$1"
}

print_warning() {
print_msg "$YELLOW" "$1"
}

print_info() {
print_msg "$CYAN" "$1"
}

print_title() {
echo -e "${BLUE}============================================${NC}"
print_msg "$BLUE" "$1"
echo -e "${BLUE}============================================${NC}"
}

# 检查root权限
if [ "$(id -u)" -ne 0 ]; then
print_error "错误:此脚本需要root权限!请使用sudo运行"
exit 1
fi

# ==================== 精简操作 ====================
print_title "执行精简操作"
targets=(
"/data/DNA/DNA_HyperSuper/product/priv-app/MIUIBrowser"
"/data/DNA/DNA_HyperSuper/product/data-app/BaiduIME"
"/data/DNA/DNA_HyperSuper/product/data-app/iFlytekIME"
"/data/DNA/DNA_HyperSuper/product/data-app/MIGalleryLockscreen"
"/data/DNA/DNA_HyperSuper/product/data-app/MIService"
"/data/DNA/DNA_HyperSuper/product/data-app/MIUIEmail"
"/data/DNA/DNA_HyperSuper/product/data-app/MIUIHuanji"
"/data/DNA/DNA_HyperSuper/product/data-app/MIUIMiDrive"
"/data/DNA/DNA_HyperSuper/product/data-app/MIUIVirtualSim"
"/data/DNA/DNA_HyperSuper/product/app/HybridPlatform"
"/data/DNA/DNA_HyperSuper/product/app/MSA"
"/data/DNA/DNA_HyperSuper/product/app/AnalyticsCore"
"/data/DNA/DNA_HyperSuper/product/app/Updater"
"/data/DNA/DNA_HyperSuper/product/app/MiTrustService"
)

deleted_count=0
not_found_count=0

for target in "${targets[@]}"; do
if [ -d "$target" ]; then
rm -rf "$target"
if [ $? -eq 0 ]; then
print_success "✓ 已删除: $target"
((deleted_count++))
else
print_error "✗ 删除失败: $target"
fi
else
print_warning "⚠ 目录不存在: $target"
((not_found_count++))
fi
done

echo
print_info "---------------------------------"
print_success "精简完成: 删除 $deleted_count 个目录"
print_warning "未找到 $not_found_count 个目录"
print_info "---------------------------------"

# ==================== build.prop处理 ====================
print_title "处理 build.prop 文件"

content='import /product/etc/${ro.boot.product.hardware.sku}_atp.prop'
file_path="/data/DNA/DNA_HyperSuper/mi_ext/etc/build.prop"

if [ -f "$file_path" ]; then
sed -i "1i$content" "$file_path"
print_success "✓ 内容已添加到文件开头: $file_path"
print_info "添加内容: $content"
else
print_error "✗ 文件不存在: $file_path"
fi

# ==================== 分区文件处理 ====================
print_title "处理分区文件"

sources=(
"/data/DNA/需替换文件/system/"
"/data/DNA/需替换文件/product/"
"/data/DNA/需替换文件/system_ext/"
)

destinations=(
"/data/DNA/DNA_HyperSuper/system/"
"/data/DNA/DNA_HyperSuper/product/"
"/data/DNA/DNA_HyperSuper/system_ext/"
)

copied_count=0
for i in "${!sources[@]}"; do
src="${sources[$i]}"
dest="${destinations[$i]}"

if [ -d "$src" ]; then
cp -rf "$src"* "$dest"
if [ $? -eq 0 ]; then
print_success "✓ 复制成功: $src → $dest"
((copied_count++))
else
print_error "✗ 复制失败: $src → $dest"
fi
else
print_error "✗ 源目录不存在: $src"
fi
done

echo
print_info "---------------------------------"
print_success "复制完成: 成功 $copied_count 个分区"
print_info "---------------------------------"

# ==================== 处理tango ====================
print_title "关闭tango服务"

tango_file="/data/DNA/DNA_HyperSuper/system/system/build.prop"

if [ -f "$tango_file" ]; then
if grep -q '^tango' "$tango_file"; then
sed -i 's/tango/#tango/g' "$tango_file"
print_success "✓ tango已成功关闭"
print_warning "已注释包含 'tango' 的行"
else
print_warning "⚠ 未找到需要处理的tango配置"
fi
else
print_error "✗ 文件不存在: $tango_file"
fi

# ==================== 最终结果 ====================
echo
print_title "所有操作已完成"
print_success "运行结束"
echo

marble_atp.prop

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#battery
persist.vendor.batteryantiaging=1
persist.vendor.high_temp_stop_charge=true
persist.vendor.extreme.mode.V2=true
persist.vendor.battery.erp=true
#camera
persist.sys.miui.camera.boost.enable=true
persist.sys.miui.camera.boost.opt=true
persist.sys.miui.camera.protect_prev_ext=true
ro.vendor.audio.zoom.support=true
ro.vendor.audio.zoom.type=2
#screen
persist.miui.density_v2=440
ro.sf.lcd_density=440
#performance
ro.vendor.perf.scroll_opt=1
vendor.perf.framepacing.enable=1
ro.virtual_ab.compression.enabled=true
#cores
persist.sys.miui_animator_sched.bigcores=4-6
persist.sys.miui_animator_sched.big_prime_cores=4-7
persist.vendor.display.miui.composer_boost=4-7
#sf
ro.miui.surfaceflinger_affinity=
persist.sys.miui.sf_cores=
ro.miui.affinity.sfui=4-6
ro.miui.affinity.sfre=4-6
ro.miui.affinity.sfuireset=4-6
#prestrain
persist.sys.preload.enable=false
persist.sys.prestart.proc=false
persist.sys.prestart.feedback.enable=false
#threads
persist.sys.miui_animator_sched.sched_threads=2
#firstframe
persist.sys.first.frame.accelerates=true
#millet
persist.sys.powmillet.enable=true
persist.sys.brightmillet.enable=true
persist.sys.millet.handshake=true
persist.sys.millet.newversion=true
ro.millet.netlink=30
#aptx
persist.vendor.qcom.bluetooth.aptxadaptiver2_2_support=true
#audio
ro.vendor.audio.sfx.harmankardon=false
ro.vendor.audio.clean_speaker=true
#haptic
sys.haptic.slide_version=2.0
#dis timeout
ro.vendor.display.type=
#network voice helper
ro.vendor.audio.voip.assistant=false
#logd_off
vendor.bluetooth.startbtlogger=false
persist.sys.offlinelog.kernel=false
persist.sys.offlinelog.logcat=false
persist.sys.offlinelog.logcatkernel=false
ro.logdumpd.enabled=0
ro.lmk.debug=false
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
sys.miui.ndcd=off
persist.logd.limit=OFF
persist.logd.size=65536
persist.logd.size.crash=1M
persist.logd.size.radio=1M
persist.logd.size.system=1M
persist.mm.enable.prefetch=false
log.tag.stats_log=OFF
ro.logd.size=64K
ro.logd.size.stats=64K
debug.sqlite.wal.syncmode=OFF
debug.sqlite.journalmode=OFF
#Extra Edition
ro.vendor.build.security_patch=2025-06-01
ro.product.brand=Redmi
ro.product.manufacturer=Xiaomi
ro.product.model=23049RAD8C
ro.product.marketname=Redmi Note 12 Turbo
ro.miui.product.home=com.miui.home
debug.game.video.speed=true
debug.game.video.support=true
#configuration
persist.sys.debug.scout_memory_disable_kgsl=true
persist.sys.scout_dumpbysocket=true
persist.sys.scout_binder_gki=true
persist.sys.device_config_gki=true
persist.sys.mmms.lowmem.wmark.boost.factor=1
persist.sys.spc.gamepay.protect.enabled=true
persist.sys.mms.bg_apps_limit=96
persist.sys.mmms.throttled.thread=8960
persist.lm.em.per_flush_quota_low=20000
persist.lm.em.per_flush_quota_medium=12000
persist.lm.em.per_flush_quota_high=8000
persist.lm.em.flush_zram_usedrate=30
persist.em.low_flush_level=8
persist.em.medium_flush_level=6
persist.em.high_flush_level=4
persist.sys.use_boot_compact=true
persist.sys.enable_templimit=true
persist.sys.testTrimMemActivityBg.wk.enable=true
persist.sys.extra_buffer_num=1
persist.sys.memory_standard.enable=true
persist.sys.expend_min_ram_limit=4
persist.sys.memory_standard.appheap.enable=true
persist.sys.memory_standard.handle.time=300000
persist.sys.smartpower.display_camera_fps_enable=true
persist.sys.adoptable=force_off
ro.miui.cust_erofs=1
persist.miui.extm.dm_opt.enable=true

底包文件提取Shell脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash

# ANSI颜色代码
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # 重置颜色

# 打印函数
print_msg() {
local color=$1
shift
echo -e "${color}$*${NC}"
}

print_error() {
print_msg "$RED" "$1"
}

print_success() {
print_msg "$GREEN" "$1"
}

print_warning() {
print_msg "$YELLOW" "$1"
}

print_info() {
print_msg "$CYAN" "$1"
}

print_title() {
echo -e "${BLUE}============================================${NC}"
print_msg "$BLUE" "$1"
echo -e "${BLUE}============================================${NC}"
}

# 源目录和目标目录
SOURCE_DIR="/data/DNA/DNA_HyperSuper/"
REPLACE_DIR="/data/DNA/需替换文件/"
DEST_DIR="/storage/emulated/0/DNA/draw/"

print_title "开始文件比对复制操作"
print_info "源目录: $SOURCE_DIR"
print_info "替换目录: $REPLACE_DIR"
print_info "目标目录: $DEST_DIR"
echo

# 确保目标目录存在
mkdir -p "$DEST_DIR" >/dev/null 2>&1
if [ $? -ne 0 ]; then
print_error "✗ 无法创建目标目录: $DEST_DIR"
exit 1
else
print_success "✓ 目标目录已创建/确认存在: $DEST_DIR"
fi

# 计数器
total_files=0
copied_files=0
missing_files=0
dir_created=0

print_info "正在扫描并复制文件..."
echo

# 临时文件用于存储结果
TMPFILE=$(mktemp)

# 处理文件复制(避免子shell问题)
while IFS= read -r file; do
# 从SOURCE_DIR中提取相对路径
relative_path=${file#"$SOURCE_DIR"}

# 构造在REPLACE_DIR下的完整路径
replace_file="$REPLACE_DIR$relative_path"

# 检查在REPLACE_DIR下是否存在同名文件
if [ -f "$replace_file" ]; then
# 构造目标目录路径
dest_file="$DEST_DIR$relative_path"
dest_dir=$(dirname "$dest_file")

# 确保目标目录存在
if [ ! -d "$dest_dir" ]; then
mkdir -p "$dest_dir" >/dev/null 2>&1
if [ $? -eq 0 ]; then
((dir_created++))
fi
fi

# 复制文件
cp "$file" "$dest_file" >/dev/null 2>&1
if [ $? -eq 0 ]; then
print_success "✓ 复制: ${relative_path:0:60}..."
((copied_files++))
else
print_error "✗ 复制失败: $relative_path"
fi
((total_files++))
else
# 统计但不显示未找到的文件(避免输出过多)
((missing_files++))
fi
done < <(find "$SOURCE_DIR" -type f -print0 | tr '\0' '\n')

# 检查是否找到任何文件
if [ $total_files -eq 0 ] && [ $missing_files -eq 0 ]; then
print_error "⚠ 未在源目录中找到任何文件: $SOURCE_DIR"
print_warning "⚠ 请检查源目录路径是否存在"
fi

echo
print_info "---------------------------------"
print_success "操作完成!"
print_info "---------------------------------"
print_info "处理的文件总数: $total_files"
print_success "成功复制的文件: $copied_files"
print_warning "未找到的替换文件: $missing_files"
print_info "创建的目录数: $dir_created"
print_info "目标目录位置: $DEST_DIR"
print_info "---------------------------------"
echo
print_success "所有操作已完成"

# 清理临时文件
rm -f "$TMPFILE"

目录文件比较Shell脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash

# ANSI颜色代码
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # 重置颜色

# 打印函数
print_msg() {
local color=$1
shift
echo -e "${color}$*${NC}"
}

print_error() {
print_msg "$RED" "$1"
}

print_success() {
print_msg "$GREEN" "$1"
}

print_warning() {
print_msg "$YELLOW" "$1"
}

print_info() {
print_msg "$CYAN" "$1"
}

print_title() {
echo -e "${BLUE}============================================${NC}"
print_msg "$BLUE" "$1"
echo -e "${BLUE}============================================${NC}"
}

# 定义要比较的两个目录
dir1="/data/DNA/DNA_HyperSuper/product/overlay"
dir2="/data/DNA/需替换文件/product/overlay"

print_title "目录差异比较工具"
print_info "目录1: $dir1"
print_info "目录2: $dir2"
echo

# 检查目录是否存在
if [ ! -d "$dir1" ]; then
print_error "错误:目录 $dir1 不存在"
exit 1
fi
if [ ! -d "$dir2" ]; then
print_error "错误:目录 $dir2 不存在"
exit 1
fi

print_info "正在扫描目录内容..."
# 创建临时文件
tmp_dir=$(mktemp -d)
tmp1="$tmp_dir/dir1_files.txt"
tmp2="$tmp_dir/dir2_files.txt"
common_files="$tmp_dir/common_files.txt"
only_in_dir1="$tmp_dir/only_in_dir1.txt"
diff_files="$tmp_dir/diff_files.txt"

# 生成文件列表(相对路径)
(cd "$dir1" && find . -type f | sort > "$tmp1")
(cd "$dir2" && find . -type f | sort > "$tmp2")

# 计算文件总数
total_dir1=$(wc -l < "$tmp1")
total_dir2=$(wc -l < "$tmp2")

# 找出仅在 dir1 中的文件
comm -23 "$tmp1" "$tmp2" > "$only_in_dir1"
only_in_dir1_count=$(wc -l < "$only_in_dir1")

# 找出共同文件列表
comm -12 "$tmp1" "$tmp2" > "$common_files"
common_count=$(wc -l < "$common_files")

# 检查共同文件内容差异
echo -n "" > "$diff_files" # 清空文件
diff_count=0
while IFS= read -r file; do
file1="$dir1/$file"
file2="$dir2/$file"
if ! cmp -s "$file1" "$file2"; then
echo "$file" >> "$diff_files"
((diff_count++))
fi
done < "$common_files"

# 输出统计信息
echo
print_info "----------------------------------------"
print_info "目录1文件总数: $total_dir1"
print_info "目录2文件总数: $total_dir2"
print_info "共同文件数量: $common_count"
print_warning "仅在目录1中存在的文件: $only_in_dir1_count"
print_warning "内容不同的文件: $diff_count"
print_info "----------------------------------------"

# 输出结果
if [ $only_in_dir1_count -gt 0 ] || [ $diff_count -gt 0 ]; then
echo
print_warning "⚠ 检测到目录差异"

if [ $only_in_dir1_count -gt 0 ]; then
echo
print_warning "仅在 $dir1 中存在的文件:"
# 截断长路径显示
while IFS= read -r file; do
if [ ${#file} -gt 60 ]; then
echo "...${file: -57}"
else
echo "$file"
fi
done < "$only_in_dir1"
fi

if [ $diff_count -gt 0 ]; then
echo
print_warning "共同文件中内容不同的文件:"
# 截断长路径显示
while IFS= read -r file; do
if [ ${#file} -gt 60 ]; then
echo "...${file: -57}"
else
echo "$file"
fi
done < "$diff_files"
fi
else
print_success "✓ 目录内容完全一致"
fi

echo
print_info "----------------------------------------"

# 清理临时文件
rm -rf "$tmp_dir"

# 返回成功退出码
exit 0