Пример #1
0
def publish_build_uefi(bld, bld_variant, bld_prod, buildnumber, board_soc):
    product_out = os.path.join("out/target/product", bld)
    fastboot_dir = os.path.join(bldpub, "fastboot-images")
    target2file = [("fastboot", "droidboot"), ("boot", "boot"),
                   ("recovery", "recovery"), ("system", "system")]
    bldx = get_build_options(key='GENERIC_TARGET_NAME')
    flashfile_dir = os.path.join(bldpub, "flash_files")
    publish_kernel_keys(product_out, bld_variant)

    f = FlashFile(
        os.path.join(
            flashfile_dir, "build-" + bld_variant,
            "%(bldx)s-%(bld_variant)s-fastboot-%(buildnumber)s.zip" %
            locals()), "flash.xml")
    f.xml_header("fastboot", bld, flashfile_version)

    publish_attach_target2file(f, product_out, buildnumber, target2file)
    f.add_file("esp_update", os.path.join(product_out, "esp.zip"), buildnumber)

    ifwis = find_ifwis(board_soc)
    for board, args in ifwis.items():
        if args["capsule"]:
            f.add_codegroup("CAPSULE",
                            (("CAPSULE_" + board.upper(), args["capsule"],
                              args["ifwiversion"]), ))

    f.add_file("INSTALLER", "device/intel/baytrail/installer.cmd", buildnumber)

    f.add_buildproperties("%(product_out)s/system/build.prop" % locals())

    publish_erase_partitions(f, ["system"])
    publish_format_partitions(f, ["cache"])

    f.add_command("fastboot flash esp_update $esp_update_file",
                  "Updating ESP.")

    publish_flash_target2file(f, target2file)

    for board, args in ifwis.items():
        if args["capsule"]:
            f.add_command(
                "fastboot flash capsule $capsule_%s_file" % (board.lower(), ),
                "Attempt flashing capsule " + board)

    f.add_command("fastboot continue", "Rebooting now.")
    f.finish()
Пример #2
0
def publish_build_uefi(bld, bld_variant, bld_prod, buildnumber, board_soc):
    product_out = os.path.join("out/target/product", bld)
    fastboot_dir = os.path.join(bldpub, "fastboot-images")
    target2file = [("fastboot", "droidboot"), ("boot", "boot"), ("recovery", "recovery"), ("system", "system")]
    bldx = get_build_options(key="GENERIC_TARGET_NAME")
    flashfile_dir = os.path.join(bldpub, "flash_files")
    publish_kernel_keys(product_out, bld_variant)

    f = FlashFile(
        os.path.join(
            flashfile_dir, "build-" + bld_variant, "%(bldx)s-%(bld_variant)s-fastboot-%(buildnumber)s.zip" % locals()
        ),
        "flash.xml",
    )
    f.xml_header("fastboot", bld, flashfile_version)

    publish_attach_target2file(f, product_out, buildnumber, target2file)
    f.add_file("esp_update", os.path.join(product_out, "esp.zip"), buildnumber)

    ifwis = find_ifwis(board_soc)
    for board, args in ifwis.items():
        if args["capsule"]:
            f.add_codegroup("CAPSULE", (("CAPSULE_" + board.upper(), args["capsule"], args["ifwiversion"]),))

    f.add_file("INSTALLER", "device/intel/baytrail/installer.cmd", buildnumber)

    f.add_buildproperties("%(product_out)s/system/build.prop" % locals())

    publish_erase_partitions(f, ["system"])
    publish_format_partitions(f, ["cache"])

    f.add_command("fastboot flash esp_update $esp_update_file", "Updating ESP.")

    publish_flash_target2file(f, target2file)

    for board, args in ifwis.items():
        if args["capsule"]:
            f.add_command(
                "fastboot flash capsule $capsule_%s_file" % (board.lower(),), "Attempt flashing capsule " + board
            )

    f.add_command("fastboot continue", "Rebooting now.")
    f.finish()
Пример #3
0
def publish_blankphone_uefi(bld, buildnumber, board_soc):
    product_out = os.path.join("out/target/product", bld)
    fastboot_dir = os.path.join(bldpub, "fastboot-images")
    target2file = [("ESP", "esp"), ("fastboot", "droidboot")]

    blankphone_dir = os.path.join(bldpub, "flash_files/blankphone")
    bldx = get_build_options(key='GENERIC_TARGET_NAME')
    f = FlashFile(os.path.join(blankphone_dir, bldx + "-blankphone.zip"),
                  "flash.xml")
    f.add_xml_file("flash-EraseFactory.xml")
    fastboot_mode = "fastboot_dnx"
    osloader = True

    if bld == "cht_rvp":
        fastboot_mode = "fastboot"
        osloader = False

    if bld == "byt_t_ffrd8":
        f.add_xml_file("flash-rvp8.xml")

    f.xml_header(fastboot_mode, bld, flashfile_version)

    publish_attach_target2file(f, product_out, buildnumber, target2file)
    if osloader:
        f.add_file("osloader",
                   os.path.join(product_out, "efilinux-%s.efi" % bld_variant),
                   buildnumber)

    f.add_file("INSTALLER", "device/intel/baytrail/installer.cmd", buildnumber)
    if bld == "byt_t_ffrd8":
        efilinuxcfg_file = os.path.join(product_out, "efilinux_fakebatt.cfg")
        fe = open(efilinuxcfg_file, 'w')
        fe.write('-e fake \n')
        fe.close()
        f.add_codegroup("CONFIG",
                        (("EFILINUX_CFG", efilinuxcfg_file, buildnumber), ),
                        xml_filter=["flash-rvp8.xml"])

    ifwis = find_ifwis(board_soc)
    for board, args in ifwis.items():
        if args["ifwi"]:
            f.add_codegroup("FIRMWARE",
                            (("DEDIPROG_" + board.upper(), args["ifwi"],
                              args["ifwiversion"]), ))
        if args["stage2"]:
            f.add_codegroup("stage2",
                            (("stage2_" + board.upper(), args["stage2"],
                              args["ifwiversion"]), ))

    part_file = os.path.join(product_out, "partition.tbl")
    f.add_codegroup("CONFIG", (("PARTITION_TABLE", part_file, buildnumber), ))

    f.add_buildproperties("%(product_out)s/system/build.prop" % locals())

    for board, args in ifwis.items():
        if args["stage2"]:
            f.add_command("fastboot flash fw_stage2 $stage2_%s_file" %
                          (board.lower(), ),
                          "Uploading Stage 2 IFWI image.",
                          mandatory=0)
            f.add_command("sleep", "Sleep for 5 seconds.", timeout=5000)

    if osloader:
        f.add_command("fastboot flash osloader $osloader_file",
                      "Uploading EFI OSLoader image.")
        f.add_command("fastboot boot $droidboot_file",
                      "Uploading fastboot image.")
        f.add_command("sleep", "Sleep for 25 seconds.", timeout=25000)

    f.add_command("fastboot oem wipe ESP",
                  "Wiping ESP partition.",
                  mandatory=0)
    f.add_command("fastboot oem wipe reserved",
                  "Wiping reserved partition.",
                  mandatory=0)
    publish_partitioning_commands(f, bld, buildnumber,
                                  os.path.split(part_file)[1],
                                  ["cache", "config", "logs", "data"])

    publish_flash_target2file(f, target2file)

    if bld == "byt_t_ffrd8":
        f.add_command("fastboot oem mount ESP vfat",
                      "Mounting ESP partition.",
                      xml_filter=["flash-rvp8.xml"])
        f.add_command(
            "fastboot flash /mnt/ESP/EFI/BOOT/efilinux.cfg $efilinux_cfg_file",
            "Copy efilinux.cfg",
            xml_filter=["flash-rvp8.xml"])

    f.copy_xml_file("flash.xml", "flash-buildbot.xml")

    f.finish()
Пример #4
0
def publish_blankphone_iafw(bld, buildnumber, board_soc):
    bld_supports_droidboot = get_build_options(key='TARGET_USE_DROIDBOOT',
                                               key_type='boolean')
    bldx = get_build_options(key='GENERIC_TARGET_NAME')
    gpflag = get_build_options(key='BOARD_GPFLAG', key_type='hex')
    single_dnx = get_build_options(key='SINGLE_DNX')
    config_list = get_build_options(key='CONFIG_LIST')
    product_out = os.path.join("out/target/product", bld)
    blankphone_dir = os.path.join(bldpub, "flash_files/blankphone")
    partition_filename = "partition.tbl"
    partition_file = os.path.join(product_out, partition_filename)
    part_scheme = get_build_options(key='TARGET_PARTITIONING_SCHEME',
                                    default_value='osip-gpt')

    if bld_supports_droidboot:
        if part_scheme == "full-gpt":
            recoveryimg = os.path.join(product_out, "droidboot_dnx.img")
        else:
            recoveryimg = os.path.join(product_out, "droidboot.img.POS.bin")
    else:
        recoveryimg = os.path.join(product_out, "recovery.img.POS.bin")
    ifwis = find_ifwis(board_soc)
    for board, args in ifwis.items():
        # build the blankphone flashfile
        f = FlashFile(
            os.path.join(blankphone_dir,
                         "%(board)s-blankphone.zip" % locals()), "flash.xml")
        f.add_xml_file("flash-EraseFactory.xml")
        # create all config XML files including default config
        if config_list:
            for conf in config_list.split():
                f.add_xml_file("flash-%s.xml" % conf)

        default_files = f.xml.keys()

        if args["softfuse"]:
            softfuse_files = [
                "flash-softfuse.xml", "flash-softfuse-EraseFactory.xml"
            ]
            for softfuse_f in softfuse_files:
                f.add_xml_file(softfuse_f)

            f.xml_header("system", bld, flashfile_version)
            f.add_gpflag(gpflag | 0x00000200, xml_filter=softfuse_files)
            f.add_gpflag(gpflag | 0x00000100, xml_filter=default_files)
        else:
            if bld == "baylake" or bld == "byt_t_ffrd8":
                f.xml_header("fastboot_dnx", bld, flashfile_version)
            elif args["capsule"]:
                f.xml_header("fastboot", bld, flashfile_version)
            else:
                f.xml_header("system", bld, flashfile_version)
                f.add_gpflag(gpflag, xml_filter=default_files)

        if args["capsule"]:
            default_ifwi = (
                ("CAPSULE", args["capsule"], args["ifwiversion"]),
                ("DEDIPROG", args["ifwi"], args["ifwiversion"]),
            )
        else:
            if single_dnx == "true":
                default_ifwi = (("IFWI", args["ifwi"], args["ifwiversion"]),
                                ("FW_DNX", args["fwdnx"], args["ifwiversion"]))
            else:
                default_ifwi = (("IFWI", args["ifwi"], args["ifwiversion"]),
                                ("FW_DNX", args["fwdnx"], args["ifwiversion"]),
                                ("OS_DNX", args["osdnx"], args["ifwiversion"]))

        ifwis_dict = {}
        for xml_file in f.xml.keys():
            ifwis_dict[xml_file] = default_ifwi

        if args["xxrdnx"]:
            xxrdnx = ("XXR_DNX", args["xxrdnx"], args["ifwiversion"])
            for xml_file in f.xml.keys():
                ifwis_dict[xml_file] += (xxrdnx, )

        if args["softfuse"]:
            softfuse = ("SOFTFUSE", args["softfuse"], args["ifwiversion"])
            for xml_file in softfuse_files:
                ifwis_dict[xml_file] += (softfuse, )

        for xml_file in f.xml.keys():
            f.add_codegroup("FIRMWARE",
                            ifwis_dict[xml_file],
                            xml_filter=[xml_file])

        if part_scheme == "full-gpt":
            f.add_file("FASTBOOT", os.path.join(product_out, "droidboot.img"),
                       buildnumber)

        if args["capsule"]:
            fastboot_dir = os.path.join(bldpub, "fastboot-images", bld_variant)
            f.add_file("FASTBOOT", os.path.join(product_out, "droidboot.img"),
                       buildnumber)
            f.add_file("KERNEL", os.path.join(product_out, "boot.img"),
                       buildnumber)
            f.add_file("RECOVERY", os.path.join(product_out, "recovery.img"),
                       buildnumber)
            f.add_file("INSTALLER", "device/intel/baytrail/installer.cmd",
                       buildnumber)
        else:
            f.add_codegroup("BOOTLOADER",
                            (("KBOOT", recoveryimg, buildnumber), ))

        f.add_codegroup("CONFIG",
                        (("PARTITION_TABLE", partition_file, buildnumber), ))

        f.add_buildproperties("%(product_out)s/system/build.prop" % locals())

        if args["capsule"]:
            if bld == "baylake" or bld == "byt_t_ffrd8":
                f.add_command("fastboot boot $fastboot_file",
                              "Downloading fastboot image")
                f.add_command("fastboot continue", "Booting on fastboot image")
                f.add_command("sleep", "Sleep 25 seconds", timeout=25000)
            f.add_command("fastboot oem write_osip_header",
                          "Writing OSIP header")
            f.add_command("fastboot flash boot $kernel_file", "Flashing boot")
            f.add_command("fastboot flash recovery $recovery_file",
                          "Flashing recovery")
            f.add_command("fastboot flash fastboot $fastboot_file",
                          "Flashing fastboot")

        if part_scheme == "full-gpt":
            f.add_command("fastboot oem erase_osip_header",
                          "Erase OSIP header")

        publish_partitioning_commands(f, bld, buildnumber, partition_filename,
                                      ["cache", "config", "logs", "data"])

        # must provision the AOSP droidboot during blankphone
        if part_scheme == "full-gpt":
            f.add_command("fastboot flash fastboot $fastboot_file",
                          "Flashing droidboot")

        fru_token_dir = fru_configs = get_build_options(key='FRU_TOKEN_DIR')
        if os.path.isdir(fru_token_dir):
            # Use tokens to set the fru
            for filename in os.listdir(fru_token_dir):
                f.filenames.add(os.path.join(fru_token_dir, filename))

        fru_configs = get_build_options(key='FRU_CONFIGS')
        if os.path.exists(fru_configs):
            # Use fastboot command to set the fru
            f.add_xml_file("flash-fru.xml")
            fru = ["flash-fru.xml"]
            f.xml_header("fastboot", bld, flashfile_version, xml_filter=fru)
            f.add_command("fastboot oem fru set $fru_value",
                          "Flash FRU value on device",
                          xml_filter=fru)
            f.add_command(
                "popup",
                "Please turn off the board and update AOBs according to the new FRU value",
                xml_filter=fru)
            f.add_raw_file(fru_configs, xml_filter=fru)

        if args["capsule"] is None:
            # Creation of a "flash IFWI only" xml
            flash_IFWI = "flash-IFWI-only.xml"
            f.add_xml_file(flash_IFWI)
            f.xml_header("system",
                         bld,
                         flashfile_version,
                         xml_filter=[flash_IFWI])
            f.add_gpflag((gpflag & 0xFFFFFFF8) | 0x00000102,
                         xml_filter=[flash_IFWI])
            f.add_codegroup("FIRMWARE", default_ifwi, xml_filter=[flash_IFWI])

        if config_list:
            # populate alternate config XML files with corresponding configuration
            for conf in config_list.split():
                f.add_command("fastboot oem mount config ext4",
                              "Mount config partition",
                              xml_filter="flash-%s.xml" % conf)
                f.add_command("fastboot oem config %s" % conf,
                              "Activating config %s" % conf,
                              xml_filter="flash-%s.xml" % conf)

            if f.clear_xml_file("flash.xml"):
                f.xml_header("fastboot",
                             bld,
                             flashfile_version,
                             xml_filter="flash.xml")
                f.add_command(
                    "popup",
                    "This build does not support generic flash file, please select the one that corresponds to your hardware",
                    xml_filter="flash.xml")
                f.add_command("fastboot flash fail",
                              "Fake command to always return a flash failure",
                              xml_filter="flash.xml")
                f.add_gpflag((gpflag & 0xFFFFFFF8) | 0x00000045,
                             xml_filter="flash.xml")

        # Create a dedicated flash file for buildbot
        f.copy_xml_file("flash.xml", "flash-buildbot.xml")

        f.finish()
Пример #5
0
def publish_ota_flashfile(bld, bld_variant, bld_prod, buildnumber):
    # Get values from environment variables
    supported = not (get_build_options(key='FLASHFILE_NO_OTA',
                                       key_type='boolean'))
    published = do_we_publish_extra_build(bld_variant, 'full_ota_flashfile')
    target_name = get_build_options(key='GENERIC_TARGET_NAME')

    if not supported or not published:
        print "Do not publish ota flashfile"
        return

    # Set paths
    pub_dir_flashfiles = os.path.join(bldpub, "flash_files")

    product_out = os.path.join("out/target/product", bld)
    full_ota_basename = "%(target_name)s-ota-%(buildnumber)s.zip" % locals()
    full_ota_file = os.path.join(product_out, full_ota_basename)

    # build the ota flashfile
    f = FlashFile(
        os.path.join(
            pub_dir_flashfiles, "build-" + bld_variant,
            "%(target_name)s-%(bld_variant)s-ota-%(buildnumber)s.zip" %
            locals()), "flash.xml")
    f.xml_header("ota", bld, flashfile_version)
    f.add_file("OTA", full_ota_file, buildnumber)
    f.add_buildproperties("%(product_out)s/system/build.prop" % locals())
    f.add_command("adb root", "As root user")
    f.add_command("adb wait-for-device", "Wait ADB availability")
    f.add_command("adb shell rm /cache/recovery/update/*", "Clean cache")
    f.add_command("adb shell rm /cache/ota.zip", "Clean ota.zip")

    ota_push_timeout = 300000

    f.add_command("adb push $ota_file /cache/ota.zip",
                  "Pushing update",
                  timeout=ota_push_timeout)
    f.add_command(
        "adb shell am startservice -a com.intel.ota.OtaUpdate -e LOCATION /cache/ota.zip",
        "Trigger os update")
    f.finish()
Пример #6
0
def publish_build_iafw(bld, bld_variant, bld_prod, buildnumber, board_soc):
    board = ""
    bld_supports_droidboot = get_build_options(key='TARGET_USE_DROIDBOOT',
                                               key_type='boolean')
    bld_supports_ramdump = get_build_options(key='TARGET_USE_RAMDUMP',
                                             key_type='boolean')
    bld_supports_silentlake = get_build_options(key='INTEL_FEATURE_SILENTLAKE',
                                                key_type='boolean')
    bldx = get_build_options(key='GENERIC_TARGET_NAME')
    publish_system_img = do_we_publish_extra_build(bld_variant, 'system_img')

    product_out = os.path.join("out/target/product", bld)
    fastboot_dir = os.path.join(bldpub, "fastboot-images", bld_variant)
    iafw_dir = os.path.join(bldpub, "iafw")
    flashfile_dir = os.path.join(bldpub, "flash_files")

    print "publishing fastboot images"
    publish_kernel_keys(product_out, bld_variant)
    if bld_supports_silentlake:
        publish_file(locals(), "%(product_out)s/sl_vmm.bin", fastboot_dir)
    system_img_path_in_out = None

    if bld_supports_droidboot:
        publish_file(locals(),
                     "%(product_out)s/droidboot.img",
                     fastboot_dir,
                     enforce=False)
        publish_file(locals(),
                     "%(product_out)s/droidboot.img.POS.bin",
                     fastboot_dir,
                     enforce=False)
        system_img_path_in_out = os.path.join(product_out, "system.img")
    else:
        publish_file(locals(),
                     "%(product_out)s/recovery.img.POS.bin",
                     fastboot_dir,
                     enforce=False)
        system_img_path_in_out = os.path.join(product_out, "system.tar.gz")

    publish_file(locals(), "%(product_out)s/%(bldx)s-img-%(buildnumber)s.zip",
                 fastboot_dir)

    if bld_supports_ramdump:
        publish_file(locals(),
                     "%(product_out)s/ramdump.img",
                     fastboot_dir,
                     enforce=False)

    if publish_system_img:
        publish_file_without_formatting(system_img_path_in_out, fastboot_dir)

    publish_file(locals(),
                 "%(product_out)s/installed-files.txt",
                 fastboot_dir,
                 enforce=False)
    publish_file(locals(),
                 "%(product_out)s/ifwi/iafw/ia32fw.bin",
                 iafw_dir,
                 enforce=False)
    ifwis = find_ifwis(board_soc)

    f = FlashFile(
        os.path.join(
            flashfile_dir, "build-" + bld_variant,
            "%(bldx)s-%(bld_variant)s-fastboot-%(buildnumber)s.zip" %
            locals()), "flash.xml")

    f.xml_header("fastboot", bld, flashfile_version)

    f.add_file(
        "UPDATE",
        os.path.join(fastboot_dir, bldx + "-img-" + buildnumber + ".zip"),
        buildnumber)

    if bld_supports_silentlake:
        f.add_file("SILENTLAKE", os.path.join(fastboot_dir, "sl_vmm.bin"),
                   buildnumber)

    if bld_supports_droidboot:
        f.add_file("FASTBOOT", os.path.join(fastboot_dir, "droidboot.img"),
                   buildnumber)

    for board, args in ifwis.items():
        if args["ulpmc"]:
            f.add_codegroup("ULPMC",
                            (("ULPMC", args["ulpmc"], args["ifwiversion"]), ))
        if args["capsule"]:
            f.add_codegroup("CAPSULE",
                            (("CAPSULE_" + board.upper(), args["capsule"],
                              args["ifwiversion"]), ))
        else:
            if "PROD" not in args["ifwi"]:
                f.add_codegroup("FIRMWARE",
                                (("IFWI_" + board.upper(), args["ifwi"],
                                  args["ifwiversion"]),
                                 ("FW_DNX_" + board.upper(), args["fwdnx"],
                                  args["ifwiversion"])))

    f.add_buildproperties("%(product_out)s/system/build.prop" % locals())

    if bld_supports_droidboot:
        f.add_command("fastboot flash fastboot $fastboot_file",
                      "Flashing fastboot")

    for board, args in ifwis.items():
        if args["capsule"]:
            f.add_command(
                "fastboot flash capsule $capsule_%s_file" % (board.lower()),
                "Flashing capsule")
        else:
            if "PROD" not in args["ifwi"]:
                f.add_command(
                    "fastboot flash dnx $fw_dnx_%s_file" % (board.lower(), ),
                    "Attempt flashing ifwi " + board)
                f.add_command(
                    "fastboot flash ifwi $ifwi_%s_file" % (board.lower(), ),
                    "Attempt flashing ifwi " + board)
        if args["ulpmc"]:
            f.add_command("fastboot flash ulpmc $ulpmc_file",
                          "Flashing ulpmc",
                          retry=3,
                          mandatory=0)

    publish_format_partitions(f, ["cache"])

    if bld_supports_silentlake:
        f.add_command("fastboot flash silentlake $silentlake_file",
                      "Flashing silentlake")

    update_timeout = 600000
    f.add_command("fastboot update $update_file",
                  "Flashing AOSP images",
                  timeout=update_timeout)

    # build the flash-capsule.xml
    for board, args in ifwis.items():
        if args["capsule"]:
            f.add_xml_file("flash-capsule.xml")
            f_capsule = ["flash-capsule.xml"]
            f.xml_header("fastboot",
                         bld,
                         flashfile_version,
                         xml_filter=f_capsule)
            f.add_codegroup("CAPSULE",
                            (("CAPSULE_" + board.upper(), args["capsule"],
                              args["ifwiversion"]), ),
                            xml_filter=f_capsule)
            f.add_buildproperties("%(product_out)s/system/build.prop" %
                                  locals(),
                                  xml_filter=f_capsule)
            f.add_command("fastboot flash capsule $capsule_%s_file" %
                          (board.lower(), ),
                          "Attempt flashing ifwi " + board,
                          xml_filter=f_capsule)
            f.add_command("fastboot continue", "Reboot", xml_filter=f_capsule)

    # build the flash-ramdump.xml to flash and enable the ramdump
    if bld_supports_ramdump:
        f.add_xml_file("flash-ramdump.xml")
        f_ramdump = ["flash-ramdump.xml"]
        f.xml_header("fastboot", bld, flashfile_version, xml_filter=f_ramdump)
        f.add_file("RAMDUMP",
                   os.path.join(fastboot_dir, "ramdump.img"),
                   buildnumber,
                   xml_filter=f_ramdump)
        f.add_command("fastboot flash ramdump $ramdump_file",
                      "Flashing ramdump",
                      xml_filter=f_ramdump)
        f.add_command("fastboot oem custom_boot 0x80",
                      "Enabling ramdump",
                      xml_filter=f_ramdump)
        f.add_command("fastboot continue", "Reboot", xml_filter=f_ramdump)

    f.finish()
Пример #7
0
def publish_blankphone_uefi(bld, buildnumber, board_soc):
    product_out = os.path.join("out/target/product", bld)
    fastboot_dir = os.path.join(bldpub, "fastboot-images")
    target2file = [("ESP", "esp"), ("fastboot", "droidboot")]

    blankphone_dir = os.path.join(bldpub, "flash_files/blankphone")
    bldx = get_build_options(key="GENERIC_TARGET_NAME")
    f = FlashFile(os.path.join(blankphone_dir, bldx + "-blankphone.zip"), "flash.xml")
    f.add_xml_file("flash-EraseFactory.xml")
    fastboot_mode = "fastboot_dnx"
    osloader = True

    if bld == "cht_rvp":
        fastboot_mode = "fastboot"
        osloader = False

    if bld == "byt_t_ffrd8":
        f.add_xml_file("flash-rvp8.xml")

    f.xml_header(fastboot_mode, bld, flashfile_version)

    publish_attach_target2file(f, product_out, buildnumber, target2file)
    if osloader:
        f.add_file("osloader", os.path.join(product_out, "efilinux-%s.efi" % bld_variant), buildnumber)

    f.add_file("INSTALLER", "device/intel/baytrail/installer.cmd", buildnumber)
    if bld == "byt_t_ffrd8":
        efilinuxcfg_file = os.path.join(product_out, "efilinux_fakebatt.cfg")
        fe = open(efilinuxcfg_file, "w")
        fe.write("-e fake \n")
        fe.close()
        f.add_codegroup("CONFIG", (("EFILINUX_CFG", efilinuxcfg_file, buildnumber),), xml_filter=["flash-rvp8.xml"])

    ifwis = find_ifwis(board_soc)
    for board, args in ifwis.items():
        if args["ifwi"]:
            f.add_codegroup("FIRMWARE", (("DEDIPROG_" + board.upper(), args["ifwi"], args["ifwiversion"]),))
        if args["stage2"]:
            f.add_codegroup("stage2", (("stage2_" + board.upper(), args["stage2"], args["ifwiversion"]),))

    part_file = os.path.join(product_out, "partition.tbl")
    f.add_codegroup("CONFIG", (("PARTITION_TABLE", part_file, buildnumber),))

    f.add_buildproperties("%(product_out)s/system/build.prop" % locals())

    for board, args in ifwis.items():
        if args["stage2"]:
            f.add_command(
                "fastboot flash fw_stage2 $stage2_%s_file" % (board.lower(),),
                "Uploading Stage 2 IFWI image.",
                mandatory=0,
            )
            f.add_command("sleep", "Sleep for 5 seconds.", timeout=5000)

    if osloader:
        f.add_command("fastboot flash osloader $osloader_file", "Uploading EFI OSLoader image.")
        f.add_command("fastboot boot $droidboot_file", "Uploading fastboot image.")
        f.add_command("sleep", "Sleep for 25 seconds.", timeout=25000)

    f.add_command("fastboot oem wipe ESP", "Wiping ESP partition.", mandatory=0)
    f.add_command("fastboot oem wipe reserved", "Wiping reserved partition.", mandatory=0)
    publish_partitioning_commands(f, bld, buildnumber, os.path.split(part_file)[1], ["cache", "config", "logs", "data"])

    publish_flash_target2file(f, target2file)

    if bld == "byt_t_ffrd8":
        f.add_command("fastboot oem mount ESP vfat", "Mounting ESP partition.", xml_filter=["flash-rvp8.xml"])
        f.add_command(
            "fastboot flash /mnt/ESP/EFI/BOOT/efilinux.cfg $efilinux_cfg_file",
            "Copy efilinux.cfg",
            xml_filter=["flash-rvp8.xml"],
        )

    f.copy_xml_file("flash.xml", "flash-buildbot.xml")

    f.finish()
Пример #8
0
def publish_blankphone_iafw(bld, buildnumber, board_soc):
    bld_supports_droidboot = get_build_options(key="TARGET_USE_DROIDBOOT", key_type="boolean")
    bldx = get_build_options(key="GENERIC_TARGET_NAME")
    gpflag = get_build_options(key="BOARD_GPFLAG", key_type="hex")
    single_dnx = get_build_options(key="SINGLE_DNX")
    config_list = get_build_options(key="CONFIG_LIST")
    product_out = os.path.join("out/target/product", bld)
    blankphone_dir = os.path.join(bldpub, "flash_files/blankphone")
    partition_filename = "partition.tbl"
    partition_file = os.path.join(product_out, partition_filename)
    part_scheme = get_build_options(key="TARGET_PARTITIONING_SCHEME", default_value="osip-gpt")

    if bld_supports_droidboot:
        if part_scheme == "full-gpt":
            recoveryimg = os.path.join(product_out, "droidboot_dnx.img")
        else:
            recoveryimg = os.path.join(product_out, "droidboot.img.POS.bin")
    else:
        recoveryimg = os.path.join(product_out, "recovery.img.POS.bin")
    ifwis = find_ifwis(board_soc)
    for board, args in ifwis.items():
        # build the blankphone flashfile
        f = FlashFile(os.path.join(blankphone_dir, "%(board)s-blankphone.zip" % locals()), "flash.xml")
        f.add_xml_file("flash-EraseFactory.xml")
        # create all config XML files including default config
        if config_list:
            for conf in config_list.split():
                f.add_xml_file("flash-%s.xml" % conf)

        default_files = f.xml.keys()

        if args["softfuse"]:
            softfuse_files = ["flash-softfuse.xml", "flash-softfuse-EraseFactory.xml"]
            for softfuse_f in softfuse_files:
                f.add_xml_file(softfuse_f)

            f.xml_header("system", bld, flashfile_version)
            f.add_gpflag(gpflag | 0x00000200, xml_filter=softfuse_files)
            f.add_gpflag(gpflag | 0x00000100, xml_filter=default_files)
        else:
            if bld == "baylake" or bld == "byt_t_ffrd8":
                f.xml_header("fastboot_dnx", bld, flashfile_version)
            elif args["capsule"]:
                f.xml_header("fastboot", bld, flashfile_version)
            else:
                f.xml_header("system", bld, flashfile_version)
                f.add_gpflag(gpflag, xml_filter=default_files)

        if args["capsule"]:
            default_ifwi = (
                ("CAPSULE", args["capsule"], args["ifwiversion"]),
                ("DEDIPROG", args["ifwi"], args["ifwiversion"]),
            )
        else:
            if single_dnx == "true":
                default_ifwi = (
                    ("IFWI", args["ifwi"], args["ifwiversion"]),
                    ("FW_DNX", args["fwdnx"], args["ifwiversion"]),
                )
            else:
                default_ifwi = (
                    ("IFWI", args["ifwi"], args["ifwiversion"]),
                    ("FW_DNX", args["fwdnx"], args["ifwiversion"]),
                    ("OS_DNX", args["osdnx"], args["ifwiversion"]),
                )

        ifwis_dict = {}
        for xml_file in f.xml.keys():
            ifwis_dict[xml_file] = default_ifwi

        if args["xxrdnx"]:
            xxrdnx = ("XXR_DNX", args["xxrdnx"], args["ifwiversion"])
            for xml_file in f.xml.keys():
                ifwis_dict[xml_file] += (xxrdnx,)

        if args["softfuse"]:
            softfuse = ("SOFTFUSE", args["softfuse"], args["ifwiversion"])
            for xml_file in softfuse_files:
                ifwis_dict[xml_file] += (softfuse,)

        for xml_file in f.xml.keys():
            f.add_codegroup("FIRMWARE", ifwis_dict[xml_file], xml_filter=[xml_file])

        if part_scheme == "full-gpt":
            f.add_file("FASTBOOT", os.path.join(product_out, "droidboot.img"), buildnumber)

        if args["capsule"]:
            fastboot_dir = os.path.join(bldpub, "fastboot-images", bld_variant)
            f.add_file("FASTBOOT", os.path.join(product_out, "droidboot.img"), buildnumber)
            f.add_file("KERNEL", os.path.join(product_out, "boot.img"), buildnumber)
            f.add_file("RECOVERY", os.path.join(product_out, "recovery.img"), buildnumber)
            f.add_file("INSTALLER", "device/intel/baytrail/installer.cmd", buildnumber)
        else:
            f.add_codegroup("BOOTLOADER", (("KBOOT", recoveryimg, buildnumber),))

        f.add_codegroup("CONFIG", (("PARTITION_TABLE", partition_file, buildnumber),))

        f.add_buildproperties("%(product_out)s/system/build.prop" % locals())

        if args["capsule"]:
            if bld == "baylake" or bld == "byt_t_ffrd8":
                f.add_command("fastboot boot $fastboot_file", "Downloading fastboot image")
                f.add_command("fastboot continue", "Booting on fastboot image")
                f.add_command("sleep", "Sleep 25 seconds", timeout=25000)
            f.add_command("fastboot oem write_osip_header", "Writing OSIP header")
            f.add_command("fastboot flash boot $kernel_file", "Flashing boot")
            f.add_command("fastboot flash recovery $recovery_file", "Flashing recovery")
            f.add_command("fastboot flash fastboot $fastboot_file", "Flashing fastboot")

        if part_scheme == "full-gpt":
            f.add_command("fastboot oem erase_osip_header", "Erase OSIP header")

        publish_partitioning_commands(f, bld, buildnumber, partition_filename, ["cache", "config", "logs", "data"])

        # must provision the AOSP droidboot during blankphone
        if part_scheme == "full-gpt":
            f.add_command("fastboot flash fastboot $fastboot_file", "Flashing droidboot")

        fru_token_dir = fru_configs = get_build_options(key="FRU_TOKEN_DIR")
        if os.path.isdir(fru_token_dir):
            # Use tokens to set the fru
            for filename in os.listdir(fru_token_dir):
                f.filenames.add(os.path.join(fru_token_dir, filename))

        fru_configs = get_build_options(key="FRU_CONFIGS")
        if os.path.exists(fru_configs):
            # Use fastboot command to set the fru
            f.add_xml_file("flash-fru.xml")
            fru = ["flash-fru.xml"]
            f.xml_header("fastboot", bld, flashfile_version, xml_filter=fru)
            f.add_command("fastboot oem fru set $fru_value", "Flash FRU value on device", xml_filter=fru)
            f.add_command(
                "popup", "Please turn off the board and update AOBs according to the new FRU value", xml_filter=fru
            )
            f.add_raw_file(fru_configs, xml_filter=fru)

        if args["capsule"] is None:
            # Creation of a "flash IFWI only" xml
            flash_IFWI = "flash-IFWI-only.xml"
            f.add_xml_file(flash_IFWI)
            f.xml_header("system", bld, flashfile_version, xml_filter=[flash_IFWI])
            f.add_gpflag((gpflag & 0xFFFFFFF8) | 0x00000102, xml_filter=[flash_IFWI])
            f.add_codegroup("FIRMWARE", default_ifwi, xml_filter=[flash_IFWI])

        if config_list:
            # populate alternate config XML files with corresponding configuration
            for conf in config_list.split():
                f.add_command(
                    "fastboot oem mount config ext4", "Mount config partition", xml_filter="flash-%s.xml" % conf
                )
                f.add_command(
                    "fastboot oem config %s" % conf, "Activating config %s" % conf, xml_filter="flash-%s.xml" % conf
                )

            if f.clear_xml_file("flash.xml"):
                f.xml_header("fastboot", bld, flashfile_version, xml_filter="flash.xml")
                f.add_command(
                    "popup",
                    "This build does not support generic flash file, please select the one that corresponds to your hardware",
                    xml_filter="flash.xml",
                )
                f.add_command(
                    "fastboot flash fail", "Fake command to always return a flash failure", xml_filter="flash.xml"
                )
                f.add_gpflag((gpflag & 0xFFFFFFF8) | 0x00000045, xml_filter="flash.xml")

        # Create a dedicated flash file for buildbot
        f.copy_xml_file("flash.xml", "flash-buildbot.xml")

        f.finish()
Пример #9
0
def publish_ota_flashfile(bld, bld_variant, bld_prod, buildnumber):
    # Get values from environment variables
    supported = not (get_build_options(key="FLASHFILE_NO_OTA", key_type="boolean"))
    published = do_we_publish_extra_build(bld_variant, "full_ota_flashfile")
    target_name = get_build_options(key="GENERIC_TARGET_NAME")

    if not supported or not published:
        print "Do not publish ota flashfile"
        return

    # Set paths
    pub_dir_flashfiles = os.path.join(bldpub, "flash_files")

    product_out = os.path.join("out/target/product", bld)
    full_ota_basename = "%(target_name)s-ota-%(buildnumber)s.zip" % locals()
    full_ota_file = os.path.join(product_out, full_ota_basename)

    # build the ota flashfile
    f = FlashFile(
        os.path.join(
            pub_dir_flashfiles,
            "build-" + bld_variant,
            "%(target_name)s-%(bld_variant)s-ota-%(buildnumber)s.zip" % locals(),
        ),
        "flash.xml",
    )
    f.xml_header("ota", bld, flashfile_version)
    f.add_file("OTA", full_ota_file, buildnumber)
    f.add_buildproperties("%(product_out)s/system/build.prop" % locals())
    f.add_command("adb root", "As root user")
    f.add_command("adb wait-for-device", "Wait ADB availability")
    f.add_command("adb shell rm /cache/recovery/update/*", "Clean cache")
    f.add_command("adb shell rm /cache/ota.zip", "Clean ota.zip")

    ota_push_timeout = 300000

    f.add_command("adb push $ota_file /cache/ota.zip", "Pushing update", timeout=ota_push_timeout)
    f.add_command(
        "adb shell am startservice -a com.intel.ota.OtaUpdate -e LOCATION /cache/ota.zip", "Trigger os update"
    )
    f.finish()
Пример #10
0
def publish_build_iafw(bld, bld_variant, bld_prod, buildnumber, board_soc):
    board = ""
    bld_supports_droidboot = get_build_options(key="TARGET_USE_DROIDBOOT", key_type="boolean")
    bld_supports_ramdump = get_build_options(key="TARGET_USE_RAMDUMP", key_type="boolean")
    bld_supports_silentlake = get_build_options(key="INTEL_FEATURE_SILENTLAKE", key_type="boolean")
    bldx = get_build_options(key="GENERIC_TARGET_NAME")
    publish_system_img = do_we_publish_extra_build(bld_variant, "system_img")

    product_out = os.path.join("out/target/product", bld)
    fastboot_dir = os.path.join(bldpub, "fastboot-images", bld_variant)
    iafw_dir = os.path.join(bldpub, "iafw")
    flashfile_dir = os.path.join(bldpub, "flash_files")

    print "publishing fastboot images"
    publish_kernel_keys(product_out, bld_variant)
    if bld_supports_silentlake:
        publish_file(locals(), "%(product_out)s/sl_vmm.bin", fastboot_dir)
    system_img_path_in_out = None

    if bld_supports_droidboot:
        publish_file(locals(), "%(product_out)s/droidboot.img", fastboot_dir, enforce=False)
        publish_file(locals(), "%(product_out)s/droidboot.img.POS.bin", fastboot_dir, enforce=False)
        system_img_path_in_out = os.path.join(product_out, "system.img")
    else:
        publish_file(locals(), "%(product_out)s/recovery.img.POS.bin", fastboot_dir, enforce=False)
        system_img_path_in_out = os.path.join(product_out, "system.tar.gz")

    publish_file(locals(), "%(product_out)s/%(bldx)s-img-%(buildnumber)s.zip", fastboot_dir)

    if bld_supports_ramdump:
        publish_file(locals(), "%(product_out)s/ramdump.img", fastboot_dir, enforce=False)

    if publish_system_img:
        publish_file_without_formatting(system_img_path_in_out, fastboot_dir)

    publish_file(locals(), "%(product_out)s/installed-files.txt", fastboot_dir, enforce=False)
    publish_file(locals(), "%(product_out)s/ifwi/iafw/ia32fw.bin", iafw_dir, enforce=False)
    ifwis = find_ifwis(board_soc)

    f = FlashFile(
        os.path.join(
            flashfile_dir, "build-" + bld_variant, "%(bldx)s-%(bld_variant)s-fastboot-%(buildnumber)s.zip" % locals()
        ),
        "flash.xml",
    )

    f.xml_header("fastboot", bld, flashfile_version)

    f.add_file("UPDATE", os.path.join(fastboot_dir, bldx + "-img-" + buildnumber + ".zip"), buildnumber)

    if bld_supports_silentlake:
        f.add_file("SILENTLAKE", os.path.join(fastboot_dir, "sl_vmm.bin"), buildnumber)

    if bld_supports_droidboot:
        f.add_file("FASTBOOT", os.path.join(fastboot_dir, "droidboot.img"), buildnumber)

    for board, args in ifwis.items():
        if args["ulpmc"]:
            f.add_codegroup("ULPMC", (("ULPMC", args["ulpmc"], args["ifwiversion"]),))
        if args["capsule"]:
            f.add_codegroup("CAPSULE", (("CAPSULE_" + board.upper(), args["capsule"], args["ifwiversion"]),))
        else:
            if "PROD" not in args["ifwi"]:
                f.add_codegroup(
                    "FIRMWARE",
                    (
                        ("IFWI_" + board.upper(), args["ifwi"], args["ifwiversion"]),
                        ("FW_DNX_" + board.upper(), args["fwdnx"], args["ifwiversion"]),
                    ),
                )

    f.add_buildproperties("%(product_out)s/system/build.prop" % locals())

    if bld_supports_droidboot:
        f.add_command("fastboot flash fastboot $fastboot_file", "Flashing fastboot")

    for board, args in ifwis.items():
        if args["capsule"]:
            f.add_command("fastboot flash capsule $capsule_%s_file" % (board.lower()), "Flashing capsule")
        else:
            if "PROD" not in args["ifwi"]:
                f.add_command("fastboot flash dnx $fw_dnx_%s_file" % (board.lower(),), "Attempt flashing ifwi " + board)
                f.add_command("fastboot flash ifwi $ifwi_%s_file" % (board.lower(),), "Attempt flashing ifwi " + board)
        if args["ulpmc"]:
            f.add_command("fastboot flash ulpmc $ulpmc_file", "Flashing ulpmc", retry=3, mandatory=0)

    publish_format_partitions(f, ["cache"])

    if bld_supports_silentlake:
        f.add_command("fastboot flash silentlake $silentlake_file", "Flashing silentlake")

    update_timeout = 600000
    f.add_command("fastboot update $update_file", "Flashing AOSP images", timeout=update_timeout)

    # build the flash-capsule.xml
    for board, args in ifwis.items():
        if args["capsule"]:
            f.add_xml_file("flash-capsule.xml")
            f_capsule = ["flash-capsule.xml"]
            f.xml_header("fastboot", bld, flashfile_version, xml_filter=f_capsule)
            f.add_codegroup(
                "CAPSULE", (("CAPSULE_" + board.upper(), args["capsule"], args["ifwiversion"]),), xml_filter=f_capsule
            )
            f.add_buildproperties("%(product_out)s/system/build.prop" % locals(), xml_filter=f_capsule)
            f.add_command(
                "fastboot flash capsule $capsule_%s_file" % (board.lower(),),
                "Attempt flashing ifwi " + board,
                xml_filter=f_capsule,
            )
            f.add_command("fastboot continue", "Reboot", xml_filter=f_capsule)

    # build the flash-ramdump.xml to flash and enable the ramdump
    if bld_supports_ramdump:
        f.add_xml_file("flash-ramdump.xml")
        f_ramdump = ["flash-ramdump.xml"]
        f.xml_header("fastboot", bld, flashfile_version, xml_filter=f_ramdump)
        f.add_file("RAMDUMP", os.path.join(fastboot_dir, "ramdump.img"), buildnumber, xml_filter=f_ramdump)
        f.add_command("fastboot flash ramdump $ramdump_file", "Flashing ramdump", xml_filter=f_ramdump)
        f.add_command("fastboot oem custom_boot 0x80", "Enabling ramdump", xml_filter=f_ramdump)
        f.add_command("fastboot continue", "Reboot", xml_filter=f_ramdump)

    f.finish()