Migrate the build from the Google repo manifest to kas

Replace the repo + default.xml + setup-environment workflow with kas:

- add kas/forgefirm-glowforge.yml (Scarthgap layers pinned, meta-openglow
  as a local sibling) and kas/README.md
- remove default.xml, base/conf/forgefirm-bblayers.conf,
  scripts/setup-environment
- .gitignore the kas-managed layers/ and build caches
- BUILD.md: kas host setup and build instructions
This commit is contained in:
ScottW514
2026-06-19 10:33:45 -04:00
parent 624f5ea11b
commit 90384350b3
7 changed files with 384 additions and 370 deletions
+10
View File
@@ -0,0 +1,10 @@
# kas-managed upstream layer checkouts (poky, meta-openembedded, meta-freescale...)
/layers/
# Yocto build output (incl. deploy/images) and caches
/build/
/downloads/
/sstate-cache/
# kas
*.lock.yml.bak
+76 -51
View File
@@ -1,51 +1,76 @@
# Build # Build
Instructions are for a Linux environment supported by Yocto.
ForgeFIRM is built with [**kas**](https://kas.readthedocs.io/), which manages
To get the build OpenGlow/ForgeFIRM you need to have `repo` installed: the Yocto layers and pins their versions. This replaces the old Google `repo`
+ `default.xml` workflow. The **forgefirm** repo is the base of the build.
## Install the `repo` utility:
Builds run on a Linux host, or on **WSL2** (officially supported by Yocto —
```console keep the tree on the native ext4 filesystem, not `/mnt/c`).
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo ## Host setup
chmod a+x ~/bin/repo
PATH=${PATH}:~/bin On Ubuntu/Debian (including WSL2), install the Yocto host packages and kas:
```
Add the following to the end of ```~/.bashrc``` to permanently add ```repo``` to your path: ```console
```console sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc build-essential \
export PATH=~/bin:$PATH chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \
``` iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file \
## Download the BSP source: locales libacl1 lz4 rsync
sudo locale-gen en_US.UTF-8
```console pipx install kas # use pipx — Ubuntu 24.04 (PEP 668) blocks `pip install --user`
mkdir forgefirm ```
cd forgefirm
repo init -u https://github.com/ScottW514/forgefirm.git -b master -m default.xml For other distros, see the
repo sync [Yocto Project Quick Build](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html).
``` Do not build as root (the Yocto sanity checks refuse it).
At the end of the commands you have all meta packages you need to build the basic firmware images. ## Get the sources
## Build the OpenGlow/ForgeFIRM image for factory control boards Clone the repos as siblings (the kas config references `meta-openglow` at
First time environment setup: `../meta-openglow` while it is under active Scarthgap migration):
```console
(in forgefirm directory) ```console
MACHINE=glowforge DISTRO=forgefirm . setup-environment build git clone https://github.com/ScottW514/forgefirm.git
bitbake forgefirm-image git clone https://github.com/ScottW514/meta-openglow.git
``` git clone https://github.com/ScottW514/kernel-module-glowforge.git
Subsequent builds: ```
```console
(in forgefirm directory) ```
. setup-environment build openglow-forgefirm/
bitbake forgefirm-image ├── forgefirm/ ← base repo, build runs here
``` ├── meta-openglow/
└── kernel-module-glowforge/
## Bootable Image: ```
The bootable image can be found in ```forgefirm/build/tmp/deploy/images/```.
## Build the image
It can be written directly to an SDCARD:
```console ```console
(in forgefirm/build directory) cd forgefirm
cd tmp/deploy/images/glowforge kas build kas/forgefirm-glowforge.yml
sudo zcat forgefirm-image-glowforge.wic.gz | dd of=/dev/sdX bs=1M ```
```
kas fetches the upstream layers into `forgefirm/layers/`, builds in
`forgefirm/build/`, and produces the bootable image at:
```
forgefirm/build/tmp/deploy/images/glowforge/forgefirm-image-glowforge.wic.gz
```
For exact, reproducible layer versions, generate a lockfile once:
```console
kas lock kas/forgefirm-glowforge.yml
```
See [`kas/README.md`](kas/README.md) for details, the container-build option,
and the Scarthgap migration backlog.
## Write to an SD card
```console
cd build/tmp/deploy/images/glowforge
sudo zcat forgefirm-image-glowforge.wic.gz | dd of=/dev/sdX bs=1M
```
To install onto the factory eMMC (dual-boot with the Glowforge firmware), see
[`INSTALL.md`](INSTALL.md).
-23
View File
@@ -1,23 +0,0 @@
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"
BBFILES ?= ""
BBLAYERS = " \
${BSPDIR}/sources/poky/meta \
${BSPDIR}/sources/poky/meta-poky \
\
${BSPDIR}/sources/meta-openembedded/meta-oe \
\
${BSPDIR}/sources/meta-freescale \
${BSPDIR}/sources/meta-freescale-distro \
\
${BSPDIR}/sources/meta-openembedded/meta-python \
${BSPDIR}/sources/meta-openembedded/meta-networking \
\
${BSPDIR}/sources/meta-openglow/meta-openglow-core \
${BSPDIR}/sources/meta-openglow/meta-glowforge-bsp \
\
${BSPDIR}/sources/forgefirm/meta-forgefirm \
"
-25
View File
@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Repo Manifest -->
<manifest>
<default sync-j="4" revision="master"/>
<remote fetch="https://git.yoctoproject.org/git" name="yocto"/>
<remote fetch="https://github.com/Freescale" name="freescale"/>
<remote fetch="https://github.com/openembedded" name="oe"/>
<remote fetch="https://github.com/ScottW514" name="scottw514"/>
<project remote="yocto" revision="master" name="poky" path="sources/poky"/>
<project remote="yocto" revision="master" name="meta-freescale" path="sources/meta-freescale"/>
<project remote="freescale" revision="master" name="meta-freescale-distro" path="sources/meta-freescale-distro"/>
<project remote="oe" revision="master" name="meta-openembedded" path="sources/meta-openembedded"/>
<project remote="scottw514" revision="master" name="meta-openglow" path="sources/meta-openglow"/>
<project remote="scottw514" revision="master" name="forgefirm" path="sources/forgefirm">
<copyfile dest="base/conf/bblayers.conf" src="base/conf/forgefirm-bblayers.conf"/>
<copyfile dest="setup-environment" src="scripts/setup-environment"/>
</project>
</manifest>
+167
View File
@@ -0,0 +1,167 @@
# Building ForgeFIRM with kas
The **forgefirm** repo is the base of the project: it controls the build,
the resulting firmware images land here, and all build/install docs live here.
It uses [**kas**](https://kas.readthedocs.io/) to manage Yocto layers and drive
the build, replacing the old Google `repo` + `default.xml` manifest and the
hand-maintained `base/conf/forgefirm-bblayers.conf`.
## Baseline
| | |
|---|---|
| Yocto release | **Scarthgap 5.0 LTS** |
| Kernel | **linux-fslc 6.12** (mainline LTS, from meta-freescale) |
| Machine | `glowforge` (i.MX6 Solo SOM — Basic/Plus/Pro) |
| Distro | `forgefirm` |
| Image | `forgefirm-image` |
## Layout
```
openglow-forgefirm/
├── forgefirm/ ← THIS repo, the base
│ ├── kas/
│ │ ├── forgefirm-glowforge.yml ← build entry point
│ │ └── README.md ← this file
│ ├── meta-forgefirm/ ← the forgefirm layer (this repo)
│ ├── BUILD.md / INSTALL.md / SERIAL.md
│ ├── layers/ ← kas-cloned upstreams (gitignored)
│ ├── build/ ← bitbake output incl. images (gitignored)
│ ├── downloads/ sstate-cache/ ← caches (gitignored)
│ └── .gitignore
├── meta-openglow/ ← Glowforge BSP layers (local sibling, under migration)
└── kernel-module-glowforge/ ← glowforge.ko sources (pulled by recipe SRC_URI)
```
`meta-openglow` is referenced as a **local sibling** (`../meta-openglow`) while
we migrate it to Scarthgap, so its in-place edits are what gets built. Once that
migration is committed/pushed, flip it to a kas-cloned + pinned repo (commented
block in `forgefirm-glowforge.yml`) and the forgefirm repo becomes fully
self-contained.
## Prerequisites
A Linux build host, or **WSL2** on Windows (officially supported by Yocto).
> **WSL2 note:** keep this whole tree on the WSL2 *native* ext4 filesystem
> (e.g. `~/dev/openglow-forgefirm`), **not** under `/mnt/c/...`. The Windows
> mount breaks case-sensitivity/permissions and is very slow for Yocto. Give the
> WSL2 VM plenty of RAM and disk in `.wslconfig`.
```bash
pipx install kas # or: pip install kas
```
## Build
Run from the **forgefirm repo root** so outputs land inside it:
```bash
cd forgefirm
kas build kas/forgefirm-glowforge.yml # fetch layers + full build
kas shell kas/forgefirm-glowforge.yml # interactive bitbake environment
kas dump kas/forgefirm-glowforge.yml # print the resolved config
```
The bootable image lands in `build/tmp/deploy/images/glowforge/`. Flashing /
dual-boot install steps are in [`../INSTALL.md`](../INSTALL.md).
### Container build (optional, reproducible host)
```bash
cd forgefirm
kas-container build kas/forgefirm-glowforge.yml
```
## Pinning exact versions (reproducible builds)
The config tracks the `scarthgap` **branch** of each upstream layer. To lock
every layer to an exact commit:
```bash
kas lock kas/forgefirm-glowforge.yml # writes kas/forgefirm-glowforge.lock.yml
```
kas auto-loads the lockfile on subsequent runs. Commit it; refresh deliberately.
## Scarthgap migration backlog
The kas scaffold + `LAYERSERIES_COMPAT` bumps let the layers be *selected* under
Scarthgap, but the legacy (Dunfell/Gatesgarth) layers won't build clean until:
1. ~~**Override-syntax migration**~~ — **DONE.** All `_append`/`_prepend`/
`_remove`/`_${PN}` override syntax converted to the colon form across
`meta-forgefirm`, `meta-openglow-core`, and `meta-glowforge-bsp` (22
occurrences). Note: `meta-openglow-bsp` (the separate OpenGlow_std board,
not built here) was intentionally left unconverted.
2. **Kernel forward-port (4.14 → linux-fslc 6.12.20)** — the factory NXP vendor
kernel (linux-imx 4.14.98) carried 7 out-of-tree changes; these are re-derived
against mainline 6.12 in `meta-glowforge-bsp/recipes-kernel/linux/linux-fslc_%.bbappend`
(the forward-port landing zone), **not** re-applied as the old 4.14 patches.
- **Foundation — DONE.** `linux-fslc` 6.12.20 builds for `glowforge` with a
ported device tree (`glowforge.dts` + `openglow_common.dtsi` overlaid into
`arch/arm/boot/dts/nxp/imx/`, registered via a Makefile patch) and deploys
`zImage` + `glowforge.dtb`. Boot-core + mainline-bound peripherals only.
- **Free wins — DONE.** bus-freq disable *dropped* (no mainline busfreq);
`st,lis2hh12` ×3 + `national,lm75b` + `ti,wl1805` + gpio keys/leds bind to
mainline drivers; `reg-userspace-consumer` enabled via `glowforge.cfg`.
(SPI-delay / PWM-prescaler dispositions are under Motion polish below.)
- **Motion path — DONE (builds clean; runtime needs hardware).** The whole
chain forward-ports and compiles on 6.12:
- **EPIT API**: `epit_api.c` in `arch/arm/mach-imx` (`CONFIG_MXC_EPIT_API`),
in vmlinux, symbols exported; `&epit1/&epit2` in the DT.
- **SDMA-expose**: re-created `dma-imx-sdma.h` + `0003-imx-sdma-*.patch`
(un-static survivors, re-added the glowforge helpers, custom int-callback
hook); expose symbols in `Module.symvers`.
- **`glowforge.ko`**: ported across many 6.12 API changes
(`tasklet_hrtimer`→soft hrtimer, `timer_setup`, LED-trigger API,
`pwm_get`, `spi_delay`/`controller`, `filelock.h`, void `.remove`,
1-arg i2c probe). Compiles + links, 0 undefined symbols. Built from the
local sibling via an `externalsrc` bbappend during migration.
- **DT**: `glowforge,cnc/thermal/pic/head` re-added with `pwms`/`pwm-names`
phandles; `glowforge.dtb` compiles with all motion nodes.
Motion polish: PWM prescaler (factory 1001) is **obsolete** — 6.12
`pwm-imx27` auto-computes the prescaler from the requested period. The PIC
inter-word SPI delay (factory 1005) is a **hardware-bring-up TODO**: 6.12
`spi-imx.c` has no `PERIODREG`/`word_delay` programming, so re-derive it in
`spi_imx_setupxfer` (write `MX51_ECSPI_PERIODREG` from `t->word_delay`,
guarded to ECSPI) and verify the wait-states on a scope. pic.c keeps the
inter-transfer delay meanwhile. `glowforge,imx-pwm-audio` (buzzer) deferred.
- **Camera — DONE (builds clean; runtime needs hardware).** The factory
`ov5648_mipi.c` (NXP's removed `v4l2_int_device`/`mxc_v4l2_capture`) is
replaced by the mainline `ovti,ov5648` subdev + imx6 `imx-media` (IPU CSI)
+ `imx6-mipi-csi2` receiver. The factory CAM_SEL MIPI switch is modelled
with the mainline `video-mux` (gpio-mux on `gpio7 10`): both `ov5648`s →
video-mux → `mipi_csi` → IPU CSI. Sensor `xvclk` (25 MHz fixed-clock) +
avdd/dovdd/dvdd rails in the DT. All drivers build as modules and
`glowforge.dtb` compiles with the full pipeline. **HW bring-up:** confirm
the real supply rails, CSI-2 lane count/order and CAM_SEL polarity, then
validate with `media-ctl` + a v4l2 capture.
3. **u-boot** — ~~rebuild for Scarthgap~~ **DONE.** The `glowforge` u-boot is now
a standalone `u-boot_2020.01.bb` (Scarthgap dropped the Dunfell-era poky base
recipe the old `.bbappend` extended). It reuses poky's
`u-boot-common.inc`/`u-boot.inc`, pins `SRCREV` to the upstream **v2020.01**
tag with the matching `Licenses/README` md5, and overlays the glowforge board
support + arch-Kconfig patch. **Builds clean under Scarthgap (GCC 13, no
source fixes) and deploys `u-boot-glowforge.imx`.** Remaining: move
`fw_printenv`/`fw_setenv` from `u-boot-fw-utils` to `libubootenv`
(`PREFERRED_PROVIDER_u-boot-fw-utils` in `glowforge.inc`) when the rootfs needs
them.
4. **Device tree** — revalidate the `glowforge` `.dts` against the linux-fslc
6.12 DT bindings (paired with the kernel forward-port in #2).
5. **gfui-client → forgectrl** — the Glowforge **cloud client is now removed**
from `forgefirm-image` (`IMAGE_INSTALL:remove = "gfui-client"` in
`meta-forgefirm/recipes-forgefirm/images/forgefirm-image.bb`) — it connected to
Glowforge's servers, the dependency ForgeFIRM exists to cut. The grblHAL
controller + web UI (`forgectrl`, currently a placeholder) will fill its place.
---
**Image status:** `forgefirm-image` **builds end-to-end** on the forward-ported
stack and deploys `forgefirm-image-glowforge.rootfs.wic.gz` (+ `zImage`,
`glowforge.dtb`, `u-boot-glowforge.imx`) under `build/tmp/deploy/images/glowforge/`.
Build-time prerequisites baked into the config: `ACCEPT_FSL_EULA = "1"` (NXP
firmware-imx) and the kernel default in `glowforge.conf`. Everything compiles;
on-hardware bring-up (motion timing, laser/safety chain, camera pipeline) is the
remaining validation and needs a real board.
+131
View File
@@ -0,0 +1,131 @@
# ============================================================================
# ForgeFIRM — kas build configuration (factory Glowforge control board)
# ============================================================================
# The forgefirm repo is the BASE: it controls the build, the output firmware
# images land here (build/tmp/deploy/images/glowforge/), and the build/install
# docs live here (BUILD.md, INSTALL.md, SERIAL.md, kas/README.md).
#
# Target : Yocto Scarthgap (5.0 LTS) + linux-fslc 6.12 (mainline LTS)
# Machine: glowforge (i.MX6 Solo SOM inside Basic/Plus/Pro)
# Distro : forgefirm
#
# Replaces the old Google `repo` + default.xml manifest and the hand-maintained
# base/conf/forgefirm-bblayers.conf. kas generates bblayers.conf and local.conf.
#
# Run from the forgefirm repo root so outputs land inside it:
# cd forgefirm
# kas build kas/forgefirm-glowforge.yml # fetch layers + full build
# kas shell kas/forgefirm-glowforge.yml # interactive bitbake env
# kas dump kas/forgefirm-glowforge.yml # show resolved config
#
# Reproducible pins (after first checkout):
# kas lock kas/forgefirm-glowforge.yml # writes kas/forgefirm-glowforge.lock.yml
# ============================================================================
header:
version: 14
machine: glowforge
distro: forgefirm
target: forgefirm-image
# kas uses KAS_WORK_DIR (the dir you run kas from = the forgefirm repo root).
# Upstream layers are cloned into ./layers/, the build runs in ./build/, and
# caches go in ./downloads + ./sstate-cache — all gitignored, all inside forgefirm.
repos:
# --- This repo (forgefirm) — auto-detected, no url/path needed -------------
forgefirm:
layers:
meta-forgefirm:
# --- Upstream layers (cloned + pinned to the scarthgap branch by kas) ------
poky:
url: https://git.yoctoproject.org/poky.git
branch: scarthgap
path: layers/poky
layers:
meta:
meta-poky:
meta-openembedded:
url: https://github.com/openembedded/meta-openembedded.git
branch: scarthgap
path: layers/meta-openembedded
layers:
meta-oe:
meta-python:
meta-networking:
meta-freescale:
url: https://github.com/Freescale/meta-freescale.git
branch: scarthgap
path: layers/meta-freescale
layers:
.:
meta-freescale-distro:
# Provides conf/distro/include/fslc-base.inc, required by the forgefirm distro.
url: https://github.com/Freescale/meta-freescale-distro.git
branch: scarthgap
path: layers/meta-freescale-distro
layers:
.:
# --- meta-openglow — Glowforge BSP layers ---------------------------------
# ACTIVE DEVELOPMENT: referenced as a local sibling checkout (no url => kas
# performs no git ops, so the scarthgap-migration edits we're making are what
# gets built). The kernel-module-glowforge sources are NOT a layer; they are
# pulled by the kernel-module-glowforge.bb recipe's SRC_URI, so kas does not
# manage them here.
meta-openglow:
path: ../meta-openglow
layers:
meta-openglow-core:
meta-glowforge-bsp:
# meta-openglow-bsp (separate OpenGlow_std board) intentionally excluded.
#
# FUTURE (once the meta-openglow scarthgap migration is committed/pushed,
# making forgefirm fully self-contained — clone forgefirm, run kas, done):
# meta-openglow:
# url: https://github.com/ScottW514/meta-openglow.git
# branch: scarthgap # or a pinned commit / tag
# path: layers/meta-openglow
# layers:
# meta-openglow-core:
# meta-glowforge-bsp:
# ----------------------------------------------------------------------------
# local.conf additions
# ----------------------------------------------------------------------------
local_conf_header:
# Accept the NXP/Freescale firmware EULA — required to unpack firmware-imx
# (i.MX SDMA/VPU firmware blobs) pulled in by the i.MX6 BSP. ForgeFIRM targets
# the factory i.MX6 Glowforge board, so this firmware is intrinsic to the image.
eula: |
ACCEPT_FSL_EULA = "1"
# Kernel is now defaulted to linux-fslc 6.12 in conf/machine/glowforge.conf
# (with the factory drivers forward-ported — EPIT/SDMA/OV5648/glowforge.ko —
# see kas/README.md backlog #2). This explicit pin is redundant but harmless.
kernel: |
PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"
PREFERRED_VERSION_linux-fslc = "6.12%"
# Development image features. debug-tweaks gives a passwordless root login for
# bench bring-up; kas generates its own local.conf (it does NOT inherit poky's
# local.conf.sample), so this must be set explicitly. Drop it (and set a real
# root password via extrausers) before any production/field image.
image-debug: |
EXTRA_IMAGE_FEATURES = "debug-tweaks"
build-tweaks: |
# Parallelism for the 12-core / 16 GB WSL2 VM. (The earlier mid-build deaths
# were the mirrored-networking vsock relay, not memory — see .wslconfig — so
# this can comfortably use more of the VM.)
BB_NUMBER_THREADS = "8"
PARALLEL_MAKE = "-j 8"
# Caches kept inside the forgefirm repo (gitignored):
DL_DIR ?= "${TOPDIR}/../downloads"
SSTATE_DIR ?= "${TOPDIR}/../sstate-cache"
-271
View File
@@ -1,271 +0,0 @@
#!/bin/sh
# -*- mode: shell-script; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# Copyright (C) 2012, 2013, 2016 O.S. Systems Software LTDA.
# Authored-by: Otavio Salvador <otavio@ossystems.com.br>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Add options for the script
# Copyright (C) 2013 Freescale Semiconductor, Inc.
CWD=`pwd`
PROGNAME="setup-environment"
PACKAGE_CLASSES=${PACKAGE_CLASSES:-package_rpm}
usage()
{
echo -e "
Usage: MACHINE=<machine> DISTRO=<distro> source $PROGNAME <build-dir>
Usage: source $PROGNAME <build-dir>
<machine> machine name
<distro> distro name
<build-dir> build directory
The first usage is for creating a new build directory. In this case, the
script creates the build directory <build-dir>, configures it for the
specified <machine> and <distro>, and prepares the calling shell for running
bitbake on the build directory.
The second usage is for using an existing build directory. In this case,
the script prepares the calling shell for running bitbake on the build
directory <build-dir>. The build directory configuration is unchanged.
"
ls sources/meta-openglow/meta-*/conf/machine/*.conf > /dev/null 2>&1
ls sources/forgefirm/meta-*/conf/distro/*.conf > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo -e "
Supported machines: `echo; ls sources/meta-openglow/meta-*/conf/machine/*.conf \
| sed s/\.conf//g | sed -r 's/^.+\///' | xargs -I% echo -e "\t%"`
Supported distros: `echo; ls sources/forgefirm/meta-*/conf/distro/*.conf \
| sed s/\.conf//g | sed -r 's/^.+\///' | xargs -I% echo -e "\t%"`
Examples:
- To create a new Yocto build directory:
$ MACHINE=glowforge DISTRO=forgefirm source $PROGNAME build
- To use an existing Yocto build directory:
$ . $PROGNAME build
"
fi
}
clean_up()
{
unset EULA LIST_MACHINES VALID_MACHINE
unset CWD TEMPLATES SHORTOPTS LONGOPTS ARGS PROGNAME
unset generated_config updated
unset MACHINE SDKMACHINE DISTRO OEROOT
}
# get command line options
SHORTOPTS="h"
LONGOPTS="help"
ARGS=$(getopt --options $SHORTOPTS \
--longoptions $LONGOPTS --name $PROGNAME -- "$@" )
# Print the usage menu if invalid options are specified
if [ $? != 0 -o $# -lt 1 ]; then
usage && clean_up
return 1
fi
eval set -- "$ARGS"
while true;
do
case $1 in
-h|--help)
usage
clean_up
return 0
;;
--)
shift
break
;;
esac
done
if [ "$(whoami)" = "root" ]; then
echo "ERROR: do not use the BSP as root. Exiting..."
fi
if [ ! -e $1/conf/local.conf.sample ]; then
build_dir_setup_enabled="true"
else
build_dir_setup_enabled="false"
fi
if [ "$build_dir_setup_enabled" = "true" ] && [ -z "$MACHINE" ]; then
usage
echo -e "ERROR: You must set MACHINE when creating a new build directory."
clean_up
return 1
fi
if [ -z "$SDKMACHINE" ]; then
SDKMACHINE='i686'
fi
if [ "$build_dir_setup_enabled" = "true" ] && [ -z "$DISTRO" ]; then
usage
echo -e "ERROR: You must set DISTRO when creating a new build directory."
clean_up
return 1
fi
OEROOT=$PWD/sources/poky
if [ -e $PWD/sources/oe-core ]; then
OEROOT=$PWD/sources/oe-core
fi
. $OEROOT/oe-init-build-env $CWD/$1 > /dev/null
# if conf/local.conf not generated, no need to go further
if [ ! -e conf/local.conf ]; then
clean_up && return 1
fi
# Clean up PATH, because if it includes tokens to current directories somehow,
# wrong binaries can be used instead of the expected ones during task execution
export PATH="`echo $PATH | sed 's/\(:.\|:\)*:/:/g;s/^.\?://;s/:.\?$//'`"
generated_config=
if [ "$build_dir_setup_enabled" = "true" ]; then
mv conf/local.conf conf/local.conf.sample
# Generate the local.conf based on the Yocto defaults
TEMPLATES=$CWD/base/conf
grep -v '^#\|^$' conf/local.conf.sample > conf/local.conf
cat >> conf/local.conf <<EOF
DL_DIR ?= "\${BSPDIR}/downloads/"
INHERIT += "image-buildinfo"
IMAGE_BUILDINFO_VARS = "DISTRO DISTRO_VERSION MACHINE"
# Edit these to speed up the build process.
# Replace # with the number of CPU cores on the build host
#PARALLEL_MAKE = "-j #"
#BB_NUMBER_THREADS = "16"
EOF
# Change settings according environment
sed -e "s,MACHINE ??=.*,MACHINE ??= '$MACHINE',g" \
-e "s,SDKMACHINE ??=.*,SDKMACHINE ??= '$SDKMACHINE',g" \
-e "s,DISTRO ?=.*,DISTRO ?= '$DISTRO',g" \
-e "s,PACKAGE_CLASSES ?=.*,PACKAGE_CLASSES ?= '$PACKAGE_CLASSES',g" \
-i conf/local.conf
cp $TEMPLATES/* conf/
for s in $HOME/.oe $HOME/.yocto; do
if [ -e $s/site.conf ]; then
echo "Linking $s/site.conf to conf/site.conf"
ln -s $s/site.conf conf
fi
done
generated_config=1
fi
# Handle EULA setting
EULA_ACCEPTED=
# EULA has been accepted already (ACCEPT_FSL_EULA is set in local.conf)
if grep -q '^\s*ACCEPT_FSL_EULA\s*=\s*["'\'']..*["'\'']' conf/local.conf; then
EULA_ACCEPTED=1
fi
if [ -z "$EULA_ACCEPTED" ] && [ -n "$EULA" ]; then
# The FSL EULA is not set as accepted in local.conf, but the EULA
# variable is set in the environment, so we just configure
# ACCEPT_FSL_EULA in local.conf according to $EULA.
echo "ACCEPT_FSL_EULA = \"$EULA\"" >> conf/local.conf
elif [ -n "$EULA_ACCEPTED" ]; then
# The FSL EULA has been accepted once, so ACCEPT_FSL_EULA is set
# in local.conf. No need to do anything.
:
else
# THE FSL EULA is not set as accepted in local.conf, and EULA is
# not set in the environment, so we need to ask user if he/she
# accepts the FSL EULA:
cat <<EOF
Some BSPs depend on libraries and packages which are covered by Freescale's
End User License Agreement (EULA). To have the right to use these binaries in
your images, you need to read and accept the following...
EOF
sleep 4
more -d $CWD/sources/meta-freescale/EULA
echo
REPLY=
while [ -z "$REPLY" ]; do
echo -n "Do you accept the EULA you just read? (y/n) "
read REPLY
case "$REPLY" in
y|Y)
echo "EULA has been accepted."
echo "ACCEPT_FSL_EULA = \"1\"" >> conf/local.conf
;;
n|N)
echo "EULA has not been accepted."
;;
*)
REPLY=
;;
esac
done
fi
cat <<EOF
Welcome to OpenGlow Glowforge Community BSP
For more information about OpenGlow:
https://community.openglow.org/
The Yocto Project has extensive documentation about OE including a
reference manual which can be found at:
http://yoctoproject.org/documentation
For more information about OpenEmbedded see their website:
http://www.openembedded.org/
You can now run 'bitbake <target>'
Current available targets are:
forgefirm-image (for Glowforge factory control boards)
EOF
if [ -n "$generated_config" ]; then
cat <<EOF
Your build environment has been configured with:
MACHINE=$MACHINE
SDKMACHINE=$SDKMACHINE
DISTRO=$DISTRO
EULA=$EULA
EOF
else
echo "Your configuration files at $1 have not been touched."
fi
clean_up