[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 revision | ||
howtos:hardware:arm:qemu_support_in_slackware_arm [2018/11/20 00:47 (UTC)] – [Configure Network File System services] mralk3 | howtos:hardware:arm:qemu_support_in_slackware_arm [2021/03/28 12:51 (UTC)] (current) – [Sources] 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 | ||
- | * The host machine has the address 192.168.1.1 and the network has the [[https:// | ||
- | * 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 Server (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 57: | 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 71: | 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 want 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 132: | 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 158: | 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 easiest | + | 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> |
+ | |||
+ | |||
+ | < | ||
+ | </ | ||
- | < | + | Run this command for each network interface actively used by QEMU. |
- | ip link set eth0 txqueuelen 10000 | + | |
- | ip link set lo txqueuelen 10000 | + | |
- | ip link set tap0 txqueuelen 10000</ | + | |
</ | </ | ||
==== QEMU NAT Mode Networking ==== | ==== QEMU NAT Mode Networking ==== | ||
- | 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 \ |
- | -rtc base=localtime | + | ..snip.. |
- | -no-reboot \ | + | |
- | -sd sdcard.img \ | + | |
- | | + | |
- | | + | |
- | -dtb dtb/ | + | |
- | | + | |
</ | </ | ||
- | The **-net nic** and **-net user** options enable QEMU to start the Slackwarearm | + | The **-net nic** and **-net user** options enable QEMU to start the Slackware ARM guest with NAT mode networking enabled. These settings are documented further in both the **installer_launch** and **disk_launch** helper scripts. |
- | By default | + | With NAT mode enabled, |
+ | ==== Configure a Web Server to Mirror Slackware ARM ==== | ||
- | <note important> | + | There is a very simple way to share the ARM directory |
- | ==== QEMU Bridged Mode Networking ==== | + | |
- | There are two ways to set up bridged mode networking. | + | < |
- | The second method uses the provided rc.local-additions script. | + | The URL pointing to the mirror depends on the directory structure you used to store Slackwarearm on the qemu host. |
- | The Slackware beginner' | + | For a production environment, the Apache Web server (httpd |
- | + | ||
- | First I will discuss how to use the Slackware init scripts. | + | |
- | < | + | |
- | IFNAME[0]=" | + | |
- | BRNICS[0]=" | + | |
- | IPADDR[0]="" | + | |
- | NETMASK[0]="" | + | |
- | IPALIASES[0]="" | + | |
- | USE_DHCP[0]=" | + | |
- | DHCP_HOSTNAME[0]="" | + | |
- | + | ||
- | VIRTIFNAME[0]=" | + | |
- | VIRTIFTYPE[0]=" | + | |
- | VIRTIFUSER[0]=" | + | |
- | VIRTIFGROUP[0]=" | + | |
- | </ | + | |
- | + | ||
- | You will need to restart your network for the changes to take effect. | + | |
- | + | ||
- | < | + | |
- | # / | + | |
- | # chmod -x / | + | |
- | # / | + | |
- | </ | + | |
- | + | ||
- | Next you need to create a few files that QEMU requires to bring up the guest' | + | |
- | + | ||
- | File: qemu-network-tun.sh | + | |
- | < | + | |
- | #!/bin/sh | + | |
- | + | ||
- | # This is the IP of ' | + | |
- | BRIDGEIP=192.168.1.4 | + | |
- | + | ||
- | modprobe tun | + | |
- | / | + | |
- | /sbin/brctl addif br0 $1 | + | |
- | </ | + | |
- | + | ||
- | File: qemu-network-tun-down.sh | + | |
- | < | + | |
- | #!/bin/sh | + | |
- | + | ||
- | / | + | |
- | /sbin/brctl delif br0 $1 | + | |
- | </ | + | |
- | + | ||
- | Mark both qemu-network-tun.sh and qemu-network-tun-down.sh as executable | + | |
- | < | + | |
- | # chmod +x / | + | |
- | # chmod +x / | + | |
- | </ | + | |
- | + | ||
- | You are now ready to boot the Slackware ARM guest. | + | |
- | < | + | |
- | # cd / | + | |
- | # qemu-system-arm -nographic \ | + | |
- | -net nic${MACADDR} -net tap, | + | |
- | -m 1024 \ | + | |
- | -M vexpress-a9 \ | + | |
- | -k en-us \ | + | |
- | -rtc base=localtime \ | + | |
- | | + | |
- | -sd sdcard.img \ | + | |
- | | + | |
- | | + | |
- | -dtb dtb/ | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | Notice the line: **-net nic${MACADDR} -net tap, | + | |
- | + | ||
- | This line tells QEMU to attach to the tap device, tap0, which you configured earlier in / | + | |
- | + | ||
- | ==== QEMU Bridged Mode Networking with rc.local-additions ==== | + | |
- | + | ||
- | This section describes the process of configuring QEMU networking with a more fine grained control. | + | |
- | + | ||
- | You can find the script with comments here: [[http:// | + | |
- | + | ||
- | Here is the relevant portion of the 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 | + | |
- | </ | + | |
- | + | ||
- | These network settings assume static IP addressing. | + | |
- | + | ||
- | < | + | |
- | #!/bin/sh | + | |
- | + | ||
- | # This is the IP of ' | + | |
- | BRIDGEIP=192.168.1.4 | + | |
- | + | ||
- | modprobe tun | + | |
- | / | + | |
- | /sbin/brctl addif br0 $1 | + | |
- | </ | + | |
- | + | ||
- | As described earlier in this document, you can launch the Slackware ARM installer within the QEMU guest, with the same network options: | + | |
- | < | + | |
- | # qemu-system-arm -nographic \ | + | |
- | -net nic${MACADDR} -net tap, | + | |
- | .. snip .. | + | |
- | | + | |
- | </ | + | |
+ | Alternatively, | ||
===== Install Slackware ARM ===== | ===== Install Slackware ARM ===== | ||
Line 334: | Line 172: | ||
< | < | ||
- | cd /export/ | + | cd /slackwarearm |
./ | ./ | ||
</ | </ | ||
Line 354: | 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.1 # br0 or eth0 IP address | + | |
- | 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 386: | Line 224: | ||
===== Boot Slackware ARM with QEMU ===== | ===== Boot Slackware ARM with QEMU ===== | ||
- | **Work in Progress** | + | Congratulations for making it this far! The next step is booting into your fresh installation of Slackware ARM. Locate the **disk_launch** helper script in / |
- | + | ||
- | For making it this far, congratulations! The next step is booting into your fresh installation of Slackwarearm-current. Locate the **disk_launch** helper script in / | + | |
< | < | ||
- | # cd /export/ | + | # cd /slackwarearm |
# vi disk_launch | # vi disk_launch | ||
</ | </ | ||
Line 402: | Line 238: | ||
* **NETTYPE** - network configuration, | * **NETTYPE** - network configuration, | ||
- | The **disk_launch** script can be found online, [[http:// | + | The **disk_launch** script |
The first boot will take quite a while. | The first boot will take quite a while. | ||
Line 410: | Line 246: | ||
</ | </ | ||
+ | Assuming all is well, you can begin using Slackware ARM just as you would any other Slackware installation. | ||
===== Slackware ARM Graphical User Interface ===== | ===== Slackware ARM Graphical User Interface ===== | ||
Line 417: | Line 254: | ||
====== Sources ====== | ====== Sources ====== | ||
<!-- If you are copying information from another source, then specify that source --> | <!-- If you are copying information from another source, then specify that source --> | ||
- | * Originally written by [[wiki:user: | + | * Originally written by [[http:// |
* Original source: [[http:// | * Original source: [[http:// | ||
<!-- Authors are allowed to give credit to themselves! --> | <!-- Authors are allowed to give credit to themselves! --> | ||
- | * Modified and Maintained by [[wiki: | + | * Modified and Maintained by [[wiki: |
<!-- * Contributions by [[wiki: | <!-- * Contributions by [[wiki: | ||