Apc8750: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Installing Slackware on APC-8750 ==


== Installing Slackware on apc-8750 ==
[[Image:http://apc.io/media/apc/img/apc-products-8750.jpg|APC 8750]]<br />[http://apc.io/media/apc/img/apc-angle.jpg Another photograph of APC 8750]


Mainline linux kernel lacks support for Wondermedia 8750 currently.
[https://sourceforge.net/p/slackwareonapc8750 Project Area]
However linux-vtwm kernel available at github has support for Wondermedia 8750 SOC.
Since the kernel failed to load initrd cpio archive the normal way, a special method
was used for loading the setup image.  


* Create three partitions, first bootable vfat, second reiserfs and third Linux swap.
[http://sourceforge.net/p/slackwareonapc8750/wiki/Home/ wiki @ sourceforge] Check this for latest updates
* Download and copy uzImage.bin and initrd-kirkwood.cpio to first vfat partition
 
* Download and copy Slackware installation files over to second partition
[http://sourceforge.net/p/slackwareonapc8750/code/ helper scripts] / [https://github.com/gv1/apc8750 helper scripts] 
* Boot from the micro sd card prepared, install, and configure Slackware
* Download and replace the boot kernel with new uzImage.bin for booting from
second partition.


== Creating a bootable micro sd card ==
Mainline Linux kernel lacks support for [http://www.wondermedia.com.tw/en/products/platform/soc/wm8750/ Wondermedia WM 8750] currently. However [https://github.com/linux-wmt/linux-vtwm linux-vtwm-testing] kernel available at github has support for Wondermedia 8750 SOC. Since the kernel failed to load initrd cpio archive the normal way, a special method was used for loading the Slackware setup image. ( Installer Kernel booting from embedded initramfs image creates a filesystem on ramdisk, extracts Slackware setup initrd image and chroots to the filesystem on ramdisk ). Briefly, the steps followed in installing Slackware on APC 8750 are :
 
 
For this you need a custom built kernel and a initramfs image from Slackware for  
# '''Installing Slackware.'''
arm distribution - uinitrd-kirkwood.img
## Prepare boot media: Create three partitions, first bootable vfat, second reiserfs and third Linux swap.
## Copy installer boot files: Download and copy uzImage.bin and initrd-kirkwood.cpio to first vfat partition.
            * uzImage.bin
## Download and copy Slackware installation files over to second partition.
                  [[Detailed description of how uzImage.bin was prepared.]]
## Boot from the micro sd card prepared, install, and configure Slackware.
# '''Making new installtion bootable.'''
## Download and replace the installer kernel with new uzImage.bin for booting from second partition.
## Reboot.
 
=== Creating a bootable micro sd card for installation ===
 
For this you need a custom built kernel and a initramfs image from Slackware for arm distribution - [http://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.1/isolinux/uinitrd-kirkwood.img uinitrd-kirkwood.img].


            * initrd-kirkwood.cpio
* [http://sourceforge.net/projects/slackwareonapc8750/files/install/vga/uzImage.bin/download uzImage.bin] for console on VGA monitor.<br />If this kernel is chosen boot messages will appear on VGA monitor. or
                  [[Detailed description of how initrd-kirkwood.cpio was prepared.]]
* [http://sourceforge.net/projects/slackwareonapc8750/files/install/ttyWMT0/uzImage.bin/download uzImage.bin] for console on serial port.<br />If this kernel is chosen boot messages will appear on the serial port.
* [http://sourceforge.net/projects/slackwareonapc8750/files/initrd-kirkwood.cpio.gz/download initrd-kirkwood.cpio.gz] initramfs cpio archive.<br />Download and gunzip this image file.
* Download [http://arm.slackware.com/getslack/ Slackware 14.1 for arm].<br />If you prefer, you may download this to micro sd card directly, under slackware14.1 directory.


Download and keep these files ready
Download and keep these ready.


=== Preparing the micro sd card ===
==== Preparing the micro sd card. ====


You need at least three partitions, one vfat, one or more Linux partitions, and a  
You need at least three partitions, one vfat, one or more Linux partitions, and a Linux swap partition for this method of installation. Here is how the partitions I used look like under fdisk ran on host.
Linux swap partition for this method of installation. Here is how the partitions I
used look like under fdisk ran on host.


<pre>
<pre>
Line 48: Line 50:
</pre>
</pre>


Creating filesystem:
==== Creating filesystems. ====


* 1st partition: make it bootable, and create a file system using mkfs.vfat
* 1st partition - make it bootable, and create a file system using mkfs.vfat
* 2nd partition: create a reiserfs ( or other ) file system using mkreiserfs
* 2nd partition - create a reiserfs file system using mkreiserfs ( or other tools for other types )


==== Detailed description of how Slackware install kernel was prepared. ====
==== Copying Slackware install files onto second partition. ====
 
Create a slackware14.1 directory in the reiserfs partition of the micro sd card. Copy Slackware for arm distribution to the slackware14.1 directory, from http://arm.slackware.com/getslack/. Once the preparation is over,
 
<pre>sdc1:
    /uzImage.bin 
    /initrd-kirkwood.cpio
 
sdc2:
    /slackware14.1/</pre>
==== Booting with the installer and installing Slackware. ====


I used linux-vtwm-testing available at https://github.com/linux-wmt/linux-vtwm
Now you are ready to boot from the new disk just prepared, and install Slackware from the pre mounted directory under /mnt/slackware14.1/slackware ( which is automounted as the selection for target is done ). Put the newly prepared micro sd card in the slot and reboot APC-8750. Once you get the Slackware login prompt, proceed for installation as usual.
Zipfile you download from the site may cause problem when extracting - few files
may be missing!. One option is to use p7zip or other unzip program instead of the
default zip utility in Slackware. You may also get a tar.gz file using
<pre>
wget --no-check-certificate \
    https://github.com/linux-wmt/linux-vtwm/archive/testing.tar.gz
</pre>


Please refer to the link [[config.slackinstall.vga]] for the config file which was used. This method also require a small initramfs image prepared from the boot media available at apc.io library. download it from here : [[initramfs_data.cpio.gz]] or
==== Configuration ====
use the following init scrip with the initrd.gz from apc.io library.


init:
For X Windows, use a lightweight window manager like Fluxbox.
<pre>
        #!/bin/busybox sh
        /bin/busybox mount -t proc /proc
        /bin/busybox mount -t sys /sys
        /bin/busybox echo /sbin/mdev > /proc/sys/kernel/hotplug
        /bin/busybox mdev -s
        /bin/busybox --install
        mkfs.ext2 /dev/ram0
        mkdir /root
        mount /dev/ram0 /root
        cd /root
        mkdir /flash
        mount /dev/mmcblk0p1 /flash
        cpio -id < /flash/initrd-kirkwood.cpio
        exec chroot /root /bin/busybox init
        exec /bin/busybox init
</pre>


Copy the initramfs_data.cpio.gz for to $KERNEL_SRC/usr area.
=== Post installation preparation. ===


===== Details of how initramfs_data.cpio.gz was prepared. =====
After the installation is done, you need to replace the kernel uzImage.bin with a new one, this time with no initramfs_data.cpio.gz, and CONFIG_CMDLINE= changed for booting from partition 2:


<pre>
<pre>CONFIG_CMDLINE=&quot; mem=460M root=/dev/mmcblk0p2 rootwait nonitrd ro console=tty0&quot;
gunzip initrd.gz
CONFIG_CMDLINE_FORCE=y</pre>
mkdir initramfs_data
For this, download one of
mount -o loop initrd initramfs_data


create initramfs_data/init as shown above
* [http://sourceforge.net/projects/slackwareonapc8750/files/boot/vga/uzImage.bin/download uzImage.bin] for console on VGA. Or
* [http://sourceforge.net/projects/slackwareonapc8750/files/boot/ttyWMT0/uzImage.bin/download uzImage.bin] for console on serial port.


chmod a+x initramfs_data/init
and copy over to the first partition ( bootable vfat one ).
sync
(cd initramfs_data ; find . | cpio -o -H newc | gzip  > ../initramfs_data.cpio.gz )


</pre>
Once Slackware is installed, and the new uzImage.bin is copied over,


Please note that the kernel uses a CONFIG_CMDLINE=
<pre>sdc1:
for vga:
    /uzImage.bin
<pre>
    /initrd-kirkwood.cpio  =&gt; not required anymore
CONFIG_CMDLINE=" mem=440M console=tty0 mbtotal=52M"
CONFIG_CMDLINE_FORCE=y
</pre>
for serial:
<pre>
CONFIG_CMDLINE=" mem=440M console=ttyWMT0,115200n8 mbtotal=52M"
CONFIG_CMDLINE_FORCE=y
</pre>
kernel is compiled on the host, using arm-2014.05 from arm.


kernel build procedure:
sdc2:
<pre>
    /bin
export OBJ=/src/apc.io/obj.testing
    /boot
export KERNEL_SRC=/src/apc.io/linux-vtwm-testing
    /cdrom
export PATH=~/apc.io/apc-8750-master/u-boot/tools:$PATH
    /dev/
export PATH=/opt/local/arm/arm-2014.05/bin:$PATH
    /etc/
cp config.slackinst.vga $OBJ/.config
    /home/
cp initramfs_data.cpio.gz $KERNEL_SRC/usr
    /proc/
    /slackware14.1  =&gt; not required anymore
    /usr/
    /var/</pre>
You may remove files which are not required anymore, and free up some space. Once that is done, reboot APC-8750 to get Slackware up and running.


make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j 3
=== Information on building kernel and other images. ===
mv $OBJ/arch/arm/boot/zImage $1/$2/ ;
make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- dtbs
cat $1/$2/zImage $OBJ/arch/arm/boot/dts/wm8750-apc8750.dtb > $1/$2/zImage_w_dtb
mkimage -A arm -O linux -T kernel -C none -a 0x8000 \
    -e 0x8000 -n "My Linux" -d $1/$2/zImage_w_dtb $1/$2/uzImage.bin


</pre>
Please also refer to [http://sourceforge.net/projects/slackwareonapc8750/files/build.sh/download build.sh] script used to help the build procedure.
Preparing the cpio archive:


<pre>
==== Detailed description of how Slackware install kernel was prepared. ====
        download http://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.1/isolinux/uinitrd-kirkwood.img
        dd if=./uinitrd-kirkwood.img bs=64 skip=1 of=initrd-kirkwood.cpio.gz
        gunzip initrd-kirkwood.cpio.gz
</pre>


== Copying Slackware install files onto second partition ==
===== Getting the Kernel source code. =====


Create a slackware14.1 directory in the reiserfs partition of the micro sd card.
I used [https://github.com/linux-wmt/linux-vtwm linux-vtwm-testing]. Zipfile you download from the site may cause problem when extracting on Linux. In my case couple of files were missing. One option is to use p7zip or other unzip program instead of the default zip utility in Slackware. You may also get a tar.gz file using:
Copy Slackware for arm distribution to the slackware14.1 directory, from  http://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.1/


      sdc1:
<pre>wget --no-check-certificate \
                /uzImage.bin
    https://github.com/linux-wmt/linux-vtwm/archive/testing.tar.gz</pre>
                /initrd-kirkwood.cpio
Please refer to the link [http://sourceforge.net/projects/slackwareonapc8750/files/configs/config.slackinst.vga/download config.slackinst.vga] or [http://sourceforge.net/projects/slackwareonapc8750/files/configs/config.slackinst.ttyWMT0/download config.slackinst.ttyWMT0] for the config file which was used.
      sdc2:
                /slackware14.1/


== Booting with the installer and installing Slackware ==
===== Details of how initramfs_data.cpio.gz was prepared. =====


Now you are ready to boot the from the new disk just prepared, and install Slackware from the pre mounted directory under /mnt/slackware14.1/slackware ( which is automounted as the selection for target is done ). Put the newly prepared micro sd card in the slot and reboot apc-8750. Once you get the Slackware login prompt, proceed as usual.
This method also require a small initramfs image prepared from the boot media available at [http://apc.io/library/ apc.io library]. Download it from here [http://sourceforge.net/projects/slackwareonapc8750/files/initramfs_data.cpio.gz/download initramfs_data.cpio.gz]<br />or<br />Use the following init scrip with a stripped down version of initrd.gz in [http://apc.io/media/apc/library/8750/apc-firmware-v1.0.2.zip apc-firmware-v1.0.2] from [http://apc.io/library/ apc.io library].


=== Configuration ===
init:


For X Windows, use a window manager like fluxbox.
<pre>#!/bin/busybox sh
/bin/busybox mount -t proc /proc
/bin/busybox mount -t sys /sys
/bin/busybox echo /sbin/mdev &gt; /proc/sys/kernel/hotplug
/bin/busybox mdev -s
/bin/busybox --install
mkfs.ext2 /dev/ram0
mkdir /root
mount /dev/ram0 /root
cd /root
mkdir /flash
mount /dev/mmcblk0p1 /flash   
cpio -id &lt; /flash/initrd-kirkwood.cpio
umount /flash
exec chroot /root /bin/busybox init
exec /bin/busybox init</pre>
Commands to build initramfs_data.cpio.gz:


== Post installation preparation ==
<pre>gunzip initrd.gz
mkdir initramfs_data
mount -o loop initrd initramfs_data
# create initramfs_data/init as shown above
sh build.sh init
chmod a+x initramfs_data/init
sync
(cd initramfs_data ; find . | cpio -o -H newc | gzip  &gt; ../initramfs_data.cpio.gz )</pre>
Copy [http://sourceforge.net/projects/slackwareonapc8750/files/initramfs_data.cpio.gz/download initramfs_data.cpio.gz] cpio archive to $KERNEL_SRC/usr area.


After the installation is done, you need to replace the kernel uzImage.bin with a new
Please note that the kernel uses a CONFIG_CMDLINE= for VGA:
one, this time with no initramfs_data.cpio.gz, and CONFIG_CMDLINE= changed for bootin from partition 2.


<pre>
<pre>CONFIG_CMDLINE=&quot; mem=440M console=tty0 mbtotal=52M&quot;
CONFIG_CMDLINE=" mem=460M root=/dev/mmcblk0p2 rootwait nonitrd ro console=tty0"
CONFIG_CMDLINE_FORCE=y</pre>
CONFIG_CMDLINE_FORCE=y
for serial:
</pre>


For this, download uzImage.bin from here, and copy over
<pre>CONFIG_CMDLINE=&quot; mem=440M console=ttyWMT0,115200n8 mbtotal=52M&quot;
to the first partition ( bootable vfat one ). Once that is done reboot the machine once again, to get Slackware going!
CONFIG_CMDLINE_FORCE=y</pre>
kernel is compiled on the host, using a cross compiler [http://www.elinux.org/ARMCompilers Sourcery CodeBench Lite 2014.05-28] for [http://www.arm.com/ arm]. For mkimage tool refer to [http://github.com/apc-io/apc-8750 Kernel and Bootloader] link at apc-io page at github.


=== Procedure used for preparing the Slackware boot kernel ===
===== kernel build procedure: =====


Please refer to the link [[config.slackboot.vga]] for the config file which was used.
<pre>export OBJ=/src/apc.io/obj.testing
<pre>
export OBJ=/src/apc.io/obj.testing
export KERNEL_SRC=/src/apc.io/linux-vtwm-testing
export KERNEL_SRC=/src/apc.io/linux-vtwm-testing
export PATH=~/apc.io/apc-8750-master/u-boot/tools:$PATH
export PATH=~/apc.io/apc-8750-master/u-boot/tools:$PATH
export PATH=/opt/local/arm/arm-2014.05/bin:$PATH
export PATH=/opt/local/arm/arm-2014.05/bin:$PATH
cp config.slackboot.vga $OBJ/.config
cp config.slackinst.vga $OBJ/.config
rm $KERNEL_SRC/usr/initramfs_data.cpio.g
cp initramfs_data.cpio.gz $KERNEL_SRC/usr


make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j 3
make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j 3
mv $OBJ/arch/arm/boot/zImage $1/$2/ ;
mv $OBJ/arch/arm/boot/zImage $1/$2/ ;
make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- dtbs
make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- dtbs
cat $1/$2/zImage $OBJ/arch/arm/boot/dts/wm8750-apc8750.dtb > $1/$2/zImage_w_dtb
cat $1/$2/zImage $OBJ/arch/arm/boot/dts/wm8750-apc8750.dtb &gt; $1/$2/zImage_w_dtb
mkimage -A arm -O linux -T kernel -C none -a 0x8000 \
mkimage -A arm -O linux -T kernel -C none -a 0x8000 \
    -e 0x8000 -n "My Linux" -d $1/$2/zImage_w_dtb $1/$2/uzImage.bin
      -e 0x8000 -n &quot;My Linux&quot; -d $1/$2/zImage_w_dtb $1/$2/uzImage.bin</pre>
===== Preparing the cpio archive: =====


</pre>
<pre>wget -c http://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.1/isolinux/uinitrd-kirkwood.img 
dd if=./uinitrd-kirkwood.img bs=64 skip=1 of=initrd-kirkwood.cpio.gz 
gunzip initrd-kirkwood.cpio.gz  </pre>
==== Procedure used for preparing the Slackware boot kernel. ====


Once Slackware is installed, and the new uzImage.bin is copied over
Please refer to the link [http://sourceforge.net/projects/slackwareonapc8750/files/configs/config.slackboot.vga/download config.slackboot.vga] or [http://sourceforge.net/projects/slackwareonapc8750/files/configs/config.slackboot.ttyWMT0/download config.slackboot.ttyWMT0] for the config file which was used. Download and copy this file as .config in $OBJ area before starting the build


    sdc1:
===== Kernel build procedure: =====
              /uzImage.bin
              /initrd-kirkwood.cpio  => not required anymore


    sdc2:
<pre>export OBJ=/src/apc.io/obj.testing
export KERNEL_SRC=/src/apc.io/linux-vtwm-testing
export PATH=~/apc.io/apc-8750-master/u-boot/tools:$PATH
export PATH=/opt/local/arm/arm-2014.05/bin:$PATH
cp config.slackboot.vga $OBJ/.config
rm $KERNEL_SRC/usr/initramfs_data.cpio.g


              /bin
make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j 3
              /boot
mv $OBJ/arch/arm/boot/zImage $1/$2/ ;
              /cdrom
make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- dtbs
              /dev/
cat $1/$2/zImage $OBJ/arch/arm/boot/dts/wm8750-apc8750.dtb &gt; $1/$2/zImage_w_dtb
              /etc/
mkimage -A arm -O linux -T kernel -C none -a 0x8000 \
              /home/
  -e 0x8000 -n &quot;My Linux&quot; -d $1/$2/zImage_w_dtb $1/$2/uzImage.bin</pre>
              /proc/
=== Additional info ===
              /slackware14.1 => not required anymore
From Slackware-14.1 boot messages:
              /usr/
              /var/
 
You may remove files which are not required anymore, and free up some space. Once that is done, reboot apc-8750.  
== links ==
 
http://apc.io/products/8750a/


http://apc.io/library/
<pre>Linux version 3.13.0-rc8 (ahoh@tampa) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-28) ) #23 Mon Aug 4 07 :40:48 IST 2014
Kernel command line:  mem=460M root=/dev/mmcblk0p2 rootwait nonitrd ro console=tty0</pre>


https://github.com/linux-wmt/linux-vtwm
From original boot messages on ttyS0:


http://arm.slackware.com/getslack/
<pre>Linux version 2.6.32.9-default (root@Ryan-VM-Ubuntu) (gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41) ) #1 Wed Dec 5 19:29:52 CST 2012
Kernel command line: mem=460M root=/dev/mtdblock11 noinitrd rootfstype=yaffs2 rw console=ttyS0,115200n8 mbtotal=52M init=/init
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387f
...
Memory: 460MB = 460MB total
Memory: 460288KB available (5188K code, 1069K data, 136K init, 0K highmem)
...
Creating 6 MTD partitions on &quot;mtdsf device&quot;:
0x000000000000-0x000000d00000 : &quot;filesystem-SF&quot;
0x000000d00000-0x000000f80000 : &quot;kernel-SF&quot;
0x000000f80000-0x000000fd0000 : &quot;u-boot-SF&quot;
0x000000fd0000-0x000000fe0000 : &quot;u-boot env. cfg. 1-SF&quot;
0x000000fe0000-0x000000ff0000 : &quot;u-boot env. cfg. 2-SF&quot;
0x000000ff0000-0x000001000000 : &quot;w-load-SF&quot;
wmt sf controller initial ok


http://ftp.arm.slackware.com/slackwarearm/
...


https://github.com/gv1/apc8750
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd59476 (Samsung K9GAG08U0F)
Bad block at 16
Bad block at 17
Bad block at 89
Bad block at 613
Bad block at 880
Bad block at 1583
WMT_nand: uboot no dynamic partitions defined, use default static
Creating 11 MTD partitions on &quot;WMT.nand&quot;:
0x000000000000-0x000000100000 : &quot;w-load-NAND&quot;
0x000000100000-0x000000a00000 : &quot;u-boot env. cfg. 1-NAND&quot;
0x000000a00000-0x000001300000 : &quot;u-boot-NAND&quot;
0x000001300000-0x000001b00000 : &quot;kernel-NAND&quot;
0x000001b00000-0x000002100000 : &quot;initrd-NAND&quot;
0x000002100000-0x000012100000 : &quot;filesystem-NAND&quot;
0x000012100000-0x000012300000 : &quot;u-boot-logo&quot;
0x000012300000-0x000012700000 : &quot;kernel-logo&quot;
0x000012700000-0x000052700000 : &quot;android-data&quot;
0x000052700000-0x00005a700000 : &quot;android-cache&quot;
0x00005a700000-0x000080000000 : &quot;LocalDisk&quot;
nand initialised ok
...
VIA Networking Velocity Family Gigabit Ethernet Adapter Driver Ver. 1.14
...
eth0: VIA Networking Velocity Family Gigabit Ethernet Adapter
...
WMT_SOC: dai_name=i2s, codec_name=vt1603
WMT_SOC: single, wmt_i2s_rate=44100
...
VT1603 Audio Codec 0.10
wmt.audio.i2s = vt1603:f2:f2:f1:f1:100
...</pre>

Latest revision as of 06:33, 9 August 2014

Installing Slackware on APC-8750

APC 8750
Another photograph of APC 8750

Project Area

wiki @ sourceforge Check this for latest updates

helper scripts / helper scripts

Mainline Linux kernel lacks support for Wondermedia WM 8750 currently. However linux-vtwm-testing kernel available at github has support for Wondermedia 8750 SOC. Since the kernel failed to load initrd cpio archive the normal way, a special method was used for loading the Slackware setup image. ( Installer Kernel booting from embedded initramfs image creates a filesystem on ramdisk, extracts Slackware setup initrd image and chroots to the filesystem on ramdisk ). Briefly, the steps followed in installing Slackware on APC 8750 are :

  1. Installing Slackware.
    1. Prepare boot media: Create three partitions, first bootable vfat, second reiserfs and third Linux swap.
    2. Copy installer boot files: Download and copy uzImage.bin and initrd-kirkwood.cpio to first vfat partition.
    3. Download and copy Slackware installation files over to second partition.
    4. Boot from the micro sd card prepared, install, and configure Slackware.
  2. Making new installtion bootable.
    1. Download and replace the installer kernel with new uzImage.bin for booting from second partition.
    2. Reboot.

Creating a bootable micro sd card for installation

For this you need a custom built kernel and a initramfs image from Slackware for arm distribution - uinitrd-kirkwood.img.

  • uzImage.bin for console on VGA monitor.
    If this kernel is chosen boot messages will appear on VGA monitor. or
  • uzImage.bin for console on serial port.
    If this kernel is chosen boot messages will appear on the serial port.
  • initrd-kirkwood.cpio.gz initramfs cpio archive.
    Download and gunzip this image file.
  • Download Slackware 14.1 for arm.
    If you prefer, you may download this to micro sd card directly, under slackware14.1 directory.

Download and keep these ready.

Preparing the micro sd card.

You need at least three partitions, one vfat, one or more Linux partitions, and a Linux swap partition for this method of installation. Here is how the partitions I used look like under fdisk ran on host.

Disk /dev/sdc: 15.9 GB, 15931539456 bytes
64 heads, 32 sectors/track, 15193 cylinders, total 31116288 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048      206847      102400    c  W95 FAT32 (LBA)
/dev/sdc2          206848    28878847    14336000   83  Linux
/dev/sdc3        28878848    31116287     1118720   82  Linux swap

Creating filesystems.

  • 1st partition - make it bootable, and create a file system using mkfs.vfat
  • 2nd partition - create a reiserfs file system using mkreiserfs ( or other tools for other types )

Copying Slackware install files onto second partition.

Create a slackware14.1 directory in the reiserfs partition of the micro sd card. Copy Slackware for arm distribution to the slackware14.1 directory, from http://arm.slackware.com/getslack/. Once the preparation is over,

sdc1: 
    /uzImage.bin  
    /initrd-kirkwood.cpio

sdc2:
    /slackware14.1/

Booting with the installer and installing Slackware.

Now you are ready to boot from the new disk just prepared, and install Slackware from the pre mounted directory under /mnt/slackware14.1/slackware ( which is automounted as the selection for target is done ). Put the newly prepared micro sd card in the slot and reboot APC-8750. Once you get the Slackware login prompt, proceed for installation as usual.

Configuration

For X Windows, use a lightweight window manager like Fluxbox.

Post installation preparation.

After the installation is done, you need to replace the kernel uzImage.bin with a new one, this time with no initramfs_data.cpio.gz, and CONFIG_CMDLINE= changed for booting from partition 2:

CONFIG_CMDLINE=" mem=460M root=/dev/mmcblk0p2 rootwait nonitrd ro console=tty0"
CONFIG_CMDLINE_FORCE=y

For this, download one of

and copy over to the first partition ( bootable vfat one ).

Once Slackware is installed, and the new uzImage.bin is copied over,

sdc1:
    /uzImage.bin
    /initrd-kirkwood.cpio  => not required anymore

sdc2:
    /bin
    /boot
    /cdrom
    /dev/
    /etc/
    /home/
    /proc/
    /slackware14.1  => not required anymore
    /usr/
    /var/

You may remove files which are not required anymore, and free up some space. Once that is done, reboot APC-8750 to get Slackware up and running.

Information on building kernel and other images.

Please also refer to build.sh script used to help the build procedure.

Detailed description of how Slackware install kernel was prepared.

Getting the Kernel source code.

I used linux-vtwm-testing. Zipfile you download from the site may cause problem when extracting on Linux. In my case couple of files were missing. One option is to use p7zip or other unzip program instead of the default zip utility in Slackware. You may also get a tar.gz file using:

wget --no-check-certificate \
    https://github.com/linux-wmt/linux-vtwm/archive/testing.tar.gz

Please refer to the link config.slackinst.vga or config.slackinst.ttyWMT0 for the config file which was used.

Details of how initramfs_data.cpio.gz was prepared.

This method also require a small initramfs image prepared from the boot media available at apc.io library. Download it from here initramfs_data.cpio.gz
or
Use the following init scrip with a stripped down version of initrd.gz in apc-firmware-v1.0.2 from apc.io library.

init:

#!/bin/busybox sh
/bin/busybox mount -t proc /proc
/bin/busybox mount -t sys /sys
/bin/busybox echo /sbin/mdev > /proc/sys/kernel/hotplug
/bin/busybox mdev -s
/bin/busybox --install
mkfs.ext2 /dev/ram0
mkdir /root
mount /dev/ram0 /root
cd /root
mkdir /flash
mount /dev/mmcblk0p1 /flash     
cpio -id < /flash/initrd-kirkwood.cpio
umount /flash
exec chroot /root /bin/busybox init
exec /bin/busybox init

Commands to build initramfs_data.cpio.gz:

gunzip initrd.gz
mkdir initramfs_data
mount -o loop initrd initramfs_data
# create initramfs_data/init as shown above
sh build.sh init
chmod a+x initramfs_data/init
sync
(cd initramfs_data ; find . | cpio -o -H newc | gzip  > ../initramfs_data.cpio.gz )

Copy initramfs_data.cpio.gz cpio archive to $KERNEL_SRC/usr area.

Please note that the kernel uses a CONFIG_CMDLINE= for VGA:

CONFIG_CMDLINE=" mem=440M console=tty0 mbtotal=52M"
CONFIG_CMDLINE_FORCE=y

for serial:

CONFIG_CMDLINE=" mem=440M console=ttyWMT0,115200n8 mbtotal=52M"
CONFIG_CMDLINE_FORCE=y

kernel is compiled on the host, using a cross compiler Sourcery CodeBench Lite 2014.05-28 for arm. For mkimage tool refer to Kernel and Bootloader link at apc-io page at github.

kernel build procedure:
export OBJ=/src/apc.io/obj.testing
export KERNEL_SRC=/src/apc.io/linux-vtwm-testing
export PATH=~/apc.io/apc-8750-master/u-boot/tools:$PATH
export PATH=/opt/local/arm/arm-2014.05/bin:$PATH
cp config.slackinst.vga $OBJ/.config
cp initramfs_data.cpio.gz $KERNEL_SRC/usr

make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j 3
mv $OBJ/arch/arm/boot/zImage $1/$2/ ;
make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- dtbs
cat $1/$2/zImage $OBJ/arch/arm/boot/dts/wm8750-apc8750.dtb > $1/$2/zImage_w_dtb
mkimage -A arm -O linux -T kernel -C none -a 0x8000 \
       -e 0x8000 -n "My Linux" -d $1/$2/zImage_w_dtb $1/$2/uzImage.bin
Preparing the cpio archive:
wget -c http://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.1/isolinux/uinitrd-kirkwood.img  
dd if=./uinitrd-kirkwood.img bs=64 skip=1 of=initrd-kirkwood.cpio.gz  
gunzip initrd-kirkwood.cpio.gz  

Procedure used for preparing the Slackware boot kernel.

Please refer to the link config.slackboot.vga or config.slackboot.ttyWMT0 for the config file which was used. Download and copy this file as .config in $OBJ area before starting the build

Kernel build procedure:
export OBJ=/src/apc.io/obj.testing
export KERNEL_SRC=/src/apc.io/linux-vtwm-testing
export PATH=~/apc.io/apc-8750-master/u-boot/tools:$PATH
export PATH=/opt/local/arm/arm-2014.05/bin:$PATH
cp config.slackboot.vga $OBJ/.config
rm $KERNEL_SRC/usr/initramfs_data.cpio.g

make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j 3
mv $OBJ/arch/arm/boot/zImage $1/$2/ ;
make -C $KERNEL_SRC O=$OBJ ARCH=arm CROSS_COMPILE=arm-none-eabi- dtbs
cat $1/$2/zImage $OBJ/arch/arm/boot/dts/wm8750-apc8750.dtb > $1/$2/zImage_w_dtb
mkimage -A arm -O linux -T kernel -C none -a 0x8000 \
  -e 0x8000 -n "My Linux" -d $1/$2/zImage_w_dtb $1/$2/uzImage.bin

Additional info

From Slackware-14.1 boot messages:

Linux version 3.13.0-rc8 (ahoh@tampa) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-28) ) #23 Mon Aug 4 07 :40:48 IST 2014 
Kernel command line:  mem=460M root=/dev/mmcblk0p2 rootwait nonitrd ro console=tty0

From original boot messages on ttyS0:

Linux version 2.6.32.9-default (root@Ryan-VM-Ubuntu) (gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41) ) #1 Wed Dec 5 19:29:52 CST 2012
Kernel command line: mem=460M root=/dev/mtdblock11 noinitrd rootfstype=yaffs2 rw console=ttyS0,115200n8 mbtotal=52M init=/init
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387f
...
Memory: 460MB = 460MB total
Memory: 460288KB available (5188K code, 1069K data, 136K init, 0K highmem)
...
Creating 6 MTD partitions on "mtdsf device":
0x000000000000-0x000000d00000 : "filesystem-SF"
0x000000d00000-0x000000f80000 : "kernel-SF"
0x000000f80000-0x000000fd0000 : "u-boot-SF"
0x000000fd0000-0x000000fe0000 : "u-boot env. cfg. 1-SF"
0x000000fe0000-0x000000ff0000 : "u-boot env. cfg. 2-SF"
0x000000ff0000-0x000001000000 : "w-load-SF"
wmt sf controller initial ok

...

NAND device: Manufacturer ID: 0xec, Chip ID: 0xd59476 (Samsung K9GAG08U0F)
Bad block at 16
Bad block at 17
Bad block at 89
Bad block at 613
Bad block at 880
Bad block at 1583
WMT_nand: uboot no dynamic partitions defined, use default static
Creating 11 MTD partitions on "WMT.nand":
0x000000000000-0x000000100000 : "w-load-NAND"
0x000000100000-0x000000a00000 : "u-boot env. cfg. 1-NAND"
0x000000a00000-0x000001300000 : "u-boot-NAND"
0x000001300000-0x000001b00000 : "kernel-NAND"
0x000001b00000-0x000002100000 : "initrd-NAND"
0x000002100000-0x000012100000 : "filesystem-NAND"
0x000012100000-0x000012300000 : "u-boot-logo"
0x000012300000-0x000012700000 : "kernel-logo"
0x000012700000-0x000052700000 : "android-data"
0x000052700000-0x00005a700000 : "android-cache"
0x00005a700000-0x000080000000 : "LocalDisk"
nand initialised ok
...
VIA Networking Velocity Family Gigabit Ethernet Adapter Driver Ver. 1.14
...
eth0: VIA Networking Velocity Family Gigabit Ethernet Adapter
...
WMT_SOC: dai_name=i2s, codec_name=vt1603
WMT_SOC: single, wmt_i2s_rate=44100
...
VT1603 Audio Codec 0.10
wmt.audio.i2s = vt1603:f2:f2:f1:f1:100
...