Following files required to emulate raspberry pi on windows
- QEMU Emulator
- Raspberry pi kernel
- Raspberry pi OS image
- QEMU is an emulator
- Can be downloaded from the link QEMU
- Download 32 bit the latest version of exe, 64-bit version has some issues
- When it's executed files will be extracted and available in the same folder
- Rename the folder into qemu (Which ever you like)
- QEMU requires kernel to emulate the guest OS
- It will vary between OS and architecture
- Kernel for Raspberry pi can be downloaded from the link Rpi kernel
- Download the latest version of the kernel
- Once downloaded copy the kernel into qemu folder
- Raspberry pi OS(Raspbian) can be downloaded from the following URL Rasbian
- Once downloaded extract the img file into qemu folder
- Create a start.bat file under qemu folder
- put following lines into it
qemu-system-arm -kernel kernel-qemu-4.4.34-jessie -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -drive "file=2017-07-05-raspbian-jessie.img,index=0,media=disk,format=raw" -net nic -net user,hostfwd=tcp::2222-:22
- 'kernel-qemu-4.4.34-jessie' is kernel file name
- '2017-07-05-raspbian-jessie.img' is raspberry pi OS
- 'hostfwd=tcp::2222-:22' will forward port from guest to host OS. Here we are forwarding port 22 into 2222 .Guest OS can be sshed through 2222 port
- 'init=/bin/bash' Will boot the OS and launch bash instead displaying GUI
- Boot the OS by double click on start.bat file
- Once terminal displayed we need to use followng command to add quemu rules
- Create a rule file by typing following command
sudo nano /etc/udev/rules.d/90-qemu.rules
- Once file opened type following in that file
KERNEL=="sda", SYMLINK+="mmcblk0" KERNEL=="sda?", SYMLINK+="mmcblk0p%n" KERNEL=="sda2", SYMLINK+="root"
- Save the file by pressing
ctl+x
- Shutdown the OS by typing
sudo shutdown now
If shutdown not working just close the emulator - Now open the
start.bat
file and do the following change to boot into GUI- Remove
"init=/bin/bash"
text which will be displayed afterrw
Save the file and double click to launch Rasbian with GUI
- Remove
Disk size of the OS can be increased by using the following command from the host machine, Make sure guest OS turned off before increasing the disk size
qemu-img.exe resize 2017-07-05-raspbian-jessie.img +4G
Above command will add 4 GB storage of the guest OS. Once successfully increased the disk size we should expand the partition in guest OS, Follow the steps to expanding partition
- Launch the rasbian by double click start.bat
- Once successfully launched open terminal
- Type
sudo fdisk /dev/sda
- Delete the partition
- Type
p
to display the list of partitions - Note the partition 2 details this will help us to increase the partition, especially
first sector
number - Delete the partition 2 by typing
d
and when its asks for the partition number provide2
, this will delete the partition 2
- Type
- Create a new partition
- Now create new partition by typing
n
- Choose partition type as primary by providing
p
- When position number requested provide
2
- System will ask for the first sector, provide the first sector number which we noted from the deleted 2nd partition and press enter
- When system ask for the last sector just type enter it will calculate the last sector and choose by default
- Once above steps completed type
w
to commit the changes
- Now create new partition by typing
- Now reboot the OS, after successful boot launch terminal again and provide the following command
sudo resize2fs /dev/sda2
- After that reboot the OS, Now you have expanded the partition
- Type following command in terminal
sudo nano /etc/dphys-swapfile
to open swap file - Goto CONF_SWAPSIZE and change that from 100 to 1024
- Stop the swap file and start again by using following command
sudo /etc/init.d/dphys-swapfile stop
andsudo /etc/init.d/dphys-swapfile start
where can i contact you?