Exemple #1
0
    args = parser.parse_args()

    # check firmware image
    if not check_firmware_image(args.firmware):
        logger.warning("This firmware version is not verified for this " "patches.")

    fw = Firmware()
    fw.load_from_file(args.firmware)

    if args.action == actions[1]:
        # "FindFreeBlock"
        if args.section is None:
            logger.error("No section provided")
        else:
            fw.save_last_free_chunk(section_names.index(args.section), args.output)

    if args.action == actions[0]:
        # "GenerateHFile"
        fw.generate_header_file(args.output)

    if args.action == actions[2]:
        # "ApplyPatches"

        # collect the rst and code files
        code_dict = {}
        rst_dict = {}

        args_dict = vars(args)
        if args_dict["basecode"] is not None:
            code_dict[0] = args_dict["basecode"]
Exemple #2
0
    args = parser.parse_args()

    #check firmware image
    if not check_firmware_image(args.firmware):
        logger.warning("This firmware version is not verified for this "
                       "patches.")

    fw = Firmware()
    fw.load_from_file(args.firmware)

    if args.action == actions[1]:
        # "FindFreeBlock"
        if args.section is None:
            logger.error("No section provided")
        else:
            fw.save_last_free_chunk(section_names.index(args.section),
                                    args.output)

    if args.action == actions[0]:
        # "GenerateHFile"
        fw.generate_header_file(args.output)

    if args.action == actions[2]:
        # "ApplyPatches"

        # collect the rst and code files
        code_dict = {}
        rst_dict = {}

        args_dict = vars(args)
        if args_dict["basecode"] is not None:
            code_dict[0] = args_dict["basecode"]