Build uboot_env.img statically

The environment partition can control the behavior of the bootloader.
Therefore it shouldn't be dynamically created on the device.

Bug: 180675126
Test: m microdroid_uboot_env
Change-Id: If49634293f2fe7fbb82fae243632480fc7d72d30
diff --git a/microdroid/Android.bp b/microdroid/Android.bp
index fc26f89..38c4e05 100644
--- a/microdroid/Android.bp
+++ b/microdroid/Android.bp
@@ -102,3 +102,17 @@
     },
     type: "compressed_cpio",
 }
+
+prebuilt_etc {
+    name: "microdroid_uboot_env",
+    src: ":microdroid_uboot_env_gen",
+    filename: "uboot_env.img",
+}
+
+genrule {
+    name: "microdroid_uboot_env_gen",
+    tools: ["mkenvimage_host"],
+    srcs: ["uboot-env.txt"],
+    out: ["output.img"],
+    cmd: "$(location mkenvimage_host) -s 4096 -o $(out) $(in)",
+}
diff --git a/microdroid/uboot-env.txt b/microdroid/uboot-env.txt
new file mode 100644
index 0000000..0ef66b8
--- /dev/null
+++ b/microdroid/uboot-env.txt
@@ -0,0 +1,8 @@
+# Static u-boot environment variables for microdroid. See b/180481192
+
+bootcmd=boot_android virtio -
+
+# 0:2 is the misc partition
+bootdevice=0:2
+bootdelay=0
+fdtaddr=0x80000000