Difference between revisions of "Pidora 2014 qemu"

From CDOT Wiki
Jump to: navigation, search
(Created page with '{{Pidora}}Category:PidoraCategory:Raspberry PiCategory:Pidora 18 (Raspberry Pi Fedora Remix) WARNING - THIS PAGE IS EXTREMELY ROUGH AND IS NOT FINISHED OR BEEN TEST…')
 
(Pidora QEMU)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Pidora}}[[Category:Pidora]][[Category:Raspberry Pi]][[Category:Pidora 18 (Raspberry Pi Fedora Remix)]]
+
{{Pidora}}[[Category:Pidora 18 (Raspberry Pi Fedora Remix)]][[Category:Pidora]][[Category:Raspberry Pi]]
  
  
WARNING - THIS PAGE IS EXTREMELY ROUGH AND IS NOT FINISHED OR BEEN TESTED FOR CORRECT INFORMATION. USE AT YOUR OWN RISK.
 
  
  
 +
= Pidora QEMU =
  
This is a new page that will be used as a kind of tutorial for running qemu on the pi, getting networking working, and, using a pidora image. Additionally the plan is to use this setup to make future composes for pidora 2014, or allow pidora users to create/user modified kickstart files to make their own images.
+
{{Admon/important| Warning! | Please read the instructions carefully, there may be errors or wrong information, be careful if you don't know what you are doing.}}
  
This tutorial is basically just using the tutorial found on this site(http://xecdesign.com/compiling-qemu/), with some added steps specifically for pidora.
+
This page is here to assist people who would like to run Pidora 2014 in a QEMU environment. This tutorial has been adapted from this website: http://xecdesign.com/compiling-qemu/
  
This setup is done completely on fedora 20. If you are using ubuntu/debian it might be easier to use the site above.
+
== Pidora QEMU Compose ==
  
This setup avoids the installation of the newly compiled qemu, so that your system stays clean, and keeps your system and any already install qemu instances managed by yum.
+
Using Pidora in a QEMU environment has some important restrictions to note. The model that is used to emulate Pidora has a hard coded restriction on how much RAM it can use (256 MB). The programs we use (livemedia-creator) for composing new images require much more RAM, which makes the Pidora QEMU Environment a bad place to try and create images. (See compose on Fedora Arm QEMU)
  
Some of the commands may need root.
+
= Pidora QEMU Setup =
 +
The two stages to setting up Pidora QEMU involve, getting all the files (kernel, image) and installing the QEMU environment.
  
# use whatever directory you'd like
+
== Getting The Files ==
 +
<pre>
 +
# Choose the directory to put both the image and the compiled QEMU software
 
pidora_dir=/data/pidora-qemu
 
pidora_dir=/data/pidora-qemu
  
 +
# Make the directory and enter it
 
mkdir ${pidora_dir}
 
mkdir ${pidora_dir}
 
cd ${pidora_dir}
 
cd ${pidora_dir}
 +
 +
# Download the QEMU kernel
 
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu
 
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu
 +
 +
# Download the Pidora image
 
wget http://pidora.ca/pidora/releases/20/images/Pidora-2014-R1.zip
 
wget http://pidora.ca/pidora/releases/20/images/Pidora-2014-R1.zip
  
 +
# Unzip the image file
 
unzip Pidora-2014-R1.zip
 
unzip Pidora-2014-R1.zip
 +
 +
</pre>
 +
 +
== Getting QEMU ==
 +
 +
There are multiple ways to get qemu-system-arm. You can compile a new version with a few select flags, or you can try installing the version that your distribution has already compiled. It is possible that the QEMU packaged in your distro was not compiled with the proper flags, however it seems to work on the latest Fedora 20.
 +
 +
=== Package Install ===
 +
This method should probably be good enough to run Pidora in Qemu. I have only tested on Fedora 20, and it works.
 +
 +
<pre>
 +
yum install qemu-system-arm
 +
</pre>
 +
 +
=== Manual Compile ===
 +
If the above package does not allow you to boot Pidora through QEMU, you can try the manual instructions below. This will allow you to use the QEMU software without actually installing it on your system (I don't like installing source files that are not managed by yum).
 +
 +
The manual compile will require the dependencies for the program to already be installed. Below is a list of packages that might be required (I think only the devel ones are needed?).
 +
<pre>
 +
# Install Dependencies (not sure if the non-devel packages are required?)
 +
yum install gcc-++ zlib zlib-devel SDL SDL-devel pixman pixman-devel libfdt-devel libtool glib2 glib2-devel
 +
</pre>
 +
 +
Compile qemu-system-arm:
 +
 +
<pre>
 +
# Choose the directory for the compiled QEMU software
 +
pidora_dir=/data/pidora-qemu
 +
 +
# Make a new directory for QEMU and enter it
 
mkdir ${pidora_dir}/raspidev/
 
mkdir ${pidora_dir}/raspidev/
 
cd ${pidora_dir/raspidev/
 
cd ${pidora_dir/raspidev/
 +
 +
 
git clone git://git.qemu-project.org/qemu.git
 
git clone git://git.qemu-project.org/qemu.git
 
cd ${pidora_dir}/raspidev/qemu/
 
cd ${pidora_dir}/raspidev/qemu/
  
# Before you can continue, you will probably need to install a bunch of build deps
+
# Configure the options for raspberry pi
# I will show all the packages I needed to install for the configure/make to finish successfully
+
./configure --target-list="arm-softmmu arm-linux-user" --enable-sdl --prefix=/usr
# Note: I do NOT make install
 
  
# I think you might only need to install the devel packages in the below command.
+
# Finally, compile it
yum install gcc-++ zlib zlib-devel SDL SDL-devel pixman pixman-devel libfdt-devel libtool glib2 glib2-devel
+
make
 +
 
 +
</pre>
 +
 
 +
= Boot Pidora in QEMU =
 +
Make sure you run the steps in "Before Booting" and "The First Boot" before you start Pidora for the first time to avoid issues.
 +
 
 +
== Before Booting ==
 +
{{Admon/important| Warning! | Running the command "dd" can be dangerous and could result in data loss if not used properly.}}
 +
Make sure that you add some more space to the image file. Depending on what you want to do with the Pidora image you may want more space. Replace the value in the variable size, with the number of GB to increase the size of the image with.
 +
<pre>
 +
# Choose the directory for the compiled QEMU software
 +
pidora_dir=/data/pidora-qemu
 +
 
 +
# Size = GB
 +
size=4
 +
 
 +
 
 +
dd if=/dev/zero bs=1G count=${size} >> ${pidora_dir}/Pidora-2014-R1.img
 +
</pre>
 +
 
 +
== The First Boot ==
 +
At this step we need to boot Pidora, start first boot, and allow it to automatically resize the partition inside the image to the right size. This will only work if you already increase the size of the image in the previous steps.
 +
 
 +
<pre>
 +
# Choose the directory for the compiled QEMU software
 +
pidora_dir=/data/pidora-qemu
 +
 
 +
# This is the command to boot the Pidora Image using the compiled version of QEMU
 +
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda ${pidora_dir}/Pidora-2014-R1.img
 +
</pre>
 +
 
 +
== Pidora Graphical Boot ==
 +
Run the commands below.
 +
 
 +
OR
  
# Hopefully now, you have all the dependencies on the system
+
Copy the commands below to a file called: start_pidora_graphical
 +
And execute the file: bash start_pidora_graphical
  
./configure --target-list="arm-softmmu arm-linux-user" --enable-sdl --prefix=/usr
+
<pre>
 +
#!/bin/bash
 +
# Choose the directory for the compiled QEMU software
 +
pidora_dir=/data/pidora-qemu
  
make
+
# This is the command to boot the Pidora Image using the compiled version of QEMU
 +
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda ${pidora_dir}/Pidora-2014-R1.img
 +
</pre>
  
# The newly compiled qemu program should now have compiled successfully
+
== Pidora Multi-user Boot ==
 +
Run the commands below
  
# The binary can be found in: ${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm
+
OR
  
# As per XEC's instructions I did the following(though I used vi)
+
Copy the commands below to a file called: start_pidora_multi_user
 +
And execute the file: bash start_pidora_multi_user
  
 +
<pre>
 +
#!/bin/bash
 +
# Choose the directory for the compiled QEMU software
 +
pidora_dir=/data/pidora-qemu
  
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-armqemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" -hda ${pidora_dir}/Pidora-2014-R1.img
+
# This is the command to boot the Pidora Image using the compiled version of QEMU
 +
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw 3" -hda ${pidora_dir}/Pidora-2014-R1.img
 +
</pre>
  
# Wait for the new qemu instance to boot for the first time, then do the below instructions
 
nano /etc/ld.so.preload
 
  
# Put a # in front of the first line so that it looks like this:
+
== Boot with SSH Enabled ==
#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
+
There is a option you can specify in the boot command that will allow a port to be forwarded from a localhost to the port on the pidora machine. For example, to connect to the raspberry pi qemu environment with ssh you would add this line:
 +
<pre>
 +
-redir tcp:2222::22
 +
</pre>
  
Press ctrl-x then y then enter to save and exit.
+
This will redirect all traffic from localhost on your main machine through the port 2222 to the raspberry pi qemu machine port 22. Make sure ssh is running on the qemu machine:
(Optional) Use steps 2 to 4 above to create a file /etc/udev/rules.d/90-qemu.rules with the following content:
+
<pre>
KERNEL=="sda", SYMLINK+="mmcblk0"
+
systemctl enable sshd # To make sshd start at boot time
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
+
systemctl start sshd # To start sshd
KERNEL=="sda2", SYMLINK+="root"
+
</pre>
  
# Now just close the window or shut it down
+
So you can connect with ssh by running the following command:
 +
<pre>
 +
ssh -p 2222 root@localhost # Connect to raspberry pi qemu over ssh
 +
</pre>
  
 +
=== Multi-User Boot With SSH ===
 +
This is an example of the above multi user boot with the added redirect option to enable ssh.
 +
<pre>
 +
#!/bin/bash
 +
# Choose the directory for the compiled QEMU software
 +
pidora_dir=/data/pidora-qemu
  
# At this point it's probably a good idea to increase the size of the Pidora-2014-R1.img file. If you don't it might cause some errors when you start first boot and it tries to resize your partitions and filesystem.
+
# This is the command to boot the Pidora Image using the compiled version of QEMU
 +
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -redir tcp:2222::22 -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw 3" -hda ${pidora_dir}/Pidora-2014-R1.img
 +
</pre>
  
# WARNING: This next command can be very dangerous, use at your own risk! Change the count=# number to the number of GB you would like to add to the size of the image. The command below should increase the size by 4 GB.
+
=== Graphical Boot With SSH ===
# You may be fine with 1GB more or maybe, if you are going to try composing your own images, much much more!
+
This is an example of the above graphical boot with the added redirect option to enable ssh.
dd if=/dev/zero bs=1G count=4 >> ${pidora_dir}/Pidora-2014-R1.img
+
<pre>
 +
#!/bin/bash
 +
# Choose the directory for the compiled QEMU software
 +
pidora_dir=/data/pidora-qemu
  
# you should now be able to run this command to start the pidora instance and get to first boot. This is the same command above, except without the init=/bin/bash part.
+
# This is the command to boot the Pidora Image using the compiled version of QEMU
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-armqemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda ${pidora_dir}/Pidora-2014-R1.img
+
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -redir tcp:2222::22 -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda ${pidora_dir}/Pidora-2014-R1.img
 +
</pre>
  
 +
= Issues =
 +
Some issues can occur during the above processes. Some fixes are listed below.
  
 +
== Manually Resize Pidora ==
 +
{{Admon/important| Warning! | Please make sure you follow all instructions properly, do NOT run fdisk on your main system. fdisk should only be run on the pidora qemu system, otherwise you may break your system.}}
  
# PROBLEMS: When I wrote this tutorial I accidentally ran first boot before I resized my image file, which cause a bunch of problems. I shut down the qemu instance after running first boot, and rebooted it in multi-user mode. This is done by adding a 3 to the arguments like in the below command.
 
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-armqemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw 3" -hda ${pidora_dir}/Pidora-2014-R1.img
 
  
#WARNING: The following is done on the qemu machine. This only needs to be done if you need to manually resize the partitions on the image because you forgot to increase the img file size before you started first boot.
+
If for some reason the Pidora Partitions did not resize after running first boot and you did run the dd command above to increase the size of the image, then we will manually resize the file system here.
  
# Assuming that you ran the dd command above to increase the images size, you now need to manually modify the partitions size on the pidora image.
+
First start up Pidora QEMU in Multi-user:
 +
<pre>
 +
# Choose the directory for the compiled QEMU software
 +
pidora_dir=/data/pidora-qemu
  
# On the pidora qemu instance that is booted in multi user mode
+
# This is the command to boot the Pidora Image using the compiled version of QEMU
fdisk /dev/sda
+
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw 3" -hda ${pidora_dir}/Pidora-2014-R1.img
>d
+
</pre>
>2
 
>n
 
>(press enter for default)
 
  
>(press enter for default)
+
Log in to root on Pidora, the default root password should be "raspberrypi" if it was not changed. Make sure you are running the next commands on the QEMU Pidora environment.
>(press enter for default)
 
  
>w
+
<pre>
# Shutdown the pidora qemu machine
+
# start fdisk program
 +
fdisk /dev/sda
 +
# list all partitions, note the start location of partition 2
 +
p
 +
# delete a partition
 +
d
 +
# select partition 2
 +
2
 +
# create a new partition
 +
n
 +
# select partition 2
 +
2
 +
# select start location, default should be the start location from above
 +
<press enter for default>
 +
# select end location
 +
<press enter for default>
 +
# write/save the changes
 +
w
 +
reboot
 +
<pre>
  
# Start the pidora qemu instance again and run the following command when it boots
+
After the Pidora restarts, run the following command to finish the resize setup:
 +
<pre>
 
resize2fs /dev/sda2
 
resize2fs /dev/sda2
 +
</pre>
  
# Pidora should now have the proper root filesystem size.
+
Now the Pidora QEMU environment has been successfully extended to the max size of the image file.

Latest revision as of 12:47, 4 June 2014

Pidora-horizontal.png



Pidora QEMU

Important.png
Warning!
Please read the instructions carefully, there may be errors or wrong information, be careful if you don't know what you are doing.

This page is here to assist people who would like to run Pidora 2014 in a QEMU environment. This tutorial has been adapted from this website: http://xecdesign.com/compiling-qemu/

Pidora QEMU Compose

Using Pidora in a QEMU environment has some important restrictions to note. The model that is used to emulate Pidora has a hard coded restriction on how much RAM it can use (256 MB). The programs we use (livemedia-creator) for composing new images require much more RAM, which makes the Pidora QEMU Environment a bad place to try and create images. (See compose on Fedora Arm QEMU)

Pidora QEMU Setup

The two stages to setting up Pidora QEMU involve, getting all the files (kernel, image) and installing the QEMU environment.

Getting The Files

# Choose the directory to put both the image and the compiled QEMU software
pidora_dir=/data/pidora-qemu

# Make the directory and enter it
mkdir ${pidora_dir}
cd ${pidora_dir}

# Download the QEMU kernel
wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu

# Download the Pidora image
wget http://pidora.ca/pidora/releases/20/images/Pidora-2014-R1.zip

# Unzip the image file
unzip Pidora-2014-R1.zip

Getting QEMU

There are multiple ways to get qemu-system-arm. You can compile a new version with a few select flags, or you can try installing the version that your distribution has already compiled. It is possible that the QEMU packaged in your distro was not compiled with the proper flags, however it seems to work on the latest Fedora 20.

Package Install

This method should probably be good enough to run Pidora in Qemu. I have only tested on Fedora 20, and it works.

yum install qemu-system-arm

Manual Compile

If the above package does not allow you to boot Pidora through QEMU, you can try the manual instructions below. This will allow you to use the QEMU software without actually installing it on your system (I don't like installing source files that are not managed by yum).

The manual compile will require the dependencies for the program to already be installed. Below is a list of packages that might be required (I think only the devel ones are needed?).

# Install Dependencies (not sure if the non-devel packages are required?)
yum install gcc-++ zlib zlib-devel SDL SDL-devel pixman pixman-devel libfdt-devel libtool glib2 glib2-devel

Compile qemu-system-arm:

# Choose the directory for the compiled QEMU software
pidora_dir=/data/pidora-qemu

# Make a new directory for QEMU and enter it
mkdir ${pidora_dir}/raspidev/
cd ${pidora_dir/raspidev/


git clone git://git.qemu-project.org/qemu.git
cd ${pidora_dir}/raspidev/qemu/

# Configure the options for raspberry pi
./configure --target-list="arm-softmmu arm-linux-user" --enable-sdl --prefix=/usr

# Finally, compile it
make

Boot Pidora in QEMU

Make sure you run the steps in "Before Booting" and "The First Boot" before you start Pidora for the first time to avoid issues.

Before Booting

Important.png
Warning!
Running the command "dd" can be dangerous and could result in data loss if not used properly.

Make sure that you add some more space to the image file. Depending on what you want to do with the Pidora image you may want more space. Replace the value in the variable size, with the number of GB to increase the size of the image with.

# Choose the directory for the compiled QEMU software
pidora_dir=/data/pidora-qemu

# Size = GB
size=4


dd if=/dev/zero bs=1G count=${size} >> ${pidora_dir}/Pidora-2014-R1.img

The First Boot

At this step we need to boot Pidora, start first boot, and allow it to automatically resize the partition inside the image to the right size. This will only work if you already increase the size of the image in the previous steps.

# Choose the directory for the compiled QEMU software
pidora_dir=/data/pidora-qemu

# This is the command to boot the Pidora Image using the compiled version of QEMU
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda ${pidora_dir}/Pidora-2014-R1.img

Pidora Graphical Boot

Run the commands below.

OR

Copy the commands below to a file called: start_pidora_graphical And execute the file: bash start_pidora_graphical

#!/bin/bash
# Choose the directory for the compiled QEMU software
pidora_dir=/data/pidora-qemu

# This is the command to boot the Pidora Image using the compiled version of QEMU
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda ${pidora_dir}/Pidora-2014-R1.img

Pidora Multi-user Boot

Run the commands below

OR

Copy the commands below to a file called: start_pidora_multi_user And execute the file: bash start_pidora_multi_user

#!/bin/bash
# Choose the directory for the compiled QEMU software
pidora_dir=/data/pidora-qemu

# This is the command to boot the Pidora Image using the compiled version of QEMU
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw 3" -hda ${pidora_dir}/Pidora-2014-R1.img


Boot with SSH Enabled

There is a option you can specify in the boot command that will allow a port to be forwarded from a localhost to the port on the pidora machine. For example, to connect to the raspberry pi qemu environment with ssh you would add this line:

-redir tcp:2222::22

This will redirect all traffic from localhost on your main machine through the port 2222 to the raspberry pi qemu machine port 22. Make sure ssh is running on the qemu machine:

systemctl enable sshd # To make sshd start at boot time
systemctl start sshd # To start sshd

So you can connect with ssh by running the following command:

ssh -p 2222 root@localhost # Connect to raspberry pi qemu over ssh

Multi-User Boot With SSH

This is an example of the above multi user boot with the added redirect option to enable ssh.

#!/bin/bash
# Choose the directory for the compiled QEMU software
pidora_dir=/data/pidora-qemu

# This is the command to boot the Pidora Image using the compiled version of QEMU
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -redir tcp:2222::22 -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw 3" -hda ${pidora_dir}/Pidora-2014-R1.img

Graphical Boot With SSH

This is an example of the above graphical boot with the added redirect option to enable ssh.

#!/bin/bash
# Choose the directory for the compiled QEMU software
pidora_dir=/data/pidora-qemu

# This is the command to boot the Pidora Image using the compiled version of QEMU
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -redir tcp:2222::22 -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda ${pidora_dir}/Pidora-2014-R1.img

Issues

Some issues can occur during the above processes. Some fixes are listed below.

Manually Resize Pidora

Important.png
Warning!
Please make sure you follow all instructions properly, do NOT run fdisk on your main system. fdisk should only be run on the pidora qemu system, otherwise you may break your system.


If for some reason the Pidora Partitions did not resize after running first boot and you did run the dd command above to increase the size of the image, then we will manually resize the file system here.

First start up Pidora QEMU in Multi-user:

# Choose the directory for the compiled QEMU software
pidora_dir=/data/pidora-qemu

# This is the command to boot the Pidora Image using the compiled version of QEMU
${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw 3" -hda ${pidora_dir}/Pidora-2014-R1.img

Log in to root on Pidora, the default root password should be "raspberrypi" if it was not changed. Make sure you are running the next commands on the QEMU Pidora environment.

# start fdisk program
fdisk /dev/sda
# list all partitions, note the start location of partition 2
p
# delete a partition
d
# select partition 2
2
# create a new partition
n
# select partition 2
2
# select start location, default should be the start location from above
<press enter for default>
# select end location
<press enter for default>
# write/save the changes
w
reboot
<pre>

After the Pidora restarts, run the following command to finish the resize setup:
<pre>
resize2fs /dev/sda2

Now the Pidora QEMU environment has been successfully extended to the max size of the image file.