| # Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("$zx/kernel/lib/vdso/rodso.gni") |
| |
| source_set("userboot") { |
| sources = [ |
| "userboot.cpp", |
| ] |
| include_dirs = [ target_gen_dir ] |
| deps = [ |
| ":gen-userboot-code-header", |
| ":image", |
| "$zx/kernel/lib/console", |
| "$zx/kernel/lib/counters", |
| "$zx/kernel/lib/vdso", |
| "$zx/kernel/vm", |
| "$zx/system/ulib/elf-psabi", |
| "$zx/system/ulib/zircon-internal", |
| ] |
| } |
| |
| # The userboot-code.h generated header file tells the userboot.cpp code |
| # where the segment boundaries and entry points are. |
| rodso_code_header("gen-userboot-code-header") { |
| visibility = [ ":*" ] |
| name = "USERBOOT" |
| outputs = [ |
| "$target_gen_dir/userboot-code.h", |
| ] |
| deps = [ |
| "user", |
| ] |
| } |
| |
| # The generated header is also needed to tell .incbin how much of the |
| # image file to embed (see $zx/kernel/lib/vdso/include/lib/rodso-asm.h). |
| source_set("image") { |
| visibility = [ ":*" ] |
| sources = [ |
| "userboot-image.S", |
| ] |
| include_dirs = [ target_gen_dir ] |
| deps = [ |
| ":gen-userboot-code-header", |
| "$zx/kernel/lib/vdso", |
| ] |
| |
| # userboot-image.S includes the userboot contents and so must be |
| # reassembled when that changes. We can't express that in $inputs |
| # here because we don't know the exact name of the file since that |
| # depends on the toolchain selected. Fortunately, we already depend |
| # on the generated userboot-code.h header, which is always |
| # regenerated whenever the userboot binary itself changes. So this |
| # indirect dependency is sufficient. |
| } |