Skip to content

Instantly share code, notes, and snippets.

@nooriro
Last active July 19, 2022 18:11
Show Gist options
  • Save nooriro/dfc13fb34dc59749ee1fffdea152123b to your computer and use it in GitHub Desktop.
Save nooriro/dfc13fb34dc59749ee1fffdea152123b to your computer and use it in GitHub Desktop.
codename initial build_number bootloader_version baseband_version system_size vendor_size product_size system_ext_size build_incremental build_timestamp mcfg_version
sunfish Q QD4A.200317.024.A1 s5-0.2-6281315 g7150-00013-200421-B-6413509 806584320 571858944 2183749632 0 6456895 1588517452 MCFG-g7150-00013-200416-B-6400682
sunfish Q QD4A.200317.027 s5-0.2-6281315 g7150-00013-200424-B-6426960 806584320 571858944 2183749632 0 6463901 1588696545 MCFG-g7150-00013-200424-B-6426960
sunfish Q QD4A.200805.001 s5-0.2-6281315 g7150-00013-200421-B-6413509 806588416 571871232 2183778304 0 6583866 1591947723 MCFG-g7150-00013-200424-B-6426960
sunfish Q QD4A.200805.003 s5-0.2-6281315 g7150-00013-200424-B-6426960 806588416 571871232 2183778304 0 6598198 1592375158 MCFG-g7150-00013-200424-B-6426960
sunfish R RPB3.200720.005 s5-0.2-6539975 g7150-00018-200701-B-6643937 819929088 550354944 2050846720 231133184 6705141 1595555810 MCFG-g7150-00018-200701-B-6643937
sunfish R RP1A.200720.010 s5-0.2-6539975 g7150-00018-200701-B-6643937 819933184 550641664 2043527168 231059456 6722941 1596133045 MCFG-g7150-00018-200728-B-6713616
sunfish R RP1A.200720.011 s5-0.2-6539975 g7150-00018-200701-B-6643937 819933184 550641664 2043527168 231059456 6746289 1596827004 MCFG-g7150-00018-200728-B-6713616
sunfish R RP1A.201005.006 s5-0.2-6539975 g7150-00018-200701-B-6643937 820408320 550678528 2044289024 231182336 6828489 1599851867 MCFG-g7150-00018-200728-B-6713616
sunfish R RP1A.201105.002 s5-0.2-6539975 g7150-00018-200701-B-6643937 820408320 552677376 2044289024 231186432 6869500 1601328056 MCFG-g7150-00018-200728-B-6713616
sunfish R RQ1A.201205.008 s5-0.3-6835615 g7150-00023-201008-B-6891498 822075392 555978752 2062725120 232345600 6943376 1604104967 MCFG-g7150-00023-201008-B-6891498
sunfish R RQ1A.210105.002 s5-0.3-6835615 g7150-00023-201008-B-6891498 822083584 555986944 2068152320 232349696 6985033 1605836556 MCFG-g7150-00023-201008-B-6891498
sunfish R RQ1A.210205.004 s5-0.3-6835615 g7150-00023-201008-B-6891498 822099968 555986944 2068152320 232374272 7038034 1608168918 MCFG-g7150-00023-201008-B-6891498
sunfish S SPP1.210122.020.A3 s5-0.4-7018164 g7150-00038-201230-B-7056669 847507456 595034112 2204274688 250863616 7145137 1613342751 MCFG-g7150-00038-210106-B-7064045
sunfish R RQ2A.210305.006 s5-0.3-7062598 g7150-00038-201230-B-7056669 823451648 557244416 2147917824 233533440 7119741 1612314859 MCFG-g7150-00038-210106-B-7064045
sunfish R RQ2A.210305.007 s5-0.3-7062598 g7150-00038-201230-B-7056669 823451648 557244416 2147917824 233533440 7124944 1612478553 MCFG-g7150-00038-210204-B-7123083
sunfish S SPP1.210122.022 s5-0.4-7018164 g7150-00038-201230-B-7056669 847511552 595042304 2204274688 250863616 7158812 1613792825 MCFG-g7150-00038-210106-B-7064045
sunfish S SPP2.210219.008 s5-0.4-7018164 g7150-00038-201230-B-7056669 855322624 595734528 2253778944 263733248 7195985 1615318117 MCFG-g7150-00038-210204-B-7123083
sunfish S SPP2.210219.008.A1 s5-0.4-7018164 g7150-00038-201230-B-7056669 855322624 595726336 2254020608 263733248 7233312 1616609780 MCFG-g7150-00038-210204-B-7123083
sunfish R RQ2A.210405.005 s5-0.3-7062598 g7150-00038-201230-B-7056669 823451648 557248512 2147917824 233521152 7181113 1614736020 MCFG-g7150-00038-210204-B-7123083
sunfish S SPP2.210219.018 s5-0.4-7018164 g7150-00038-201230-B-7056669 855379968 595726336 2252943360 263823360 7242751 1617043387 MCFG-g7150-00038-210204-B-7123083
sunfish S SPP3.210325.010 s5-0.4-7018164 g7150-00047-210319-B-7220401 869720064 599367680 2299924480 274718720 7282474 1618409979 MCFG-g7150-00047-210319-B-7220401
sunfish R RQ2A.210505.002 s5-0.3-7062598 g7150-00038-201230-B-7056669 823455744 557236224 2147917824 233525248 7246365 1617140331 MCFG-g7150-00038-210204-B-7123083
sunfish S SPB1.210331.013 s5-0.4-7018164 g7150-00047-210319-B-7220401 869081088 599564288 2310184960 276738048 7333779 1620089492 MCFG-g7150-00047-210325-B-7235665
sunfish R RQ3A.210605.005 s5-0.3-7241803 g7150-00047-210319-B-7220401 828133376 556806144 2185318400 229761024 7349499 1620601247 MCFG-g7150-00047-210507-B-7344994
sunfish S SPB2.210513.007 s5-0.4-7266296 g7150-00047-210319-B-7220401 878690304 601448448 2296991744 284528640 7398525 1621987155 MCFG-g7150-00047-210407-B-7264982
sunfish S SPB2.210513.011 s5-0.4-7266296 g7150-00047-210319-B-7220401 878690304 601448448 2296991744 284565504 7465093 1623879855 MCFG-g7150-00047-210407-B-7264982
sunfish R RQ3A.210705.001 s5-0.3-7241803 g7150-00047-210319-B-7220401 828157952 556810240 2185314304 229736448 7380771 1621469967 MCFG-g7150-00047-210507-B-7344994
sunfish S SPB3.210618.013 s5-0.4-7399181 g7150-00066-210614-B-7454992 839020544 620703744 2347196416 305639424 7533405 1625784418 MCFG-g7150-00047-210526-B-7400018
sunfish S SPB3.210618.016 s5-0.4-7399181 g7150-00066-210614-B-7454992 838983680 620703744 2347196416 305639424 7566885 1626815817 MCFG-g7150-00047-210526-B-7400018
sunfish R RQ3A.210805.001.A1 s5-0.3-7357976 g7150-00047-210319-B-7220401 828157952 556814336 2185314304 229781504 7474174 1624080549 MCFG-g7150-00047-210507-B-7344994
sunfish S SPB4.210715.011 s5-0.4-7513126 g7150-00066-210723-B-7576148 874557440 622702592 2392875008 292409344 7608474 1628031798 MCFG-g7150-00066-210723-B-7576148
sunfish S SPB4.210715.014 s5-0.4-7513126 g7150-00066-210723-B-7576148 876707840 622714880 2392875008 292417536 7654839 1629318360 MCFG-g7150-00066-210723-B-7576148
sunfish R RQ3A.210905.001 s5-0.3-7357976 g7150-00047-210319-B-7220401 828170240 556814336 2185314304 228970496 7511028 1625098281 MCFG-g7150-00047-210507-B-7344994
sunfish S SPB5.210812.002 s5-0.4-7617467 g7150-00066-210806-B-7617467 884805632 620593152 2383560704 290770944 7671067 1629844303 MCFG-g7150-00066-210806-B-7617467
sunfish R RQ3A.211001.001 s5-0.3-7357976 g7150-00047-210319-B-7220401 826818560 556814336 2185314304 228954112 7641976 1628903472 MCFG-g7150-00047-210507-B-7344994
sunfish S SP1A.210812.015 s5-0.4-7617467 g7150-00066-210806-B-7617467 884801536 620593152 2379218944 290705408 7679548 1630045174 MCFG-g7150-00066-210806-B-7617467
sunfish S SP1A.210812.016.A1 s5-0.4-7617467 g7150-00066-210806-B-7617467 884801536 620593152 2379218944 290705408 7796139 1633470480 MCFG-g7150-00066-210806-B-7617467
sunfish S SP1A.211105.002 s5-0.4-7617467 g7150-00066-210806-B-7617467 882778112 620593152 2379218944 290693120 7743617 1631907219 MCFG-g7150-00066-210806-B-7617467
sunfish S SP1A.211105.002.A1 s5-0.4-7617467 g7150-00066-210806-B-7617467 882778112 620593152 2379218944 290693120 7807550 1633722746 MCFG-g7150-00066-210806-B-7617467
sunfish S SP1A.211105.004 s5-0.4-7617467 g7150-00066-210806-B-7617467 882778112 620593152 2379218944 290693120 7842311 1634762541 MCFG-g7150-00066-210806-B-7617467
# 7-Zip이 설치되어 있어야 함
# https://www.7-zip.org/download.html
# Requires 'simg2img.exe' and 'cygwin1.dll' in current directory
# https://github.com/KinglyWayne/simg2img_win/archive/master.zip
#
# Usage 1: 디렉토리의 모든 파일에 대해서 작업하기
# gci E:\ROM2 | sort LastWriteTime | % { ... }
# Usage 2: 특정 시간 이후의 파일에 대해서만 작업하기
# gci E:\ROM2 | ? { $_.LastWriteTime -gt "2021-11-02 02:00" } | sort LastWriteTime | % { ... }
#
# gci E:\ROM2 | sort LastWriteTime | % {
gci C:\Users\nooriro\Downloads\*-factory-*.zip -include crosshatch-*, sunfish-* | ? { $_.LastWritetime -gt "2021-11-02 02:00" } | sort LastWriteTime | % {
# 현재 디렉토리에 임시 디렉토리를 만들고 이동
$dir = [System.IO.Path]::GetRandomFileName()
$null = New-Item $dir -ItemType Directory
Set-Location $dir
# factory image zip filename format: "CODENAME-BUILDNUMBER-factory-HASH.zip"
# 코드명, 빌드 번호
$i = $_.Name.IndexOf("-") # index of 1st '-'
$j = $_.Name.IndexOf("-", $i+1) # index of 2nd '-'
$cn = $_.Name.Substring(0, $i) # CODENAME
$bn = $_.Name.Substring($i+1, $j-$i-1) # BUILDNUMBER
$cnbn = $_.Name.Substring(0, $j) # CODENAME-BUILDNUMBER
$v = $bn.Substring(0,1) # first letter of CODENAME
# bootloader img filename format: "bootloader-CODENAME-BOOTLOADERVERSION.img"
# radio img filename format: "radio-CODENAME-BASEBANDVERSION.img"
# 부트로더 버전, 기저대역 버전
&"C:\Program Files\7-Zip\7z.exe" x "$($_.FullName)" ${cnbn}\bootloader-${cn}-*.img ${cnbn}\radio-${cn}-*.img ${cnbn}\image-${cnbn}.zip > $null
$f = ( gci "${cnbn}\bootloader-${cn}-*.img" )[0]
$i = $f.Name.IndexOf("-")
$i = $f.Name.IndexOf("-", $i+1) # index of 2nd '-'
$j = $f.Name.LastIndexOf(".") # index of '.' just before extension
$bv = $f.Name.Substring($i+1, $j-$i-1) # BOOTLOADERVERSION
$f = ( gci "${cnbn}\radio-${cn}-*.img" )[0]
$i = $f.Name.IndexOf("-")
$i = $f.Name.IndexOf("-", $i+1) # index of 2nd '-'
$j = $f.Name.LastIndexOf(".") # index of '.' just before extension
$rv = $f.Name.Substring($i+1, $j-$i-1) # BASEBANDVERSION
# system/vendor/product/system_ext img 파일 추출
# 및 sparse image를 raw image로 변환
&"C:\Program Files\7-Zip\7z.exe" x ${cnbn}\image-${cnbn}.zip system.img vendor.img product.img system_ext.img > $null
..\simg2img system.img system.ext4.img
..\simg2img vendor.img vendor.ext4.img
..\simg2img product.img product.ext4.img
if ( Test-Path system_ext.img ) {
..\simg2img system_ext.img system_ext.ext4.img
}
$ss = (Get-Item system.ext4.img).Length
$vs = (Get-Item vendor.ext4.img).Length
$ps = (Get-Item product.ext4.img).Length
if ( Test-Path system_ext.ext4.img ) {
$ses = (Get-Item system_ext.ext4.img).Length
} else {
$ses = 0
}
# system.ext4.img 파일에서 system/build.prop 추출
# 빌드 인크리멘탈: ro.build.version.incremental
# 빌드 타임스탬프: ro.build.date.utc
&"C:\Program Files\7-Zip\7z.exe" x system.ext4.img system/build.prop > $null
$mi = Select-String -Path system\build.prop -Pattern "^ro.build.version.incremental=" | select -first 1
$buildid = $mi.Line -Replace "^ro.build.version.incremental=",""
$mi = Select-String -Path system\build.prop -Pattern "^ro.build.date.utc=" | select -first 1
$timestamp = $mi.Line -Replace "^ro.build.date.utc=",""
# vendor.ext4.img에서 mbn files 추출
&"C:\Program Files\7-Zip\7z.exe" x vendor.ext4.img rfs/msm/mpss/readonly/vendor/mbn/* > $null
$mcfgver = Get-Content rfs\msm\mpss\readonly\vendor\mbn\mcfg.version
# 알아낸 정보를 화면에 출력
"{0,-13} {1,-2} {2,-20} {3,-19} {4,-30} {5,10} {6,10} {7,10} {8,10} {9,11} {10,12} {11,35}" -f $cn, $v.toupper(), $bn.toupper(), $bv, ($rv -replace "b","B"), $ss, $vs, $ps, $ses, $buildid, $timestamp, $mcfgver
# radio 버전에서 년월일만 뽑아내기
$i = $rv.IndexOf("-")
$i = $rv.IndexOf("-", $i+1)
$radio_short = $rv.Substring($i+1, 6)
# mcfg 버전에서 년월일만 뽑아내기
$i = $mcfgver.IndexOf("-")
$i = $mcfgver.IndexOf("-", $i+1)
$i = $mcfgver.IndexOf("-", $i+1)
$mcfg_short = $mcfgver.Substring($i+1, 6)
$zip_name = "mbn-${cn}-$( $v.toupper() )-${buildid}-${radio_short}-${mcfg_short}-$( $bn.toupper() ).zip"
Set-Location rfs\msm\mpss\readonly\vendor\mbn
if ( -not ( Test-Path "..\..\..\..\..\..\..\${zip_name}" ) ) {
&"C:\Program Files\7-Zip\7z.exe" a -tzip "..\..\..\..\..\..\..\${zip_name}" * > $null
}
Set-Location ..\..\..\..\..\..\..
Remove-Item $dir -Recurse -Force
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment