David Brazdil | c53ea95 | 2020-10-15 12:41:26 +0000 | [diff] [blame] | 1 | // Copyright (C) 2020 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
David Brazdil | d8d6e1d | 2020-10-15 14:02:03 +0000 | [diff] [blame^] | 15 | kernel_version = "5.4" |
| 16 | |
| 17 | kernel_target_stem = ":kernel_prebuilts-" + kernel_version |
| 18 | vendor_ramdisk_target_stem = ":cf_prebuilts_initramfs-" + kernel_version |
| 19 | |
David Brazdil | c53ea95 | 2020-10-15 12:41:26 +0000 | [diff] [blame] | 20 | // Ramdisk containing /init and test binaries/resources needed inside guest. |
| 21 | genrule { |
| 22 | name: "virt_hostside_tests_initramfs_base", |
| 23 | tools: [ |
| 24 | "mkbootfs", |
| 25 | "lz4", |
| 26 | ], |
| 27 | tool_files: ["scripts/place_files.sh"], |
| 28 | out: ["initramfs.lz4"], |
| 29 | srcs: [ |
| 30 | ":virt_hostside_tests_guest_init", |
| 31 | ], |
| 32 | cmd: "$(location scripts/place_files.sh) $(in) -- " + |
| 33 | "$(genDir)/root/init " + |
| 34 | "&& $(location mkbootfs) $(genDir)/root | $(location lz4) -fq - $(out)", |
| 35 | } |
David Brazdil | d8d6e1d | 2020-10-15 14:02:03 +0000 | [diff] [blame^] | 36 | |
| 37 | // Default rule for producing a combined base + vendor ramdisk. |
| 38 | genrule_defaults { |
| 39 | name: "virt_hostside_tests_initramfs_concat", |
| 40 | srcs: [":virt_hostside_tests_initramfs_base"], |
| 41 | tools: ["lz4"], |
| 42 | cmd: "cat $(in) | $(location lz4) -dfq - $(out)", |
| 43 | } |
| 44 | |
| 45 | // Combined base + vendor ramdisk for arm64. |
| 46 | genrule { |
| 47 | name: "virt_hostside_tests_initramfs-arm64", |
| 48 | defaults: ["virt_hostside_tests_initramfs_concat"], |
| 49 | srcs: [vendor_ramdisk_target_stem + "-arm64"], |
| 50 | out: ["virt_hostside_tests_initramfs-arm64"], |
| 51 | } |
| 52 | |
| 53 | // Combined base + vendor ramdisk for x86_64. |
| 54 | genrule { |
| 55 | name: "virt_hostside_tests_initramfs-x86_64", |
| 56 | defaults: ["virt_hostside_tests_initramfs_concat"], |
| 57 | srcs: [vendor_ramdisk_target_stem + "-x86_64"], |
| 58 | out: ["virt_hostside_tests_initramfs-x86_64"], |
| 59 | } |