pmbootstrap flasher: use boot.img file with fastboot

This commit is contained in:
Oliver Smith 2017-07-04 22:47:03 +02:00
parent d96c6951b7
commit 615880e161
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 42 additions and 29 deletions

View file

@ -50,15 +50,12 @@ def kernel(args):
# Generate the paths and run the flasher
pmb.flasher.init(args)
mnt = "/mnt/rootfs_" + args.device
kernel = mnt + "/boot/vmlinuz-" + flavor
ramdisk = mnt + "/boot/initramfs-" + flavor
if args.action_flasher == "boot":
logging.info("(native) boot " + flavor + " kernel")
pmb.flasher.run(args, "boot", kernel, ramdisk)
pmb.flasher.run(args, "boot", flavor)
else:
logging.info("(native) flash kernel " + flavor)
pmb.flasher.run(args, "flash_kernel", kernel, ramdisk)
pmb.flasher.run(args, "flash_kernel", flavor)
def list_flavors(args):
@ -78,7 +75,7 @@ def system(args):
# Run the flasher
logging.info("(native) flash system image")
pmb.flasher.run(args, "flash_system", image=img_path)
pmb.flasher.run(args, "flash_system")
def list_devices(args):

View file

@ -20,7 +20,7 @@ import pmb.flasher
import pmb.chroot.initfs
def run(args, action, kernel=None, ramdisk=None, image=None):
def run(args, action, flavor):
pmb.flasher.init(args)
# Verify action
@ -30,12 +30,18 @@ def run(args, action, kernel=None, ramdisk=None, image=None):
raise RuntimeError("action " + action + " is not"
" configured for method " + method + "!")
# Kernel commandline is optional
# Optional variables
cmdline = ""
if "kernel_cmdline" in args.deviceinfo:
cmdline = args.deviceinfo["kernel_cmdline"]
# Variable setup
vars = {
"$KERNEL": kernel,
"$RAMDISK": ramdisk,
"$IMAGE": image,
"$OFFSET_BASE": args.deviceinfo["flash_offset_base"],
"$BOOT": "/mnt/rootfs_" + args.device + "/boot",
"$FLAVOR": flavor,
"$IMAGE": "/home/user/rootfs/" + args.device + ".img",
"$KERNEL_CMDLINE": cmdline,
"$OFFSET_KERNEL": args.deviceinfo["flash_offset_kernel"],
"$OFFSET_RAMDISK": args.deviceinfo["flash_offset_ramdisk"],
"$OFFSET_SECOND": args.deviceinfo["flash_offset_second"],
@ -49,10 +55,11 @@ def run(args, action, kernel=None, ramdisk=None, image=None):
for key, value in vars.items():
for i in range(len(command)):
if key in command[i]:
if not value:
if not value and key != "$KERNEL_CMDLINE":
raise RuntimeError("Variable " + key + " found in"
" action " + action + " for method " + method + ","
" but the value for this variable is None!")
" but the value for this variable is None! Is that"
" missing in your deviceinfo?")
command[i] = command[i].replace(key, value)
# Run the action