* [PULL 0/1] runqemu: add OTA image
@ 2016-08-16 13:11 Anton Gerasimov
2016-08-16 13:11 ` [PULL 1/1] " Anton Gerasimov
0 siblings, 1 reply; 2+ messages in thread
From: Anton Gerasimov @ 2016-08-16 13:11 UTC (permalink / raw)
To: poky
Tipical use of OSTree deployment system relies on u-boot and specific
boot filesysem organization. It would be useful to be able to emulate
such system natively with qemu. On x86 machine u-boot can be run either
as BIOS or with Coreboot BIOS, default SeaBIOS is not supported.
Respective changes are made to runqemu.
Image type for otaimg is committed to meta-agl-extra/meta-sota at AGL
and is copied to gerasimov/meta-sota branch at poky-contrib for convenience.
The following changes since commit 6b66e9317f4ec3a69f98f29836aafa35b52f3fc7:
Allow for simultaneous do_rootfs tasks with rpm (2016-08-12 15:25:22 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib gerasimov/qemuota
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=gerasimov/qemuota
Anton Gerasimov (1):
runqemu: add OTA image
scripts/runqemu | 27 +++++++++++++++++++++++++--
scripts/runqemu-internal | 41 +++++++++++++++++++++++++++++++----------
2 files changed, 56 insertions(+), 12 deletions(-)
--
2.8.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PULL 1/1] runqemu: add OTA image
2016-08-16 13:11 [PULL 0/1] runqemu: add OTA image Anton Gerasimov
@ 2016-08-16 13:11 ` Anton Gerasimov
0 siblings, 0 replies; 2+ messages in thread
From: Anton Gerasimov @ 2016-08-16 13:11 UTC (permalink / raw)
To: poky
Add support for "otaimg" live image. This type of image also requires providing
u-boot as bios.
Signed-off-by: Anton Gerasimov <anton@advancedtelematic.com>
---
scripts/runqemu | 27 +++++++++++++++++++++++++--
scripts/runqemu-internal | 41 +++++++++++++++++++++++++++++++----------
2 files changed, 56 insertions(+), 12 deletions(-)
diff --git a/scripts/runqemu b/scripts/runqemu
index d52ea15..b6c9b54 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -96,7 +96,7 @@ process_filename() {
error "conflicting FSTYPE types [$FSTYPE] and [$EXT]"
fi
;;
- /hddimg/|/hdddirect/|/vmdk/|/wic/|/qcow2/|/vdi/)
+ /hddimg/|/hdddirect/|/vmdk/|/wic/|/qcow2/|/vdi/|/otaimg/)
FSTYPE=$EXT
VM=$filename
ROOTFS=$filename
@@ -128,7 +128,7 @@ while true; do
"ext"[234] | "jffs2" | "nfs" | "btrfs")
check_fstype_conflicts $arg
;;
- "hddimg" | "hdddirect" | "wic" | "vmdk" | "qcow2" | "vdi" | "iso")
+ "hddimg" | "hdddirect" | "wic" | "vmdk" | "qcow2" | "vdi" | "iso" | "otaimg")
check_fstype_conflicts $arg
IS_VM="true"
;;
@@ -447,6 +447,29 @@ findimage() {
exit 1
}
+# Bios is necessary when using otaimg, look for it
+if [ "$FSTYPE" = "otaimg" ]; then
+ setup_path_vars 1
+ bios_option=`expr "$SCRIPT_QEMU_OPT" : '.*\(-bios\)'`
+ echo "bios_option: $bios_option"
+ if [ -z $bios_option ]; then
+ echo "LOOK FOR BIOS at ${DEPLOY_DIR_IMAGE}"
+ # if -bios wasn't specified explicitly, try to look at the default location
+ if [ -e "${DEPLOY_DIR_IMAGE}/u-boot.rom" ]; then
+ SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${DEPLOY_DIR_IMAGE}/u-boot.rom"
+ else
+ error "OTA image requires specifying u-boot as BIOS"
+ fi
+ fi
+fi
+
+
+# Kernel command line is stored in compressed format as u-boot environment
+# which breaks determining drive interface with grep in runqemu-internal
+if [ "$FSTYPE" = "otaimg" ]; then
+ FORCE_DRIVE_IF="ide"
+fi
+
if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
# Extract the filename extension
EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index d10466d..9811cf9 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -705,16 +705,37 @@ echo "Running $QEMU..."
if [ "$IS_VM" = "true" ]; then
# Check root=/dev/sdX or root=/dev/vdX
[ ! -e "$VM" ] && error "VM image is not found!"
- if grep -q 'root=/dev/sd' $VM; then
- echo "Using scsi drive"
- VM_DRIVE="-drive if=none,id=hd,file=$VM -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd"
- elif grep -q 'root=/dev/hd' $VM; then
- echo "Using ide drive"
- VM_DRIVE="$VM"
- else
- echo "Using virtio block drive"
- VM_DRIVE="-drive if=virtio,file=$VM"
- fi
+
+ case "$FORCE_DRIVE_IF" in
+ "ide")
+ echo "Using ide drive"
+ VM_DRIVE="$VM"
+ ;;
+ "scsi")
+ echo "Using scsi drive"
+ VM_DRIVE="-drive if=none,id=hd,file=$VM -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd"
+ ;;
+ "virtio")
+ echo "Using virtio block drive"
+ VM_DRIVE="-drive if=virtio,file=$VM"
+ ;;
+ "")
+ if grep -q 'root=/dev/sd' $VM; then
+ echo "Using scsi drive"
+ VM_DRIVE="-drive if=none,id=hd,file=$VM -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd"
+ elif grep -q 'root=/dev/hd' $VM; then
+ echo "Using ide drive"
+ VM_DRIVE="$VM"
+ else
+ echo "Using virtio block drive"
+ VM_DRIVE="-drive if=virtio,file=$VM"
+ fi
+ ;;
+ *)
+ error "Invalid drive interface: $FORCE_DRIVE_IF"
+ ;;
+ esac
+
QEMU_FIRE="$QEMUBIN $VM_DRIVE $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT"
echo $QEMU_FIRE
LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE
--
2.8.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-16 13:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-16 13:11 [PULL 0/1] runqemu: add OTA image Anton Gerasimov
2016-08-16 13:11 ` [PULL 1/1] " Anton Gerasimov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.