[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
howtos:hardware:arm:qemu_support_in_slackware_arm [2018/11/30 22:57 (UTC)] – [Boot Slackware ARM with QEMU] mralk3 | howtos:hardware:arm:qemu_support_in_slackware_arm [2020/09/30 18:43 (UTC)] – [Configure the Apache Mirror] mralk3 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Qemu Support in Slackware ARM ====== | ====== Qemu Support in Slackware ARM ====== | ||
- | This document describes the process of installing **Slackwarearm** inside of QEMU. | + | This document describes the process of installing **Slackware ARM** inside of QEMU. |
* QEMU is a full system emulator that can emulate a range of real hardware architectures. In this case we will use QEMU to emulate the ARM Ltd. " | * QEMU is a full system emulator that can emulate a range of real hardware architectures. In this case we will use QEMU to emulate the ARM Ltd. " | ||
* QEMU provides a platform to allow an operating system to believe that it is running on real hardware. | * QEMU provides a platform to allow an operating system to believe that it is running on real hardware. | ||
- | * QEMU runs on your Intel-based | + | * QEMU runs on your Slackware PC or server. In most cases this will be a desktop machine. However, it is possible to run QEMU on a headless server and use VNC for graphics. |
+ | |||
+ | ===== Last modified (September 2020) ===== | ||
+ | |||
+ | This tutorial was last verified on // | ||
+ | |||
+ | < | ||
+ | |||
+ | If you have suggestions for the helper scripts, please post a diff [[https:// | ||
===== Who is Slackware ARM in QEMU aimed at? ===== | ===== Who is Slackware ARM in QEMU aimed at? ===== | ||
Line 27: | Line 35: | ||
* You have root access on the host machine and can compile software | * You have root access on the host machine and can compile software | ||
* The Slackware host and QEMU emulator are on a secure Local Area Network | * The Slackware host and QEMU emulator are on a secure Local Area Network | ||
- | * You can export a Network File System file share on the host machine that shares the Slackware ARM tree with the QEMU guest | ||
- | * The root directory of the exported NFS share on the host is located at /export | ||
- | |||
- | <note tip> | ||
- | |||
===== Slackware x86 Host Prerequisites ===== | ===== Slackware x86 Host Prerequisites ===== | ||
- Download the **Slackwarearm** distribution package tree with rsync | - Download the **Slackwarearm** distribution package tree with rsync | ||
- Populate a location with the Slackware ARM QEMU files | - Populate a location with the Slackware ARM QEMU files | ||
- | - Configure the Network File System (NFS) on the Slackware x86 Host | ||
- Install QEMU and the device-tree-compiler software on the Slackware x86 host | - Install QEMU and the device-tree-compiler software on the Slackware x86 host | ||
- Configure QEMU Permissions on the Slackware x86 Host | - Configure QEMU Permissions on the Slackware x86 Host | ||
- Create the QEMU disk image using the helper scripts | - Create the QEMU disk image using the helper scripts | ||
+ | - Configure a web server to mirror Slackware ARM for the qemu guest | ||
==== Download Slackware ARM ==== | ==== Download Slackware ARM ==== | ||
- | Download Slackware ARM to your Slackware x86 Host. In this tutorial rsync is used to mirror Slackware ARM. Before running rsync, make your user has read, write, and execute permissions within the /export | + | Download Slackware ARM to your Slackware x86 Host. In this tutorial rsync is used to mirror Slackware ARM. Before running rsync, make sure your user has read, write, and execute permissions within the directory you pick. In this example |
+ | Log in as root and run the following: | ||
< | < | ||
- | mkdir -p /export/ | + | mkdir -p / |
- | cd /export/ | + | cd / |
rsync --exclude ' | rsync --exclude ' | ||
</ | </ | ||
Line 56: | Line 59: | ||
==== Populate Slackware ARM Files and Directories ==== | ==== Populate Slackware ARM Files and Directories ==== | ||
- | In order to boot the Slackware ARM installer you need to create a directory that stores the Kernel and Initial RAM disk. You also need a few helper scripts to run QEMU. In this totorial, all of these files will be stored in /export/ | + | In order to boot the Slackware ARM installer you need to create a directory that stores the Kernel and Initial RAM disk. You also need a few helper scripts to run QEMU. In this totorial, all of these files will be stored in /slackwarearm. |
Copy the kernel and RAM disk: | Copy the kernel and RAM disk: | ||
< | < | ||
- | mkdir -p /export/ | + | cd /slackwarearm |
- | cp -fa /export/ | + | cp -fa / |
- | cp -fa /export/ | + | cp -fa / |
</ | </ | ||
Line 70: | Line 73: | ||
# rsync -Prlvv --delete ftp.arm.slackware.com:: | # rsync -Prlvv --delete ftp.arm.slackware.com:: | ||
# cd $SLACKREL | # cd $SLACKREL | ||
- | # cp -fav helper-scripts/ | + | # cp -fav helper-scripts/ |
</ | </ | ||
You can find the [[http:// | You can find the [[http:// | ||
- | <note tip>The $SLACKREL variable refers to the Slackware ARM tree you downloaded. If you chose Slackwarearm-14.2, | + | <note tip>The $SLACKREL variable refers to the Slackware ARM tree you downloaded. |
- | < | + | < |
- | ==== Configure Network File System services ==== | ||
- | |||
- | The Slackware x86 host needs to be configured appropriately in order to run the Slackwarearm installation process within QEMU. The easiest and most efficient way to do so is by setting up a Network File System (NFS) share on the host machine. | ||
- | |||
- | You need to know the QEMU network settings in order to access the NFS share. | ||
- | |||
- | With a text editor, as root, add the following to the Slackware host's / | ||
- | |||
- | < | ||
- | # QEMU guest virtual IP address | ||
- | / | ||
- | </ | ||
- | |||
- | NAT mode does not allow direct access to the physical Local Area Network. | ||
- | |||
- | Use something similar to the following if you plan to use a bridged network interface: | ||
- | < | ||
- | / | ||
- | </ | ||
- | |||
- | Replace xxx.xxx.x.x/ | ||
- | |||
- | Activate the NFS share by executing the following as root: | ||
- | < | ||
- | # chmod +x / | ||
- | # / | ||
- | # exportfs -va | ||
- | </ | ||
==== Install QEMU and device-tree-compiler ==== | ==== Install QEMU and device-tree-compiler ==== | ||
Line 133: | Line 108: | ||
==== Create QEMU Disk Image ==== | ==== Create QEMU Disk Image ==== | ||
- | Prior to booting the Slackware ARM installer in QEMU, you must create a disk image that acts as an emulated [[https:// | + | Prior to booting the Slackware ARM installer in QEMU, you must create a disk image that acts as an emulated [[https:// |
Switch to the directory where you copied the helper scripts and execute **makeimg**: | Switch to the directory where you copied the helper scripts and execute **makeimg**: | ||
< | < | ||
- | cd /export/ | + | cd /slackwarearm |
./makeimg | ./makeimg | ||
- | </ | ||
- | |||
- | For reference, this is the **makeimg** script: | ||
- | < | ||
- | # Create the QEMU disk image - the emulated SD card. | ||
- | |||
- | IMG=sdcard.img | ||
- | SIZE=15G | ||
- | |||
- | rm -f $IMG | ||
- | qemu-img \ | ||
- | | ||
- | $IMG $SIZE | ||
</ | </ | ||
Line 159: | Line 121: | ||
===== QEMU Network Settings ===== | ===== QEMU Network Settings ===== | ||
- | This section covers the process of setting up QEMU guest networking. Two different processes will be described. //Network Address Translation mode (NAT)// is the first and recommended way to get a functional network in QEMU guests. | + | This section covers the process of setting up QEMU guest networking. |
There are many different ways to configure QEMU guest networking. | There are many different ways to configure QEMU guest networking. | ||
- | <note warning> | + | <note warning> |
Line 174: | Line 136: | ||
NAT mode does not require any additional configuration on the Slackware x86 host machine or in the QEMU guest machine. | NAT mode does not require any additional configuration on the Slackware x86 host machine or in the QEMU guest machine. | ||
< | < | ||
- | # cd /export/ | + | # cd /slackwarearm |
# qemu-system-arm -nographic \ | # qemu-system-arm -nographic \ | ||
-m 1024 \ | -m 1024 \ | ||
-M vexpress-a9 \ | -M vexpress-a9 \ | ||
+ | -smp 4 \ | ||
-k en-us \ | -k en-us \ | ||
-net nic \ | -net nic \ | ||
- | -net user | + | -net user,restrict=n \ |
| | ||
</ | </ | ||
Line 187: | Line 150: | ||
With NAT mode enabled, QEMU launches a virtual network of 10.0.2.0/ | With NAT mode enabled, QEMU launches a virtual network of 10.0.2.0/ | ||
- | ==== QEMU Bridged Mode Networking | + | ==== Configure a Web Server to Mirror Slackware ARM ==== |
- | The best way to set up a bridged network interface for QEMU is with the provided helper script, rc.local-additions. | + | There is a very simple |
- | You can find the helper script with comments online here: [[http:// | + | < |
- | The following commands must be executed as root to disable NetworkManager: | + | The URL pointing |
- | < | + | |
- | # / | + | |
- | # chmod -x / | + | |
- | </ | + | |
- | + | ||
- | The following network settings are assumed for the **Slackware x86 host machine**. | + | |
- | < | + | |
- | Default Gateway: 192.168.1.1 | + | |
- | Static IP address: 192.168.1.2 | + | |
- | Network Mask: 255.255.255.0 / 192.168.1.0/ | + | |
- | Name server: 192.168.1.1 | + | |
- | </ | + | |
- | + | ||
- | You need to edit the //qemu-network-tun.sh// helper script for QEMU. It is required to bring up the QEMU guest network interface. | + | |
- | + | ||
- | File: / | + | |
- | < | + | |
- | #!/bin/sh | + | |
- | + | ||
- | # This is the IP of ' | + | |
- | BRIDGEIP=192.168.1.4 | + | |
- | + | ||
- | modprobe tun | + | |
- | /sbin/ifconfig $1 $BRIDGEIP netmask 255.255.255.0 | + | |
- | /sbin/brctl addif br0 $1 | + | |
- | </ | + | |
- | + | ||
- | Here is the relevant portion of the rc.local-addtions script that requires modification. | + | |
- | < | + | |
- | .. snip .. | + | |
- | + | ||
- | # Turn on the bridge. | + | |
- | # the one specified in your qemu-network-bridge.sh script | + | |
- | # in your ' | + | |
- | # You need a bridge IP, a tunnel (tap0) IP, and then another | + | |
- | # IP which is assigned to the Slackware ARM host (by Linux inside QEMU) | + | |
- | # to its own eth0. | + | |
- | # I tried bringing this up after eth0 but the bridge didn't work. | + | |
- | # I don't know why that is! | + | |
- | ifconfig br0 192.168.1.3 up | + | |
- | + | ||
- | # Put back the original IP for eth0: | + | |
- | ifconfig eth0 192.168.1.2 up | + | |
- | + | ||
- | # | + | |
- | route del default | + | |
- | route add default gw 192.168.1.1 | + | |
- | </code> | + | |
- | + | ||
- | These network settings assume static IP addressing. | + | |
- | + | ||
- | Copy rc.local-addtions to /etc/ | + | |
- | < | + | |
- | # cp / | + | |
- | # chmod +x / | + | |
- | </ | + | |
- | + | ||
- | At this point it is recommended reboot your Slackware x86 host to assure the settings in rc.local are in use and that NetworkManager is completely disabled. | + | |
- | <note important> | + | For a production environment, |
- | Modify the launcher helper scripts once you are certain your host has the appropriate network settings. | + | Alternatively, |
===== Install Slackware ARM ===== | ===== Install Slackware ARM ===== | ||
Line 267: | Line 172: | ||
< | < | ||
- | cd /export/ | + | cd /slackwarearm |
./ | ./ | ||
</ | </ | ||
Line 287: | Line 192: | ||
==== Setup and Configuration ==== | ==== Setup and Configuration ==== | ||
- | Run the **setup** command at the shell prompt after you exit the partitioning tool. Make the installer aware of your swap parition | + | Run the **setup** command at the shell prompt after you exit the partitioning tool. Make the installer aware of your swap partition |
- | The full path of the NFS share is required: | + | < |
- | < | + | In this case we will use the host IP address, enter the URL address: |
- | Enter the IP address: 192.168.1.2 | + | |
- | Enter the directory: /export/ | + | < |
- | </ | + | This is the directory that is accessible in your web browser. |
Following that, you will be prompted for package selection. | Following that, you will be prompted for package selection. | ||
Line 322: | Line 227: | ||
< | < | ||
- | # cd /export/ | + | # cd /slackwarearm |
# vi disk_launch | # vi disk_launch | ||
</ | </ |