blob: 452d00a79cdc5c9bdc828a4fd33485137c8c2e84 [file] [log] [blame]
# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//common-mk/pkg_config.gni")
if (use.lvm_stateful_partition) {
action("chromeos_install_script") {
inputs = [ "chromeos-install" ]
outputs = [ "${root_gen_dir}/chromeos-install" ]
script = "/bin/sh"
args = [
"-c",
"sed '/DEFINE_boolean lvm_stateful/s:FLAGS_FALSE:FLAGS_TRUE:'" +
" \$S/chromeos-install > ${root_gen_dir}/chromeos-install",
]
}
} else {
copy("chromeos_install_script") {
sources = [ "chromeos-install" ]
outputs = [ "${root_gen_dir}/chromeos-install" ]
}
}
install_config("sbin_scripts") {
sources = [
"${root_gen_dir}/chromeos-install",
"chromeos-install-kernel",
"chromeos-postinst",
"chromeos-recovery",
"chromeos-setdevpasswd",
"chromeos-setgoodkernel",
"encrypted_import",
]
deps = [ ":chromeos_install_script" ]
install_path = "sbin"
type = "executable"
}
action("postinst_script_symlink") {
deps = [ ":sbin_scripts" ]
script = "/bin/ln"
outputs = [ "${root_gen_dir}/postinst" ]
args = [
"-sf",
"usr/sbin/chromeos-postinst",
"${root_gen_dir}/postinst",
]
install_configs = [
{
path = "/"
},
]
}
install_config("crx_import_script") {
sources = [ "init/crx-import.sh" ]
install_path = "/usr/share/cros/init"
type = "executable"
}
install_config("init_confs") {
sources = [ "init/*.conf" ]
install_path = "/etc/init"
glob = true
}
group("all") {
deps = [
":cros_installer",
":crx_import_script",
":postinst_script_symlink",
":sbin_scripts",
]
if (!use.cros_host) {
deps += [ ":evwaitkey" ]
}
if (use.mtd) {
deps += [ ":nand_partition" ]
}
if (use.test) {
deps += [ ":cros_installer_test" ]
}
if (!use.systemd) {
deps += [ ":init_confs" ]
}
}
pkg_config("target_defaults") {
pkg_deps = [
"libbrillo",
"libchrome",
"libdm-bht",
"vboot_host",
]
}
config("libcros_installer_config") {
defines = [
"USE_POSTINSTALL_CONFIG_EFI_AND_LEGACY=${use.postinstall_config_efi_and_legacy}",
"USE_POSTINSTALL_CGPT_REPAIR=${use.postinstall_cgpt_repair}",
]
}
if (use.manage_efi_boot_entries) {
pkg_config("efi_boot_management") {
pkg_deps = [
"efiboot",
"efivar",
"libcros_config",
]
}
}
# See docs/postinst_metrics.md
if (use.postinst_metrics) {
pkg_config("metrics") {
pkg_deps = [ "libmetrics" ]
}
}
static_library("libcros_installer") {
sources = [
"cgpt_manager.cc",
"chromeos_install_config.cc",
"chromeos_legacy.cc",
"chromeos_postinst.cc",
"chromeos_setimage.cc",
"chromeos_verity.cc",
"inst_util.cc",
]
if (use.enable_slow_boot_notify) {
sources += [ "slow_boot_notify_enable.cc" ]
} else {
sources += [ "slow_boot_notify_stub.cc" ]
}
if (use.manage_efi_boot_entries) {
configs += [ ":efi_boot_management" ]
sources += [
"efi_boot_management.cc",
"efivar.cc",
]
} else {
sources += [ "efi_boot_management_stub.cc" ]
}
if (use.postinst_metrics) {
configs += [ ":metrics" ]
sources += [ "metrics.cc" ]
} else {
sources += [ "metrics_stub.cc" ]
}
if (use.reven_partition_migration) {
sources += [ "reven_partition_migration.cc" ]
} else {
sources += [ "reven_partition_migration_stub.cc" ]
}
configs += [ ":target_defaults" ]
all_dependent_configs = [ ":libcros_installer_config" ]
}
pkg_config("cros_installer_config") {
pkg_deps = [ "libchrome" ]
}
executable("cros_installer") {
sources = [ "cros_installer_main.cc" ]
configs += [
":cros_installer_config",
":target_defaults",
]
deps = [ ":libcros_installer" ]
install_path = "bin"
}
executable("evwaitkey") {
sources = [ "util/evwaitkey.c" ]
configs += [ ":target_defaults" ]
install_path = "sbin"
}
if (use.mtd) {
pkg_config("nand_partition_config") {
pkg_deps = [ "libchrome" ]
}
executable("nand_partition") {
sources = [
"nand_partition.cc",
"nand_partition_main.cc",
]
configs += [
":nand_partition_config",
":target_defaults",
]
deps = [ ":libcros_installer" ]
install_path = "bin"
}
}
if (!use.cros_host && use.test) {
pkg_config("cros_installer_test_config") {
pkg_deps = [
"libbrillo",
"libchrome",
"libchrome-test",
]
}
executable("cros_installer_test") {
sources = [
"chromeos_install_config_test.cc",
"chromeos_legacy_test.cc",
"chromeos_verity_test.cc",
"inst_util_test.cc",
]
if (use.enable_slow_boot_notify) {
sources += [ "slow_boot_notify_test.cc" ]
}
configs += [
"//common-mk:test",
":cros_installer_test_config",
":target_defaults",
]
if (use.manage_efi_boot_entries) {
sources += [ "efi_boot_management_test.cc" ]
configs += [ ":efi_boot_management" ]
}
if (use.postinst_metrics) {
sources += [ "chromeos_postinst_test.cc" ]
configs += [ ":metrics" ]
}
if (use.reven_partition_migration) {
sources += [ "reven_partition_migration_test.cc" ]
}
deps = [
":libcros_installer",
"//common-mk/testrunner:testrunner",
]
}
}