Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cb240d7 authored by Tom Cherry's avatar Tom Cherry Committed by android-build-merger
Browse files

Merge "init: clean up the 1st/2nd stage init split" am: 3ecaf2e7

am: 8f1c2fc8

Change-Id: I9b862f104d5caa4708ac57c4a2336920213b20fa
parents 782068bc 8f1c2fc8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ cc_defaults {
        "libkeyutils",
        "liblog",
        "liblogwrap",
        "liblp",
        "libselinux",
        "libutils",
    ],
@@ -99,6 +100,7 @@ cc_library_static {
        "devices.cpp",
        "epoll.cpp",
        "firmware_handler.cpp",
        "first_stage_init.cpp",
        "first_stage_mount.cpp",
        "import_parser.cpp",
        "init.cpp",
@@ -117,6 +119,7 @@ cc_library_static {
        "sigchld_handler.cpp",
        "subcontext.cpp",
        "subcontext.proto",
        "switch_root.cpp",
        "rlimit_parser.cpp",
        "tokenizer.cpp",
        "uevent_listener.cpp",
+7 −9
Original line number Diff line number Diff line
@@ -39,12 +39,15 @@ init_cflags += \

# --

# Do not build this even with mmma if we're system-as-root, otherwise it will overwrite the symlink.
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
include $(CLEAR_VARS)
LOCAL_CPPFLAGS := $(init_cflags)
LOCAL_SRC_FILES := \
    devices.cpp \
    first_stage_init.cpp \
    first_stage_main.cpp \
    first_stage_mount.cpp \
    init_first_stage.cpp \
    reboot_utils.cpp \
    selinux.cpp \
    switch_root.cpp \
@@ -93,19 +96,16 @@ LOCAL_SANITIZE := signed-integer-overflow
# First stage init is weird: it may start without stdout/stderr, and no /proc.
LOCAL_NOSANITIZE := hwaddress
include $(BUILD_EXECUTABLE)
endif

include $(CLEAR_VARS)

LOCAL_MODULE := init_system
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
LOCAL_REQUIRED_MODULES := \
   init_first_stage \
   init_second_stage \

else
LOCAL_REQUIRED_MODULES := \
   init_second_stage \

ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
LOCAL_POST_INSTALL_CMD := ln -sf /system/bin/init $(TARGET_ROOT_OUT)/init
endif
include $(BUILD_PHONY_PACKAGE)

@@ -118,5 +118,3 @@ LOCAL_REQUIRED_MODULES := \

endif
include $(BUILD_PHONY_PACKAGE)

+4 −6
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
 * limitations under the License.
 */

#include "first_stage_init.h"

#include <dirent.h>
#include <fcntl.h>
#include <paths.h>
@@ -94,7 +96,7 @@ bool ForceNormalBoot() {

}  // namespace

int main(int argc, char** argv) {
int FirstStageMain(int argc, char** argv) {
    if (REBOOT_BOOTLOADER_ON_PANIC) {
        InstallRebootSignalHandlers();
    }
@@ -214,7 +216,7 @@ int main(int argc, char** argv) {
    setenv("INIT_STARTED_AT", std::to_string(start_ms).c_str(), 1);

    const char* path = "/system/bin/init";
    const char* args[] = {path, nullptr};
    const char* args[] = {path, "selinux_setup", nullptr};
    execv(path, const_cast<char**>(args));

    // execv() only returns if an error happened, in which case we
@@ -226,7 +228,3 @@ int main(int argc, char** argv) {

}  // namespace init
}  // namespace android

int main(int argc, char** argv) {
    return android::init::main(argc, argv);
}
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

namespace android {
namespace init {

int FirstStageMain(int argc, char** argv);

}  // namespace init
}  // namespace android
+21 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "first_stage_init.h"

int main(int argc, char** argv) {
    return android::init::FirstStageMain(argc, argv);
}
Loading