## meta-kas-pcmm2g
Yocto Layer to build a Linux/Xenomai4-based system to run on Kollmorgen's PCMM2G controller.

## Dependencies:
  meta-raspberrypi layer
  meta-openembedded layer
  meta-swupdate layer

## What's in distro:
- Kernel
  - Xenomai
  - Xenomai EVL library
- HW Support
  - USB
  - eth0 - Configured for EtherCAT communications
  - eth1 - Ethernet switch
  - i2C  - Rotary Switch, 7-seg LED
  - GPIO - Onboard I/O
- Users
  - root (login not allowed)
  - admin (password: pcmm2g)
- Distro extras over core-image-cmdline-full
  - systemd
  - gdb
  - gdbserver

## Build Steps

1. Create a directory for the sources. For these instructions, we'll use the directory /yocto.

2. Get the bitbake sources.
	If a zip file, then unzip the zip file into /yocto. If not, you can use the repo to get the sources.
	**The steps below marked with 4 carats (^^^^) are to be applied only when building from the ZIP file.**

3. Configure meta-kas as a safe directory for git:
	```
	git config --global --add safe.directory /yocto/layers/meta-kas
	```

4. ^^^^ Edit /yocto/layers/meta-kas/conf/layer.conf and comment out these lines:
	```
	require conf/get_manifest_sha.py.inc
	MANIFEST_SHA = "${@get_manifest_sha(d)}"
	```

5. ^^^^ Edit /yocto/layers/meta-kas/recipes-core/images/kas-image-common.inc and replace the following lines that call git:
	```
    # GIT_COMMIT_COUNT=`git -C ${GIT_SRC_DIR} rev-list HEAD | wc -l`
    GIT_COMMIT_COUNT=000000

    # GIT_COMMIT_HASH=`git -C ${GIT_SRC_DIR} rev-parse HEAD`
    GIT_COMMIT_HASH=None

    GIT_MODIFIED_BY=""
    # git -C ${GIT_SRC_DIR} diff --quiet || GIT_MODIFIED_BY=`git -C ${GIT_SRC_DIR} config user.name`
	```

6. Set bitbake environment:
	```
	. setup-environment build
	```

7. ^^^^ Edit /yocto/build/local.conf and make the following changes:
	INSTALL_KAS_RUNTIME = "0"

8. Run bitbake:
	```
	bitbake kas-image
        bitbake kas-image-usb
	```

