Page 1 of 1

Altering available memory for QEMU

Posted: Sun Jun 17, 2012 6:51 pm
by djhuk
I'm running an installation of ARM Arch on my own machine using QEMU, as the memory limit on the R-PI is too low for what I want to do (I want to compile the glasgow haskell compiler version 7.4.2 but it needs lots of RAM which is causing it to fail when running on the R-PI)

The problem is, I can't seem to "up" the memory from the 256mb, even after providing the -m 1024 flag to the qemu application

Code: Select all

[email protected]:~/p/pi$ qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 1024 -M versatilepb -serial stdio -append "root=/dev/sda2 panic=1" -hda archlinuxarm-29-04-2012.img -hdb root.ext2 -clock dynticks
It just seems to stay at 256mb

Code: Select all

[[email protected] ~]# cat /proc/meminfo 
MemTotal:         255044 kB
MemFree:          230492 kB
Has anyone had any experience/knowledge how to make this work?

Re: Altering available memory for QEMU

Posted: Sun Jun 17, 2012 7:56 pm
by djhuk
Additionally, the boot messages when you boot the OS just says

Code: Select all

Memory: 256MB = 256MB total
So it seems to be ignoring the -m flag completely.

Re: Altering available memory for QEMU

Posted: Fri Jun 22, 2012 9:13 pm
by nick.mccloud
The Versatile kernel has some sort of hard coded memory limit of 256Mb. I've tried giving it more in the past and it just crashes out.

Re: Altering available memory for QEMU

Posted: Fri Jun 22, 2012 9:38 pm
by djhuk
Ah thanks for the reply, looks like it's not possible, oh well!

Re: Altering available memory for QEMU

Posted: Sat Jun 23, 2012 7:36 pm
by n_K
A chroot or using qemu whilst compiling with really mess your compilation up, chances are VERY high that it won't work.
Do a cross compile instead and disable all local compiling on the RPi itself.

Re: Altering available memory for QEMU

Posted: Tue Jun 26, 2012 1:45 pm
by maribu
Hi, djhuk!

I had the same problem with installing LaTeX (texlive packages). It failed during update because of lack of RAM and I couldn't set up more via qemu.

My solution was to create a raw image (qemu-img create -f raw /tmp/image 1G) and use it as swap partition.

You should at to your command the parameter
qemu -kernel ... -hdb /tmp/image
(or what ever you named it and where ever you placed it).

Whit mkswap you can generate a swap partition an with swapon you activate it.

mkswap /dev/sdb
swapon /dev/sdb

(You don't need to crate a partition table on sdb, you can use the whole disk as swap instead.)

If you have lots of RAM on the host server you can place your image in tmpfs, which will make it just as fast as emulated RAM.

Cheers,
Maribu

Re: Altering available memory for QEMU

Posted: Tue Jun 26, 2012 2:06 pm
by DuncanKennedy
Not really central to the point, but remember that on your actual Pi you won't have 256 Meg's available either, you'll have 128 Megs or some fraction of the total, depending on the amount allocated to the GPU. If you are testing your compile results using Qemu, make sure to test using a reasonable memory limit.

Re: Altering available memory for QEMU

Posted: Tue Aug 14, 2012 8:50 pm
by m][sko
I was able to compile whole Qt5 on qemu with distcc
1 x real rapsberry as host machine
5 x rapsberry in qemu

no problem distcc is really nice

rapsberry have RAM options 240 ARM /16MB VIDEOCORE
and it is best for compilation :)