The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | # Copyright 2005 The Android Open Source Project |
| 2 | |
| 3 | LOCAL_PATH:= $(call my-dir) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 4 | |
Jeff Vander Stoep | 402e4a6 | 2019-03-19 17:01:09 -0700 | [diff] [blame] | 5 | -include system/sepolicy/policy_version.mk |
Jeff Vander Stoep | 724eda5 | 2019-02-15 12:13:38 -0800 | [diff] [blame] | 6 | |
Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 7 | # -- |
| 8 | |
Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 9 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
Tom Cherry | 663fdfc | 2017-03-10 14:46:38 -0800 | [diff] [blame] | 10 | init_options += \ |
Steve Muckle | d75f30a | 2019-05-21 15:50:39 -0700 | [diff] [blame] | 11 | -DALLOW_FIRST_STAGE_CONSOLE=1 \ |
Tom Cherry | 663fdfc | 2017-03-10 14:46:38 -0800 | [diff] [blame] | 12 | -DALLOW_LOCAL_PROP_OVERRIDE=1 \ |
| 13 | -DALLOW_PERMISSIVE_SELINUX=1 \ |
Josh Gao | bf2dd48 | 2017-03-28 13:07:15 -0700 | [diff] [blame] | 14 | -DREBOOT_BOOTLOADER_ON_PANIC=1 \ |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 15 | -DWORLD_WRITABLE_KMSG=1 \ |
| 16 | -DDUMP_ON_UMOUNT_FAILURE=1 |
Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 17 | else |
Tom Cherry | 663fdfc | 2017-03-10 14:46:38 -0800 | [diff] [blame] | 18 | init_options += \ |
Steve Muckle | d75f30a | 2019-05-21 15:50:39 -0700 | [diff] [blame] | 19 | -DALLOW_FIRST_STAGE_CONSOLE=0 \ |
Tom Cherry | 663fdfc | 2017-03-10 14:46:38 -0800 | [diff] [blame] | 20 | -DALLOW_LOCAL_PROP_OVERRIDE=0 \ |
| 21 | -DALLOW_PERMISSIVE_SELINUX=0 \ |
Josh Gao | bf2dd48 | 2017-03-28 13:07:15 -0700 | [diff] [blame] | 22 | -DREBOOT_BOOTLOADER_ON_PANIC=0 \ |
Keun-young Park | 2ba5c81 | 2017-03-29 12:54:40 -0700 | [diff] [blame] | 23 | -DWORLD_WRITABLE_KMSG=0 \ |
| 24 | -DDUMP_ON_UMOUNT_FAILURE=0 |
Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 25 | endif |
| 26 | |
Keun-young Park | c4ffa5c | 2017-03-28 09:41:36 -0700 | [diff] [blame] | 27 | ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT))) |
| 28 | init_options += \ |
| 29 | -DSHUTDOWN_ZERO_TIMEOUT=1 |
| 30 | else |
| 31 | init_options += \ |
| 32 | -DSHUTDOWN_ZERO_TIMEOUT=0 |
| 33 | endif |
| 34 | |
Jeff Vander Stoep | 724eda5 | 2019-02-15 12:13:38 -0800 | [diff] [blame] | 35 | init_options += -DLOG_UEVENTS=0 \ |
| 36 | -DSEPOLICY_VERSION=$(POLICYVERS) |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 37 | |
| 38 | init_cflags += \ |
| 39 | $(init_options) \ |
| 40 | -Wall -Wextra \ |
| 41 | -Wno-unused-parameter \ |
| 42 | -Werror \ |
Elliott Hughes | c0e919c | 2015-02-04 14:46:36 -0800 | [diff] [blame] | 43 | |
| 44 | # -- |
| 45 | |
Tom Cherry | 7bfea3d | 2018-11-06 14:12:05 -0800 | [diff] [blame] | 46 | # Do not build this even with mmma if we're system-as-root, otherwise it will overwrite the symlink. |
| 47 | ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 48 | include $(CLEAR_VARS) |
| 49 | LOCAL_CPPFLAGS := $(init_cflags) |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 50 | LOCAL_SRC_FILES := \ |
David Anderson | 4117559 | 2020-03-20 19:38:28 -0700 | [diff] [blame] | 51 | block_dev_initializer.cpp \ |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 52 | devices.cpp \ |
Steve Muckle | a4bf2ce | 2019-11-01 13:58:02 -0700 | [diff] [blame] | 53 | first_stage_console.cpp \ |
Tom Cherry | 7bfea3d | 2018-11-06 14:12:05 -0800 | [diff] [blame] | 54 | first_stage_init.cpp \ |
| 55 | first_stage_main.cpp \ |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 56 | first_stage_mount.cpp \ |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 57 | reboot_utils.cpp \ |
Vic Yang | 92c236e | 2019-05-28 15:58:35 -0700 | [diff] [blame] | 58 | selabel.cpp \ |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 59 | selinux.cpp \ |
Tom Cherry | 4590a2a | 2018-08-07 10:22:01 -0700 | [diff] [blame] | 60 | switch_root.cpp \ |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 61 | uevent_listener.cpp \ |
| 62 | util.cpp \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 63 | |
Tom Cherry | 29e5348 | 2018-10-15 17:47:16 -0700 | [diff] [blame] | 64 | LOCAL_MODULE := init_first_stage |
| 65 | LOCAL_MODULE_STEM := init |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 66 | |
| 67 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
Andres Morales | db5f5d4 | 2015-05-08 08:30:33 -0700 | [diff] [blame] | 68 | |
Tom Cherry | 4590a2a | 2018-08-07 10:22:01 -0700 | [diff] [blame] | 69 | LOCAL_MODULE_PATH := $(TARGET_RAMDISK_OUT) |
| 70 | LOCAL_UNSTRIPPED_PATH := $(TARGET_RAMDISK_OUT_UNSTRIPPED) |
| 71 | |
Bowgo Tsai | 05f07d8 | 2019-04-19 22:08:56 +0800 | [diff] [blame] | 72 | # Install adb_debug.prop into debug ramdisk. |
| 73 | # This allows adb root on a user build, when debug ramdisk is used. |
| 74 | LOCAL_REQUIRED_MODULES := \ |
| 75 | adb_debug.prop \ |
| 76 | |
Tom Cherry | cbeaca5 | 2019-12-09 07:09:32 -0800 | [diff] [blame] | 77 | # Set up the directories that first stage init mounts on. |
Jiyong Park | e5dc674 | 2019-03-07 10:53:23 +0900 | [diff] [blame] | 78 | LOCAL_POST_INSTALL_CMD := mkdir -p \ |
Bowgo Tsai | 30afda7 | 2019-04-11 23:57:24 +0800 | [diff] [blame] | 79 | $(TARGET_RAMDISK_OUT)/debug_ramdisk \ |
Jiyong Park | e5dc674 | 2019-03-07 10:53:23 +0900 | [diff] [blame] | 80 | $(TARGET_RAMDISK_OUT)/dev \ |
Xin Li | 1721645 | 2018-09-17 14:20:16 -0700 | [diff] [blame] | 81 | $(TARGET_RAMDISK_OUT)/mnt \ |
| 82 | $(TARGET_RAMDISK_OUT)/proc \ |
| 83 | $(TARGET_RAMDISK_OUT)/sys \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 84 | |
Kenny Root | b5982bf | 2012-10-16 23:07:05 -0700 | [diff] [blame] | 85 | LOCAL_STATIC_LIBRARIES := \ |
Bowgo Tsai | 30afda7 | 2019-04-11 23:57:24 +0800 | [diff] [blame] | 86 | libc++fs \ |
Bowgo Tsai | c1bc281 | 2018-11-26 17:49:23 +0800 | [diff] [blame] | 87 | libfs_avb \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 88 | libfs_mgr \ |
Sami Tolvanen | 99e3a92 | 2015-05-22 15:43:50 +0100 | [diff] [blame] | 89 | libfec \ |
| 90 | libfec_rs \ |
Mohamad Ayyash | 030ef359 | 2015-04-08 17:59:19 -0700 | [diff] [blame] | 91 | libsquashfs_utils \ |
Elliott Hughes | f682b47 | 2015-02-06 12:19:48 -0800 | [diff] [blame] | 92 | liblogwrap \ |
Alex Deymo | 705353a | 2017-01-11 14:03:11 -0800 | [diff] [blame] | 93 | libext4_utils \ |
Josh Gao | 47763c3 | 2016-08-05 15:47:57 -0700 | [diff] [blame] | 94 | libcrypto_utils \ |
Alex Deymo | b0c3959 | 2017-01-11 14:37:50 -0800 | [diff] [blame] | 95 | libsparse \ |
Elliott Hughes | f8627ce | 2017-05-09 17:09:06 -0700 | [diff] [blame] | 96 | libavb \ |
| 97 | libkeyutils \ |
David Anderson | f792e41 | 2018-07-27 16:05:31 -0700 | [diff] [blame] | 98 | liblp \ |
Jiyong Park | 787322c | 2018-06-01 19:26:42 +0900 | [diff] [blame] | 99 | libcutils \ |
| 100 | libbase \ |
| 101 | liblog \ |
Colin Cross | f117f34 | 2019-09-18 11:04:35 -0700 | [diff] [blame] | 102 | libcrypto_static \ |
Jiyong Park | 787322c | 2018-06-01 19:26:42 +0900 | [diff] [blame] | 103 | libdl \ |
| 104 | libz \ |
Jiyong Park | 012171d | 2018-06-19 16:55:05 +0900 | [diff] [blame] | 105 | libselinux \ |
Tom Cherry | 3143848 | 2018-07-20 14:57:00 -0700 | [diff] [blame] | 106 | libcap \ |
David Anderson | 0e330f1 | 2019-01-03 18:16:56 -0800 | [diff] [blame] | 107 | libgsi \ |
Jiyong Park | 8502ed3 | 2019-02-25 22:18:37 +0900 | [diff] [blame] | 108 | libcom.android.sysprop.apex \ |
Tom Cherry | 59656fb | 2019-05-28 10:19:44 -0700 | [diff] [blame] | 109 | liblzma \ |
Martin Stjernholm | a2cc893 | 2019-10-23 21:32:43 +0100 | [diff] [blame] | 110 | libunwindstack_no_dex \ |
| 111 | libbacktrace_no_dex \ |
Steve Muckle | 18b981e | 2019-04-15 17:43:02 -0700 | [diff] [blame] | 112 | libmodprobe \ |
David Anderson | 924858c | 2019-06-26 17:00:00 -0700 | [diff] [blame] | 113 | libext2_uuid \ |
Yifan Hong | 5fcc2b5 | 2019-10-01 13:59:56 -0700 | [diff] [blame] | 114 | libprotobuf-cpp-lite \ |
David Anderson | dfe6d07 | 2019-10-09 16:24:03 -0700 | [diff] [blame] | 115 | libsnapshot_init \ |
Yifan Hong | 66f0115 | 2020-04-16 11:05:16 -0700 | [diff] [blame] | 116 | update_metadata-protos \ |
Jiyong Park | 787322c | 2018-06-01 19:26:42 +0900 | [diff] [blame] | 117 | |
Tom Cherry | 2ffd65e | 2017-07-26 14:17:09 -0700 | [diff] [blame] | 118 | LOCAL_SANITIZE := signed-integer-overflow |
Evgenii Stepanov | 1f47f4a | 2018-11-01 13:38:38 -0700 | [diff] [blame] | 119 | # First stage init is weird: it may start without stdout/stderr, and no /proc. |
| 120 | LOCAL_NOSANITIZE := hwaddress |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 121 | include $(BUILD_EXECUTABLE) |
Yo Chiang | 78ee4c1 | 2020-08-12 23:50:24 +0800 | [diff] [blame^] | 122 | |
| 123 | # LOCAL_FORCE_STATIC_EXECUTABLE targets are skipped and not defined for ASAN builds |
| 124 | init_vendor_deps := |
| 125 | ifneq (true,$(my_skip_this_target)) |
| 126 | init_vendor_deps += init_first_stage |
| 127 | endif # my_skip_this_target is true |
| 128 | |
Tom Cherry | 7bfea3d | 2018-11-06 14:12:05 -0800 | [diff] [blame] | 129 | endif |
Tom Cherry | 29e5348 | 2018-10-15 17:47:16 -0700 | [diff] [blame] | 130 | |
| 131 | include $(CLEAR_VARS) |
| 132 | |
| 133 | LOCAL_MODULE := init_system |
Tom Cherry | 7bfea3d | 2018-11-06 14:12:05 -0800 | [diff] [blame] | 134 | LOCAL_REQUIRED_MODULES := \ |
| 135 | init_second_stage \ |
| 136 | |
Tom Cherry | 29e5348 | 2018-10-15 17:47:16 -0700 | [diff] [blame] | 137 | include $(BUILD_PHONY_PACKAGE) |
| 138 | |
| 139 | include $(CLEAR_VARS) |
| 140 | |
| 141 | LOCAL_MODULE := init_vendor |
| 142 | ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) |
Yo Chiang | 78ee4c1 | 2020-08-12 23:50:24 +0800 | [diff] [blame^] | 143 | LOCAL_REQUIRED_MODULES := $(init_vendor_deps) |
Tom Cherry | 29e5348 | 2018-10-15 17:47:16 -0700 | [diff] [blame] | 144 | endif |
| 145 | include $(BUILD_PHONY_PACKAGE) |
Yo Chiang | 78ee4c1 | 2020-08-12 23:50:24 +0800 | [diff] [blame^] | 146 | init_vendor_deps := |