• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revisão6b71e30be33ac9ae1af29f3ec823fc7abe44eae5 (tree)
Hora2016-10-16 18:01:30
AutorDodoGTA GT <aidas957@gmai...>
CommiterDodoGTA GT

Mensagem de Log

init: Add support for kernels that don't have finit_module

Some kernels don't have finit_module, which makes booting Android 7.0
impossible if people can't backport it themselves, so set
KERNEL_HAS_FINIT_MODULE := false in BoardConfig.mk file to
allow booting 7.0 even when the kernel doesn't have finit_
module :)

Change-Id: Iec63c1846cdc5e5bb3b61610ea438cf8eff8635b

Mudança Sumário

Diff

--- a/init/Android.mk
+++ b/init/Android.mk
@@ -99,6 +99,10 @@ ifneq ($(TARGET_IGNORE_RO_BOOT_REVISION),)
9999 LOCAL_CFLAGS += -DIGNORE_RO_BOOT_REVISION
100100 endif
101101
102+ifeq ($(KERNEL_HAS_FINIT_MODULE), false)
103+LOCAL_CFLAGS += -DNO_FINIT_MODULE
104+endif
105+
102106 LOCAL_MODULE:= init
103107 LOCAL_C_INCLUDES += \
104108 system/extras/ext4_utils \
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -29,7 +29,9 @@
2929 #include <sys/socket.h>
3030 #include <sys/mount.h>
3131 #include <sys/resource.h>
32+#ifndef NO_FINIT_MODULE
3233 #include <sys/syscall.h>
34+#endif
3335 #include <sys/time.h>
3436 #include <sys/types.h>
3537 #include <sys/stat.h>
@@ -69,20 +71,34 @@ using android::base::StringPrintf;
6971 #define UNMOUNT_CHECK_MS 5000
7072 #define UNMOUNT_CHECK_TIMES 10
7173
74+#ifdef NO_FINIT_MODULE
75+// System call provided by bionic but not in any header file.
76+extern "C" int init_module(void *, unsigned long, const char *);
77+#endif
78+
7279 static const int kTerminateServiceDelayMicroSeconds = 50000;
7380
7481 static int insmod(const char *filename, const char *options) {
82+#ifndef NO_FINIT_MODULE
7583 int fd = open(filename, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
7684 if (fd == -1) {
7785 ERROR("insmod: open(\"%s\") failed: %s", filename, strerror(errno));
86+#else
87+ std::string module;
88+ if (!read_file(filename, &module)) {
89+#endif
7890 return -1;
7991 }
92+#ifndef NO_FINIT_MODULE
8093 int rc = syscall(__NR_finit_module, fd, options, 0);
8194 if (rc == -1) {
8295 ERROR("finit_module for \"%s\" failed: %s", filename, strerror(errno));
8396 }
8497 close(fd);
8598 return rc;
99+#else
100+ return init_module(&module[0], module.size(), options);
101+#endif
86102 }
87103
88104 static int __ifupdown(const char *interface, int up) {