aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorAlistair Delva <adelva@google.com>2021-03-16 13:33:28 -0700
committerAlistair Delva <adelva@google.com>2021-04-12 11:21:30 -0700
commitff9459ea35d5ec69e68cba8ab14e926192399bba (patch)
treee6ed4f4ccb53a30954aa0a92443d4658d4795e8a /build
parentd3b49af78bf4628480211c81e4e49c452929bed2 (diff)
downloadcuttlefish-ff9459ea35d5ec69e68cba8ab14e926192399bba.tar.gz
Support auto-generation of ESP, add otheros_root
The existing code allowed a user to inject an ESP, but building a good one is quite onerous, as you need to find the right GRUB binaries, put them in the right place, make a grub.cfg to chain load, and so on. It's better in most cases if assemble_cvd takes care of this process. This change uses the new mtools binary to modify a FAT32 partition without requiring root, and pulls GRUB from the host machine. A suitable grub.cfg is injected into the ESP as well. GRUB is taken from the host because it is difficult to build, and we can't add it to AOSP right now. This new partition can boot a kernel / initramfs.img directly from a static location in the ESP ("/vmlinuz" and "/initrd.img"), or it can search for another grub installation and chain-load it. This change removes the old -use_esp flag, and an ESP will be generated when needed by the otheros flags. Three new flags are added: -otheros_kernel_path The path to a raw vmlinuz -otheros_initramfs_path The path to an initramfs.img -otheros_root_image The path to a root filesystem image. If the root filesystem is not specified, the other options have no effect. Bug: 175204891 Change-Id: I2c4c4316dc1e4e7bae08893e4feff4c4fd9baf9c
Diffstat (limited to 'build')
-rw-r--r--build/Android.bp4
-rw-r--r--build/cvd-host-package.go6
2 files changed, 10 insertions, 0 deletions
diff --git a/build/Android.bp b/build/Android.bp
index b056360ff..76b8480bb 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -23,6 +23,7 @@ soong_config_module_type {
module_type: "cvd_host_package",
config_namespace: "cvd",
value_variables: [
+ "grub_config",
"launch_configs",
"custom_action_config",
"custom_action_servers",
@@ -63,6 +64,9 @@ cvd_host_tools = [
"mkenvimage",
"modem_simulator",
"ms-tpm-20-ref",
+ "mcopy",
+ "mmd",
+ "mtools",
"newfs_msdos",
"powerwash_cvd",
"restart_cvd",
diff --git a/build/cvd-host-package.go b/build/cvd-host-package.go
index b025386cd..d15708396 100644
--- a/build/cvd-host-package.go
+++ b/build/cvd-host-package.go
@@ -56,6 +56,12 @@ func (c *cvdHostPackage) DepsMutator(ctx android.BottomUpMutatorContext) {
{Mutator: "arch", Variation: android.Common.String()},
}
for _, dep := range strings.Split(
+ ctx.Config().VendorConfig("cvd").String("grub_config"), " ") {
+ if ctx.OtherModuleExists(dep) {
+ ctx.AddVariationDependencies(variations, cvdHostPackageDependencyTag, dep)
+ }
+ }
+ for _, dep := range strings.Split(
ctx.Config().VendorConfig("cvd").String("launch_configs"), " ") {
if ctx.OtherModuleExists(dep) {
ctx.AddVariationDependencies(variations, cvdHostPackageDependencyTag, dep)