Commit 4e2580fc authored by Yusuke Sato's avatar Yusuke Sato Committed by Chromium LUCI CQ

arc: Remove arc::GenerateFirstStageFstab()

The function has been moved to platform2/arc/setup/.

BUG=chromium:1163122
TEST=try

Change-Id: I12fe15ee0d86a5be443f27ec7640e0298114102b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611179
Commit-Queue: Yusuke Sato <yusukes@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#846272}
parent 3e18a519
......@@ -11,8 +11,6 @@
#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/process/launch.h"
......@@ -352,28 +350,6 @@ 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()));
}
int GetSystemPropertyInt(const std::string& property) {
std::string output;
if (!base::GetAppOutput({kCrosSystemPath, property}, &output))
......
......@@ -21,7 +21,6 @@ class Window;
namespace base {
class CommandLine;
class FilePath;
} // namespace base
namespace user_manager {
......@@ -177,12 +176,6 @@ void SetArcCpuRestriction(CpuRestrictionState cpu_restriction_state);
// factor used on chrome.
int32_t GetLcdDensityForDeviceScaleFactor(float device_scale_factor);
// Generates a file called first stage fstab at |fstab_path| which is exported
// by crosvm to the guest via the device tree so the guest can read certain
// files in its init's first stage.
bool GenerateFirstStageFstab(const base::FilePath& combined_property_file_name,
const base::FilePath& fstab_path);
// Gets a system property managed by crossystem. This function can be called
// only with base::MayBlock().
int GetSystemPropertyInt(const std::string& property);
......
......@@ -351,33 +351,6 @@ TEST_F(ArcUtilTest, ScaleFactorToDensity) {
EXPECT_EQ(240, GetLcdDensityForDeviceScaleFactor(2.0));
}
TEST_F(ArcUtilTest, GenerateFirstStageFstab) {
constexpr const char kFakeCombinedBuildPropPath[] = "/path/to/build.prop";
constexpr const char kAnotherFakeCombinedBuildPropPath[] =
"/foo/bar/baz.prop";
auto* command_line = base::CommandLine::ForCurrentProcess();
command_line->InitFromArgv({"", "--enable-arcvm"});
std::string content;
base::ScopedTempDir dir;
ASSERT_TRUE(dir.CreateUniqueTempDir());
const base::FilePath fstab(dir.GetPath().Append("fstab"));
// Generate the fstab and verify the content.
EXPECT_TRUE(GenerateFirstStageFstab(
base::FilePath(kFakeCombinedBuildPropPath), fstab));
EXPECT_TRUE(base::ReadFileToString(fstab, &content));
EXPECT_NE(std::string::npos, content.find(kFakeCombinedBuildPropPath));
// Generate the fstab again with the other prop file and verify the content.
EXPECT_TRUE(GenerateFirstStageFstab(
base::FilePath(kAnotherFakeCombinedBuildPropPath), fstab));
EXPECT_TRUE(base::ReadFileToString(fstab, &content));
EXPECT_EQ(std::string::npos, content.find(kFakeCombinedBuildPropPath));
EXPECT_NE(std::string::npos, content.find(kAnotherFakeCombinedBuildPropPath));
}
TEST_F(ArcUtilTest, ConfigureUpstartJobs_Success) {
std::deque<JobDesc> jobs{
JobDesc{"Job_2dA", UpstartOperation::JOB_STOP, {}},
......
......@@ -303,7 +303,7 @@ vm_tools::concierge::StartArcVmRequest CreateStartArcVmRequest(
file_system_status.is_system_image_ext_format());
// Add /vendor as /dev/block/vdb. The device name has to be consistent with
// the one in GenerateFirstStageFstab() in ../arc_util.cc.
// the one in GenerateFirstStageFstab() in platform2/arc/setup/.
vm_tools::concierge::DiskImage* disk_image = request.add_disks();
disk_image->set_path(file_system_status.vendor_image_path().value());
disk_image->set_image_type(vm_tools::concierge::DISK_IMAGE_AUTO);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment