Altering available memory for QEMU


8 posts
by djhuk » Sun Jun 17, 2012 6:51 pm
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
daniel@daniel-VirtualBox:~/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
[root@alarmpi ~]# cat /proc/meminfo
MemTotal:         255044 kB
MemFree:          230492 kB


Has anyone had any experience/knowledge how to make this work?
Posts: 20
Joined: Fri May 25, 2012 5:54 pm
by djhuk » Sun Jun 17, 2012 7:56 pm
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.
Posts: 20
Joined: Fri May 25, 2012 5:54 pm
by nick.mccloud » Fri Jun 22, 2012 9:13 pm
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.
User avatar
Posts: 797
Joined: Sat Feb 04, 2012 4:18 pm
by djhuk » Fri Jun 22, 2012 9:38 pm
Ah thanks for the reply, looks like it's not possible, oh well!
Posts: 20
Joined: Fri May 25, 2012 5:54 pm
by n_K » Sat Jun 23, 2012 7:36 pm
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.
Posts: 10
Joined: Mon Jun 18, 2012 9:04 pm
by maribu » Tue Jun 26, 2012 1:45 pm
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
User avatar
Posts: 143
Joined: Mon Feb 13, 2012 9:56 pm
by DuncanKennedy » Tue Jun 26, 2012 2:06 pm
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.
Duncan
The mind is an infinite resource, provided you don't waste it!
Posts: 44
Joined: Sun Apr 22, 2012 3:35 am
by m][sko » Tue Aug 14, 2012 8:50 pm
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 :)
Posts: 81
Joined: Fri Jul 20, 2012 6:37 am
Location: Slovakia