Use sparse image when uploading
Bug: N/A
Test: N/A
Change-Id: I8dc9445696161b5c4302b77da1bdbde00250be93
diff --git a/docs/custom_vm.md b/docs/custom_vm.md
index e10799a..c3d6ee6 100644
--- a/docs/custom_vm.md
+++ b/docs/custom_vm.md
@@ -26,20 +26,33 @@
`/apex/com.android.virt/bin/vm help` for details.
### Running Debian
-1. Prepare Debian image from https://cloud.debian.org/images/cloud/ (We tested nocloud image)
-2. (Optional) Resize the image if necessary
+1. Download an ARM64 image from https://cloud.debian.org/images/cloud/ (We tested nocloud image)
+
+2. Resize the image
+```shell
+truncate -s 20G debian.img
+virt-resize --expand /dev/sda1 <download_image_file> debian.img
```
-truncate -s 20G ./debian.img
-virt-resize --expand /dev/sda1 ./debian-12-nocloud-arm64.raw ./debian.img
+
+3. Copy the image file
+```shell
+tar cfS debian.img.tar debian.img
+adb push debian.img.tar /data/local/tmp/
+adb shell tar xf /data/local/tmp/debian.img.tar -C /data/local/tmp/
+adb shell rm /data/local/tmp/debian.img.tar
+rm debian.img.tar
```
-3. Copy Debian image file(like `debian-12-nocloud-arm64.raw`) and `vm_config.json` to `/data/local/tmp`
+
+Note: we tar and untar to keep the image file sparse.
+
+4. Make the VM config file
```shell
cat > vm_config.json <<EOF
{
"name": "debian",
"disks": [
{
- "image": "/data/local/tmp/debian-12-nocloud-arm64.raw", # or debian.img if you resized the image.
+ "image": "/data/local/tmp/debian.img
"partitions": [],
"writable": true
}
@@ -73,12 +86,14 @@
}
}
EOF
-adb push debian-12-nocloud-arm64.raw /data/local/tmp # or debian.img
-adb push vm_config.json /data/local/tmp/vm_config.json
+adb push vm_config.json /data/local/tmp/
```
-4. Launch VmLauncherApp(the detail will be explain below)
-5. For console, we can refer to `Debugging` section below. (id: root)
-5. For graphical shell, you need to install xfce(for now, only xfce is tested)
+
+5. Launch VmLauncherApp(the detail will be explain below)
+
+6. For console, we can refer to `Debugging` section below. (id: root)
+
+7. For graphical shell, you need to install xfce(for now, only xfce is tested)
```
apt install task-xfce-desktop
dpkg --configure -a (if necessary)