HOWTO_Softgun_ARM_Emulator
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
Abstract
This HOWTO presents a step by step guide to run ARM GNU/Linux operating system in the Softgun ARM Emulator. The presented way intends to be more comfortable, flexible and easier to use (in the point of view of the author of this document) than the restricted to a couple of boards (with very limited storage and memory) way softgun is intended to be used with. This is archived by patching the kernel to allow the use of up to 256 MB of RAM and the use of Network File System (NFS) for storage.
What is Softgun?
Softgun is a Software ARM. It is Intended to help developers of embedded systems without real Hardware. Currently it emulates an ARM-9 with MMU and many Netsilicon NS9750 peripherals, Flash, PCI, CAN-Bus and network.
What will we need?
- Fast host computer running Gentoo Linux (we will have about 14 ARM MHz per Intel GHz)
- ARM cross compiler (can be created by crosstool, crossdev or uclibc's buildroot)
- Softfloat ARM GNU/Linux to run on softgun (like OpenZaurus)
Steps outline
- Compile Linux Kernel for use in Softgun
- Configure Host Computer
- Configure Softgun
Linux Kernel Compilation
At this step we will generate the kernel image that we will later boot softgun with.
Patch
First we need to download the vanilla kernel and patches, we need this files:
- The kernel itself: linux-2.6.10.tar.bz2 from http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.10.tar.bz2
- Softgun's kernel patch: ns9750_kernelpatch-0.02.gz from http://sourceforge.net/projects/softgun/
- My patch: ns9750-kernel-2.6.10-gentoo.patch from http://yvasilev.main.hsphere.com/zentoo/softgun/patches/ns9750-kernel-2.6.10-gentoo.patch
Then we unpack the kernel:
$ tar -xjvpf linux-2.6.10.tar.bz2
Patch the vanilla kernel for ns9750 support:
$ zcat ns9750_kernelpatch-0.02.gz | patch -p1
This also gives us a working kernel configuration which we will use as a starting point when we will reconfigure the kernel.
And finally, apply my patch:
$ patch -p1 < ns9750-kernel-2.6.10-gentoo.patch
This patch will allow us to configure softgun to provide more than 64MB of RAM (the current maximum is 256MB) to the guest ARM GNU/Linux softgun will run, as well as, it disables (actually not enables) the watchdog timer as there is no public source code available for the module dealing with watchdog.
Configure
This section contains the minimum changes we have to do to the default configuration so we can boot softgun form an NFS export. But there isn't any reason why we can not change and personalize other settings.
To make this changes with menuconfig:
| Code: ARCH="arm" make menuconfig |
First we configure the Network Interface Card drivers to be compiled into the kernel, as at the time we want our kernel to boot from NFS there is no way to load modules into it: Networking support ---> Ethernet (10 or 100Mbit) ---> <*> NS9750 Ethernet Support Tulip family network device support ---> [*] "Tulip" family network device support <*> DECchip Tulip (dc2114x) PCI support Then we allow the kernel to configure the network form the information we'll pass it in the command line: Networking support ---> Networking options ---> [*] IP: kernel level autoconfiguration Then we configure it to support NFS and to be able to boot form it: File systems ---> Network File Systems ---> <*> NFS file system support [*] Provide NFSv3 client support [*] Root file system on NFS And finally we specify the command line we pass to the kernel: General setup ---> (mem=128M root=/dev/nfs nfsroot=192.168.81.3:/var/exports/softgun/root,rw,sync,dirsync,rsize=8192,wsize=8192,hard,intr,tcp,nolock ip=192.168.81.10::192.168.81.3:255.255.255.0:softgun:eth1:) Default kernel command string |
This is what we tell to the kernel:
- mem=128M it should use no more than 128MB of RAM (can be anything ≤ 256M)
- root=/dev/nfs it should boot form a NFS export
- nfsroot=192.168.81.3:/var/exports/softgun/root,rw,sync,dirsync,rsize=8192,wsize=8192,hard,intr,tcp,nolock it should mount /var/exports/softgun/root form the host computer to / with options rw,sync,dirsync,rsize=8192,wsize=8192,hard,intr,tcp,nolock
- ip=192.168.81.10::192.168.81.3:255.255.255.0:softgun:eth1: it should configure eth1 with ip address 192.168.81.10, netmask 255.255.255.0, default gateway 192.168.81.3 (the host computer) and hostname softgun
Also we need to create an empty file usr/initrd.image that will work as a fake root image that the kernel will expect to boot from:
$ touch usr/initrd.image
Cross compile
Note: At this stage we will use an ARM crosscompiler which is expected to be found in the PATH.
This is the easy part:
$ make ARCH="arm"
And after a little delay the kernel image arch/arm/boot/zImage should be ready to be booted.
Host Configuration
In this section we configure the host computer. Which should provide network capabilities and storage space (via NFS) to softgun.
TUN/TAP
For networking in softgun to work the hosts kernel needs to provide TUN/TAP network driver compiled into it or as a module. This is found in:
| Code: make menuconfig |
Device Drivers ---> Networking support ---> [*] Network device support <*/M> Universal TUN/TAP device driver support |
If this is compiled as a module we need to load it with:
# modprobe tun
And if we want Gentoo to load it at boot:
# echo tun >> /etc/modules.autoload.d/kernel-2.6
sudo
The app-admin/sudo package is used by softgun to configure host's virtual network interfaces (provided by TUN/TAP driver) to provide network connectivity for the ARM GNU/Linux that will run inside softgun. So all softgun needs form sudo is to have the ability to run ifconfig as root.
To modify sudo's configuration:
# visudo
And then we add:
username ALL=(ALL) NOPASSWD: /sbin/ifconfig
Where username is the username of the user that will run softgun.
NFS Exports
For our host linux to work as a NFS server we need to make sure that the kernel supports this and to have net-fs/nfs-utils installed.
| Code: make menuconfig |
The kernel options we need to check for: File systems ---> Network File Systems ---> <*/M> NFS server support [*] Provide NFSv3 server support [*] Provide NFS server over TCP support |
In case we have compiled it as a module:
# modprobe nfsd
And if we want Gentoo to load it at boot:
# echo nfsd >> /etc/modules.autoload.d/kernel-2.6
Then we add the NFS export with the root filesystem to be used by softgun:
# echo "/var/exports/softgun/root 192.168.81.0/24(sync,rw,no_root_squash,no_all_squash)" >> /etc/exports
And [re]start nfsd:
# /etc/init.d/nfs restart
Softgun Configuration
This is the final part, in this part we just have to create a configuration file for softgun to read it's settings form.
First we create the default configuration file:
$ gzcat /usr/share/doc/softgun-X.XX/defaultconfig.gz > ~/.emuconfig
Then we may want to change imagedir to something meaningful:
imagedir: /the/dir/for/kernel/images
And manually set the RAM bank settings:
[dram0] size: 128M [dram1] size: 128M
Boot into ARM GNU/Linux
Finally we are ready to test what we have done.
To do so we just copy/unpack the root file system of the soft float ARM GNU/Linux we would like to use to /var/exports/softgun/root.
And then try to boot into it with:
$ softgun path/to/linux-2.6.10/arch/arm/boot/zImage
And if everything goes right, we can copy path/to/linux-2.6.10/arch/arm/boot/zImage to /the/dir/for/kernel/images/nice-and-meaningful-kernel-name.
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and list their apartments, townhouses and units.
