This directory contains the Kernels for Slackware ARM's
supported architectures.

These Kernels are extracted from the slackware/a/kernel-*.
packages.

For details of using these Kernels and Initial RAM disks,
please see the installation instructions in the root directory
of the Slackware ARM tree, for example:


 slackwarearm-slackwarearm-14.2/INSTALL_KIRKWOOD.TXT 
 slackwarearm-slackwarearm-14.2/INSTALL_QEMU.TXT
 slackwarearm-slackwarearm-14.2/INSTALL_TRIMSLICE.TXT
 slackwarearm-slackwarearm-14.2/INSTALL_BANANAPI.TXT

These documents guide you step by step how to install Slackware
ARM and how which files to choose from this directory.

Each Kernel directory contains:
-------------------------------

  [ ] An initial RAM disk ('initrd' and 'uinitrd')
      These are required to boot the kernels.  The initrd
      contains the Kernel modules, providing support for hardware
      and filesystems.

  [ ] A Linux Kernel ('zImage' and 'uImage')
      This is the Linux Kernel.

There are two versions of the Kernel and the Initial RAM disk.
The 'uImage' and 'uinitrd' files are for use with the Das U-BootLinux loader,
which is widely used on some ARM platforms.

The 'zImage' files are standard gzip compressed Kernel images (from a 
'make zImage' in the Linux kernel source), and the 'initrd' files are gzip
compressed cpio archives.

Some versions of the U-Boot loader can load the standard gzip compressed 
format Kernels ('zImage' and 'initrd'), whilst older versions of U-Boot
cannot.  You can check whether yours does by seeing if U-Boot supports the
'bootz' command.  If it does, you can use the 'zImage' and 'initrd' versions
in preference to the 'uImage' and 'uinitrd' versions.

Booting the initial RAM disks
-----------------------------

To boot the Kernel with the initrd, you will need to specify a 
few kernel command line options:

 [ ] The location of the root filesystem

 [ ] The filesystem format used

     root=/dev/xxx rootfs=<filesystem type>

 example: 

     root=/dev/sda2 rootfs=ext4

          the root filesystem resides on /dev/sda2 and is formatted
          using the 'ext4' filesystem.
          Following the installation of Slackware ARM, you'll need to
          specify the filesystem type (all lower case letters) to
          match what you chose at installation time.


It's also possible to rebuild the initrd using the 'mkinitrd' tool, but
for first boot at least, you'll need to manually specify these to your
boot loader since the default configuration in the initrd most likely
won't match your installation.

Creating/updating the initrd
----------------------------

If you want to update the initrd, please read the document included in
the "mkinitrd" package:

/usr/doc/mkinitrd-*/ README.initrd


Unpacking the uInitrd files
---------------------------

If you wish to unpack one of the U-Boot image files, you can
use this command as root (if you wish to preserve the permissions):

# mkdir /tmp/unpack && cd /tmp/unpack
# dd if=/path/to/uInitrd bs=64 skip=1 | gzip -dc | cpio -div


Extracting the 'zImage' from the 'uImage' files to append a DTB
----------------------------------------------------------------

If you need to extract the zImage files from the uImage (U-Boot) files
because you are interested in obtaining the zImage, or because your U-Boot
cannot be upgraded in order to append the DTB (Device Tree Blob) you can
follow these steps:

Note that if your U-Boot supports loading the standard formats 'zImage' and 'initrd'
then you can skip steps 1, 2 and the 'mkimage' piece of step 3.

1.  Obtain the extraction script
    ````````````````````````````

    http://buffalo.nas-central.org/wiki/How_to_Extract_an_uImage
    A copy is kept here: ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-slackwarearm-14.2/source/k/scripts/extract-zImage-from-uImage

2.  Extract zImage
    ``````````````

    # mkdir /tmp/extractzImage && cd /tmp/extractzImage
    # cp -fav /path/to/slackwarearm-slackwarearm-14.2/kernels/tegra/uImage-tegra .
    # /path/to/scripts/extract-zImage-from-uImage uImage-tegra

    You now have the 'zImage'.

3.  Appending a DTB (Device Tree Blob) to the zImage & creating a new U-Boot 'uImage'
    `````````````````````````````````````````````````````````````````````````````````

    Install the 'Device Tree Compiler' ('dtc') package.  This package converts
    the human readable device configuration into a binary format:

    # upgradepkg --install-new /path/to/slackware/d/device-tree-compiler-*.t?z

    You need to locate the DTB for your particular device.
    For each of the architectures supported by Slackware ARM, all of the DTB files in the
    kernel source are shipped in the 'kernel' package for that particular architecture.
    You may find the appropriate DTB file is already present and installed.  If not,
    you can download the kernel source and find them in 'linux-x.x.x/arch/arm/boot/dts'.

    To make it clear, here's an example on one of the Slackware ARM build hosts 
    upon which a full Slackware installation has been deployed:

     root@pepa:~# ls /boot/dtb/tegra* -1
     /boot/dtb/tegra20-harmony.dtb
     /boot/dtb/tegra20-medcom-wide.dtb
     [.. snip ..]

     root@pepa:~# ls /boot/dtb/kirkwood* -1
     /boot/dtb/kirkwood-dns320.dtb
     /boot/dtb/kirkwood-dns325.dtb
     [.. snip..]

     Locate which package contains these DTB files:

     root@pepa:~# egrep "boot/dtb/tegra20-harmony.dtb|boot/dtb/kirkwood-dns320.dtb" /var/log/packages/*
     /var/log/packages/kernel_kirkwood-3.7.1-arm-1:boot/dtb/kirkwood-dns320.dtb
     /var/log/packages/kernel_tegra-3.7.1-arm-1:boot/dtb/tegra20-harmony.dtb
 
     If the DTB you need is not present in the Slackware ARM kernel packages,
     but you have located it in the Linux kernel source, follow these steps to create
     a 'dtb' file.  For this example I will create the DTB for the Compulab 'TrimSlice'
     which uses an NVIDIA 'Tegra 20' SoC:

     # cd linux-x.x.x/arch/arm/boot/
     # dtc -I dts -O dtb -o tegra20-trimslice.dtb dts/tegra20-trimslice.dts

     Now that you have your '.dtb' file, you can append it to the zImage.
     In this example I am appending the Trimslice/Tegra 20 DTB to the zImage:

     # cat zImage tegra20-trimslice.dtb > zImage-dtb-appended
     
     ** If the version of U-Boot on your device supports loading the standard format of Kernels
        ('zImage' and 'initrd') then you can skip the step below, and simply make U-Boot
        load the new kernel 'zImage-dtb-appended' instead **

     Create a new uImage file for booting from U-Boot:
     You will need the 'u-boot-tools' package installed (found in the 'slackware/a'
     series) as this provides the 'mkimage' tool.
     
     # mkimage \
         -A arm \
         -O linux \
         -T kernel \
         -C none \
         -a 0x00008000 \
         -e 0x00008000 \
         -n "Linux with DTB appended" -d zImage-dtb-appended /boot/uImage-with-dtb-appended

     Your new uImage file is '/boot/uImage-with-dtb-appended'.  You may want to temporarily
     adjust your U-Boot configuration values to perform a test boot before renaming the
     uImage file to suit your environment.

-- 
Stuart Winter <mozes@slackware.com>
Created: 10-May-2009
Updated: 28-Feb-2015