how to compile qemu code in debug mode?

2021-01-26 Thread ckim
Hello,

How can I compile qeme in debug mode? I configured it with -enable-debug but
this is to debug the application running on qemu, isn't it?

I want to use debugger to more efficiently analyze qemu code, where should I
insert the -g -O0 option? Please help..

Thank you.

Chan Kim

 



Re: file permission error during make after source change

2021-01-26 Thread Peter Maydell
On Tue, 26 Jan 2021 at 02:48,  wrote:
>
> I found just ‘sudo make’ solves it…

That's not ideal. (Probably the 'sudo make install' decided to rebuild
some files, which then were owned by root so a non-root 'make'
cannot overwrite them.)

If you do a 'sudo make distclean' that should get rid of the
root-owned files and you can do a normal 'make' as your
own user.

Some suggestions:
 * you don't need to 'make install' to test changes, you can
   just run the QEMU binaries directly from the build directory.
   That means you can avoid doing anything as root while you're
   developing.
 * I recommend using a build directory, where you:
 mkdir build
 (cd build && ../configure [configure arguments here]
 make -C build
   and then QEMU will put its binaries and other files generated
   during the build in build/ rather than in with the source files.
   This means it's easy to just rm -rf build and get back to a
   clean tree. (You can also have multiple build directories if
   you want to build with more than one set of configure options.)

thanks
-- PMM



Re: qemu hello world prints nothing..

2021-01-26 Thread Peter Maydell
On Tue, 26 Jan 2021 at 07:02,  wrote:
> I wish someone could help me here. Running a simple program on qemu is not 
> easy for me.
>
> I tried to run baremetal hello world program and found this web page.
>
> (https://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/)
>
> This page is somewhat so old, but I decided to give it a try.
[details of changes for aarch64 skipped]
> When I execute
>
> “qemu-system-aarch64 -M virt -cpu cortex-a57 -kernel test.bin -nographic”
>
> nothing comes out.
>
> What can be wrong?

You tried to run a bare-metal program, and it isn't built correctly,
so it has crashed. "Nothing happens" is the most common visible
effect of a bug in initial startup of bare-metal programs. It's not
specific to QEMU -- if you try to do bare metal development on
real hardware you will see a lot of "nothing happened" there too.
Now you have to debug it :-)

This is a good point to look into how to use gdb and connect it
to the QEMU debug stub so that you can single step the initial
startup of your program and see where it does something you don't
expect it to.

As a more specific suggestion: the linker script in the tutorial
is written for the 32-bit 'versatilepb' board, which has RAM
starting at address 0. You're running on the aarch64 'virt' board,
where address 0 has flash (ROM) memory, and RAM starts at
0x4000_. The UART also is not at the same address in 'virt'
as it is in 'versatilepb'. You will need to adjust your linker
script and the definition of UART0DR to work on the 'virt' board.

thanks
-- PMM



Re: [EXT] Re: Bugs in SSH module

2021-01-26 Thread Berto Furth
Can you post a text attachment of the complete build log when you do "configure 
--disable-libssh"? Can you make sure you're doing a "make clean" before 
recompiling?

Thanks!

On Tue, 26 Jan 2021, at 19:26, Sawyer Liu wrote:
> Hi,
>   As you said, I disabled libssh(./configure --disable-libssh), but the 
> result is the same as before. Cannot compile QEMU.
>   Thanks. 
> 
> Best Regards
> Sawyer Liu(刘维峰)
> 
> -Original Message-
> From: Berto Furth  
> Sent: Monday, January 25, 2021 19:38
> To: Sawyer Liu ; Nerijus Baliunas 
> 
> Cc: nerijus--- via 
> Subject: Re: [EXT] Re: Bugs in SSH module
> 
> Caution: EXT Email
> 
> I believe we're talking about when you run "configure" to compile QEMU 
> from the source code. It's not a parameter you pass to QEMU itself.
> 
> So when you compile QEMU from the source code you first run something like...
> 
> configure --disable-libssh  make
> 
> Run "configure --help" to see all the available options.
> 
> Then QEMU will compile without trying to use libssh and hopefully 
> you'll avoid all those errors.
> 
> Good luck!
> 
> On Mon, 25 Jan 2021, at 20:04, Sawyer Liu wrote:
> > Hello Nerijus,
> >   Sorry, I am newer for QEMU, could you tell me details how to 
> > config QEMU? Thanks.
> >
> > Best Regards
> > Sawyer Liu(刘维峰)
> >
> > -Original Message-
> > From: Nerijus Baliunas 
> > Sent: Monday, January 25, 2021 16:42
> > To: Sawyer Liu 
> > Cc: qemu-discuss@nongnu.org
> > Subject: Re: [EXT] Re: Bugs in SSH module
> >
> > Caution: EXT Email
> >
> > Hi,
> >
> > it is written in the email you quoted:
> > you can pass QEMU configure "--disable-libssh".
> >
> > Regards,
> > Nerijus
> >
> > On Mon, 25 Jan 2021 02:12:25 + Sawyer Liu  wrote:
> >
> > > Hello peter,
> > >   How to disable libssh for QEMU? Thanks.
> > >
> > >
> > > Best Regards
> > > Sawyer Liu(Áõά·å)
> > >
> > > -Original Message-
> > > From: Peter Maydell 
> > > Sent: Friday, January 22, 2021 18:23
> > > To: Sawyer Liu 
> > > Cc: qemu-discuss@nongnu.org
> > > Subject: [EXT] Re: Bugs in SSH module
> > >
> > > Caution: EXT Email
> > >
> > > On Fri, 22 Jan 2021 at 03:49, Sawyer Liu  wrote:
> > > >I found same question, see 
> > > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.launchpad.net%2Fqemu%2F%2Bbug%2F1838763&data=04%7C01%7Csawyer.liu%40nxp.com%7Cbd58f51ce6a045a3a91708d8c125a979%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637471714790059547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=U%2FTegU4q236nennH0mfjtEGx4mhS2DFOmdjjTcgQ584%3D&reserved=0.
> > > >  The status is ¡°Won¡¯t Fix¡±. Do you have any result?
> > >
> > > The only feature that compiling QEMU with libssh adds is support for a 
> > > 'ssh' block backend. That means you can pass '-drive 
> > > file=ssh://host/path/to/file' to get QEMU to open a disk image on a 
> > > remote machine.
> > >
> > > If you don't need to use that feature, you can pass QEMU configure 
> > > "--disable-libssh". QEMU will then just not try to use the Ubuntu libssh.
> > >
> > > There seems to be some confusion in this thread about whether the problem 
> > > is libssh or libssl. These are two different libraries. The bug report 
> > > you give the URL for is for libssh.
> > >
> > > thanks
> > > -- PMM
> >
> >
> 
> Attachments:
> * sss.jpg



Re: how to compile qemu code in debug mode?

2021-01-26 Thread Peter Maydell
On Tue, 26 Jan 2021 at 09:12,  wrote:
> How can I compile qeme in debug mode? I configured it with –enable-debug but 
> this is to debug the application running on qemu, isn’t it?
>
> I want to use debugger to more efficiently analyze qemu code, where should I 
> insert the -g -O0 option? Please help..

Passing configure '--enable-debug' is the correct way to build QEMU
itself for debugging. This will build QEMU's source files with
-g -O0, and also enable some extra assertions.

thanks
-- PMM



RE: how to compile qemu code in debug mode?

2021-01-26 Thread ckim
Thanks again, that helped.
(so --enable-debug is for qemu itself, and -g for the application.)
Chan Kim

> -Original Message-
> From: Peter Maydell 
> Sent: Tuesday, January 26, 2021 6:49 PM
> To: Chan Kim 
> Cc: qemu-discuss 
> Subject: Re: how to compile qemu code in debug mode?
> 
> On Tue, 26 Jan 2021 at 09:12,  wrote:
> > How can I compile qeme in debug mode? I configured it with –enable-debug
> but this is to debug the application running on qemu, isn’t it?
> >
> > I want to use debugger to more efficiently analyze qemu code, where
> should I insert the -g -O0 option? Please help..
> 
> Passing configure '--enable-debug' is the correct way to build QEMU itself
> for debugging. This will build QEMU's source files with -g -O0, and also
> enable some extra assertions.
> 
> thanks
> -- PMM







RE: qemu hello world prints nothing..

2021-01-26 Thread ckim
Hello, Peter Maydell
Thank you so much again! I'll try your suggestions. Thanks!
Chan Kim

> -Original Message-
> From: Peter Maydell 
> Sent: Tuesday, January 26, 2021 6:47 PM
> To: Chan Kim 
> Cc: qemu-discuss 
> Subject: Re: qemu hello world prints nothing..
> 
> On Tue, 26 Jan 2021 at 07:02,  wrote:
> > I wish someone could help me here. Running a simple program on qemu is
> not easy for me.
> >
> > I tried to run baremetal hello world program and found this web page.
> >
> > (https://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-a
> > rm-using-qemu/)
> >
> > This page is somewhat so old, but I decided to give it a try.
> [details of changes for aarch64 skipped]
> > When I execute
> >
> > “qemu-system-aarch64 -M virt -cpu cortex-a57 -kernel test.bin -nographic”
> >
> > nothing comes out.
> >
> > What can be wrong?
> 
> You tried to run a bare-metal program, and it isn't built correctly, so it
> has crashed. "Nothing happens" is the most common visible effect of a bug
> in initial startup of bare-metal programs. It's not specific to QEMU -- if
> you try to do bare metal development on real hardware you will see a lot
> of "nothing happened" there too.
> Now you have to debug it :-)
> 
> This is a good point to look into how to use gdb and connect it to the
> QEMU debug stub so that you can single step the initial startup of your
> program and see where it does something you don't expect it to.
> 
> As a more specific suggestion: the linker script in the tutorial is
> written for the 32-bit 'versatilepb' board, which has RAM starting at
> address 0. You're running on the aarch64 'virt' board, where address 0 has
> flash (ROM) memory, and RAM starts at 0x4000_. The UART also is not at
> the same address in 'virt'
> as it is in 'versatilepb'. You will need to adjust your linker script and
> the definition of UART0DR to work on the 'virt' board.
> 
> thanks
> -- PMM







RE: file permission error during make after source change

2021-01-26 Thread ckim
Thank you so much,
I'll use those methods.

Chan Kim

> -Original Message-
> From: Peter Maydell 
> Sent: Tuesday, January 26, 2021 6:40 PM
> To: Chan Kim 
> Cc: qemu-discuss 
> Subject: Re: file permission error during make after source change
> 
> On Tue, 26 Jan 2021 at 02:48,  wrote:
> >
> > I found just ‘sudo make’ solves it…
> 
> That's not ideal. (Probably the 'sudo make install' decided to rebuild
> some files, which then were owned by root so a non-root 'make'
> cannot overwrite them.)
> 
> If you do a 'sudo make distclean' that should get rid of the root-owned
> files and you can do a normal 'make' as your own user.
> 
> Some suggestions:
>  * you don't need to 'make install' to test changes, you can
>just run the QEMU binaries directly from the build directory.
>That means you can avoid doing anything as root while you're
>developing.
>  * I recommend using a build directory, where you:
>  mkdir build
>  (cd build && ../configure [configure arguments here]
>  make -C build
>and then QEMU will put its binaries and other files generated
>during the build in build/ rather than in with the source files.
>This means it's easy to just rm -rf build and get back to a
>clean tree. (You can also have multiple build directories if
>you want to build with more than one set of configure options.)
> 
> thanks
> -- PMM







Re: how to compile qemu code in debug mode?

2021-01-26 Thread Peter Maydell
On Tue, 26 Jan 2021 at 11:22,  wrote:
>
> Thanks again, that helped.
> (so --enable-debug is for qemu itself, and -g for the application.)

How you enable debug symbols for the guest application
is entirely up to that application's build process:
it might be "add -g to CFLAGS", it might have a configure
option, it might have debug symbols by default, any
number of ways...

thanks
-- PMM



question about qemu user emulation

2021-01-26 Thread الاحترافية Æ
can I compile qemu to make it as fast as exagear
qemu user x86_64 because I need 64bit emulator
thanks