Apc8750: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
mNo edit summary
Line 199: Line 199:
   -e 0x8000 -n &quot;My Linux&quot; -d $1/$2/zImage_w_dtb $1/$2/uzImage.bin</pre>
   -e 0x8000 -n &quot;My Linux&quot; -d $1/$2/zImage_w_dtb $1/$2/uzImage.bin</pre>
=== Additional info ===
=== Additional info ===
From Slackware-14.1 boot messages:
<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>


From original boot messages on ttyS0:
From original boot messages on ttyS0:


<pre>Kernel command line: mem=460M root=/dev/mtdblock11 noinitrd rootfstype=yaffs2 rw console=ttyS0,115200n8 mbtotal=52M init=/init
<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
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
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387f
...
...

Revision as of 08:22, 7 August 2014

Installing Slackware on APC-8750

APC 8750
Another photograph of APC 8750

Project Area

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