Файлы System/bin Android 12. Справочник.


  Все     Команда     Скрипт     Служба     Приложение  

lpflash - исходный текст
#include <stdio.h>
#include <sysexits.h>
#include <string>
#include <liblp/liblp.h>
using namespace android;
using namespace android::fs_mgr;
/* Prints program usage to |where|. */
static int usage(int /* argc */, char* argv[]) {
    fprintf(stderr,
            "%s - command-line tool for dumping Android Logical Partition images.\n"
            "\n"
            "Usage:\n"
            "  %s [block-device] [img-file]\n",
            argv[0], argv[0]);
    return EX_USAGE;
}
int main(int argc, char* argv[]) {
    if (argc != 3) {
        return usage(argc, argv);
    }
    std::unique_ptr<LpMetadata> pt = ReadFromImageFile(argv[2]);
    if (!pt) {
        printf("Failed to read image file.\n");
        return EX_NOINPUT;
    }
    if (!FlashPartitionTable(argv[1], *pt.get())) {
        printf("Failed to flash partition table.\n");
        return EX_SOFTWARE;
    }
    printf("Successfully flashed partition table.\n");
    return EX_OK;
}