Apc8750: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
No edit summary
Line 224: Line 224:


http://ftp.arm.slackware.com/slackwarearm/
http://ftp.arm.slackware.com/slackwarearm/
https://github.com/gv1/apc8750

Revision as of 18:21, 3 August 2014

Installing Slackware on apc-8750

Mainline linux kernel lacks support for Wondermedia 8750 currently. 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.
  • Download and copy uzImage.bin and initrd-kirkwood.cpio to first vfat partition
  • Download and copy Slackware installation files over to second partition
  • 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

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

            * uzImage.bin
                  Detailed description of how uzImage.bin was prepared.
            * initrd-kirkwood.cpio
                  Detailed description of how initrd-kirkwood.cpio was prepared.

Download and keep these files 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 filesystem:

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

Detailed description of how Slackware install kernel was prepared.

I used linux-vtwm-testing available at https://github.com/linux-wmt/linux-vtwm 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

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

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 use the following init scrip with the initrd.gz 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
        exec chroot /root /bin/busybox init
        exec /bin/busybox init

Copy the initramfs_data.cpio.gz for to $KERNEL_SRC/usr area.

Details of how initramfs_data.cpio.gz was prepared.
gunzip initrd.gz
mkdir initramfs_data
mount -o loop initrd initramfs_data

create initramfs_data/init as shown above

chmod a+x initramfs_data/init
sync
(cd initramfs_data ; find . | cpio -o -H newc | gzip  > ../initramfs_data.cpio.gz )

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 arm-2014.05 from arm.

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:

        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

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://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.1/

     sdc1:
               /uzImage.bin
               /initrd-kirkwood.cpio
     sdc2:
               /slackware14.1/

Booting with the installer and installing Slackware

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.

Configuration

For X Windows, use a 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 bootin from partition 2.

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

For this, download uzImage.bin from here, and copy over to the first partition ( bootable vfat one ). Once that is done reboot the machine once again, to get Slackware going!

Procedure used for preparing the Slackware boot kernel

Please refer to the link config.slackboot.vga for the config file which was used.

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

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.

links

http://apc.io/products/8750a/

http://apc.io/library/

https://github.com/linux-wmt/linux-vtwm

http://arm.slackware.com/getslack/

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

https://github.com/gv1/apc8750