Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-20 Thread Rob Landley

On 08/18/2013 08:57:08 AM, Herbei Dacian wrote:


good to know.
I was working back in 2005-2006 with a company that had a 4MB kernel.
At that time I was too inexperienced to work at that level but I  
thought now I could reproduce their work with some help.
Anyhow for the moment I'll go for 256 MB of ram board just so that I  
don't worry too much about things that are not yet relevant for me.

But thanks again for the warning.
But since you helped me soo much I have another question.
Is it fisible to change the emulator so that I may visualize the  
following aspects:

_ address of the currently executed instruction from the guest system
_ if this instruction is a form of jump like call return conditional  
jump.

_ the address or range of addresses read by this instruction
_ the address or range of addresses written by this instruction


If you feed qemu the -s option it'll open a network port you can  
connect to to provide the gdbserver protocol (gdb's target remote  
command attaches to this). For system emulation it acts like a jtag  
attached to the emulated hardware, letting you see registers and such.


I read some things about the emulator and if I understood it  
correctly the emulator
breaks the instructions of the gurest platform in micro ops which are  
then executed

on the host operation system.


Not really, no.

QEMU translates large blocks of code (used to be pages, now it's  
variable sized chunks depending on where the return instruction is) and  
keeps the translated versions cached (sort of like a java JIT). The  
main QEMU loop then calls the translated functions which execute until  
they return or get interrupted by signals (simulating things like timer  
IRQ). This is why QEMU is so fast, the actual translation overhead is  
amortized by the resulting native code being run lots of times, a  
function or loop gets translated once and then runs as native code.


This means that the address of the currently executing instruction  
isn't really something qemu naturally tracks, because although there  
_is_ a copy of the untranslated code page, it's not what we're running.  
The gdbserver code tries to do so artifically, but it's slow and  
awkward and not always perfect.


Self-modifying code is actually a horrible thing to do to qemu, from a  
performance perspective. Every time the emulated code page is modified,  
the cached copy of the translated code is discarded and the entire page  
gets retranslated. This means that in Aboriginal Linux, the shell  
scripts ./configure runs sped up 20% when I replaced my dynamically  
linked busybox with a statically linked one, due to the extra  
translations caused by the relocation fixups.


Rob


Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-18 Thread Herbei Dacian

good to know.
I was working back in 2005-2006 with a company that had a 4MB kernel.
At that time I was too inexperienced to work at that level but I thought now I 
could reproduce their work with some help.
Anyhow for the moment I'll go for 256 MB of ram board just so that I don't 
worry too much about things that are not yet relevant for me.
But thanks again for the warning.
But since you helped me soo much I have another question.
Is it fisible to change the emulator so that I may visualize the following 
aspects:
_ address of the currently executed instruction from the guest system
_ if this instruction is a form of jump like call return conditional jump.
_ the address or range of addresses read by this instruction
_ the address or range of addresses written by this instruction

I read some things about the emulator and if I understood it correctly the 
emulator breaks the instructions of the gurest platform in micro ops which are 
then executed on the host operation system.
So I'm asking the question above in the idea that maybe there is also somekind 
of reordering of these micro instructions.
best regards,
dacian





 From: Rob Landley r...@landley.net
To: Herbei Dacian dacian_her...@yahoo.fr 
Cc: Peter Maydell peter.mayd...@linaro.org; QEmu Devel 
qemu-devel@nongnu.org 
Sent: Sunday, 18 August 2013, 8:00
Subject: Re: [Qemu-devel] minimal linux distribution for qemu
 

On 08/16/2013 11:17:06 AM, Herbei Dacian wrote:
 my system should run in far less memory. something like 2-4MB.
 but first I need to have a system running so that I can monitor with  
 qemu the addresses accessed for read execute and write by the code  
 run by the emulator.
 if I reach that is a real big deal.
 dacian

Linux 2.6 and later won't run in 2 megs at all. You can trim it down to  
4 megs on a nommu system (the page tables take up too much ram  
otherwise), but won't be able to do much.

Really, things like kobjects in the modern kernel take up too much  
space. Getting anything to work in 4 megs requires diabling all the  
printk strings at compile time. (The last time I saw somebody do a 4  
meg system was CELF in 2006. 32 bit x86.)

Look at the uClinux project. Or try to bolt your app onto uboot and run  
it on the bare metal.

Rob

Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-17 Thread Rob Landley

On 08/16/2013 11:17:06 AM, Herbei Dacian wrote:

my system should run in far less memory. something like 2-4MB.
but first I need to have a system running so that I can monitor with  
qemu the addresses accessed for read execute and write by the code  
run by the emulator.

if I reach that is a real big deal.
dacian


Linux 2.6 and later won't run in 2 megs at all. You can trim it down to  
4 megs on a nommu system (the page tables take up too much ram  
otherwise), but won't be able to do much.


Really, things like kobjects in the modern kernel take up too much  
space. Getting anything to work in 4 megs requires diabling all the  
printk strings at compile time. (The last time I saw somebody do a 4  
meg system was CELF in 2006. 32 bit x86.)


Look at the uClinux project. Or try to bolt your app onto uboot and run  
it on the bare metal.


Rob


Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-16 Thread Rob Landley

On 08/15/2013 06:53:30 AM, Andreas Färber wrote:

Hi,

Am 15.08.2013 10:57, schrieb Herbei Dacian:

 please, can anyone recommend me a distribution that offers a  
barebone

 linux kernel.
 minimum that I need on that image are:
 _ the kernel
 _ the compiler and development infrastructure to build it

Aboriginal Linux.

Andreas


Aboriginal actually comes with qemu launch scripts for each target.  
./run-emulator.sh is just the qemu command line, ./dev-environment.sh  
is a wrappe around that providing a better development enviornment  
(more memory and disk space). It's all described at  
http://landley.net/aboriginal/about.html


Try this:

  wget http://landley.net/aboriginal/bin/system-image-armv5l.tar.bz2
  tar xvjf system-image-armv5l.tar.bz2
  cd system-image.armv5l
  ./run-emulator.sh

  gcc /usr/src/thread-hello2.c -lpthread
  ./a.out
  exit

Thanks,

Rob


Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-16 Thread Rob Landley

On 08/15/2013 09:01:19 AM, Herbei Dacian wrote:


yes but which binary do I use to call to run an emulated arm image?

is there an actual binary that can emulate an existing arm board,  
anyboard?

qemu?
if not which is the emulator that works with arm?
If not where is the project that I can tweak to build such a binary.


The arm versatilepb emulation can accept a range of processors (I've  
tried armv4, armv4t, armv5, armv6, and armv7), provides a PCI bus with  
a virtual hard drive controller and network card, and can accept 256  
megs of ram. (In theory it can accept more but I have to get the  
discontiguous memory stuff to work, haven't done that yet.)


That's the one I used in Aboriginal Linux arm images.

Rob


Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-16 Thread Herbei Dacian
Thanks Rob I think that should do it for me.






 From: Rob Landley r...@landley.net
To: Andreas Färber afaer...@suse.de 
Cc: Herbei Dacian dacian_her...@yahoo.fr; QEmu Devel qemu-devel@nongnu.org 
Sent: Friday, 16 August 2013, 17:59
Subject: Re: [Qemu-devel] minimal linux distribution for qemu
 

On 08/15/2013 06:53:30 AM, Andreas Färber wrote:
 Hi,
 
 Am 15.08.2013 10:57, schrieb Herbei Dacian:
 
  please, can anyone recommend me a distribution that offers a  
 barebone
  linux kernel.
  minimum that I need on that image are:
  _ the kernel
  _ the compiler and development infrastructure to build it
 
 Aboriginal Linux.
 
 Andreas

Aboriginal actually comes with qemu launch scripts for each target.  
./run-emulator.sh is just the qemu command line, ./dev-environment.sh  
is a wrappe around that providing a better development enviornment  
(more memory and disk space). It's all described at  
http://landley.net/aboriginal/about.html

Try this:

   wget http://landley.net/aboriginal/bin/system-image-armv5l.tar.bz2
   tar xvjf system-image-armv5l.tar.bz2
   cd system-image.armv5l
   ./run-emulator.sh

   gcc /usr/src/thread-hello2.c -lpthread
   ./a.out
   exit

Thanks,

Rob

Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-16 Thread Herbei Dacian
my system should run in far less memory. something like 2-4MB.
but first I need to have a system running so that I can monitor with qemu the 
addresses accessed for read execute and write by the code run by the emulator.
if I reach that is a real big deal.
dacian





 From: Rob Landley r...@landley.net
To: Herbei Dacian dacian_her...@yahoo.fr 
Cc: Peter Maydell peter.mayd...@linaro.org; QEmu Devel 
qemu-devel@nongnu.org 
Sent: Friday, 16 August 2013, 18:05
Subject: Re: [Qemu-devel] minimal linux distribution for qemu
 

On 08/15/2013 09:01:19 AM, Herbei Dacian wrote:
 
 yes but which binary do I use to call to run an emulated arm image?
 
 is there an actual binary that can emulate an existing arm board,  
 anyboard?
 qemu?
 if not which is the emulator that works with arm?
 If not where is the project that I can tweak to build such a binary.

The arm versatilepb emulation can accept a range of processors (I've  
tried armv4, armv4t, armv5, armv6, and armv7), provides a PCI bus with  
a virtual hard drive controller and network card, and can accept 256  
megs of ram. (In theory it can accept more but I have to get the  
discontiguous memory stuff to work, haven't done that yet.)

That's the one I used in Aboriginal Linux arm images.

Rob

Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-16 Thread Rob Landley

On 08/15/2013 09:18:48 AM, Herbei Dacian wrote:


but you said that qemu-system-arm is not maintained and it doesn't  
work.


Who said that?

git log --pretty=format:%h %ci %s hw/arm

be2f78b 2013-08-05 11:46:58 -0500 pxa2xx: Avoid  
object_get_link_property() asser
cfc6b24 2013-07-29 21:06:27 +0200 versatilepb: QOM cast cleanup for  
vpb_sic_stat
0ca8187 2013-07-29 21:06:27 +0200 strongarm: QOM cast cleanup for  
StrongARMSSPSt
fff3af9 2013-07-29 21:06:27 +0200 strongarm: QOM cast cleanup for  
StrongARMUARTS


Something like 50 commits to hw/arm last month alone, and August was  
feature freeze for the 1.6.0 release. (If it _wasn't_ actively  
developed I wouldn't have had to work around a darn IRQ routing issue  
on the arm target in the last Aboriginal release...)


Rob


Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-16 Thread Andreas Färber
Am 16.08.2013 18:17, schrieb Herbei Dacian:
 my system should run in far less memory. something like 2-4MB.

I thought either 16MB or 64MB RAM was a lower limit for uCLinux?

If you want to write your own custom firmware then you can go pretty low
of course. For low-end ARM embedded development the two Stellaris
machines (Cortex-M3) might be a good starting point in that case.

Andreas

P.S. Please avoid top-posting and HTML on this mailing list.

 but first I need to have a system running so that I can monitor with
 qemu the addresses accessed for read execute and write by the code run
 by the emulator.
 if I reach that is a real big deal.
 dacian
 
 
 
 *From:* Rob Landley r...@landley.net
 *To:* Herbei Dacian dacian_her...@yahoo.fr
 *Cc:* Peter Maydell peter.mayd...@linaro.org; QEmu Devel
 qemu-devel@nongnu.org
 *Sent:* Friday, 16 August 2013, 18:05
 *Subject:* Re: [Qemu-devel] minimal linux distribution for qemu
 
 On 08/15/2013 09:01:19 AM, Herbei Dacian wrote:

 yes but which binary do I use to call to run an emulated arm image?

 is there an actual binary that can emulate an existing arm board, 
 anyboard?
 qemu?
 if not which is the emulator that works with arm?
 If not where is the project that I can tweak to build such a binary.
 
 The arm versatilepb emulation can accept a range of processors (I've 
 tried armv4, armv4t, armv5, armv6, and armv7), provides a PCI bus with 
 a virtual hard drive controller and network card, and can accept 256 
 megs of ram. (In theory it can accept more but I have to get the 
 discontiguous memory stuff to work, haven't done that yet.)
 
 That's the one I used in Aboriginal Linux arm images.
 
 Rob
 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Andreas Färber
Hi,

Am 15.08.2013 10:57, schrieb Herbei Dacian:
 
 please, can anyone recommend me a distribution that offers a barebone
 linux kernel.
 minimum that I need on that image are:
 _ the kernel
 _ the compiler and development infrastructure to build it

Aboriginal Linux.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Stefan Hajnoczi
On Thu, Aug 15, 2013 at 09:57:09AM +0100, Herbei Dacian wrote:
 please, can anyone recommend me a distribution that offers a barebone linux 
 kernel.
 minimum that I need on that image are:
 _ the kernel
 _ the compiler and development infrastructure to build it

If you want something small and customizable, try Tiny Core Linux:

http://www.tinycorelinux.net/



Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Herbei Dacian

In the end I went for debian cause it is widely used.

So I'm using the following command to install linux:
qemu-system-arm -m 1024 -hda arm.img -cdrom debian-7.1.0-armel-CD-1.iso -boot d

And I get this error:
Kernel image must be specified

In the documentation is mentioned that i don't need a bzImage if the CD is 
bootable.
any suggestions?

Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Peter Maydell
On 15 August 2013 14:22, Herbei Dacian dacian_her...@yahoo.fr wrote:

 In the end I went for debian cause it is widely used.

 So I'm using the following command to install linux:
 qemu-system-arm -m 1024 -hda arm.img -cdrom debian-7.1.0-armel-CD-1.iso
 -boot d

This command line is totally broken. You're running
(by default) an emulation of the 'integratorcp' board (which is
pretty much obsolete and a bad choice), and you're trying to
pass it a CDROM image, when the board doesn't have a CDROM
drive. You need to specify the right board to emulate (with
'-M something' and also pass a kernel and an initrd to load
(with -kernel and -initrd).

-- PMM



Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Herbei Dacian

OK but which command should I use if that is broken and where I can find some 
documentation that is actually up to date?




 From: Peter Maydell peter.mayd...@linaro.org
To: Herbei Dacian dacian_her...@yahoo.fr 
Cc: QEmu Devel qemu-devel@nongnu.org 
Sent: Thursday, 15 August 2013, 15:31
Subject: Re: [Qemu-devel] minimal linux distribution for qemu
 

On 15 August 2013 14:22, Herbei Dacian dacian_her...@yahoo.fr wrote:

 In the end I went for debian cause it is widely used.

 So I'm using the following command to install linux:
 qemu-system-arm -m 1024 -hda arm.img -cdrom debian-7.1.0-armel-CD-1.iso
 -boot d

This command line is totally broken. You're running
(by default) an emulation of the 'integratorcp' board (which is
pretty much obsolete and a bad choice), and you're trying to
pass it a CDROM image, when the board doesn't have a CDROM
drive. You need to specify the right board to emulate (with
'-M something' and also pass a kernel and an initrd to load
(with -kernel and -initrd).

-- PMM

Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Peter Maydell
On 15 August 2013 14:46, Herbei Dacian dacian_her...@yahoo.fr wrote:
 OK but which command should I use if that is broken and where I can find
 some documentation that is actually up to date?

You need to start by finding out which of the boards QEMU
models your distribution actually supports, and the expected
install method for them. ARM is *not* like x86 here -- all x86
systems are basically identical, but all ARM boards are
different and you need the correct kernel for the board you're
running, whether that board is real hardware or emulated.

-- PMM



Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Herbei Dacian

yes but which binary do I use to call to run an emulated arm image?

is there an actual binary that can emulate an existing arm board, anyboard?
qemu?
if not which is the emulator that works with arm?
If not where is the project that I can tweak to build such a binary.


I can search for the board that is not a problem and then I can tweak the 
project but I need to know where can I find this.
I couldn't find any documentation in this direction.




 From: Peter Maydell peter.mayd...@linaro.org
To: Herbei Dacian dacian_her...@yahoo.fr 
Cc: QEmu Devel qemu-devel@nongnu.org 
Sent: Thursday, 15 August 2013, 15:48
Subject: Re: [Qemu-devel] minimal linux distribution for qemu
 

On 15 August 2013 14:46, Herbei Dacian dacian_her...@yahoo.fr wrote:
 OK but which command should I use if that is broken and where I can find
 some documentation that is actually up to date?

You need to start by finding out which of the boards QEMU
models your distribution actually supports, and the expected
install method for them. ARM is *not* like x86 here -- all x86
systems are basically identical, but all ARM boards are
different and you need the correct kernel for the board you're
running, whether that board is real hardware or emulated.

-- PMM

Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Peter Maydell
On 15 August 2013 15:01, Herbei Dacian dacian_her...@yahoo.fr wrote:
 yes but which binary do I use to call to run an emulated arm image?

qemu-system-arm.

 is there an actual binary that can emulate an existing arm board, anyboard?

qemu-system-arm -M help lists the boards we support.

http://www.aurel32.net/info/debian_arm_qemu.php is a good howto
type document.

-- PMM



Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Herbei Dacian

but you said that qemu-system-arm is not maintained and it doesn't work.

The link below contains only links to kernel images that don't work.
Anyway I'll figure it somehow cause this doesn't help me.




 From: Peter Maydell peter.mayd...@linaro.org
To: Herbei Dacian dacian_her...@yahoo.fr 
Cc: QEmu Devel qemu-devel@nongnu.org 
Sent: Thursday, 15 August 2013, 16:05
Subject: Re: [Qemu-devel] minimal linux distribution for qemu
 

On 15 August 2013 15:01, Herbei Dacian dacian_her...@yahoo.fr wrote:
 yes but which binary do I use to call to run an emulated arm image?

qemu-system-arm.

 is there an actual binary that can emulate an existing arm board, anyboard?

qemu-system-arm -M help lists the boards we support.

http://www.aurel32.net/info/debian_arm_qemu.php is a good howto
type document.

-- PMM

Re: [Qemu-devel] minimal linux distribution for qemu

2013-08-15 Thread Peter Maydell
On 15 August 2013 15:18, Herbei Dacian dacian_her...@yahoo.fr wrote:
 but you said that qemu-system-arm is not maintained and it doesn't work.

No, I said that the arguments you were giving it were requesting a
model of an obsolete board, and you should ask it to emulate a
different board.

-- PMM