| # 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("//src/virtualization/packages/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" |
| |
| declare_args() { |
| linux_guest_extras_path = "" |
| } |
| |
| guest_prebuilt("block") { |
| source = "//prebuilt/virtualization/packages/linux_guest/images/${target_cpu}/disk.img" |
| output = disk_image |
| } |
| |
| guest_prebuilt("tests") { |
| source = "//prebuilt/virtualization/packages/linux_guest/images/${target_cpu}/tests.img" |
| output = tests_image |
| } |
| |
| guest_prebuilt("kernel") { |
| source = "//prebuilt/virtualization/packages/linux_guest/images/${target_cpu}/Image" |
| output = linux_image |
| } |
| |
| if (linux_guest_extras_path != "") { |
| extras_image = "$target_out_dir/linux/extras.img" |
| |
| guest_prebuilt("extras") { |
| source = "${linux_guest_extras_path}" |
| output = 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 = "disk.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" ] |
| } |
| } |