@@ -183,6 +183,69 @@ NB: It's also possible to run qdl from the host while the baord is not connected
183183
184184Want to join in the development? Changes welcome! See [CONTRIBUTING.md file](CONTRIBUTING.md) for step by step instructions.
185185
186+ ### Test an image locally with qemu
187+
188+ You can boot an image locally with qemu as follows:
189+
190+ 1. As above under "Usage", build the disk image from the root filesystem
191+ tarball if you haven' t done this already:
192+ ` ` ` bash
193+ debos debos-recipes/qualcomm-linux-debian-image.yaml
194+ ` ` `
195+
196+ 1. Run qemu as follows:
197+ ` ` ` bash
198+ # SCSI is required to present a device with a matching 4096 sector size
199+ # inside the VM
200+ qemu-system-aarch64 -cpu cortex-a57 -m 2048 -M virt -nographic \
201+ -device virtio-scsi-pci,id=scsi1 \
202+ -device scsi-hd,bus=scsi1.0,drive=disk1,physical_block_size=4096,logical_block_size=4096 \
203+ -drive if=none,file=disk-ufs.img,format=raw,id=disk1 \
204+ -bios /usr/share/AAVMF/AAVMF_CODE.fd
205+ ` ` `
206+
207+ # ### Copy on write
208+
209+ Instead of modifying ` file-ufs.img` , you can arrange copy-on-write instead,
210+ for example to reproduce the same first boot multiple times:
211+
212+ 1. Prepare a qcow file to contain the writes, backed by ` disk-ufs.img` :
213+ ` ` ` bash
214+ qemu-img create -b disk-ufs.img -f qcow -F raw disk1.qcow
215+ ` ` `
216+
217+ 1. Run qemu as follows:
218+ ` ` ` bash
219+ qemu-system-aarch64 -cpu cortex-a57 -m 2048 -M virt -nographic \
220+ -device virtio-scsi-pci,id=scsi1 \
221+ -device scsi-hd,bus=scsi1.0,drive=disk1,physical_block_size=4096,logical_block_size=4096 \
222+ -drive if=none,file=disk1.img,format=qcow,id=disk1 \
223+ -bios /usr/share/AAVMF/AAVMF_CODE.fd
224+ ` ` `
225+
226+ # ### Direct kernel boot
227+
228+ For debugging purposes, it is sometimes useful to boot the kernel directly, for
229+ example to confirm that an issue in the image lies in the bootloader
230+ installation. You can do this as follows:
231+
232+ 1. Extract the rootfs:
233+ ` ` ` bash
234+ mkdir rootfs
235+ tar xzC rootfs -f rootfs.tar.gz
236+ ` ` `
237+
238+ 2. Run qemu against the kernel and initrd present inside the rootfs directly:
239+ ` ` ` bash
240+ qemu-system-aarch64 -cpu cortex-a57 -m 2048 -M virt -nographic \
241+ -device virtio-scsi-pci,id=scsi1 \
242+ -device scsi-hd,bus=scsi1.0,drive=disk1,physical_block_size=4096,logical_block_size=4096 \
243+ -drive if=none,file=disk-ufs.img,format=raw,id=disk1 \
244+ -kernel rootfs/boot/vmlinuz-*
245+ -initrd rootfs/boot/initrd.img-*
246+ -append root=/dev/sda2
247+ ` ` `
248+
186249# # Reporting Issues
187250
188251We' d love to hear if you run into issues or have ideas for improvements. [Report an Issue on GitHub](../../issues) to discuss, and try to include as much information as possible on your specific environment.
0 commit comments