Slackware ARM inside QEMU
Linux :
2014. 11. 20. 19:03
반응형
출처 : ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.1/INSTALL_QEMU.TXT
########################################################################### # Document: INSTALL_QEMU.TXT # Purpose : How to install Slackware ARM inside QEMU on # Slackware/x86. # Author : Stuart Winter <mozes@slackware.com> # For questions and support, please use the Slackware ARM forum # http://www.linuxquestions.org/questions/slackware-arm-108/ # Date : 09-Sep-2009 ########################################################################### Slackware ARM inside QEMU ========================= This document describes the process of installing Slackware ARM inside of QEMU. What is QEMU? ------------- QEMU is a full system emulator that can emulate a range of real hardware architectures. In this case we will using QEMU to emulate the ARM Ltd. "Versatile" development board. QEMU provides a platform to allow an operating system to believe that it is running on real hardware. QEMU runs on your Intel-based Slackware PC/server (in most cases this will be a desktop machine, but it is possible to run QEMU on a headless server and use VNC for graphics). Who is Slackware ARM in QEMU aimed at? -------------------------------------- The aim of installing Slackware ARM inside QEMU is to allow people who do not have ARM hardware but would like to try out Slackware ARM. Whilst QEMU is an excellent emulator, it is very slow compared to real ARM hardware; I used QEMU for approximately a year and most of Slackware ARM version 12.2 was built on QEMU (using distcc to several x86 machines to speedup compilation), so it's possible to use Slackware ARM in qemu -- however I am concious that it will not present the best user experience due to the slow speed. Ideally Slackware ARM should be run on real ARM hardware. One of the cheapest options at the time of writing is the Marvell SheevaPlug which is supported by Slackware ARM. However, that said I am very happy to be able to present Slackware ARM for use by all who care to install QEMU. === Installation & running instructions ===================== 1.0 Assumptions ----------- Several assumptions -- in the form of IP addresses and directory paths -- are made to help writing the examples for this documentation. These values are easy to modify to suit your environment. - You have a secure (you trust the people using it) LAN, on 192.168.1.0/24 - You're running Slackware/x86: You have root on this machine and can compile software. Your host Slackware/x86 machine has the IP 192.168.1.1; You have the 'bridge-utils' Slackware package installed on this machine; You can NFS export the Slackware ARM tree from this machine; You want to use /export to house the Slackware ARM tree on this machine. You only need one Slackware/x86 host machine to perform an installtion of Slackware ARM inside QEMU. A single machine can be the NFS server (used for the one time installation) and host Slackware ARM inside QEMU. 2.0 Configuring your environment on the Slackware/x86 machine --------------------------------------------------------- 2.1 Create a location for your Slackware ARM host ---------------------------------------------- We need a location for the hard disk image, Kernel, initrd and QEMU helper scripts. For this example, we will put them into /export/armhost. These do not need to be available to the OS or installer, so they do not need to be NFS exported. # mkdir -p /export/armhost 2.2 NFS export ---------- On your Slackware x86 host, add a line similar to the example below in to your /etc/exports file: /export/slackwarearm 192.168.1.0/255.255.255.0(insecure,ro,nohide,root_squash,sync,no_subtree_check) Note: The 'insecure' value is set because we install Slackware ARM inside QEMU, running as a normal user, through NAT - so the source port number is higher than 1024. If you don't have an NFS server already running: # chmod +x /etc/rc.d/{rc.rpc,rc.nfsd} # /etc/rc.d/rc.nfsd If you have an NFS server already running: # exportfs -va 2.3 Download & build a Slackware QEMU package ----------------------------------------- QEMU must be built for your environment. On your host machine: # cd /tmp # mkdir qemu && cd qemu # rsync \ -Pavv \ ftp.arm.slackware.com::slackwarearm/slackwarearm-devtools/qemu/slackwarearm-14.1 . The source directory also contains the QEMU helper scripts. We'll move these into the Slackware ARM host's directory: # cd slackwarearm-14.1 # cp -fav helper-scripts/* /export/armhost/ 2.3.1 Compile QEMU ------------ By default the QEMU build script assumes 'i686'. However, it only selects CFLAGS '-O2' - no architecture specific flags. The architecture name is only used for the resulting package file, so you may wish edit the ARCH value set in 'qemu.SlackBuild' to i486, x86_64 or what ever your architecture is. **Notes:** [1] If you have an existing package of QEMU that has ARM support, you can use that version - but please ensure that it is the most up to date version QEMU can be found at: http://www.nongnu.org/qemu/ If you would rather use another build of QEMU, you will still need to download the Slackware ARM helper scripts using rsync (see setion 2.3). [2] The QEMU build script for Slackware ARM only builds the ARM system emulator, rather than the full range of emulators QEMU supports. If you wish to build the others, you need to uncomment a line in the 'qemu.SlackBuild' script. Once you've done that, as _root_ : # ./qemu.SlackBuild It should compile and leave a package in /tmp. 2.3.2 Install QEMU package -------------------- # installpkg /tmp/qemu-*-*.t?z 2.3.3 setuid root for qemu -------------------- /usr/bin/qemu-system-arm needs root permissions. You can either accomplish this using sudo, editing /etc/sudoers; this would be the most secure option if you have multiple users on your host. If like me you only have yourself using your system, it's easiest to: # chmod +s /usr/bin/qemu-system-arm ifconfig & brctl need to run as root if you are using bridged mode. If you intend on only using NAT, you can skip this. Again, you can use sudoers for security. # chmod +s /sbin/{ifconfig,brctl} 2.4 Setting up your Slackware ARM host ----------------------------------- The ARM machine needs a 'hard disk' - QEMU provides this ability by emulating a SCSI controller, and providing a single file on the host. # cd /export/armhost # vi makeimg The script creates a 15G hard disk. A full installation of Slackware occupies around 6.5GB of this, so there's plenty of room to play with afterwards. Please adjust the size if you need to. Create the image: # ./makeimg # note that it wipes the original disk image!! 2.5 QEMU network settings --------------------- The easiest way to get going with QEMU is to use NAT mode. For the expert user, I have provided two helper/example scripts to get your system working with bridged mode (which is by far the best method if you intend on doing any serious stuff): rc.local-additions - Additions for /etc/rc.d/rc.local These lines must be modified for your system, and you may prefer to add the configuration into /etc/rc.d/rc.inet1. qemu-network-tun.sh - Script to bring up the Tunnel interface when using QEMU in bridge mode. This script is run by qemu and referenced by the helper script 'disk_launch' - you do not need to run it directly - it only needs to be in the same location as the 'disk_launch' script. For more reading about QEMU in bridged mode, please see these sites: http://compsoc.dur.ac.uk/~djw/qemu.html http://blog.alantan.com/2007/01/qemu-tap-bridge-network-configuration.html http://fedoraproject.org/wiki/Architectures/ARM/HowToQemu Please email me if you need more help with the QEMU bridge setup! 4.0 Downloading Slackware ARM ------------------------- Assumptions: [ ] Your current user has read/write/execute access to /export. Make the directory that we'll download Slackware ARM into: # mkdir -p /export/slackwarearm # cd /export/slackwarearm Download: The easiest way to download Slackware ARM is to use rsync. # rsync \ --exclude '*/source/*' \ --delete -Pavv \ ftp.arm.slackware.com::slackwarearm/slackwarearm-14.1 . Download speed will depend on the bandwidth speed of your Internet connection. Whilst it is possible to use the FTP installation inside the installer, it's recommended to download the full tree first, as in this example, and install off an NFS host on your LAN. The full download will be approximately 2.6GB. You may choose a mirror site - some are listed on the Slackware ARM web page: http://arm.slackware.com 4.1 Copy the Kernel & Initial RAM disk into the ARM host directory -------------------------------------------------------------- The Kernel & initrd need to be in the directory where the ARM emulated hard disk and QEMU scripts are located. Copy them from the Slackware ARM tree: # cp -fa slackwarearm-14.1/kernels/versatile/{zImage*,initrd*} /export/armhost/ Copy the installer: # cp -fa slackwarearm-14.1/isolinux/initrd-versatile.img /export/armhost/ 5.0 Installing Slackware ARM ------------------------ I will assume that you are now in X Windows, running as your normal user account, and you have followed the steps above. Please note that even on a 3.4GHz Pentium D, installing Slackware ARM inside QEMU takes about 6 hours, so give it some time. Once you're using the installed OS, it's faster - but it depends on the speed of your host CPU. 5.1 Booting the installer --------------------- # cd /export/armhost # ./installer_launch You should see a QEMU window open, and after a few seconds the Kernel should boot, and drop you into the familiar Slackware installer. The 'installer_launch' script provided will make the Slackware installer obtain an IP via DHCP. The QEMU emulator will take care of providing the IP via its built-in DHCP server. The side-effect of this however, is that you will need to refer to your x86 NFS server via its IP address rather than any canonical host name. ( e.g. 192.168.1.1 rather than server.myhouse.com ) 5.2 Installation ------------ Proceed as normal, selecting a new key map if you do not have a US keyboard layout. 5.2.1 Partitioning your hard disk --------------------------- QEMU provides an emulated SCSI card, and the hard disk image you created in section 2.1 will show as /dev/sda. Please choose a partitioning scheme. I recommend /dev/sda1 - 200MB swap /dev/sda2 - the rest of the disc, "Linux" - type 83. Slackware ARM has an identical installer to Slackware x86, so the same tools are available, including fdisk. 5.2.2 Begin the setup --------------- The Slackware ARM setup is identical to Slackware x86. To begin, type 'setup' into the shell and proceed as normal, but take note of the following suggestions. 5.2.2.1 Caveats about the installer --------------------------- 1. After installation has finished, running 'MKFONTSCALE' takes a long time. It may appear as if the installation has hung, as the system seems unresponsive and you are unable to change virtual console. If you run 'top' on your host OS, you will probably find QEMU busy using 100% of the CPU. Solution: be patient ;-) 5.2.3 Tips on choosing Filesystems & Real Time Clock (RTC) ---------------------------------------------------- Slackware ARM provides the same filesystems as Slackware x86. However, it is advised that you do not choose JFS. This is because all versions of QEMU up to and including 0.10.3 do not emulate an RTC (Real Time Clock), which means that when QEMU boots, the local time is epoch (1970) which causes a circular fsck-reboot-fsck-reboot. 5.2.3.1 Turning off fsck checks ----------------------- After choosing your filesystem types and formatting the partitions, you will be asked whether you want to turn off fsck checks. You are advised to say yes to avoid the circular fsck/reboot problem. This is accomplished by switching the fsck value in /etc/fstab to 0, and for ext* filesystems, tune2fs -i0 is used to unset the interval between fsck checks. This works for all the supported filesystems except JFS, which refuses to mount an unchecked filesystem. 5.2.4 Source media selection ---------------------- Choose '3 - Install from NFS (Network Filesystem)' Enter the IP address: 192.168.1.1 Enter the directory: /export/slackwarearm/slackwarearm-14.1/slackware 5.2.5 Package selection ----------------- Slackware ARM has all of the Slackware packages apart from those which are x86 only. It's up to you which packages you install, but we recommend a full installation. 5.2.6 Mouse selection --------------- Choose the first option "USB Mouse" 5.2.7 Network setup ------------- If you intend on using NAT for networking, QEMU has a built-in DHCP server, so the best and easiest way is to configure the OS to use DHCP. If you will be using bridging and have a DHCP server, you may also wish to choose DHCP. 5.2.8 Window manager for X -------------------- You can choose any of them, but it's recommended to choose something light weight such as WindowMaker or Fluxbox. KDE4 does not work on ARM Versatile inside QEMU - presumably because of a lack of RAM; the emulated ARM CPU is not fast enough to provide a useful KDE experience anyway. 6.0 Booting the Slackware ARM OS ---------------------------- Congratulations! The first thing to do is amend the 'disk_launch' script: # cd /export/armhost # vi disk_launch Changes to make & installation tips: 1. Root filesystem type: Change the root filesystem type to match the one you chose in the Slackware installer. The supported types are listed and you must comment/uncomment as appropriate. 2. Root filesystem location: If you followed the example in this document, you will have used /dev/sda2 which is the default setting in this script; Otherwise set the partition name of the location of your root ('/') filesystem. 3. If you are going to be using bridging for your networking, you must make the appropriate changes. The default is to use NAT which is good enough to begin with. Once you've made your changes, you're ready to go! # ./disk_launch A QEMU window should pop up, and in a few seconds you should see the Kernel messages, the modules being loaded from the initrd and finally the output from the familiar Slackware boot scripts. 6.1 Post installation tweaks ------------------------ 6.1.1 root's password has expired --------------------------- The first time you login as root, you will be prompted to change the password because it has expired. This is because of the lack of real time clock. Change the password, and login. Follow the next step to set the date using NTP; then change root's password again. 6.1.2 Setting the date & time via NTP ------------------------------- As already mentioned, QEMU does not emulate a RTC for ARM, so the date is incorrect. The easiest way to fix this is to setup the NTP client, or simply add the following line to your start up script: echo "/usr/sbin/ntpdate rolex.ripe.net" >> /etc/rc.d/rc.local This is an NTP server based in the UK - you may want to find some alternative, geographically closer NTP servers. 7.0 Help support the Slackware ARM project -------------------------------------- Maintainance of the Slackware ARM port takes not only a lot of time, but also has financial costs such as the on-going use of electricity, Internet hosting and purchasing and maintainance of ARM hardware. Once you find yourself enjoying using the ARM port of Slackware, please take a few moments to show your appreciation by sponsoring through Paypal. Please visit the URL below to learn more. http://arm.slackware.com/sponsor 8.0 Suggestions/alterations ----------------------- If you have any suggestions, recommendations or corrections(!) for this document, please do email me. Thanks! Stuart Winter. -- Stuart Winter mozes@slackware.com
반응형
'Linux' 카테고리의 다른 글
SlackwareArm Arm Slackware ArmedSlackware (0) | 2014.11.21 |
---|---|
wpa_supplicant WPA-PSK TKIP방식 AP접속 방법 (0) | 2014.11.14 |
Linux 날짜와 시간 (0) | 2014.11.14 |