Changes

Jump to: navigation, search

Pidora 2014 qemu

3,712 bytes added, 13:47, 4 June 2014
Pidora QEMU
{{Pidora}}[[Category:Pidora18 (Raspberry Pi Fedora Remix)]][[Category:Raspberry PiPidora]][[Category:Pidora 18 (Raspberry Pi Fedora Remix)]] 
{{Admon/important| Security Warning! |This page is a work in progress. The page is not formatted correctly and the information may or may not lead to breaking your computer. Don't use this page till it is complete, or you really know what you are doing.}}
= Pidora QEMU =
 
{{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 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 plan model that is used to allow emulate Pidora QEMU to compose new Pidora imageshas a hard coded restriction on how much RAM it can use (256 MB). This could increase speed The programs we use (livemedia-creator) for making composing new composesimages require much more RAM, add which makes the Pidora QEMU Environment a standard operating procedure for completing it, bad place to try and finally allow other users to make remixes using the Pidora 2014 package setcreate 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.
= Pidora = Getting The Files ==<pre># Choose the directory to put both the image and the compiled QEMU Setup softwarepidora_dir=/data/pidora-qemu # Make the directory and enter itmkdir ${pidora_dir}cd ${pidora_dir} # Download the QEMU kernelwget http://xecdesign.com/downloads/linux-qemu/kernel-qemu # Download the Pidora imagewget http://pidora.ca/pidora/releases/20/images/Pidora-2014-R1.zip # Unzip the image fileunzip 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.
This tutorial is basically just using the tutorial found on this site(http://xecdesign.com/compiling<pre>yum install qemu-system-qemuarm</), with some added steps specifically for pidora.pre>
=== Manual Compile ===If the above package does not allow you to boot Pidora through QEMU, you can try the manual instructions below. This setup is done completely on fedora 20. If will allow you are using ubuntu/debian it might be easier to use the site aboveQEMU software without actually installing it on your system (I don't like installing source files that are not managed by yum).
This setup avoids The manual compile will require the installation dependencies for the program to already be installed. Below is a list of packages that might be required (I think only the newly compiled qemu, so that your system stays clean, and keeps your system and any already devel ones are needed?).<pre># Install Dependencies (not sure if the non-devel packages are required?)yum install qemu instances managed by yum.gcc-++ zlib zlib-devel SDL SDL-devel pixman pixman-devel libfdt-devel libtool glib2 glib2-devel</pre>
Some of the commands may need root.Compile qemu-system-arm:
<pre># use whatever Choose the directory you'd likefor the compiled QEMU software
pidora_dir=/data/pidora-qemu
mkdir ${pidora_dir}cd ${pidora_dir}wget http://xecdesign.com/downloads/linux-qemu/kernel-qemuwget http://pidora.ca/pidora/releases/20/images/Pidora-2014-R1.zip unzip Pidora-2014-R1.zip# 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/
# Before you can continue, you will probably need to install a bunch of build deps# I will show all Configure the packages I needed to install options for the raspberry pi./configure--target-list="arm-softmmu arm-linux-user" --enable-sdl --prefix=/make to finish successfully# Note: I do NOT make installusr
# I think Finally, compile itmake </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 might only 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 softwarepidora_dir=/data/pidora-qemu # Size = GBsize=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 install 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 devel packages image in the below previous steps. <pre># Choose the directory for the compiled QEMU softwarepidora_dir=/data/pidora-qemu # This is the command.to boot the Pidora Image using the compiled version of QEMUyum install gcc${pidora_dir}/raspidev/qemu/arm-++ zlib zlibsoftmmu/qemu-devel SDL SDLsystem-devel pixman pixmanarm -devel libfdtkernel ${pidora_dir}/kernel-devel libtool glib2 glib2qemu -develcpu 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 Copy the dependencies on commands below to a file called: start_pidora_graphicalAnd execute the systemfile: bash start_pidora_graphical
.<pre>#!/configure --target-listbin/bash# Choose the directory for the compiled QEMU softwarepidora_dir="arm-softmmu arm/data/pidora-linux-user" --enable-sdl --prefix=/usrqemu
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-armOR
# As per XEC's instructions I did Copy the following(though I used vi)commands below to a file called: start_pidora_multi_userAnd execute the file: bash start_pidora_multi_user
<pre>
#!/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-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/bash3" -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 == Boot with SSH Enabled ==There is a # option you can specify in front of the first line so boot command that it looks like 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 thisline:#/usr/lib/arm<pre>-linux-gnueabihfredir tcp:2222::22</libcofi_rpi.sopre>
Press ctrl-x then y then enter This will redirect all traffic from localhost on your main machine through the port 2222 to save and exit.(Optional) Use steps 2 to 4 above to create a file /etc/udev/rules.d/90-the raspberry pi qemumachine port 22.rules with Make sure ssh is running on the following contentqemu machine:KERNEL=="sda", SYMLINK+="mmcblk0"<pre>KERNEL=="sda?", SYMLINK+="mmcblk0p%n"systemctl enable sshd # To make sshd start at boot timeKERNEL=="sda2", SYMLINK+="root"systemctl start sshd # To start sshd</pre>
So you can connect with ssh by running the following command:<pre>ssh -p 2222 root@localhost # Now just close the window or shut it downConnect 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 This is the command to increase boot the Pidora Image using the size compiled version of the 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 file. If you don't it might cause some errors when you start first boot and it tries to resize your partitions and filesystem.</pre>
# WARNING: === Graphical Boot With SSH ===This next command can be very dangerous, use at your own risk! Change is an example of the count=# number to above graphical boot with the number of GB you would like to add added redirect option to the size of the image. The command below should increase the size by 4 GBenable ssh.<pre># You may be fine with 1GB more or maybe, if you are going to try composing your own images, much much more!/bin/bash# Choose the directory for the compiled QEMU softwaredd ifpidora_dir=/dev/zero bs=1G count=4 >> ${pidora_dir}data/Pidorapidora-2014-R1.imgqemu
# you should now be able to run this This is the command to start the pidora instance and get to first boot. This is the same command above, except without Pidora Image using the init=/bin/bash part.compiled version of QEMU${pidora_dir}/raspidev/qemu/arm-softmmu/qemu-system-armqemuarm -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 If for some reason the qemu machine. This only needs to be done if Pidora Partitions did not resize after running first boot and you need did run the dd command above to manually resize increase the partitions on size of the image because you forgot to increase , then we will manually resize the img file size before you started first bootsystem here.
First start up Pidora QEMU in Multi-user:<pre># Assuming that you ran Choose the dd command above to increase the images size, you now need to manually modify the partitions size on directory for the compiled QEMU softwarepidora_dir=/data/pidora image.-qemu
# On This is the command to boot the Pidora Image using the pidora compiled version of QEMU${pidora_dir}/raspidev/qemu instance that is booted in multi user modefdisk /arm-softmmu/qemu-system-arm -kernel ${pidora_dir}/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda>d>2>nsda2 panic=1 rootfstype=ext4 rw 3" -hda ${pidora_dir}/Pidora-2014-R1.img</pre>(press enter for default)
>(press enter for Log in to root on Pidora, the default)>(press enter for default)root password should be "raspberrypi" if it was not changed. Make sure you are running the next commands on the QEMU Pidora environment.
<pre># start fdisk programfdisk /dev/sda# list all partitions, note the start location of partition 2p# delete a partitiond# select partition 22# create a new partitionn# select partition 22# select start location, default should be the start location from above<press enter for default># select end location<press enter for default>w# Shutdown write/save the pidora qemu machinechangeswreboot<pre>
# Start After the pidora qemu instance again and Pidora restarts, run the following command when it bootsto finish the resize setup:<pre>
resize2fs /dev/sda2
</pre>
# Now the Pidora should now have QEMU environment has been successfully extended to the proper root filesystem max sizeof the image file.
198
edits

Navigation menu