Pages

Saturday, February 9, 2013

Installing Slackware ARM in Qemu

ARM, ARM and ARM. Everybody is using it - knowing or not knowing. So I decided to write a small tutorial about installing Slackware ARM in Qemu. For this tutorial I expect a few things:

- you should be able to install Slackware
- you should have worked with Qemu
- you should know how Linux boots

I can not cover the above topics in this tutorial and I won't explain too much about them (if you want I can write something about them in different articles). So let's start!
First you need a kernel and a initrd. Both can be downloaded from http://www.armedslack.org/. You don't need to download every single file from http://armedslack.org! For this tutorial download only the files I mention.
Before you download anything create a directory where you can store all the files you need for this tutorial (I'll create the original directory structure in this article as needed):

# mkdir -p /local/armedslack/

Where /local/armedslack will be the root directory for the packages. Then download the kernel:

# mkdir -p /local/armedslack/kernels/versatile
# cd /local/armedslack/kernels/versatile
# wget -c "ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.0/kernels/versatile/zImage-versatile"
...


And the initrd:

# mkdir -p /local/amredslack/isolinux
# cd /local/amredslack/isolinux
# wget -c "ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.0/isolinux/initrd-versatile.img"
...


With the kernel and the initrd available locally you can start Slackware ARM already:

# qemu-system-arm -M versatilepb -kernel /local/armedslack/kernels/versatile/zImage-versatile -initrd /local/armedslack/isolinux/initrd-versatile.img

You should see some kernel messages and when the kernel and the initrd are loaded you should see the typical question you see every time when booting any Slackware install CD:

...
Enter 1 to select a keyboard map:


There's currently nothing better to do as selecting your keyboard map so do it. After that you'll notice that the booted environment is the typical Slackware installer environment. There is not much to do currently except for looking around a little:

# free -m
             total         used         free
Mem:           123           49           73
...
# cat /proc/cpuinfo
Processor       : ARM926EJ-S rev 5 (v5l)
...


And so on. It is safe to turn off Qemu here.
Before you can install Slackware ARM you need a harddisk:

# mkdir /local/qemu/
# qemu-img create /local/qemu/arm.qcow 10g
Formatting '/local/qemu/arm.qcow', fmt=raw size=10737418240


10GB might be a little oversized but depending on what you want to do you can to resize the disk size. For the purpose of this tutorial even 512MB are enough space. Next you need to download a few packages which you can install. All needed packages can be found inside the a and l series:

# tree /local/armedslack/
/local/armedslack/
|-- isolinux
|   `-- initrd-versatile.img
|-- kernel
|   `-- versatile
|       `-- zImage-versatile
`-- slackware
    |-- a
    |   |-- aaa_base-14.0-arm-4.tgz
    |   |-- aaa_elflibs-14.0-arm-2.tgz
    |   |-- aaa_terminfo-5.8-arm-1.tgz
    |   |-- bash-4.2.037-arm-1.tgz
    |   |-- bin-11.1-arm-2.tgz
    |   |-- coreutils-8.19-arm-1.tgz
    |   |-- e2fsprogs-1.42.6-arm-1.tgz
    |   |-- etc-14.0-arm-1.tgz
    |   |-- kernel-modules-versatile-3.4.11_versatile-arm-1.tgz
    |   |-- kernel_versatile-3.4.11-arm-1.tgz
    |   |-- pkgtools-14.0-noarch-2.tgz
    |   |-- shadow-4.1.4.3-arm-6.tgz
    |   |-- sysvinit-2.88dsf-arm-2.tgz
    |   |-- sysvinit-functions-8.53-arm-1.tgz
    |   |-- sysvinit-scripts-2.0-noarch-9.tgz
    |   `-- util-linux-2.21.2-arm-3.tgz
    `-- l
        `-- glibc-2.15-arm-8.tgz


Download the above packages and create the exact directory structure. Then assemble all these packages into an ISO image. First create a directory for the ISO image:

# mkdir -p /local/iso

Then create the ISO image itself (the mkisofs command is nearly the same Stuart uses):

# cd /local/armedslack
# mkisofs -udf -o /local/iso/slackware-arm-14.0.iso -R -J -V "Slackware ARM 14.0" -hide-rr-moved -v -d -N -A "Slackware ARM 14.0" .


All right, with the kernel, initrd and the newly created ISO image you can start Qemu again and install Slackware as usual:

# qemu-system-arm -M versatilepb -kernel /local/armedslack/kernel/versatile/zImage-versatile -initrd /local/armedslack/isolinux/initrd-versatile.img /local/qemu/arm.qcow -cdrom /local/iso/slackware-arm-14.0.iso

Qemu will load the given kernel and then the given initrd. With a disk and a cdrom you can install Slackware ARM nearly as a usual Slackware. Just one hint: as filesystem choose ext3! After the installation has finished turn of Qemu. Before you can proceed you need to extract the installed kernel and initrd from the Slackware ARM packages.

# cd /local/armedslack
# tar xfv slackware/a/kernel_versatile-3.4.11-arm-1.tgz boot/zImage-versatile-3.4.11
# tar xfv slackware/a/kernel_versatile-3.4.11-arm-1.tgz boot/initrd-versatile-3.4.11.gz


The extracted kernel and initrd will be same as on your Qemu disk. You can boot now with the following command. At the end of the boot process you will be prompted for a username and a password:

# qemu-system-arm -M versatilepb -kernel /local/armedslack/boot/zImage-versatile-3.4.11 -initrd /local/armedslack/boot/initrd-versatile-3.4.11.gz /local/qemu/arm.qcow -cdrom /local/iso/slackware-arm-14.0.iso
...
/bin/grep: No such file or directory
....


During the boot process you will notice several error messages like the above that grep can not be found etc. Just ignore them. If you followed my instructions then grep is not installed on your system. But from this point you can install every package that is available for Slackware ARM. All to easy!