qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Qemu doesn't detect hard drive
@ 2020-04-03  5:16 Aijaz.Baig
  2020-04-03  7:39 ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Aijaz.Baig @ 2020-04-03  5:16 UTC (permalink / raw)
  To: qemu-devel@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 1677 bytes --]

Hi

I have a working QEMU image emulating an ARM vexpress-a9 and I run it like so:

`sudo qemu-system-arm -m 512M -M vexpress-a9 -D qemu.log -d unimp -kernel buildroot-2019.02.5/output/images/zImage -dtb buildroot-2019.02.5/output/images/vexpress-v2p-ca9.dtb -append "console=ttyAMA0,115200 kgdboc=kbd,ttyAMA0,115200 ip=dhcp nokaslr" -initrd buildroot-2019.02.5/output/images/rootfs.cpio -nographic -net nic -net bridge,br=mybridge -s`

I would now like to add a hard disk for persistent storage and then transfer control from busybox initrd based rootfs over to the full fledged version offered with Linux. So I add it to the command line

`sudo qemu-system-arm -m 1024M -M vexpress-a9 -D qemu.log -drive if=none,format=raw,file=disk.img -kernel buildroot-2019.02.5/output/images/zImage -dtb buildroot-2019.02.5/output/images/vexpress-v2p-ca9.dtb -append "console=ttyAMA0,115200 kgdboc=kbd,ttyAMA0,115200 ip=dhcp nokaslr" -initrd buildroot-2019.02.5/output/images/rootfs.cpio -nographic -net nic -net bridge,br=mybridge -s
`

of course I first create a disk image and format it as ext2:
`qemu-img create disk.img 10G && mkfs.ext2 -F disk.img`

From the log messages I see that it has not been able to detect this at all. Can someone please summarize how block devices work with Qemu. I know the older `-hda` has been changed to a newer `-drive` option can combines the cumbersome specification of the front and back ends separately. But I don't know the basics and why I am getting this problem.

I am basically looking to `switch_root` from initrd to the full fledged Linux rootfs but this is only the first step.

Sent with [ProtonMail](https://protonmail.com) Secure Email.

[-- Attachment #2: Type: text/html, Size: 2148 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Qemu doesn't detect hard drive
  2020-04-03  5:16 Qemu doesn't detect hard drive Aijaz.Baig
@ 2020-04-03  7:39 ` Peter Maydell
  2020-04-03  8:01   ` Aijaz.Baig
  2020-04-03 11:07   ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Maydell @ 2020-04-03  7:39 UTC (permalink / raw)
  To: Aijaz.Baig; +Cc: qemu-devel@nongnu.org

On Fri, 3 Apr 2020 at 06:18, Aijaz.Baig <Aijaz.Baig@protonmail.com> wrote:
> I would now like to add a hard disk for persistent storage and then transfer control from busybox initrd based rootfs over to the full fledged version offered with Linux. So I add it to the command line
>
> `sudo qemu-system-arm -m 1024M -M vexpress-a9 -D qemu.log -drive if=none,format=raw,file=disk.img -kernel buildroot-2019.02.5/output/images/zImage -dtb buildroot-2019.02.5/output/images/vexpress-v2p-ca9.dtb -append "console=ttyAMA0,115200 kgdboc=kbd,ttyAMA0,115200 ip=dhcp nokaslr" -initrd buildroot-2019.02.5/output/images/rootfs.cpio -nographic -net nic -net bridge,br=mybridge -s

This command line creates a "drive" object but doesn't plug it in to anything
(it's like asking QEMU to model a board, with a hard drive sat next to it
on the desk but no cable between them :-))

More generally, the vexpress-a9 board does not support hard disks.
This is because the real hardware we're modelling here has no disk
drive interfaces and no PCI or similar bus that you could plug a
scsi controller into. The best it can do for storage is an SD card
emulation, which works but the performance is not great.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Qemu doesn't detect hard drive
  2020-04-03  7:39 ` Peter Maydell
@ 2020-04-03  8:01   ` Aijaz.Baig
  2020-04-03  8:45     ` Peter Maydell
  2020-04-03 11:07   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 6+ messages in thread
From: Aijaz.Baig @ 2020-04-03  8:01 UTC (permalink / raw)
  To: 'Peter Maydell'; +Cc: qemu-devel

Thanks for the tip Pete. It is always tiny tidbits like these that can waste hours of time for someone coming from x86 😉. 

Ok I changed the command line and it looks like this now:
sudo qemu-system-arm -m 1024M -M vexpress-a9 -D qemu.log -sd armdisk.img -kernel buildroot-2019.02.5/output/images/zImage -dtb buildroot-2019.02.5/output/images/vexpress-v2p-ca9.dtb -append "root=/dev/ram console=ttyAMA0,115200 kgdboc=kbd,ttyAMA0,115200 ip=dhcp nokaslr" -initrd buildroot-2019.02.5/output/images/rootfs.cpio -nographic -net nic -net bridge,br=mybridge -s

I am looking at 'dumping' a Debian like rootfs on the MMC and then use that as the default rootfs instead of the busybox one. Is there an easy to follow guide that you can point me at?  Would save me a couple hours. Also, merely specifying that partition as the kernel 'root' parameter should suffice right?

-----Original Message-----
From: Peter Maydell <peter.maydell@linaro.org> 
Sent: Friday, April 3, 2020 1:10 PM
To: Aijaz.Baig <Aijaz.Baig@protonmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: Qemu doesn't detect hard drive


On Fri, 3 Apr 2020 at 06:18, Aijaz.Baig <Aijaz.Baig@protonmail.com> wrote:
> I would now like to add a hard disk for persistent storage and then 
> transfer control from busybox initrd based rootfs over to the full 
> fledged version offered with Linux. So I add it to the command line
>
> `sudo qemu-system-arm -m 1024M -M vexpress-a9 -D qemu.log -drive 
> if=none,format=raw,file=disk.img -kernel 
> buildroot-2019.02.5/output/images/zImage -dtb 
> buildroot-2019.02.5/output/images/vexpress-v2p-ca9.dtb -append 
> "console=ttyAMA0,115200 kgdboc=kbd,ttyAMA0,115200 ip=dhcp nokaslr" 
> -initrd buildroot-2019.02.5/output/images/rootfs.cpio -nographic -net 
> nic -net bridge,br=mybridge -s

This command line creates a "drive" object but doesn't plug it in to anything (it's like asking QEMU to model a board, with a hard drive sat next to it on the desk but no cable between them :-))

More generally, the vexpress-a9 board does not support hard disks.
This is because the real hardware we're modelling here has no disk drive interfaces and no PCI or similar bus that you could plug a scsi controller into. The best it can do for storage is an SD card emulation, which works but the performance is not great.

thanks
-- PMM




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Qemu doesn't detect hard drive
  2020-04-03  8:01   ` Aijaz.Baig
@ 2020-04-03  8:45     ` Peter Maydell
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2020-04-03  8:45 UTC (permalink / raw)
  To: Aijaz.Baig; +Cc: QEMU Developers

On Fri, 3 Apr 2020 at 09:01, <Aijaz.Baig@protonmail.com> wrote:
> I am looking at 'dumping' a Debian like rootfs on the MMC and then use that as the default rootfs instead of the busybox one. Is there an easy to follow guide that you can point me at?  Would save me a couple hours. Also, merely specifying that partition as the kernel 'root' parameter should suffice right?

If you just want to run Debian on a 32-bit arm model and you
don't care about it specifically being vexpress (or that it's
cortex-a9 rather than -a15) you're probably better off using
the "virt" board, which has more memory, supports pci and
so can use real hard disks and a more efficient network
interface, etc.

This walkthrough is a few years old now but should still
be basically correct I think:
https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Qemu doesn't detect hard drive
  2020-04-03  7:39 ` Peter Maydell
  2020-04-03  8:01   ` Aijaz.Baig
@ 2020-04-03 11:07   ` Philippe Mathieu-Daudé
  2020-04-03 12:11     ` Markus Armbruster
  1 sibling, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-03 11:07 UTC (permalink / raw)
  To: Peter Maydell, Aijaz.Baig; +Cc: qemu-devel@nongnu.org, Markus Armbruster

On 4/3/20 9:39 AM, Peter Maydell wrote:
> On Fri, 3 Apr 2020 at 06:18, Aijaz.Baig <Aijaz.Baig@protonmail.com> wrote:
>> I would now like to add a hard disk for persistent storage and then transfer control from busybox initrd based rootfs over to the full fledged version offered with Linux. So I add it to the command line
>>
>> `sudo qemu-system-arm -m 1024M -M vexpress-a9 -D qemu.log -drive if=none,format=raw,file=disk.img -kernel buildroot-2019.02.5/output/images/zImage -dtb buildroot-2019.02.5/output/images/vexpress-v2p-ca9.dtb -append "console=ttyAMA0,115200 kgdboc=kbd,ttyAMA0,115200 ip=dhcp nokaslr" -initrd buildroot-2019.02.5/output/images/rootfs.cpio -nographic -net nic -net bridge,br=mybridge -s
> 
> This command line creates a "drive" object but doesn't plug it in to anything
> (it's like asking QEMU to model a board, with a hard drive sat next to it
> on the desk but no cable between them :-))

Should QEMU warn the user about unplugged drives?

Or is it an expected feature (these drives might be hot-plugged later?)

> 
> More generally, the vexpress-a9 board does not support hard disks.
> This is because the real hardware we're modelling here has no disk
> drive interfaces and no PCI or similar bus that you could plug a
> scsi controller into. The best it can do for storage is an SD card
> emulation, which works but the performance is not great.
> 
> thanks
> -- PMM
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Qemu doesn't detect hard drive
  2020-04-03 11:07   ` Philippe Mathieu-Daudé
@ 2020-04-03 12:11     ` Markus Armbruster
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2020-04-03 12:11 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Aijaz.Baig, qemu-devel@nongnu.org

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> On 4/3/20 9:39 AM, Peter Maydell wrote:
>> On Fri, 3 Apr 2020 at 06:18, Aijaz.Baig <Aijaz.Baig@protonmail.com> wrote:
>>> I would now like to add a hard disk for persistent storage and then transfer control from busybox initrd based rootfs over to the full fledged version offered with Linux. So I add it to the command line
>>>
>>> `sudo qemu-system-arm -m 1024M -M vexpress-a9 -D qemu.log -drive if=none,format=raw,file=disk.img -kernel buildroot-2019.02.5/output/images/zImage -dtb buildroot-2019.02.5/output/images/vexpress-v2p-ca9.dtb -append "console=ttyAMA0,115200 kgdboc=kbd,ttyAMA0,115200 ip=dhcp nokaslr" -initrd buildroot-2019.02.5/output/images/rootfs.cpio -nographic -net nic -net bridge,br=mybridge -s
>>
>> This command line creates a "drive" object but doesn't plug it in to anything
>> (it's like asking QEMU to model a board, with a hard drive sat next to it
>> on the desk but no cable between them :-))
>
> Should QEMU warn the user about unplugged drives?
>
> Or is it an expected feature (these drives might be hot-plugged later?)

For what it's worth, it warns about unused network backends, but not
about unused block or character backends.  All of them can be connected
later in the monitor.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-03 12:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-03  5:16 Qemu doesn't detect hard drive Aijaz.Baig
2020-04-03  7:39 ` Peter Maydell
2020-04-03  8:01   ` Aijaz.Baig
2020-04-03  8:45     ` Peter Maydell
2020-04-03 11:07   ` Philippe Mathieu-Daudé
2020-04-03 12:11     ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).