chromeos_postinst.cc
// Updates firmware. We must activate new firmware only after new kernel is
// actived (installed and made bootable), otherwise new firmware with all old
// kernels may lead to recovery screen (due to new key).
// TODO(hungte) Replace the shell execution by native code (crosbug.com/25407).
Updates firmware. We must activate new firmware only after new kernel is
actived (installed and made bootable), otherwise new firmware with all old
kernels may lead to recovery screen (due to new key).
Updates firmware . We must activate new firmware only after new kernel is actived ( installed and made bootable ) otherwise new firmware with all old kernels may lead to recovery screen ( due to new key ) .
bool FirmwareUpdate(const string &install_dir, bool is_update) {
  int result;
  const char *mode;
  string command = install_dir + "/usr/sbin/chromeos-firmwareupdate";
  if (access(command.c_str(), X_OK) != 0) {
    printf("No firmware updates available.\n");
    return true;
  }
  if (is_update) {
    mode = "autoupdate";
  } else {
    mode = "recovery";
  }
  command += " --mode=";
  command += mode;
  printf("Starting firmware updater (%s)\n", command.c_str());
  result = system(command.c_str());
  if (result == 0) {
    printf("Firmware update completed.\n");
  } else if (result == 3) {
    printf("Firmware can't be updated because booted from B (error code: %d)\n",
           result);
  } else {
    printf("Firmware update failed (error code: %d).\n", result);
  }
  return result == 0;
}
bool FirmwareUpdate ( const string & install_dir , bool is_update ) { int result ; const char * mode ; string command = install_dir + " " ; if ( access ( command . c_str ( ) , X_OK ) != 0 ) { printf ( " \n " ) ; return true ; } if ( is_update ) { mode = " " ; } else { mode = " " ; } command += " " ; command += mode ; printf ( " \n " , command . c_str ( ) ) ; result = system ( command . c_str ( ) ) ; if ( result == 0 ) { printf ( " \n " ) ; } else if ( result == 3 ) { printf ( " \n " , result ) ; } else { printf ( " \n " , result ) ; } return result == 0 ; }
Updates firmware.
Updates firmware .
// Background auto update by Update Engine. // Recovery image, or from command "chromeos-install". // Next step after postinst may take a lot of time (eg, disk wiping) // and people may confuse that as 'firmware update takes a long wait', // we explicitly prompt here.