diff options
Diffstat (limited to 'chromium/components/arc/arc_util.cc')
-rw-r--r-- | chromium/components/arc/arc_util.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/chromium/components/arc/arc_util.cc b/chromium/components/arc/arc_util.cc index 7b0e268efe2..ddc04468c0e 100644 --- a/chromium/components/arc/arc_util.cc +++ b/chromium/components/arc/arc_util.cc @@ -11,6 +11,9 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/feature_list.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/logging.h" #include "base/optional.h" #include "base/strings/string_number_conversions.h" #include "chromeos/constants/chromeos_switches.h" @@ -303,7 +306,6 @@ bool IsArcPlayAutoInstallDisabled() { chromeos::switches::kArcDisablePlayAutoInstall); } -// static int32_t GetLcdDensityForDeviceScaleFactor(float device_scale_factor) { const auto* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(chromeos::switches::kArcScale)) { @@ -333,4 +335,26 @@ int32_t GetLcdDensityForDeviceScaleFactor(float device_scale_factor) { kDefaultDensityDpi); } +bool GenerateFirstStageFstab(const base::FilePath& combined_property_file_name, + const base::FilePath& fstab_path) { + DCHECK(IsArcVmEnabled()); + // The file is exposed to the guest by crosvm via /sys/firmware/devicetree, + // which in turn allows the guest's init process to mount /vendor very early, + // in its first stage (device) initialization step. crosvm also special-cases + // #dt-vendor line and expose |combined_property_file_name| via the device + // tree file system too. This also allow the init process to load the expanded + // properties very early even before all file systems are mounted. + // + // The device name for /vendor has to match what arc_vm_client_adapter.cc + // configures. + constexpr const char kFirstStageFstabTemplate[] = + "/dev/block/vdb /vendor squashfs ro,noatime,nosuid,nodev " + "wait,check,formattable,reservedsize=128M\n" + "#dt-vendor build.prop %s default default\n"; + return base::WriteFile( + fstab_path, + base::StringPrintf(kFirstStageFstabTemplate, + combined_property_file_name.value().c_str())); +} + } // namespace arc |