赞
踩
1 需求
2 源码
/system/core/fastboot/fastboot.cpp
3.X 示例:
- 389 static int show_help() {
- 390 // clang-format off
- 391 fprintf(stdout,
- 392 // 1 2 3 4 5 6 7 8
- 393 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
- 394 "usage: fastboot [OPTION...] COMMAND...\n"
- 395 "\n"
- 396 "flashing:\n"
- 397 " update ZIP Flash all partitions from an update.zip package.\n"
- 398 " flashall Flash all partitions from $ANDROID_PRODUCT_OUT.\n"
- 399 " On A/B devices, flashed slot is set as active.\n"
- 400 " Secondary images may be flashed to inactive slot.\n"
- 401 " flash PARTITION [FILENAME] Flash given partition, using the image from\n"
- 402 " $ANDROID_PRODUCT_OUT if no filename is given.\n"
- 403 "\n"
- 404 "basics:\n"
- 405 " devices [-l] List devices in bootloader (-l: with device paths).\n"
- 406 " getvar NAME Display given bootloader variable.\n"
- 407 " reboot [bootloader] Reboot device.\n"
- 408 "\n"
- 409 "locking/unlocking:\n"
- 410 " flashing lock|unlock Lock/unlock partitions for flashing\n"
- 411 " flashing lock_critical|unlock_critical\n"
- 412 " Lock/unlock 'critical' bootloader partitions.\n"
- 413 " flashing get_unlock_ability\n"
- 414 " Check whether unlocking is allowed (1) or not(0).\n"
- 415 "\n"
- 416 "advanced:\n"
- 417 " erase PARTITION Erase a flash partition.\n"
- 418 " format[:FS_TYPE[:SIZE]] PARTITION\n"
- 419 " Format a flash partition.\n"
- 420 " set_active SLOT Set the active slot.\n"
- 421 " oem [COMMAND...] Execute OEM-specific command.\n"
- 422 " gsi wipe|disable Wipe or disable a GSI installation (fastbootd only).\n"
- 423 " wipe-super [SUPER_EMPTY] Wipe the super partition. This will reset it to\n"
- 424 " contain an empty set of default dynamic partitions.\n"
- 425 " create-logical-partition NAME SIZE\n"
- 426 " Create a logical partition with the given name and\n"
- 427 " size, in the super partition.\n"
- 428 " delete-logical-partition NAME\n"
- 429 " Delete a logical partition with the given name.\n"
- 430 " resize-logical-partition NAME SIZE\n"
- 431 " Change the size of the named logical partition.\n"
- 432 " snapshot-update cancel On devices that support snapshot-based updates, cancel\n"
- 433 " an in-progress update. This may make the device\n"
- 434 " unbootable until it is reflashed.\n"
- 435 " snapshot-update merge On devices that support snapshot-based updates, finish\n"
- 436 " an in-progress update if it is in the \"merging\"\n"
- 437 " phase.\n"
- 438 " fetch PARTITION OUT_FILE Fetch a partition image from the device."
- 439 "\n"
- 440 "boot image:\n"
- 441 " boot KERNEL [RAMDISK [SECOND]]\n"
- 442 " Download and boot kernel from RAM.\n"
- 443 " flash:raw PARTITION KERNEL [RAMDISK [SECOND]]\n"
- 444 " Create boot image and flash it.\n"
- 445 " --dtb DTB Specify path to DTB for boot image header version 2.\n"
- 446 " --cmdline CMDLINE Override kernel command line.\n"
- 447 " --base ADDRESS Set kernel base address (default: 0x10000000).\n"
- 448 " --kernel-offset Set kernel offset (default: 0x00008000).\n"
- 449 " --ramdisk-offset Set ramdisk offset (default: 0x01000000).\n"
- 450 " --tags-offset Set tags offset (default: 0x00000100).\n"
- 451 " --dtb-offset Set dtb offset (default: 0x01100000).\n"
- 452 " --page-size BYTES Set flash page size (default: 2048).\n"
- 453 " --header-version VERSION Set boot image header version.\n"
- 454 " --os-version MAJOR[.MINOR[.PATCH]]\n"
- 455 " Set boot image OS version (default: 0.0.0).\n"
- 456 " --os-patch-level YYYY-MM-DD\n"
- 457 " Set boot image OS security patch level.\n"
- 458 // TODO: still missing: `second_addr`, `name`, `id`, `recovery_dtbo_*`.
- 459 "\n"
- 460 // TODO: what device(s) used this? is there any documentation?
- 461 //" continue Continue with autoboot.\n"
- 462 //"\n"
- 463 "Android Things:\n"
- 464 " stage IN_FILE Sends given file to stage for the next command.\n"
- 465 " get_staged OUT_FILE Writes data staged by the last command to a file.\n"
- 466 "\n"
- 467 "options:\n"
- 468 " -w Wipe userdata.\n"
- 469 " -s SERIAL Specify a USB device.\n"
- 470 " -s tcp|udp:HOST[:PORT] Specify a network device.\n"
- 471 " -S SIZE[K|M|G] Break into sparse files no larger than SIZE.\n"
- 472 " --force Force a flash operation that may be unsafe.\n"
- 473 " --slot SLOT Use SLOT; 'all' for both slots, 'other' for\n"
- 474 " non-current slot (default: current active slot).\n"
- 475 " --set-active[=SLOT] Sets the active slot before rebooting.\n"
- 476 " --skip-secondary Don't flash secondary slots in flashall/update.\n"
- 477 " --skip-reboot Don't reboot device after flashing.\n"
- 478 " --disable-verity Sets disable-verity when flashing vbmeta.\n"
- 479 " --disable-verification Sets disable-verification when flashing vbmeta.\n"
- 480 " --fs-options=OPTION[,OPTION]\n"
- 481 " Enable filesystem features. OPTION supports casefold, projid, compress\n"
- 482 // TODO: remove --unbuffered?
- 483 " --unbuffered Don't buffer input or output.\n"
- 484 " --verbose, -v Verbose output.\n"
- 485 " --version Display version.\n"
- 486 " --help, -h Show this message.\n"
- 487 );
- 488 // clang-format on
- 489 return 0;
- 490 }
3.X 示例:
- 141 static Image images[] = {
- 142 // clang-format off
- 143 { "boot", "boot.img", "boot.sig", "boot", false, ImageType::BootCritical },
- 144 { "init_boot",
- 145 "init_boot.img", "init_boot.sig",
- 146 "init_boot",
- 147 true, ImageType::BootCritical },
- 148 { nullptr, "boot_other.img", "boot.sig", "boot", true, ImageType::Normal },
- 149 { "cache", "cache.img", "cache.sig", "cache", true, ImageType::Extra },
- 150 { "dtbo", "dtbo.img", "dtbo.sig", "dtbo", true, ImageType::BootCritical },
- 151 { "dts", "dt.img", "dt.sig", "dts", true, ImageType::BootCritical },
- 152 { "odm", "odm.img", "odm.sig", "odm", true, ImageType::Normal },
- 153 { "odm_dlkm", "odm_dlkm.img", "odm_dlkm.sig", "odm_dlkm", true, ImageType::Normal },
- 154 { "product", "product.img", "product.sig", "product", true, ImageType::Normal },
- 155 { "pvmfw", "pvmfw.img", "pvmfw.sig", "pvmfw", true, ImageType::BootCritical },
- 156 { "recovery", "recovery.img", "recovery.sig", "recovery", true, ImageType::BootCritical },
- 157 { "super", "super.img", "super.sig", "super", true, ImageType::Extra },
- 158 { "system", "system.img", "system.sig", "system", false, ImageType::Normal },
- 159 { "system_dlkm",
- 160 "system_dlkm.img", "system_dlkm.sig",
- 161 "system_dlkm",
- 162 true, ImageType::Normal },
- 163 { "system_ext",
- 164 "system_ext.img", "system_ext.sig",
- 165 "system_ext",
- 166 true, ImageType::Normal },
- 167 { nullptr, "system_other.img", "system.sig", "system", true, ImageType::Normal },
- 168 { "userdata", "userdata.img", "userdata.sig", "userdata", true, ImageType::Extra },
- 169 { "vbmeta", "vbmeta.img", "vbmeta.sig", "vbmeta", true, ImageType::BootCritical },
- 170 { "vbmeta_system",
- 171 "vbmeta_system.img",
- 172 "vbmeta_system.sig",
- 173 "vbmeta_system",
- 174 true, ImageType::BootCritical },
- 175 { "vbmeta_vendor",
- 176 "vbmeta_vendor.img",
- 177 "vbmeta_vendor.sig",
- 178 "vbmeta_vendor",
- 179 true, ImageType::BootCritical },
- 180 { "vendor", "vendor.img", "vendor.sig", "vendor", true, ImageType::Normal },
- 181 { "vendor_boot",
- 182 "vendor_boot.img", "vendor_boot.sig",
- 183 "vendor_boot",
- 184 true, ImageType::BootCritical },
- 185 { "vendor_dlkm",
- 186 "vendor_dlkm.img", "vendor_dlkm.sig",
- 187 "vendor_dlkm",
- 188 true, ImageType::Normal },
- 189 { nullptr, "vendor_other.img", "vendor.sig", "vendor", true, ImageType::Normal },
- 190 // clang-format on
- 191 };
4 参考资料
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。