pmbootstrap flasher: use boot.img file with fastboot
This commit is contained in:
parent
d96c6951b7
commit
615880e161
|
@ -192,29 +192,31 @@ flash_mount_bind = [
|
||||||
"/dev/bus/usb/"
|
"/dev/bus/usb/"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Allowed variables:
|
"""
|
||||||
# $KERNEL, $RAMDISK, $IMAGE (system partition image), $BOOTPARAM
|
Flasher abstraction. Allowed variables:
|
||||||
|
|
||||||
|
$BOOT: Path to the /boot partition
|
||||||
|
$FLAVOR: Kernel flavor
|
||||||
|
$IMAGE: Path to the system partition image
|
||||||
|
$KERNEL_CMDLINE: Kernel commandline
|
||||||
|
|
||||||
|
Fastboot specific: $OFFSET_KERNEL, $OFFSET_RAMDISK, $OFFSET_TAGS, $PAGE_SIZE
|
||||||
|
"""
|
||||||
flashers = {
|
flashers = {
|
||||||
"fastboot": {
|
"fastboot": {
|
||||||
"depends": ["android-tools"],
|
"depends": ["android-tools"],
|
||||||
"actions":
|
"actions":
|
||||||
{
|
{
|
||||||
"list_devices": [["fastboot", "devices", "-l"]],
|
"list_devices": [["fastboot", "devices", "-l"]],
|
||||||
"flash_system": [["fastboot", "flash", "system", "$IMAGE"]],
|
"flash_system": [["fastboot", "flash", "system", "$IMAGE"]],
|
||||||
"flash_kernel": [["fastboot",
|
"flash_kernel": [["fastboot", "flash" "boot", "$BOOT/boot.img-$FLAVOR"]],
|
||||||
"--base", "$OFFSET_BASE",
|
"boot": [["fastboot",
|
||||||
"--kernel-offset", "$OFFSET_KERNEL",
|
"--kernel-offset", "$OFFSET_KERNEL",
|
||||||
"--ramdisk-offset", "$OFFSET_RAMDISK",
|
"--ramdisk-offset", "$OFFSET_RAMDISK",
|
||||||
"--tags-offset", "$OFFSET_TAGS",
|
"--tags-offset", "$OFFSET_TAGS",
|
||||||
"--page-size", "$PAGE_SIZE",
|
"--page-size", "$PAGE_SIZE",
|
||||||
"flash:raw", "$KERNEL", "$RAMDISK"]],
|
"-c", "$KERNEL_CMDLINE",
|
||||||
"boot": [["fastboot",
|
"boot", "$BOOT/vmlinuz-$FLAVOR", "$BOOT/initramfs-$FLAVOR"]],
|
||||||
"--base", "$OFFSET_BASE",
|
|
||||||
"--kernel-offset", "$OFFSET_KERNEL",
|
|
||||||
"--ramdisk-offset", "$OFFSET_RAMDISK",
|
|
||||||
"--tags-offset", "$OFFSET_TAGS",
|
|
||||||
"--page-size", "$PAGE_SIZE",
|
|
||||||
"boot", "$KERNEL", "$RAMDISK"]],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"heimdall": {
|
"heimdall": {
|
||||||
|
@ -222,10 +224,12 @@ flashers = {
|
||||||
"actions":
|
"actions":
|
||||||
{
|
{
|
||||||
"list_devices": [["heimdall", "detect"]],
|
"list_devices": [["heimdall", "detect"]],
|
||||||
"flash_system": [
|
"flash_system": [
|
||||||
["heimdall_wait_for_device.sh"],
|
["heimdall_wait_for_device.sh"],
|
||||||
["heimdall", "flash", "--SYSTEM", "$IMAGE"]],
|
["heimdall", "flash", "--SYSTEM", "$IMAGE"]],
|
||||||
"flash_kernel": [["heimdall_flash_kernel.sh", "$RAMDISK", "$KERNEL"]]
|
"flash_kernel": [["heimdall_flash_kernel.sh",
|
||||||
|
"$BOOT/initramfs-$FLAVOR",
|
||||||
|
"$BOOT/vmlinuz-$FLAVOR"]]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,15 +50,12 @@ def kernel(args):
|
||||||
|
|
||||||
# Generate the paths and run the flasher
|
# Generate the paths and run the flasher
|
||||||
pmb.flasher.init(args)
|
pmb.flasher.init(args)
|
||||||
mnt = "/mnt/rootfs_" + args.device
|
|
||||||
kernel = mnt + "/boot/vmlinuz-" + flavor
|
|
||||||
ramdisk = mnt + "/boot/initramfs-" + flavor
|
|
||||||
if args.action_flasher == "boot":
|
if args.action_flasher == "boot":
|
||||||
logging.info("(native) boot " + flavor + " kernel")
|
logging.info("(native) boot " + flavor + " kernel")
|
||||||
pmb.flasher.run(args, "boot", kernel, ramdisk)
|
pmb.flasher.run(args, "boot", flavor)
|
||||||
else:
|
else:
|
||||||
logging.info("(native) flash kernel " + flavor)
|
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):
|
def list_flavors(args):
|
||||||
|
@ -78,7 +75,7 @@ def system(args):
|
||||||
|
|
||||||
# Run the flasher
|
# Run the flasher
|
||||||
logging.info("(native) flash system image")
|
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):
|
def list_devices(args):
|
||||||
|
|
|
@ -20,7 +20,7 @@ import pmb.flasher
|
||||||
import pmb.chroot.initfs
|
import pmb.chroot.initfs
|
||||||
|
|
||||||
|
|
||||||
def run(args, action, kernel=None, ramdisk=None, image=None):
|
def run(args, action, flavor):
|
||||||
pmb.flasher.init(args)
|
pmb.flasher.init(args)
|
||||||
|
|
||||||
# Verify action
|
# Verify action
|
||||||
|
@ -30,12 +30,18 @@ def run(args, action, kernel=None, ramdisk=None, image=None):
|
||||||
raise RuntimeError("action " + action + " is not"
|
raise RuntimeError("action " + action + " is not"
|
||||||
" configured for method " + method + "!")
|
" configured for method " + method + "!")
|
||||||
|
|
||||||
|
# Kernel commandline is optional
|
||||||
|
# Optional variables
|
||||||
|
cmdline = ""
|
||||||
|
if "kernel_cmdline" in args.deviceinfo:
|
||||||
|
cmdline = args.deviceinfo["kernel_cmdline"]
|
||||||
|
|
||||||
# Variable setup
|
# Variable setup
|
||||||
vars = {
|
vars = {
|
||||||
"$KERNEL": kernel,
|
"$BOOT": "/mnt/rootfs_" + args.device + "/boot",
|
||||||
"$RAMDISK": ramdisk,
|
"$FLAVOR": flavor,
|
||||||
"$IMAGE": image,
|
"$IMAGE": "/home/user/rootfs/" + args.device + ".img",
|
||||||
"$OFFSET_BASE": args.deviceinfo["flash_offset_base"],
|
"$KERNEL_CMDLINE": cmdline,
|
||||||
"$OFFSET_KERNEL": args.deviceinfo["flash_offset_kernel"],
|
"$OFFSET_KERNEL": args.deviceinfo["flash_offset_kernel"],
|
||||||
"$OFFSET_RAMDISK": args.deviceinfo["flash_offset_ramdisk"],
|
"$OFFSET_RAMDISK": args.deviceinfo["flash_offset_ramdisk"],
|
||||||
"$OFFSET_SECOND": args.deviceinfo["flash_offset_second"],
|
"$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 key, value in vars.items():
|
||||||
for i in range(len(command)):
|
for i in range(len(command)):
|
||||||
if key in command[i]:
|
if key in command[i]:
|
||||||
if not value:
|
if not value and key != "$KERNEL_CMDLINE":
|
||||||
raise RuntimeError("Variable " + key + " found in"
|
raise RuntimeError("Variable " + key + " found in"
|
||||||
" action " + action + " for method " + method + ","
|
" 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)
|
command[i] = command[i].replace(key, value)
|
||||||
|
|
||||||
# Run the action
|
# Run the action
|
||||||
|
|
|
@ -129,7 +129,12 @@ def install(args, show_flash_msg=True):
|
||||||
" target device:")
|
" target device:")
|
||||||
logging.info("* pmbootstrap flasher flash_kernel")
|
logging.info("* pmbootstrap flasher flash_kernel")
|
||||||
logging.info(" Flashes the kernel + initramfs to your device:")
|
logging.info(" Flashes the kernel + initramfs to your device:")
|
||||||
logging.info(" " + args.work + "/chroot_rootfs_" + args.device + "/boot")
|
logging.info(
|
||||||
|
" " +
|
||||||
|
args.work +
|
||||||
|
"/chroot_rootfs_" +
|
||||||
|
args.device +
|
||||||
|
"/boot")
|
||||||
method = args.deviceinfo["flash_methods"]
|
method = args.deviceinfo["flash_methods"]
|
||||||
if (method in pmb.config.flashers and "boot" in
|
if (method in pmb.config.flashers and "boot" in
|
||||||
pmb.config.flashers[method]["actions"]):
|
pmb.config.flashers[method]["actions"]):
|
||||||
|
|
Loading…
Reference in New Issue