Re-compile Kernel For Supporting 512M Memory For RaspberryPI In Qemu

TurnToJPG -->

###Cross Compiler Prepration Get the cross-compiler from github:

	[Trusty@XXXyyy tools]$ pwd
	[Trusty@XXXyyy tools]$ git clone git://

Add the cross-compiler to system path:

	export PATH="/media/y/raspberryPI/tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH"

Now input “arm-linux-g” + tab you will see the cross-compiler is ready.
###Prepare the kernel Get the kernel source from github:

	git clone git://

Now we need to get the patches for supporting the raspberryPI, Torlus has done the patches which could also be downloaded from github:

Now we need to configure the kernel:

	cd linux
	make ARCH=arm versatile_defconfig


###Compile qemu Get the modified qemu branch from github:

	git clone git://

Switch to ‘rpi’ branch:

	git fetch origin
	git branch -v -a # List the available branches.
	git checkout -b raspberry origin/rpi	# Checkout the origin/rpi to local raspberry
	git fetch
	git checkout raspberry

Begin to configure qemu, notice we have to use python2 for configuring the qemu:

	workon venv2
	./configure --help
	./configure --target-list="arm-softmmu arm-linux-user" --enable-sdl 

Now begin to make the qemu, use -j8 for speeding up, adjust the number according to your own machine:

	make -j8

Now under the following directory you will get the qemu-system-arm:

	$ pwd

Get the kernel.img from the SD image.

###Use the compiled qemu for running We have to change the scripts for running the qemu:

	/media/y/raspberryPI/qemu/arm-softmmu/qemu-system-arm -net nic,macaddr=$macaddr -net user -kernel kernel.img -cpu arm1176 -m 512 -M raspi -no-reboot -serial stdio -append "rw earlyprintk loglevel=8 panic=120 keep_bootcon rootwait dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1024 bcm2708_fb.fbheight=768 bcm2708.boardrev=0xf bcm2708.serial=0xcad0eedf smsc95xx.macaddr=B8:27:EB:D0:EE:DF sdhci-bcm2708.emmc_clock_freq=100000000 vc_mem.mem_base=0x1c000000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait" -sd 2014-01-07-wheezy-raspbian.img  -device usb-kbd -device usb-mouse -usbdevice net 

Now we can run the raspberryPI in QEMU with 512MB memory, but, the network is still unavailable.