From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx.groups.io with SMTP id smtpd.web10.1469.1628642098973569005 for ; Tue, 10 Aug 2021 17:34:59 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=softfail (domain: linux.com, ip: 211.29.132.53, mailfrom: chris.willing@linux.com) Received: from d8.hgw.net.au (pa49-197-140-170.pa.qld.optusnet.com.au [49.197.140.170]) (Authenticated sender: chris.willing@optusnet.com.au) by mail107.syd.optusnet.com.au (Postfix) with ESMTPSA id 88E5811435B1; Wed, 11 Aug 2021 10:34:55 +1000 (AEST) Reply-To: chris.willing@linux.com Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg PlatformBootManagerLib: Move TryRunningQemuKernel() To: James Bottomley , devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, jiewen.yao@intel.com, Gerd Hoffmann References: <20210728020232.127332-1-chris.willing@linux.com> <1695D2E15A92C8E7.3876@groups.io> <62f9ffa0-786f-09dd-9546-c4c118fa2a17@linux.com> <1b544f28-b5b9-c08c-bab7-8c1f41778dce@linux.com> <5c85a3f963d1ab7d20e177db9a07a73e82a0eed0.camel@HansenPartnership.com> <7dc3b9d2-5ebb-c261-46b4-658dcbbfd0f4@linux.com> <8286f815812caccbffaa3696f5e884a62ec0a046.camel@HansenPartnership.com> From: "Christoph Willing" Message-ID: Date: Wed, 11 Aug 2021 10:34:54 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <8286f815812caccbffaa3696f5e884a62ec0a046.camel@HansenPartnership.com> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=YKPhNiOx c=1 sm=1 tr=0 a=jHkrTDijwrxVdaLaom9wOA==:117 a=jHkrTDijwrxVdaLaom9wOA==:17 a=IkcTkHD0fZMA:10 a=hqBzw_eTAAAA:8 a=vBKi8zoqThxwubar9wUA:9 a=QEXdDO2ut3YA:10 a=bkWp_v3HvcftT6DRAIDL:22 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 11/8/21 9:24 am, James Bottomley wrote: > On Wed, 2021-08-11 at 09:04 +1000, Christoph Willing wrote: >> On 11/8/21 12:26 am, James Bottomley wrote: >> [...] >>> In the working kernel dmesg Gerd requested, what does it mount as >>> root? sda? In which case what does the kernel say about where it >>> got sda from? >>> >> Yes it mounts /dev/sda2 as root. >> >> The boot logs are are now attached at >> https://bugzilla.tianocore.org/show_bug.cgi?id=3504 as well a diff >> between good and bad boots (patched & unpatched code). There's >> nothing obvious (to me) as to why the unpatched code can't find the >> virtual disk. >> >> My simple minded guess is that PlatformBdsConnectSequence() performs >> some preparatory work that enables the kernel to have access to the >> vm (therefore to the virtual disk) by the time TryRunningQemuKernel() >> is called. At the moment however, TryRunningQemuKernel() is called >> before PlatformBdsConnectSequence() so that preparatory work hasn't >> been done and the disk can't be found. > > I suspect the problem is that it no longer creates default devices if > you don't specify them. If I look at my working version of a command > line boot, it's this: > > qemu-kvm \ > -drive if=pflash,format=raw,unit=0,file=/home/jejb/git/edk2/Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd,readonly \ > -debugcon file:debug.log -global isa-debugcon.iobase=0x402 \ > -kernel bzImage \ > -initrd initrd.img \ > -append "console=ttyS0 rd.driver.pre=virtio_scsi,9p,9pnet_virtio root=/dev/sda1" \ > -m 2048 \ > -serial stdio \ > -drive if=none,id=sd00,file=debian.img,format=qcow2 \ > -fsdev local,security_model=passthrough,id=modules,path=/tmp/lib/modules \ > -fsdev local,security_model=passthrough,id=home,path=/home/jejb \ > -device virtio-scsi-pci,id=scsi \ > -device virtio-9p-pci,fsdev=modules,id=sd01,mount_tag=modules \ > -device virtio-9p-pci,fsdev=home,id=sd02,mount_tag=home \ > -device scsi-hd,bus=scsi.0,drive=sd00 \ > -device e1000,netdev=net0 \ > -netdev user,id=net0,hostfwd=tcp::5555-:22 \ > -display vnc=:5 \ > > > # -chardev socket,id=chrtpm,path=`pwd`/tpmdev/swtpm-sock \ > # -tpmdev emulator,id=tpm0,chardev=chrtpm \ > # -device tpm-tis,tpmdev=tpm0 \ > > You can ignore all the TPM stuff and my 9p pass throughs for home > directory and /tmp modules directory (to make it easy to boot any > kernel I build). The relevant lines for you are: > > -drive if=none,id=sd00,file=debian.img,format=qcow2 \ > -device virtio-scsi-pci,id=scsi \ > -device scsi-hd,bus=scsi.0,drive=sd00 \ > > Which is how I connect /dev/sda to the qcow2 debian image I use to > boot. You have the drive line but no device lines giving the driver > ... if you add device lines can you then get it to boot? > Thanks for the suggestion James, I amended my script to have: -drive if=none,id=sd00,file=disk.img,format=raw \ -device virtio-scsi-pci,id=scsi \ -device scsi-hd,bus=scsi.0,drive=sd00 \ but no joy unfortunately. I also stripped out some other qemu options like -enable-kvm,-cpu,-cores etc., in case they caused some weird impacts during boot but that also had no effect. chris