-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcoreboot-manager
executable file
·46 lines (41 loc) · 1.79 KB
/
coreboot-manager
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
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 2018 iomonad <[email protected]>
# (https://github.com/iomonad/dotfiles)
#
# Simple coreboot manager to avoid command
# line mistakes and bios dramas.
# Actually support build, rebuild, flash
# backups, extractions and deblobing.
import os, sys
import argparse
import subprocess
tasks = ["backups"]
if not os.geteuid() == 0:
sys.exit("\nOnly Root can manipulate coreboot.\n")
parser = argparse.ArgumentParser(description='Coreboot Manager')
parser.add_argument('--version', action='version', version='%(prog)s 1.0')
parser.add_argument('--server', '-s', dest='ssh_host', action='store',
required=True, type=str,
help='Coreboot Compiler Server. Eg: Raspberry PI.')
parser.add_argument('--port', '-p', dest='ssh_port', action='store',
required=False, type=int, default=22, help="CC server port.")
parser.add_argument('--outdir', '-o', dest='backup_file', action='store',
required=False, type=str, default="coreboot_backup_stock_latest.rom",
help='Output dump path.')
parser.add_argument('--task','-t', dest='task', action='store',
required=True, choices=tasks,
help='Task to compute')
parser.add_argument('-x', '--system', dest='system_backup', action="store_true", default=False,
help='Use flashrom on system. Warning, Coreboot should be already hardware flashed !')
def backup(agv):
if args.system_backup:
subprocess.check_call(["flashrom", "-c", "MX25L6405", "-p",
"internal:laptop=force_I_want_a_brick",
"-r", args.backup_file])
if __name__ == '__main__':
args = parser.parse_args()
({
args.task == "backups" : backup(args)
})