android-13.0.0_r82 patches
This commit is contained in:
126
android-13.0.0_r82/system/core/0001-fix-booting.patch
Normal file
126
android-13.0.0_r82/system/core/0001-fix-booting.patch
Normal file
@@ -0,0 +1,126 @@
|
||||
From ec4d2aeb05eaaa87aa141d8a2de1bc956ee9cce2 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Sun, 9 May 2021 23:09:00 +0800
|
||||
Subject: [PATCH 1/8] fix booting
|
||||
|
||||
---
|
||||
init/first_stage_init.cpp | 18 +++++++++++++++---
|
||||
init/init.cpp | 0
|
||||
init/property_service.cpp | 0
|
||||
init/service.cpp | 3 ++-
|
||||
init/util.cpp | 3 ++-
|
||||
rootdir/init.rc | 1 -
|
||||
6 files changed, 19 insertions(+), 6 deletions(-)
|
||||
mode change 100644 => 100755 init/init.cpp
|
||||
mode change 100644 => 100755 init/property_service.cpp
|
||||
|
||||
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
|
||||
index d050ed783..9ec04ab39 100644
|
||||
--- a/init/first_stage_init.cpp
|
||||
+++ b/init/first_stage_init.cpp
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <android-base/chrono_utils.h>
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
+#include <android-base/strings.h>
|
||||
#include <modprobe/modprobe.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
|
||||
@@ -237,6 +238,8 @@ int FirstStageMain(int argc, char** argv) {
|
||||
CHECKCALL(mkdir("/dev/pts", 0755));
|
||||
CHECKCALL(mkdir("/dev/socket", 0755));
|
||||
CHECKCALL(mkdir("/dev/dm-user", 0755));
|
||||
+ mount("/system/etc", "/etc", "none", MS_BIND, NULL); // cgroup fix
|
||||
+ unshare(CLONE_NEWCGROUP);
|
||||
CHECKCALL(mount("devpts", "/dev/pts", "devpts", 0, NULL));
|
||||
#define MAKE_STR(x) __STRING(x)
|
||||
CHECKCALL(mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC)));
|
||||
@@ -303,7 +306,6 @@ int FirstStageMain(int argc, char** argv) {
|
||||
for (const auto& [error_string, error_errno] : errors) {
|
||||
LOG(ERROR) << error_string << " " << strerror(error_errno);
|
||||
}
|
||||
- LOG(FATAL) << "Init encountered errors starting first stage, aborting";
|
||||
}
|
||||
|
||||
LOG(INFO) << "init first stage started!";
|
||||
@@ -417,12 +419,22 @@ int FirstStageMain(int argc, char** argv) {
|
||||
1);
|
||||
|
||||
const char* path = "/system/bin/init";
|
||||
- const char* args[] = {path, "selinux_setup", nullptr};
|
||||
+ std::vector<const char *> args = {path, "second_stage"};
|
||||
+ std::string init_cmdline;
|
||||
+ android::base::ReadFileToString("/proc/self/cmdline", &init_cmdline);
|
||||
+ std::replace(init_cmdline.begin(), init_cmdline.end(), '\0', ' ');
|
||||
+ auto cmd_vector = android::base::Split(android::base::Trim(init_cmdline), " ");
|
||||
+ int i = 0;
|
||||
+ for (const auto& entry : cmd_vector) {
|
||||
+ if (i++ == 0) continue; // ignore first arg '/init'
|
||||
+ args.push_back(entry.c_str());
|
||||
+ }
|
||||
+ args.push_back(nullptr);
|
||||
auto fd = open("/dev/kmsg", O_WRONLY | O_CLOEXEC);
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
close(fd);
|
||||
- execv(path, const_cast<char**>(args));
|
||||
+ execv(path, const_cast<char**>(args.data()));
|
||||
|
||||
// execv() only returns if an error happened, in which case we
|
||||
// panic and never fall through this conditional.
|
||||
diff --git a/init/init.cpp b/init/init.cpp
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
diff --git a/init/property_service.cpp b/init/property_service.cpp
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
diff --git a/init/service.cpp b/init/service.cpp
|
||||
index bd704cf8e..38ab63810 100644
|
||||
--- a/init/service.cpp
|
||||
+++ b/init/service.cpp
|
||||
@@ -65,6 +65,7 @@ namespace android {
|
||||
namespace init {
|
||||
|
||||
static Result<std::string> ComputeContextFromExecutable(const std::string& service_path) {
|
||||
+ se_hack1("HACKED");
|
||||
std::string computed_context;
|
||||
|
||||
char* raw_con = nullptr;
|
||||
@@ -332,7 +333,7 @@ void Service::Reap(const siginfo_t& siginfo) {
|
||||
if (!GetBoolProperty("init.svc_debug.no_fatal." + name_, false)) {
|
||||
// Aborts into `fatal_reboot_target_'.
|
||||
SetFatalRebootTarget(fatal_reboot_target_);
|
||||
- LOG(FATAL) << "critical process '" << name_ << "' exited 4 times "
|
||||
+ LOG(ERROR) << "critical process '" << name_ << "' exited 4 times "
|
||||
<< exit_reason;
|
||||
}
|
||||
} else {
|
||||
diff --git a/init/util.cpp b/init/util.cpp
|
||||
index 5b3a73c0d..6532155d0 100644
|
||||
--- a/init/util.cpp
|
||||
+++ b/init/util.cpp
|
||||
@@ -239,7 +239,8 @@ int wait_for_file(const char* filename, std::chrono::nanoseconds timeout) {
|
||||
|
||||
void ImportKernelCmdline(const std::function<void(const std::string&, const std::string&)>& fn) {
|
||||
std::string cmdline;
|
||||
- android::base::ReadFileToString("/proc/cmdline", &cmdline);
|
||||
+ android::base::ReadFileToString("/proc/self/cmdline", &cmdline); // HACKED
|
||||
+ std::replace(cmdline.begin(), cmdline.end(), '\0', ' '); // HACKED
|
||||
|
||||
for (const auto& entry : android::base::Split(android::base::Trim(cmdline), " ")) {
|
||||
std::vector<std::string> pieces = android::base::Split(entry, "=");
|
||||
diff --git a/rootdir/init.rc b/rootdir/init.rc
|
||||
index 2b53d883e..7d0c1c948 100644
|
||||
--- a/rootdir/init.rc
|
||||
+++ b/rootdir/init.rc
|
||||
@@ -556,7 +556,6 @@ on post-fs
|
||||
|
||||
# Once everything is setup, no need to modify /.
|
||||
# The bind+remount combination allows this to work in containers.
|
||||
- mount rootfs rootfs / remount bind ro nodev
|
||||
|
||||
# Mount default storage into root namespace
|
||||
mount none /mnt/user/0 /storage bind rec
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 17a9b675b0f2cae349440b99acbf74f4da2c3ae2 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Sat, 26 Jun 2021 05:42:24 +0000
|
||||
Subject: [PATCH 2/8] allow override ro.* prop
|
||||
|
||||
---
|
||||
init/property_service.cpp | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/init/property_service.cpp b/init/property_service.cpp
|
||||
index 26341b196..a4635054c 100755
|
||||
--- a/init/property_service.cpp
|
||||
+++ b/init/property_service.cpp
|
||||
@@ -1269,6 +1269,8 @@ static void ProcessKernelCmdline() {
|
||||
ImportKernelCmdline([&](const std::string& key, const std::string& value) {
|
||||
if (StartsWith(key, ANDROIDBOOT_PREFIX)) {
|
||||
InitPropertySet("ro.boot." + key.substr(ANDROIDBOOT_PREFIX.size()), value);
|
||||
+ } else if (StartsWith(key, "ro.")) {
|
||||
+ InitPropertySet(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 5d8ad1ddd88fd62a1e16fc2639429dba1f950841 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Sun, 27 Jun 2021 09:49:22 +0000
|
||||
Subject: [PATCH 3/8] ? fix first stage mount
|
||||
|
||||
---
|
||||
init/first_stage_init.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
|
||||
index 9ec04ab39..f347a1911 100644
|
||||
--- a/init/first_stage_init.cpp
|
||||
+++ b/init/first_stage_init.cpp
|
||||
@@ -400,7 +400,7 @@ int FirstStageMain(int argc, char** argv) {
|
||||
}
|
||||
|
||||
if (!DoFirstStageMount(!created_devices)) {
|
||||
- LOG(FATAL) << "Failed to mount required partitions early ...";
|
||||
+ LOG(ERROR) << "Failed to mount required partitions early ..."; // HACKED
|
||||
}
|
||||
|
||||
struct stat new_root_info;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 4cd13d9475561e389105dd64a1f61e05b58f6e17 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Fri, 25 Jun 2021 15:56:47 +0000
|
||||
Subject: [PATCH 4/8] ignore input subsystem
|
||||
|
||||
---
|
||||
rootdir/ueventd.rc | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
|
||||
index 4ec59afe9..ef8cd2ef4 100644
|
||||
--- a/rootdir/ueventd.rc
|
||||
+++ b/rootdir/ueventd.rc
|
||||
@@ -12,9 +12,6 @@ subsystem drm
|
||||
devname uevent_devpath
|
||||
dirname /dev/dri
|
||||
|
||||
-subsystem input
|
||||
- devname uevent_devpath
|
||||
- dirname /dev/input
|
||||
|
||||
subsystem sound
|
||||
devname uevent_devpath
|
||||
--
|
||||
2.34.1
|
||||
|
||||
24
android-13.0.0_r82/system/core/0005-ignore-devfs-mount.patch
Normal file
24
android-13.0.0_r82/system/core/0005-ignore-devfs-mount.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 1addf80e4bf30462fffd42d27a78c29e27de2997 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Fri, 17 Dec 2021 22:44:33 +0800
|
||||
Subject: [PATCH 5/8] ignore devfs mount
|
||||
|
||||
---
|
||||
init/first_stage_init.cpp | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
|
||||
index f347a1911..3c25b5ba5 100644
|
||||
--- a/init/first_stage_init.cpp
|
||||
+++ b/init/first_stage_init.cpp
|
||||
@@ -234,7 +234,6 @@ int FirstStageMain(int argc, char** argv) {
|
||||
CHECKCALL(setenv("PATH", _PATH_DEFPATH, 1));
|
||||
// Get the basic filesystem setup we need put together in the initramdisk
|
||||
// on / and then we'll let the rc file figure out the rest.
|
||||
- CHECKCALL(mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"));
|
||||
CHECKCALL(mkdir("/dev/pts", 0755));
|
||||
CHECKCALL(mkdir("/dev/socket", 0755));
|
||||
CHECKCALL(mkdir("/dev/dm-user", 0755));
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
From a95ad83691b06ea901a9078a7575679c0c761ddb Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Thu, 6 Jan 2022 20:47:28 +0800
|
||||
Subject: [PATCH 6/8] auto alloc binder devices
|
||||
|
||||
---
|
||||
rootdir/init.rc | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/rootdir/init.rc b/rootdir/init.rc
|
||||
index 7d0c1c948..07ff1fc4e 100644
|
||||
--- a/rootdir/init.rc
|
||||
+++ b/rootdir/init.rc
|
||||
@@ -243,6 +243,7 @@ on init
|
||||
mkdir /dev/binderfs
|
||||
mount binder binder /dev/binderfs stats=global
|
||||
chmod 0755 /dev/binderfs
|
||||
+ exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
|
||||
|
||||
# Mount fusectl
|
||||
mount fusectl none /sys/fs/fuse/connections
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 034e45234b3ad1e44ac4f23314e0ef36b67e36bd Mon Sep 17 00:00:00 2001
|
||||
From: John Tung <watchnight@163.com>
|
||||
Date: Sun, 21 Aug 2022 11:24:11 +0800
|
||||
Subject: [PATCH 7/8] fix cpu cgroup mount, possible need mount cpuacct and cpu
|
||||
together
|
||||
|
||||
---
|
||||
libprocessgroup/setup/cgroup_map_write.cpp | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/libprocessgroup/setup/cgroup_map_write.cpp b/libprocessgroup/setup/cgroup_map_write.cpp
|
||||
index 3831ef20a..80fa6a157 100644
|
||||
--- a/libprocessgroup/setup/cgroup_map_write.cpp
|
||||
+++ b/libprocessgroup/setup/cgroup_map_write.cpp
|
||||
@@ -324,6 +324,11 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) {
|
||||
result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
|
||||
controller->name());
|
||||
}
|
||||
+ if (result < 0 && (!strcmp(controller->name(), "cpu")
|
||||
+ || !strcmp(controller->name(), "cpuacct"))) {
|
||||
+ result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
|
||||
+ "cpu,cpuacct");
|
||||
+ }
|
||||
}
|
||||
|
||||
if (result < 0) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
24
android-13.0.0_r82/system/core/0008-skip-fusectl-mount.patch
Normal file
24
android-13.0.0_r82/system/core/0008-skip-fusectl-mount.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 9fea3745198ad19542601e07c99022dfad53c0bb Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Sat, 2 Sep 2023 17:10:16 +0800
|
||||
Subject: [PATCH 8/8] skip fusectl mount
|
||||
|
||||
---
|
||||
rootdir/init.rc | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/rootdir/init.rc b/rootdir/init.rc
|
||||
index 07ff1fc4e..6851f62bd 100644
|
||||
--- a/rootdir/init.rc
|
||||
+++ b/rootdir/init.rc
|
||||
@@ -246,7 +246,6 @@ on init
|
||||
exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
|
||||
|
||||
# Mount fusectl
|
||||
- mount fusectl none /sys/fs/fuse/connections
|
||||
|
||||
symlink /dev/binderfs/binder /dev/binder
|
||||
symlink /dev/binderfs/hwbinder /dev/hwbinder
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Reference in New Issue
Block a user