Compiling Yantrr Vayu Drivers on Debian Wheezy

From Yantrr Wiki
Revision as of 13:22, 24 February 2014 by Admin (Talk | contribs) (Root file system (~/))

Jump to: navigation, search

Note : All steps are executed on a Ubuntu System and as a root user. We used Ubuntu 12.04 LTS. Most of the steps are exactly same as described in the BBB-RobertCNelson-Main Wiki.

Basic Requirements

ARM cross compiler linaro gcc (~/)

Download and extract the ARM Cross compiler linaro gcc . Supposedly we mark that directory as root (~/)

wget -c https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz
tar xJf gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz
export CC='pwd'/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-

Test the version of the gcc path set above to verify it will work

${CC}gcc –version
arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.8-2013.10 - Linaro GCC 2013.10) 4.8.2 20131014 (prerelease)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

if the above test fails, verify that you have 32bit libraries installed on your development system , and execute following :

 apt-get install lbs
 apt-get install ia32-libs

Bootloader U-boot (~/)

Bootloader used is Das U-Boot, and its works like charm. Das U-Boot -- the Universal Boot Loader http://www.denx.de/wiki/U-Boot

Download:

~/
git clone git://git.denx.de/u-boot.git
cd u-boot/
git checkout v2013.10 -b tmp

Patches: After cloning git takes you to the u-boot directory of the working directory, else go to the u-boot directory

~/u-boot
wget https://raw.github.com/eewiki/u-boot-patches/master/v2013.10/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch

Configure and Build:

~/u-boot
make ARCH=arm CROSS_COMPILE=${CC} distclean
make ARCH=arm CROSS_COMPILE=${CC} am335x_evm_config
make ARCH=arm CROSS_COMPILE=${CC}

Upgrade distro "device-tree-compiler" package

 (~/) {In the working directory}
wget -c https://raw.github.com/RobertCNelson/tools/master/pkgs/dtc.sh
chmod +x dtc.sh
./dtc.sh

Linux kernel (~/)

We follow RobertCNelson branch of the kernel. For more details, please go to BBB-RobertCNelson-Main Wiki

Git setup and Kernel Compile

git clone git://github.com/RobertCNelson/linux-dev.git
cd linux-dev/

checkout v3.8.xbranch (full cape support) There are other versions,check here BBB-RobertCNelson-Main Wiki

git checkout origin/am335x-v3.8 -b eewiki

Now setup the git and compile the kernel

apt-get update
apt-get install device-tree-compiler lzma lzop u-boot-tools libncurses5-dev
git config --global user.name "username"
git config --global user.email "useremailid"
./build_kernel.sh

Add USB and PPS driver

While compiling for first time, LINUX_GIT is set by default(check its path in build_kernel.sh and /tools/rebuild.sh). Set it to 'pwd'/linux-dev/ignore/linux-src/ in build_kernel.sh and /tools/rebuild.sh, so use following for later use:

export LINUX_GIT='pwd'/linux-dev/ignore/linux-src/

Please download our USB drivers patch which is required to use the WCDMA modem on Cape.

wget wcdma_patch_vayu_usb_drivers.patch
patch -p1 < wcdma_patch_vayu_usb_drivers.patch

Rebuild kernel

Now rebuild the kernel while enabling the pps drivers in makemenuconfig and after USB drivers patch applied.

./tools/rebuild.sh
  • Following figures illustrate how to enable the PPS drivers and also some settings in USB drivers section
  • First image shows the first screen of makemenuconfig while recompiling the kernel. Select Device drivers .
Select device drivers
  • In the device drivers window, scroll down to select PPS support.
Select PPS support
  • In PPS support, select PPS client using GPIO as built-in driver. It should look like as illustrated in figure below :
Select PPS client using GPIO
  • Exit PPS Support and select USB support and ensure that EHCI HCD (USB2.0) support is enabled. Please match other options too from the figure illustrated below :
USB Support


At the end of compilation , copy and paste the line with kernel_version, which is as follows

export kernel_version=3.X.Y-Z          ( in our case 3.8.13-bone32)

Root file system (~/)

Download and extract the minimal root file system for debian wheezy :

wget -c https://rcn-ee.net//deb/minfs/wheezy/debian-7.3-minimal-armhf-2013-12-18.tar.xz
md5sum debian-7.3-minimal-armhf-2013-12-18.tar.xz
tar xf debian-7.3-minimal-armhf-2013-12-18.tar.xz

Setup MicroSD card (as root)

Attach a microSD card of size atleast 2GB to the desktop with the help of a card reader.

Use lsblk to determine device id of sd card , it is either /dev/mmcblkx or /dev/sdx , so supposedly :

export DISK=/dev/mmcblk0
dd if=/dev/zero of=${DISK} bs=1M
sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__
1,48,0xE,*
,,,-
__EOF__
dd if=/dev/zero of=${DISK} bs=512 count=1

Format partitions, for DISK=/dev/mmcblk0

mkfs.vfat -F 16 ${DISK}p1 -n boot
mkfs.ext4 ${DISK}p2 -L rootfs

Or for DISK=/dev/sdX

mkfs.vfat -F 16 ${DISK}1 -n boot
mkfs.ext4 ${DISK}2 -L rootfs

After formatting, mount the partitions. Mount paths may vary, sometimes they are auto mounted, otherwise do following

mkdir -p /media/boot/
mkdir -p /media/rootfs/
mount ${DISK}p1 /media/boot/        or mount ${DISK}1 /media/boot/
mount ${DISK}p2 /media/rootfs/      or mount ${DISK}2 /media/rootfs/
  1. install bootloader (~/)

cp -v ./u-boot/MLO /media/boo t/ cp -v ./u-boot/u-boot.img /media/boot/

  1. Create “uEnv.txt” boot script and copy following in it: (nano uEnv.txt)
  2. u-boot eMMC specific overrides; Angstrom Distribution (BeagleBone Black) 2013-06-20

kernel_file=zImage initrd_file=uInitrd

loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${kernel_file} loadinitrd=load mmc ${mmcdev}:${mmcpart} 0x81000000 ${initrd_file}; setenv initrd_size ${filesize} loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /dtbs/${fdtfile}

console=ttyO0,115200n8 mmcroot=/dev/mmcblk0p2 rw mmcrootfstype=ext4 rootwait fixrtc

    1. To disable HDMI/eMMC...
  1. optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G
    1. 3.1MP Camera Cape
  1. optargs=capemgr.disable_partno=BB-BONE-EMMC-2G

mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}

  1. zImage:

uenvcmd=run loadzimage; run loadfdt; run mmcargs; bootz ${loadaddr} - ${fdtaddr}

  1. zImage + uInitrd: where uInitrd has to be generated on the running system.
  2. boot_fdt=run loadzimage; run loadinitrd; run loadfdt
  3. uenvcmd=run boot_fdt; run mmcargs; bootz ${loadaddr} 0x81000000:${initrd_size} ${fdtaddr}

cp -v ./uEnv.txt /media/boot/

  1. Install Kernel and root file system
  2. copy root file system (~/)

tar xfvp ./*-*-*-armhf-*/armhf-rootfs-*.tar -C /media/rootfs/

  1. copy kernel files

cp -v ./linux-dev/deploy/${kernel_version}.zImage /media/boot/zImage mkdir -p /media/boot/dtbs/ tar xfov ./linux-dev/deploy/${kernel_version}-dtbs.tar.gz -C /media/boot/dtbs/ tar xfv ./linux-dev/deploy/${kernel_version}-firmware.tar.gz -C /media/rootfs/lib/firmware tar xfv ./linux-dev/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/

  1. file systems table, edit /etc/fstab

nano /media/rootfs/etc/fstab

  1. and copy following

/dev/mmcblk0p2 / auto errors=remount-ro 0 1 /dev/mmcblk0p1 /boot/uboot auto defaults 0 2

  1. networking , edit /etc/network/interfaces

nano /media/rootfs/etc/network/interfaces

  1. and copy following

auto lo iface lo inet loopback auto eth0

  1. iface eth0 inet dhcp

iface eth0 inet static

   address 192.168.1.150
   netmask 255.255.255.0
   network 192.168.1.0
   gateway 192.168.1.1
  1. networking: using a shared sd card with multiple beaglebone

nano /media/rootfs/etc/udev/rules.d/70-persistent-net.rules

  1. and copy following
  2. BeagleBone: net device ()

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

  1. for enabling serial login to system

nano /media/rootfs/etc/inittab

  1. and copy following at the end of inittab

T0:23:respawn:/sbin/getty -L ttyO0 115200 vt102

  1. Remove microsd card

sync umount /media/boot/ umount /media/rootfs/

  1. Extras
  2. usb gadget (http access to beaglebone black over usb)
  3. run beaglebone black with the created sd card and then do the following in it over eth0 ssh

apt-get install udhcpd

  1. and edit the file at /etc/default/udhcpd for enabling udhcpd
  2. and edit /etc/network/interfaces to add following at the end
  3. Ethernet/RNDIS gadget (g_ether)
  4. ... or on host side, usbnet and random hwaddr

iface usb0 inet static

   address 192.168.7.2
   netmask 255.255.255.0
   network 192.168.7.0
   gateway 192.168.7.1
  1. and use the following temp script

wget -c https://raw.github.com/RobertCNelson/tools/master/scripts/beaglebone-black-g-ether-load.sh chmod +x beaglebone-black-g-ether-load.sh sudo ./beaglebone-black-g-ether-load.sh

  1. to enable/disable HDMI or eMMC or LCD
  2. edit the uEnv.txt and comment/uncomment the line corresponding to this appropriately
  1. to boot from eMMC
  2. we have to boot with an init filesystem so edit the uEnv.txt and comment out zImage commands and uncomment zImage+uInitrd boot commands.
  3. then use scripts to copy microSD to eMMC

wget -c https://raw.github.com/RobetCNelson/tools/master/scripts/beaglebone-black-copy-microSD-to-eMMC.sh chmod +x beaglebone-black-copy-microSD-to-eMMC.sh sudo ./beaglebone-black-copy-microSD-to-eMMC.sh

  1. script to just update the boot partition of the eMMC

wget -c https://raw.github.com/RobertCNelson/tools/master/scripts/beaglebone-black-just-copy-boot-to-eMMC.sh chmod +x beaglebone-black-just-copy-boot-to-eMMC.sh sudo ./beaglebone-black-just-copy-boot-to-eMMC.sh

  1. other scripts are also there, they can be found here :

https://raw.github.com/RobertCNelson/tools/master/scripts/

  1. Note : These steps are publicly available here : http://eewiki.net/display/linuxonarm/BeagleBone+Black

Please check the above link for any updates.