Installing slackware on ARM device

Hi guys, I would like to share on how I managed install slackware 14.0 in ARM device. I was planning to run slackware in my Nexus 4 phone. I did search for any readily available image of slackware arm but I can't find one. So I decided to create one. Thanks to Stuart Winter for creating docs on installing slackware on ARM device, which can be refered here

Since I do not have any bare bone SoC hardware such as the Raspberry Pi and Kirkwood, I would only create an image using qemu, mount it, and chroot into it, on top of the android 4.2.2 on my Nexus 4 phone.

Please read the installation guide first.

I am using the qemu installation method for this. To outline the process a bit, here's how.

  1. Download the 14.0 tree to your local disk
  2. Create a qemu disk container that will be used to install slackware arm
  3. Install the Slackware ARM.
  4. Boot the system and setup post boot scripts and you're done!

Sound easy right? hahaha

Based on the guide, the installation method will be using NFS source. I do not want to change my current network settings. I'm installing it from my slackware host, using a created a DVD installation media to ease out the installation . The reason why Stuart didn't use DVD image is because that most ARM devices do not have any optical drive.

Since I'm installing it using qemu, I have the option to create a DVD image file to be mounted as the optical drive. For those .who are not really techie and knows little of Linux, I wouldn't recommend proceeding with this. You are better off without this. Unless if you wanted to gain more knowledge, by all means.

Quoting from the assumptions

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. So I will not be using the NFS method. SO you can just skip creating the network stuff for NFS.

1.0 Configuring the host machine

1.1 Create a location for your Slackware ARM host

We need to create a work directory to store the hard disk image, Kernel, initrd and QEMU helper scripts. following the docs, I'm keeping it identical, so I'm also using /export/armhost

# mkdir -p /export/armhost

1.2 Download & build a Slackware QEMU package

On your host machine:

# cd /tmp # rsync 
-Pavv .

The source directory also contains the QEMU helper scripts. We'll move these into the Slackware ARM host's directory:

# cp -fav qemu/helper-scripts/* /export/armhost/

1.3 Compile qemu

# cd qemu
# ./qemu.SlackBuild
# installpkg /tmp/qemu-*-*.tgz

Since qemu-system-arm needs root, the easiest way is to chmod it +x. You can achieve the same by using sudo.

# chmod +s /usr/bin/qemu-system-arm

1.4 Setting up your Slackware ARM host

# cd /export/armhost
# nano makeimg

Edit the script to adjust the disk image size. My Nexus 4 has a built in 16GB storage but only 13GB usable. A full installation of Slackware occupies around 6.5GB so I've allocated 8GB for it.

Create the image:

# ./makeimg # note that it wipes the original disk image!!

2.0 Downloading Slackware ARM

Make the directory that we'll rsync Slackware ARM into:

# mkdir -p /export/slackwarearm
# cd /export/slackwarearm
# rsync 
--exclude '*/source/*' 
--delete -Pavv .

The full download will be about 2.6GB. So just sit back and relax until the rsync completes. Depending on your connection speed and location, you may want to choose a suitable mirror site - listed on the Slackware ARM web page:

2.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 and the installer into the directory.

# cp -fa slackwarearm-14.0/kernels/versatile/{zImage*,initrd*} /export/armhost/ 
# cp -fa slackwarearm-14.0/isolinux/initrd-versatile.img /export/armhost/

3.0 Installing Slackware ARM

Installing Slackware ARM inside QEMU takes more than 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.

3.1 Booting the installer

# cd /export/armhost 
# ./installer_launch

A qemu window will open and you would drop into the familiar install screen.

3.2 Installation

Just proceed as usual installation,

3.2.1 Partitioning your hard disk

Qemu provide an emulated SCSI card, which will show up at the guest as /dev/sda

I don't want to use swap so I just create the root fs. Format it using ext3 type.

/dev/sda1 - linux ext3

3.2.2 Begin the installation

In the shell, type setup and proceed as usual in the installation menu. Some info 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 ;-)

3.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 boot loop (circular fsck-reboot-fsck-reboot) 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 bootloop.

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.

3.2.4 Source media selection

Choose Install from a CD Drive

3.2.5 Package selection

ARM devices are x86 only. You can choose waht to install and what not, but the docs recommends full installation

3.2.6 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.

4.0 Booting the Slackware ARM OS

Amend the 'disk_launch' script:

# cd /export/armhost # vi disk_launch

Changes to make & installation tips:

1. Root filesystem type: change to ext3

2. Root filesystem location: Since I do not set any swap partition my disk should be /dev/sda1 as the root ('/') filesystem.

# ./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.

4.1 Post installation tweaks

4.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.

4.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">> /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.

And there you have it!