Microdroid_manager executes the kexec binary as part of the boot process
if ramdumping is supported.
Bug: 238404545
Test: boot microdroid
Change-Id: Ie9835b427dd0e556bf21a004cea070d553b829a8
For better security, hard-code the paths to the kernel and initrd, and
the cmdline into the kexec binary so that one can use kexec to load
something else.
Bug: 238272206
Test: do the kdump
Change-Id: I79a167b2597a7b5090a263cce3065a4dc353ea21
From cppreference:
This function may only be used after stream has been
associated with an open file, but before any other operation
(other than a failed call to setbuf/setvbuf).
Test: watch TH
Change-Id: I70d331c9150efc2a2b5e92f8b2933ef8214d1ce9
pvmfw seems to have a hard limit on the number of PCI devices. Until
that is fixed, don't add a new PCI device, but use the existing (but
used) one.
Bug: N/A
Test: watch TH
Change-Id: I6ab7f3c2a3a072b28afa9601c617ec461fbeed93
It doesn't support 32-bit target. Build crashdump, kexec, and the kernel
only for 64-bit and disable the 32-bit variant.
Bug: N/A
Test: build for aosp_x86 and full
Change-Id: I3fafff4a1a45ab808aa3b8cd720925c6b8f4fef3
Cast statbuf.st_size to long before printing as %ld.
Bug: N/A
Test: watch TH for aosp-master/full-eng.
Change-Id: Icb25ccaeb9ca2e705039b87e4fae582a613605d0
microdroid_crashdump_kernel is a very small kernel that is executed when
a kernel panic occurs. Since it's only use case is to run the crashdump
binary, the kernel is very minimal. In addition, it has to be as small
as possible because the kernel has to be loaded (using kexec) in the VM
RAM before a panic occurs.
To support these needs, it is built with most configuration options
turned off, except for the followings needed for dumping the RAM:
* CONFIG_CRASH_DUMP
* CONFIG_PROC_VMCORE
* CONFIG_RELOCATABLE
This is basically following the guideline at [1].
In addition, the following device drivers are enabled.
* CONFIG_SERIAL_8250 // for use as the earlycon
* CONFIG_VIRTIO_CONSOLE // for use as the dump target
[1] https://www.kernel.org/doc/html/latest/admin-guide/kdump/kdump.html#dump-capture-kernel-config-options-arch-independent
These kernel prebuilts are for now locally built. It will soon be
replaced with the prebuilts from the build bot when the kernel config is
uploaded to the Android common kernel repo.
Bug: 237380607
Test: N/A (follow-up CLs needed)
Change-Id: I238e1dbb74c0fc47fd4bb926b7d09caef4b90e78
crashdump is a small binary which copies the ramdump from /proc/vmcore
to /dev/hvc3 which will be backed by a file outside of the VM.
crashdump is included in a init ramdisk image, and will be executed as
the init process when a kernel panic occurs.
Bug: 237381237
Test: N/A (follow-up CL needed)
Change-Id: Iecac0b437a2f512348ee28abe8b2bf6b23640029
To support ramdump of VMs, implement a kexec binary and add it to
Microdroid. The binary will be used to preload the kernel and the init
ramdisk that the system will boot into when a kernel panic occurs.
The binary is very minimal. It has much less functionalities than the
upstream kexec-tools. It has a different cmdline interface, and is just
a thin wrapper around the kexec_file_load syscall. It supports loading
the kernel and the ramdisk only for the exec-on-crash use case.
Bug: 237380224
Test: run kexec on Microdroid
Change-Id: I75610d4f55c97a79a7200ecf9e8aa7fc7b12c010