From 90384350b30d7e28860eb90e3cf84e193288b50e Mon Sep 17 00:00:00 2001 From: ScottW514 Date: Fri, 19 Jun 2026 10:33:45 -0400 Subject: [PATCH] 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 --- .gitignore | 10 ++ BUILD.md | 127 ++++++++------ base/conf/forgefirm-bblayers.conf | 23 --- default.xml | 25 --- kas/README.md | 167 ++++++++++++++++++ kas/forgefirm-glowforge.yml | 131 +++++++++++++++ scripts/setup-environment | 271 ------------------------------ 7 files changed, 384 insertions(+), 370 deletions(-) create mode 100644 .gitignore delete mode 100644 base/conf/forgefirm-bblayers.conf delete mode 100644 default.xml create mode 100644 kas/README.md create mode 100644 kas/forgefirm-glowforge.yml delete mode 100644 scripts/setup-environment diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4634139 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/BUILD.md b/BUILD.md index ecd2aeb..7e854e8 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,51 +1,76 @@ -# Build -Instructions are for a Linux environment supported by Yocto. - -To get the build OpenGlow/ForgeFIRM you need to have `repo` installed: - -## Install the `repo` utility: - -```console -mkdir ~/bin -curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo -chmod a+x ~/bin/repo -PATH=${PATH}:~/bin -``` -Add the following to the end of ```~/.bashrc``` to permanently add ```repo``` to your path: -```console -export PATH=~/bin:$PATH -``` -## Download the BSP source: - -```console -mkdir forgefirm -cd forgefirm -repo init -u https://github.com/ScottW514/forgefirm.git -b master -m default.xml -repo sync -``` - -At the end of the commands you have all meta packages you need to build the basic firmware images. - -## Build the OpenGlow/ForgeFIRM image for factory control boards -First time environment setup: -```console -(in forgefirm directory) -MACHINE=glowforge DISTRO=forgefirm . setup-environment build -bitbake forgefirm-image -``` -Subsequent builds: -```console -(in forgefirm directory) -. setup-environment build -bitbake forgefirm-image -``` - -## Bootable Image: -The bootable image can be found in ```forgefirm/build/tmp/deploy/images/```. - -It can be written directly to an SDCARD: -```console -(in forgefirm/build directory) -cd tmp/deploy/images/glowforge -sudo zcat forgefirm-image-glowforge.wic.gz | dd of=/dev/sdX bs=1M -``` +# Build + +ForgeFIRM is built with [**kas**](https://kas.readthedocs.io/), which manages +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. + +Builds run on a Linux host, or on **WSL2** (officially supported by Yocto — +keep the tree on the native ext4 filesystem, not `/mnt/c`). + +## Host setup + +On Ubuntu/Debian (including WSL2), install the Yocto host packages and kas: + +```console +sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc build-essential \ + chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \ + iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file \ + locales libacl1 lz4 rsync +sudo locale-gen en_US.UTF-8 +pipx install kas # use pipx — Ubuntu 24.04 (PEP 668) blocks `pip install --user` +``` + +For other distros, see the +[Yocto Project Quick Build](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html). +Do not build as root (the Yocto sanity checks refuse it). + +## Get the sources + +Clone the repos as siblings (the kas config references `meta-openglow` at +`../meta-openglow` while it is under active Scarthgap migration): + +```console +git clone https://github.com/ScottW514/forgefirm.git +git clone https://github.com/ScottW514/meta-openglow.git +git clone https://github.com/ScottW514/kernel-module-glowforge.git +``` + +``` +openglow-forgefirm/ +├── forgefirm/ ← base repo, build runs here +├── meta-openglow/ +└── kernel-module-glowforge/ +``` + +## Build the image + +```console +cd forgefirm +kas build kas/forgefirm-glowforge.yml +``` + +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). diff --git a/base/conf/forgefirm-bblayers.conf b/base/conf/forgefirm-bblayers.conf deleted file mode 100644 index 1dda159..0000000 --- a/base/conf/forgefirm-bblayers.conf +++ /dev/null @@ -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 \ -" diff --git a/default.xml b/default.xml deleted file mode 100644 index 8e0a906..0000000 --- a/default.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kas/README.md b/kas/README.md new file mode 100644 index 0000000..b978251 --- /dev/null +++ b/kas/README.md @@ -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. diff --git a/kas/forgefirm-glowforge.yml b/kas/forgefirm-glowforge.yml new file mode 100644 index 0000000..d559bff --- /dev/null +++ b/kas/forgefirm-glowforge.yml @@ -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" diff --git a/scripts/setup-environment b/scripts/setup-environment deleted file mode 100644 index 7035c00..0000000 --- a/scripts/setup-environment +++ /dev/null @@ -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 -# -# 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= DISTRO= source $PROGNAME -Usage: source $PROGNAME - machine name - distro name - build directory - -The first usage is for creating a new build directory. In this case, the -script creates the build directory , configures it for the -specified and , 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 . 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 <> 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 <> conf/local.conf - ;; - n|N) - echo "EULA has not been accepted." - ;; - *) - REPLY= - ;; - esac - done -fi - -cat <' - -Current available targets are: - forgefirm-image (for Glowforge factory control boards) - -EOF - -if [ -n "$generated_config" ]; then - cat <