blob: 5f576d9fdebb1f13475fbaea6f801433b2467df4 [file] [log] [blame]
# Copyright 2018 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("//garnet/bin/guest/pkg/guest_package.gni")
disk_image = "$target_out_dir/linux/disk.img"
tests_image = "$target_out_dir/linux/tests.img"
linux_image = "$target_out_dir/linux/Image"
extras_image = "$target_out_dir/linux/extras.img"
declare_args() {
linux_guest_extras_path = ""
}
action("block") {
visibility = [ ":*" ]
script = "check_image.sh"
depfile = "$target_out_dir/block.d"
args = [
rebase_path("images/${target_cpu}/disk.img", root_build_dir),
rebase_path(disk_image, root_build_dir),
rebase_path(depfile, root_build_dir),
]
outputs = [
disk_image,
]
}
action("tests") {
visibility = [ ":*" ]
script = "check_image.sh"
depfile = "$target_out_dir/tests.d"
args = [
rebase_path("images/${target_cpu}/tests.img", root_build_dir),
rebase_path(tests_image, root_build_dir),
rebase_path(depfile, root_build_dir),
]
outputs = [
tests_image,
]
}
action("kernel") {
visibility = [ ":*" ]
script = "check_image.sh"
depfile = "$target_out_dir/kernel.d"
args = [
rebase_path("images/${target_cpu}/Image", root_build_dir),
rebase_path(linux_image, root_build_dir),
rebase_path(depfile, root_build_dir),
]
outputs = [
linux_image,
]
}
action("extras") {
visibility = [ ":*" ]
script = "mkextras.sh"
depfile = "$target_out_dir/extras.d"
if ("${linux_guest_extras_path}" != "") {
args = [
rebase_path(linux_guest_extras_path, root_build_dir),
rebase_path(extras_image, root_build_dir),
rebase_path(depfile, root_build_dir),
]
}
outputs = [
extras_image,
]
}
guest_package("linux_guest") {
deps = [
":block",
":kernel",
":tests",
]
if (target_cpu == "arm64") {
cmdline = "earlycon=pl011,0x808300000"
} else if (target_cpu == "x64") {
cmdline = "earlycon=uart,io,0x3f8"
}
cmdline += " console=hvc0 console=tty0 root=/dev/vda rw"
linux = "$target_out_dir/linux/Image"
disk_filename = "filesystem.img"
resources = [
{
path = rebase_path("${disk_image}")
dest = "${disk_filename}"
},
]
block_devices = [ "/guest/data/${disk_filename},ro,volatile" ]
tests_filename = "tests.img"
resources += [
{
path = rebase_path("${tests_image}")
dest = "${tests_filename}"
},
]
block_devices += [ "/guest/data/${tests_filename},ro,volatile" ]
if ("${linux_guest_extras_path}" != "") {
deps += [ ":extras" ]
resources += [
{
path = rebase_path("$target_out_dir/linux/extras.img")
dest = "extras.img"
},
]
block_devices += [ "/guest/data/extras.img,ro,volatile" ]
}
}