Add OTA firmware extraction command
This commit is contained in:
parent
06576a5dce
commit
1dbd18af2b
1 changed files with 30 additions and 0 deletions
30
src/commands/ota-firmware.ts
Normal file
30
src/commands/ota-firmware.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { Command, flags } from '@oclif/command'
|
||||
import { run } from '../util/process'
|
||||
import { readFile } from '../util/fs'
|
||||
|
||||
import YAML from 'yaml'
|
||||
|
||||
export default class ExtractFirmware extends Command {
|
||||
static description = 'extract firmware partitions'
|
||||
|
||||
static flags = {
|
||||
help: flags.help({char: 'h'}),
|
||||
factoryOtaPath: flags.string({char: 'f', description: 'path to stock factory OTA images zip (for extracting firmware)', required: true}),
|
||||
}
|
||||
|
||||
static args = [
|
||||
{name: 'configPath', description: 'path to device-specific YAML config', required: true},
|
||||
]
|
||||
|
||||
async run() {
|
||||
let {args: {configPath}, flags: {factoryOtaPath}} = this.parse(ExtractFirmware)
|
||||
|
||||
// parse config file
|
||||
let config = YAML.parse(await readFile(configPath))
|
||||
let vendor = "google_devices"
|
||||
let device = config.device.name
|
||||
|
||||
let outDir = `vendor/${vendor}/${device}/firmware`
|
||||
await run(__dirname + `/../../external/extract_android_ota_payload/extract_android_ota_payload.py ${factoryOtaPath} ${outDir}`)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue