[go: up one dir, main page]

tree: ad6ccde5af597997a08eacef04f51c1bdeeeca82 [path history] [tgz]
  1. client/
  2. dbus_adaptors/
  3. init/
  4. minijail/
  5. ramfs/
  6. screens/
  7. scripts/
  8. seccomp/
  9. blkid_wrapper.cc
  10. blkid_wrapper.h
  11. blkid_wrapper_test.cc
  12. BUILD.gn
  13. cgpt_util.cc
  14. cgpt_util.h
  15. cgpt_util_test.cc
  16. cgpt_wrapper.h
  17. daemon.cc
  18. daemon.h
  19. disk_util.cc
  20. disk_util.h
  21. disk_util_test.cc
  22. draw_utils.cc
  23. draw_utils.h
  24. draw_utils_test.cc
  25. error.cc
  26. error.h
  27. key_reader.cc
  28. key_reader.h
  29. key_reader_test.cc
  30. log_store_manager.cc
  31. log_store_manager.h
  32. log_store_manager_test.cc
  33. log_store_manifest.cc
  34. log_store_manifest.h
  35. log_store_manifest_test.cc
  36. logger.cc
  37. logger.h
  38. logger_test.cc
  39. main.cc
  40. metrics_reporter.cc
  41. metrics_reporter.h
  42. metrics_reporter_test.cc
  43. minios.cc
  44. minios.h
  45. minios_util.cc
  46. mock_blkid_wrapper.h
  47. mock_cgpt_util.h
  48. mock_cgpt_wrapper.h
  49. mock_disk_util.h
  50. mock_draw.h
  51. mock_draw_utils.h
  52. mock_log_store_manager.h
  53. mock_log_store_manifest.h
  54. mock_metrics_reporter.h
  55. mock_minios.h
  56. mock_network_manager.h
  57. mock_process_manager.h
  58. mock_recovery_installer.h
  59. mock_screen.h
  60. mock_screen_controller.h
  61. mock_shill_proxy.h
  62. mock_state_reporter_interface.h
  63. mock_update_engine_proxy.h
  64. network_manager.cc
  65. network_manager.h
  66. network_manager_test.cc
  67. org.chromium.MiniOs.conf
  68. OWNERS
  69. process_manager.cc
  70. process_manager.h
  71. README.md
  72. recovery_installer.cc
  73. recovery_installer.h
  74. recovery_installer_test.cc
  75. screen_controller.cc
  76. screen_controller.h
  77. screen_controller_test.cc
  78. screen_types.h
  79. shill_proxy.cc
  80. shill_proxy.h
  81. state_reporter_interface.h
  82. test_utils.h
  83. update_engine_proxy.cc
  84. update_engine_proxy.h
  85. update_engine_proxy_test.cc
  86. utils.cc
  87. utils.h
  88. utils_test.cc
minios/README.md

MiniOS

MiniOS, also known as the Network Based Recovery (go/cros-nbr), is a “mini” version of CrOS designed specifically for device recovery. It is used to recover ChromeOS devices that are unable to boot normally.

MiniOS can be used to repartition the disk, wipe the stateful partition and all user data, and update to the latest stable version of ChromeOS.

Upstart

MiniOS is brought up with Upstart, similar to ChromeOS. The majority of the scripts are located in platform2/init/upstart with some MiniOS specific processes located in minios/init.

Frecon

MiniOS graphics are done with frecon-lite and can show images and draw shapes. The layout of MiniOS elements is based on the frecon canvas size and scaling factor which are from frecon.conf. The images are created with Pango during build time with no run time size or color changes supported.

KeyReader

KeyReader is how MiniOS processes input. There are two types of input KeyReader handles.

The first type is basic navigation using the up, down, and enter keys. This is used to navigate between screens and make basic selections. This type of input uses an Epoll file descriptor which sends all input to ScreenController so each screen can decide what action to take based on user input.

The other kind of functionality KeyReader supports is taking in alphanumeric input, which is used for things like the network password; this does not use the watcher. For this type of input, KeyReader must be given a keyboard layout to correctly map key codes to characters. Currently, there is no foolproof way to do this, but the region information is read from VPD and then mapped to a list of supported chrome keyboard layouts using cros-regions.json. Due to the size and complexity constraints of MiniOS, only standard ASCII characters are processed. Other special characters such as “ê” are ignored even if they are a part of the keyboard layout.

Building MiniOS image

To build MiniOS image, create ${OUT_DIR} and run

# ${VERSION} can be an arbitrary string
build_minios --board ${BOARD} --kernel-only --kernel-output ${OUT_DIR} \
  --version ${VERSION} --mod-for-dev --force-build

Alternatively, to manually build the MiniOS kernel and pack it, run

# Build /build/${BOARD}/boot/vmlinuz
# ${KERNEL_EBUILD} is chromeos-kernel-6_6 for example
USE="minios minios_ramfs" emerge-${BOARD} ${KERNEL_EBUILD}

# Pack vmlinuz as ${OUT_IMAGE}
vbutil_kernel --pack ${OUT_IMAGE} \
  --keyblock /usr/share/vboot/devkeys/minios_kernel.keyblock \
  --signprivate /usr/share/vboot/devkeys/minios_kernel_data_key.vbprivk \
  --version 1 \
  --arch ${ARCH} \
  --config ${KERNEL_CONFIG} \
  --vmlinuz "/build/${BOARD}/boot/vmlinuz"

Flashing MiniOS image

Currently update_kernel.sh doesn't support flashing MiniOS kernels (partitions 9 and 10). Therefore, scp the image to DUT and run dd.

To modify MiniOS configs on DUT, run

/usr/share/vboot/bin/make_dev_ssd.sh --minios_key --partitions '9 10'

along with other flags (such as --enable_earlycon or --set_config).

To flash MiniOS partitions from an OS image, pass --minios-update to cros flash.

Locally testing on older devices

MiniOS can be test on devices which don't have the newer partitions for miniOS. The way to test is by repartitioning the device.

On locally available DUTs:

  1. Convert to disk_layout_v3 or newer in disk_layout.json.
  2. Enabled minios USE flag.
  3. Build image.
  4. chromeos-install the image from USB.
  5. Reboot the device.

On lab DUTs:

  1. From the labstation run:
# Find the correct SERVO_PORT (e.g. 9996, 9997)
$> start servod PORT=$P
$> dut-control -p $P power_state:off
# Only for devices with battery and type-c connection to servo with PD.
$> dut-control -p $P servo_pd_role:snk
# Download a image to flash or use a cache server URL.
# The flashing of USB might take some time.
$> dut-control -p $P download_image_to_usb_dev:$PATH_OR_URL
$> dut-control -p $P image_usbkey_direction:dut_sees_usbkey
$> dut-control -p $P power_state:rec
  1. From the DUT:
# Verify that the DUT has booted from USB.
$> rootdev -s # should be /dev/sd*
$> /usr/sbin/chromeos-install
$> reboot

The device will now use the newer layout with miniOS support.