Merge "libinit_host: clean up dependencies" into main
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp
index 08619b9..962097e 100644
--- a/debuggerd/debuggerd_test.cpp
+++ b/debuggerd/debuggerd_test.cpp
@@ -86,7 +86,6 @@
#define ARCH_SUFFIX ""
#endif
-constexpr size_t kTagGranuleSize = 16;
constexpr char kWaitForDebuggerKey[] = "debug.debuggerd.wait_for_debugger";
#define TIMEOUT(seconds, expr) \
@@ -742,6 +741,8 @@
}
#if defined(__aarch64__)
+constexpr size_t kTagGranuleSize = 16;
+
static uintptr_t CreateTagMapping() {
// Some of the MTE tag dump tests assert that there is an inaccessible page to the left and right
// of the PROT_MTE page, so map three pages and set the two guard pages to PROT_NONE.
diff --git a/fs_mgr/libfstab/fstab_priv.h b/fs_mgr/libfstab/fstab_priv.h
index 5105da0..73cb175 100644
--- a/fs_mgr/libfstab/fstab_priv.h
+++ b/fs_mgr/libfstab/fstab_priv.h
@@ -39,9 +39,6 @@
void ImportBootconfigFromString(const std::string& bootconfig,
const std::function<void(std::string, std::string)>& fn);
-bool GetBootconfigFromString(const std::string& bootconfig, const std::string& key,
- std::string* out);
-
void ImportKernelCmdlineFromString(const std::string& cmdline,
const std::function<void(std::string, std::string)>& fn);
diff --git a/fs_mgr/libfstab/include/fstab/fstab.h b/fs_mgr/libfstab/include/fstab/fstab.h
index 1696daf..21fe017 100644
--- a/fs_mgr/libfstab/include/fstab/fstab.h
+++ b/fs_mgr/libfstab/include/fstab/fstab.h
@@ -153,5 +153,8 @@
// Return the "other" slot for the given slot suffix.
std::string OtherSlotSuffix(const std::string& suffix);
+bool GetBootconfigFromString(const std::string& bootconfig, const std::string& key,
+ std::string* out);
+
} // namespace fs_mgr
} // namespace android
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index bfe636b..e06a645 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -38,6 +38,7 @@
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android/avf_cc_flags.h>
+#include <fs_mgr.h>
#include <modprobe/modprobe.h>
#include <private/android_filesystem_config.h>
@@ -303,6 +304,22 @@
return BootMode::NORMAL_MODE;
}
+static void MaybeResumeFromHibernation(const std::string& bootconfig) {
+ std::string hibernationResumeDevice;
+ android::fs_mgr::GetBootconfigFromString(bootconfig, "androidboot.hibernation_resume_device",
+ &hibernationResumeDevice);
+ if (!hibernationResumeDevice.empty()) {
+ android::base::unique_fd fd(open("/sys/power/resume", O_RDWR | O_CLOEXEC));
+ if (fd >= 0) {
+ if (!android::base::WriteStringToFd(hibernationResumeDevice, fd)) {
+ PLOG(ERROR) << "Failed to write to /sys/power/resume";
+ }
+ } else {
+ PLOG(ERROR) << "Failed to open /sys/power/resume";
+ }
+ }
+}
+
static std::unique_ptr<FirstStageMount> CreateFirstStageMount(const std::string& cmdline) {
auto ret = FirstStageMount::Create(cmdline);
if (ret.ok()) {
@@ -442,6 +459,8 @@
<< module_elapse_time.count() << " ms";
}
+ MaybeResumeFromHibernation(bootconfig);
+
std::unique_ptr<FirstStageMount> fsm;
bool created_devices = false;