Skip to content

Commit

Permalink
SGSIs: Update to v1.9
Browse files Browse the repository at this point in the history
Signed-off-by: Pinkdoge <3361534564@qq.com>
  • Loading branch information
Pinkdoge committed Oct 25, 2020
1 parent eb61fcf commit 748c4db
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 44 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-XiaoxinSGSIs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ jobs:
- name: Generate SGSI
run: |
rm -rf SGSI-build-tool/10/SGSI.sh SGSI-build-tool/10/makeimg.sh SGSI-build-tool/10/bin/mke2fs SGSI-build-tool/10/bin/e2fsdroid SGSI-build-tool/10/dynamic_SGSI.sh SGSI-build-tool/10/oppo.sh
mv make/makeimg.sh make/SGSI.sh make/dynamic_SGSI.sh make/oppo.sh SGSI-build-tool/10/
rm -rf SGSI-build-tool/10/SGSI.sh SGSI-build-tool/10/makeimg.sh SGSI-build-tool/10/bin/mke2fs SGSI-build-tool/10/bin/e2fsdroid SGSI-build-tool/10/dynamic_SGSI.sh SGSI-build-tool/10/oppo.sh SGSI-build-tool/10/make.sh
mv make/makeimg.sh make/SGSI.sh make/dynamic_SGSI.sh make/oppo.sh make/make.sh SGSI-build-tool/10/
mv bin/mke2fs bin/e2fsdroid SGSI-build-tool/10/bin/
cd SGSI-build-tool/10
sudo bash make.sh
- name: Prepare Files to Make Patch
- name: Make Patch Module
run: |
zip -r Prepare_patch.zip SGSI-build-tool/10/out/vendor/app/* SGSI-build-tool/10/out/vendor/bin/* SGSI-build-tool/10/out/vendor/etc/* SGSI-build-tool/10/out/vendor/lib/* SGSI-build-tool/10/out/vendor/lib64/* SGSI-build-tool/10/out/vendor/overlay/*
sudo mv Prepare_patch.zip SGSI-build-tool/10/SGSI/
zip -r Patchmod.zip SGSI-build-tool/10/out/vendor/app/* SGSI-build-tool/10/out/vendor/bin/* SGSI-build-tool/10/out/vendor/etc/* SGSI-build-tool/10/out/vendor/lib/* SGSI-build-tool/10/out/vendor/lib64/* SGSI-build-tool/10/out/vendor/overlay/*
sudo mv Patchmod.zip SGSI-build-tool/10/SGSI/
- name: Zip Patch
run: |
Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

<br />

<div align="center">
<span style="font-weight: bold"> 中文 | <a href=README_EN.md>English</a> </span>
</div>

<br />

## 配置

配置文件是[sgsi.json](sgsi.json)
Expand All @@ -38,10 +44,19 @@ Fork此仓库后,点击右上角Star就会开始
## 制作结果
在此提供三个选择,详情请看表格

## 关于Patch
这里引用小新大大的一句话
>本工具仅仅制作system.img部分 Patch部分需要手动 因为有些处理自动化并不理想 多变 所以手动制造Patch1 2 3更好
## 文件结构

| 文件名 | 类型 | 描述 |
| ------------------ | ------- | ------------------------------------------------------------ |
| `system.img` | IMG | SGSI本体 |
| `Patch1.zip`<br>`Patch2.zip`<br>`Patch3.zip` | ZIP | Patch模板 |
| `Patchmod.zip` | ZIP | 给用户套Patch模板以制作补丁的压缩包 |

## 疑难解答
### 问题1: 为什么不支持动态分区ColorOS的SGSI制作?

解答: 动态分区ColorOS制作出来的SGSI,经过多次测试仍然无法开机,故舍弃此方案

***Prepare_patch.zip***是我从Rom的vendor提取部分文件打包得来,用以筛选文件合成Patch1
### 问题2: 为什么工具不能全自动化制作?

Patch样本我已内置在压缩包里,请解压后自行更改
解答: 本工具Patch部分需要手动 因为有些处理自动化并不理想 多变 所以手动制造Patch1 2 3更好 (感谢 **[@迷路的小新大大](https://github.com/xiaoxindada)**
56 changes: 56 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<h1 align="center"> Auto XiaoxinSGSIs Tools </h1>

<p align="center">
A Github Action to make XiaoxinSGSIs
</p>

<div align="center">
<a href="../../actions">
<img src="../../workflows/build_XiaoxinSGSIs/badge.svg" title="Building Status" />
</a>
</div>

<br />

## Configuration

The configuration file is [sgsi.json](sgsi.json)

| Variable | Type | Description |
| ------------------ | ------- | ------------------------------------------------------------ |
| `rom_url` | String | Your rom url |
| `rom_name` | String | Your rom file name |
| `pack_sgsi` | String | The compressed file name after compilation |
| `make_miui` | Boolean | Indicates whether to make MIUI sgsi |
| `make_flyme` | Boolean | Indicates whether to make Flyme sgsi |
| `make_coloros` | Boolean | Indicates whether to make ColorOS sgsi |
| `make_h2os` | Boolean | Indicates whether to make H2OS sgsi |
| `make_smartisanos` | Boolean | Indicates whether to make SmartisanOS sgsi |
| `make_zui` | Boolean | Indicates whether to make zui sgsi |
| `make_super` | Boolean | Indicate whether to create a dynamic partitioned sgsi <sub>(Note: The production of `ColorOS` with dynamic partition is not supported)</sub> |
| `upload_transfer` | Boolean | Indicate whether to upload sgsi to wetransfer |
| `upload_artifact` | Boolean | Indicate whether to upload sgsi to artifact <sub>(Note: Github seems to have restrictions on free users, uploads can no longer be uploaded after a certain amount of upload, so this scheme is not recommended)</sub> |

## Start

After Fork this repositorie, click on Star in the upper right corner to start

## Compilation result
Provide three upload ways, please see the form for details

## File Structure

| File | Type | Description |
| ------------------ | ------- | ------------------------------------------------------------ |
| `system.img` | IMG | The main of SGSI |
| `Patch1.zip`<br>`Patch2.zip`<br>`Patch3.zip` | ZIP | Patch template |
| `Patchmod.zip` | ZIP | Apply patch templates to make patches |

## Troubleshoot
### Q1: Why not support the SGSI production of super partition ColorOS?

A1: The SGSI produced by Dynamic Partition ColorOS can not boot after several tests, so it is not supported.

### Q2: Why can't tools make SGSI fully automated?

A2: The Patch part of this tool needs to be manually, because some processing automation is not ideal and often changes, so it is better to make Patch1 2 3 manually (Thanks to **[@迷路的小新大大](https://github.com/xiaoxindada)**
24 changes: 8 additions & 16 deletions make/SGSI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ function normal (){
echo "" >> ./make/add_build/build2
echo "#oem厂商自定义属性" >> ./make/add_build/build2

true > ./make/add_build/build3
echo "" >> ./make/add_build/build3
echo "#oem厂商odm自定义属性" >> ./make/add_build/build3
echo "重置完成"

echo "" > /dev/null 2>&1

#系统种类检测
Expand Down Expand Up @@ -241,7 +236,6 @@ function normal (){
sed -i 's/ro.sf.lcd/#&/' ./out/system/system/product/build.prop
cat ./make/add_build/build1 >> ./out/system/system/build.prop
cat ./make/add_build/build2 >> ./out/system/system/build.prop
cat ./make/add_build/build3 >> ./out/system/system/build.prop
rm -rf ./make/add_build/*.bak

mainkeys="$(grep 'qemu.hw.mainkeys=' ./out/system/system/build.prop)"
Expand Down Expand Up @@ -331,6 +325,9 @@ function normal (){
./add_phh_lib64_fs.sh
cd ../../../

#为phh化注册必要的selinux上下文
cat ./make/add_phh/plat_file_contexts >> ./out/system/system/etc/selinux/plat_file_contexts

#fs数据整合
cat ./make/add_fs/contexts >> ./out/config/system_file_contexts
cat ./make/add_fs/fs >> ./out/config/system_fs_config
Expand Down Expand Up @@ -434,11 +431,6 @@ function mandatory_pt (){
true > ./make/add_build/build2
echo "" >> ./make/add_build/build2
echo "#oem厂商自定义属性" >> ./make/add_build/build2

true > ./make/add_build/build3
echo "" >> ./make/add_build/build3
echo "#oem厂商odm自定义属性" >> ./make/add_build/build3
echo "重置完成"

echo "" > /dev/null 2>&1

Expand Down Expand Up @@ -526,13 +518,10 @@ function mandatory_pt (){
sed -i '/ro.control_privapp_permissions/d' ./out/system/system/build.prop
sed -i 's/ro.sf.lcd/#&/' ./out/system/system/build.prop
sed -i 's/ro.sf.lcd/#&/' ./out/system/system/product/build.prop
sed -i '/debug.sf.early_app_phase_offset_ns/d' ./out/system/system/build.prop
sed -i '/debug.sf.early_gl_app_phase_offset_ns/d' ./out/system/system/build.prop
sed -i '/debug.sf.early_gl_phase_offset_ns/d' ./out/system/system/build.prop
sed -i '/debug.sf.early_phase_offset_ns/d' ./out/system/system/build.prop
sed -i '/debug.sf/d' ./out/system/system/build.prop
sed -i '/hbm/d' ./out/system/system/build.prop
cat ./make/add_build/build1 >> ./out/system/system/build.prop
#cat ./make/add_build/build2 >> ./out/system/system/build.prop
cat ./make/add_build/build3 >> ./out/system/system/build.prop
rm -rf ./make/add_build/*.bak

mainkeys="$(grep 'qemu.hw.mainkeys=' ./out/system/system/build.prop)"
Expand Down Expand Up @@ -603,6 +592,9 @@ function mandatory_pt (){
./add_phh_lib64_fs.sh
cd ../../../

#为phh化注册必要的selinux上下文
cat ./make/add_phh/plat_file_contexts >> ./out/system/system/etc/selinux/plat_file_contexts

#fs数据整合
cat ./make/add_fs/contexts >> ./out/config/system_file_contexts
cat ./make/add_fs/fs >> ./out/config/system_fs_config
Expand Down
16 changes: 2 additions & 14 deletions make/dynamic_SGSI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,6 @@ function normal (){
true > ./make/add_build/build2
echo "" >> ./make/add_build/build2
echo "#oem厂商自定义属性" >> ./make/add_build/build2

true > ./make/add_build/build3
echo "" >> ./make/add_build/build3
echo "#oem厂商odm自定义属性" >> ./make/add_build/build3
echo "重置完成"

echo "" > /dev/null 2>&1

Expand Down Expand Up @@ -318,7 +313,6 @@ function normal (){
sed -i 's/ro.sf.lcd/#&/' ./out/system/system/product/build.prop
cat ./make/add_build/build1 >> ./out/system/system/build.prop
cat ./make/add_build/build2 >> ./out/system/system/build.prop
cat ./make/add_build/build3 >> ./out/system/system/build.prop
rm -rf ./make/add_build/*.bak

mainkeys="$(grep 'qemu.hw.mainkeys=' ./out/system/system/build.prop)"
Expand Down Expand Up @@ -583,11 +577,6 @@ function mandatory_pt (){
true > ./make/add_build/build2
echo "" >> ./make/add_build/build2
echo "#oem厂商自定义属性" >> ./make/add_build/build2

true > ./make/add_build/build3
echo "" >> ./make/add_build/build3
echo "#oem厂商odm自定义属性" >> ./make/add_build/build3
echo "重置完成"

echo "" > /dev/null 2>&1

Expand Down Expand Up @@ -676,12 +665,11 @@ function mandatory_pt (){
sed -i 's/ro.sf.lcd/#&/' ./out/system/system/build.prop
sed -i 's/ro.sf.lcd/#&/' ./out/system/system/product/build.prop
sed -i '/debug.sf.early_app_phase_offset_ns/d' ./out/system/system/build.prop
sed -i '/debug.sf.early_gl_app_phase_offset_ns/d' ./out/system/system/build.prop
sed -i '/debug.sf.early_gl_phase_offset_ns/d' ./out/system/system/build.prop
sed -i '/debug.sf/d' ./out/system/system/build.prop
sed -i '/hbm/d' ./out/system/system/build.prop
sed -i '/debug.sf.early_phase_offset_ns/d' ./out/system/system/build.prop
cat ./make/add_build/build1 >> ./out/system/system/build.prop
#cat ./make/add_build/build2 >> ./out/system/system/build.prop
cat ./make/add_build/build3 >> ./out/system/system/build.prop
rm -rf ./make/add_build/*.bak

mainkeys="$(grep 'qemu.hw.mainkeys=' ./out/system/system/build.prop)"
Expand Down
130 changes: 130 additions & 0 deletions make/make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/bin/bash

#by 迷路的小新大大

source ./bin.sh

echo "环境初始化中 请稍候......."
chmod -R 777 ./
chown -R root:root ./
rm -rf ./out
rm -rf ./SGSI
echo "初始化环境完成"
echo "请把要解压的刷机包放入tmp文件夹中"
read -p "请输入需要解压的zip包名: " zip
echo "解压当前目录的刷机包中......"
cd ./tmp

if [ -e ./$zip ];then
7z x ./$zip
echo "解压zip完成"
else
echo "当前所输入的刷机包不存在"
fi

#payload.bin检测
if [ -e './payload.bin' ];then
mv ./payload.bin ../payload
echo "解压payload.bin中......."
cd ../
cd ./payload
python3 ./payload.py ./payload.bin ./out
mv ./payload.bin ../tmp
echo "移动img至输出目录......."

if [ -e "./out/product.img" ];then
mv ./out/product.img ../tmp/
fi

if [ -e "./out/reserve.img" ];then
mv ./out/reserve.img ../tmp/
fi

mv ./out/system.img ../tmp/
mv ./out/vendor.img ../tmp/
rm -rf ./out/*
cd ../
cd ./tmp
mv ./system.img ../
mv ./vendor.img ../

if [ -e "./product.img" ];then
mv ./product.img ../
fi

if [ -e "./res:erve.img" ];then
mv ./reserve.img ../
fi

echo "转换完成"
fi

#br检测
if [ -e ./system.new.dat.br ];then
echo "正在解压system.new.br"
if [ -e ./system.new.dat.br ];then
brotli -d system.new.dat.br
python $bin/sdat2img.py system.transfer.list system.new.dat ./system.img
mv ./system.img ../
rm -rf ./system.new.dat
fi

if [ -e ./vendor.new.dat.br ];then
echo "正在解压vendor.new.br"
brotli -d vendor.new.dat.br
python $bin/sdat2img.py vendor.transfer.list vendor.new.dat ./vendor.img
mv ./vendor.img ../
fi

if [ -e ./product.new.dat.br ];then
echo "正在解压product.new.br"
brotli -d product.new.dat.br
python $bin/sdat2img.py product.transfer.list product.new.dat ./product.img
mv ./product.img ../
fi

if [ -e ./system_ext.new.dat.br ];then
echo "正在解压system_ext.new.br"
brotli -d system_ext.new.dat.br
python $bin/sdat2img.py system_ext.transfer.list system_ext.new.dat ./system_ext.img
mv ./system_ext.img ../
fi
fi

#dat检测
if [ -e ./system.new.dat ];then
echo "正在转换system.new.dat"
if [ -e ./system.new.dat ];then
python $bin/sdat2img.py system.transfer.list system.new.dat ./system.img
mv ./system.img ../
fi

if [ -e ./vendor.new.dat ];then
python $bin/sdat2img.py vendor.transfer.list vendor.new.dat ./vendor.img
mv ./vendor.img ../
fi

if [ -e ./product.new.dat ];then
python $bin/sdat2img.py product.transfer.list product.new.dat ./product.img
mv ./product.img ../
fi

if [ -e ./system_ext.new.dat ];then
echo "正在解压system_ext.new.dat"
python $bin/sdat2img.py system_ext.transfer.list system_ext.new.dat ./system_ext.img
mv ./system_ext.img ../
fi
fi

#img检测
if [ -e ./system.img ];then
mv ./*.img ../
fi

cd ../
if [ -e ./system.img ];then
./SGSI.sh
exit
else
echo "没有检测到system.img 无法制作SGSI"
fi
8 changes: 4 additions & 4 deletions sgsi.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"rom_url": "https://nchc.dl.sourceforge.net/project/xiaomi-eu-multilang-miui-roms/xiaomi.eu/MIUI-WEEKLY-RELEASES/20.9.17/xiaomi.eu_multi_HMNote7_20.9.17_v12-10.zip",
"rom_name": "xiaomi.eu_multi_HMNote7_20.9.17_v12-10.zip",
"pack_sgsi": "HMNote7_20.9.17_Q-eu_XiaoxinSGSIs_Pinkdoge.7z",
"rom_url": "https://udomain.dl.sourceforge.net/project/xiaomi-eu-multilang-miui-roms/xiaomi.eu/MIUI-WEEKLY-RELEASES/20.10.22/xiaomi.eu_multi_HMNote7_20.10.22_v12-10.zip",
"rom_name": "xiaomi.eu_multi_HMNote7_20.10.22_v12-10.zip",
"pack_sgsi": "HMNote7_20.10.22_Q-eu_XiaoxinSGSIs_Pinkdoge.7z",
"make_miui": true,
"make_flyme": false,
"make_coloros": false,
Expand All @@ -10,5 +10,5 @@
"make_zui": false,
"make_super": false,
"upload_transfer": true,
"upload_artifact": true
"upload_artifact": false
}

0 comments on commit 748c4db

Please sign in to comment.