diff --git a/microdroid/Android.bp b/microdroid/Android.bp index 84565912..08870ba2 100644 --- a/microdroid/Android.bp +++ b/microdroid/Android.bp @@ -132,6 +132,14 @@ logical_partition { ], } +// TODO(jiyong): change the name to init, cause it's confusing +microdroid_boot_cmdline = "rdinit=/bin/init_vendor " + + "panic=-1 " + + // TODO(b/181936135) make the ratelimiting conditional; ratelimiting on prod build + "printk.devkmsg=on " + + "androidboot.first_stage_console=1 " + + "androidboot.hardware=microdroid " + bootimg { name: "microdroid_boot-5.10", ramdisk_module: "microdroid_ramdisk-5.10", @@ -141,19 +149,16 @@ bootimg { arch: { arm64: { kernel_prebuilt: ":kernel_prebuilts-5.10-arm64", + cmdline: microdroid_boot_cmdline + + "androidboot.boot_devices=10000.pci", }, x86_64: { kernel_prebuilt: ":kernel_prebuilts-5.10-x86_64", + cmdline: microdroid_boot_cmdline + + "pci=noacpi " + + "androidboot.boot_devices=pci0000:00/0000:00:01.0", }, }, - // TODO(jiyong): change the name to init, cause it's confusing - cmdline: "rdinit=/bin/init_vendor " + - "panic=-1 " + - // TODO(b/181936135) make the ratelimiting conditional; ratelimiting on prod build - "printk.devkmsg=on " + - "androidboot.first_stage_console=1 " + - "androidboot.hardware=microdroid " + - "androidboot.boot_devices=10000.pci ", dtb_prebuilt: "dummy_dtb.img", header_version: "4", partition_name: "boot", @@ -227,6 +232,14 @@ prebuilt_etc { prebuilt_etc { name: "microdroid_bootloader", src: ":microdroid_bootloader_gen", + arch: { + x86_64: { + // For unknown reason, the signed bootloader doesn't work on x86_64. Until the problem + // is fixed, let's use the unsigned bootloader for the architecture. + // TODO(b/185115783): remove this + src: ":cuttlefish_crosvm_bootloader", + }, + }, filename: "microdroid_bootloader", } @@ -262,6 +275,11 @@ genrule { prebuilt_etc { name: "microdroid_uboot_env", src: ":microdroid_uboot_env_gen", + arch: { + x86_64: { + src: ":microdroid_uboot_env_gen_x86_64", + }, + }, filename: "uboot_env.img", } @@ -273,6 +291,14 @@ genrule { cmd: "$(location mkenvimage_host) -s 4096 -o $(out) $(in)", } +genrule { + name: "microdroid_uboot_env_gen_x86_64", + tools: ["mkenvimage_host"], + srcs: ["uboot-env-x86_64.txt"], + out: ["output.img"], + cmd: "$(location mkenvimage_host) -s 4096 -o $(out) $(in)", +} + // sepolicy sha256 for vendor prebuilt_etc { name: "microdroid_precompiled_sepolicy.plat_sepolicy_and_mapping.sha256", diff --git a/microdroid/uboot-env-x86_64.txt b/microdroid/uboot-env-x86_64.txt new file mode 100644 index 00000000..ab0fc26e --- /dev/null +++ b/microdroid/uboot-env-x86_64.txt @@ -0,0 +1,13 @@ +# Static u-boot environment variables for microdroid. See b/180481192 + +# Boot the device following the Android boot procedure +bootcmd=boot_android virtio 0#misc + +bootdelay=0 + +# U-Boot in x86_64 by defaults loads kernel at 0x20000000 (512MB), which is +# out of the physical memory when the VM is launched with the default memory +# size of 256MB. To avoid that, explicitly set the kernel load addresss using +# loadaddr variable. +loadaddr=0x02000000 +fdtaddr=0x40000000 diff --git a/tests/hostside/java/android/virt/test/MicrodroidTestCase.java b/tests/hostside/java/android/virt/test/MicrodroidTestCase.java index 1f8cef5e..5bfa4b39 100644 --- a/tests/hostside/java/android/virt/test/MicrodroidTestCase.java +++ b/tests/hostside/java/android/virt/test/MicrodroidTestCase.java @@ -112,7 +112,14 @@ public class MicrodroidTestCase extends BaseHostJUnit4Test { Thread.sleep(MICRODROID_BOOT_TIMEOUT_MILLIS); // Connect to microdroid and read a system property from there - executeCommand("adb forward tcp:" + TEST_VM_ADB_PORT + " vsock:" + TEST_VM_CID + ":5555"); + executeCommand( + "adb -s " + + getDevice().getSerialNumber() + + " forward tcp:" + + TEST_VM_ADB_PORT + + " vsock:" + + TEST_VM_CID + + ":5555"); executeCommand("adb connect " + MICRODROID_SERIAL); String prop = executeCommand("adb -s " + MICRODROID_SERIAL + " shell getprop ro.hardware"); assertThat(prop, is("microdroid"));