mirror of
https://github.com/tuxbox-neutrino/buildenv.git
synced 2025-08-27 07:23:13 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1fd7cb62fc | ||
|
061053c7b5 | ||
|
d84f277098 | ||
|
2d26cc0775 | ||
|
116cc557dc | ||
|
1ff67985ec | ||
|
889b4b9746 | ||
|
0ecffb58dd | ||
|
1528ca7279 | ||
|
6bc2f1b7f9 | ||
|
48ec25e2e4 | ||
|
6d4ae33a0e | ||
|
7961947fa9 | ||
|
0c17141c15 | ||
|
1488d7f07a | ||
|
0acb4f2bcb | ||
|
2f12b0e953 | ||
|
b220b0804f | ||
|
3c9c730ef5 | ||
|
b85a65968f | ||
|
495bd574c1 | ||
|
fd2fec8550 | ||
|
3e510b0f91 | ||
|
e915e9a3af | ||
|
e207b2f214 |
25
.github/scripts/translate.py
vendored
25
.github/scripts/translate.py
vendored
@@ -1,25 +0,0 @@
|
||||
from googletrans import Translator
|
||||
|
||||
def translate_readme(input_text, target_lang):
|
||||
translator = Translator()
|
||||
translated = translator.translate(input_text, dest=target_lang)
|
||||
translated_text = translated.text
|
||||
|
||||
# add hint for automatically translation
|
||||
translated_text = f"Note: This is an automatically translated file. Original content from [here](https://github.com/tuxbox-neutrino/buildenv/blob/3.2.4/README-de.md):\n\n{translated_text}"
|
||||
|
||||
# Use this workaround, because translater breaks some links and anchors
|
||||
translated_text = translated_text.replace("[Build Image](#Build Image)", "[Build Image](#build-image)")
|
||||
translated_text = translated_text.replace("devtool -reference.html", "devtool-reference.html")
|
||||
translated_text = translated_text.replace("dev-manual -common-tasks.html", "dev-manual-common-tasks.html")
|
||||
translated_text = translated_text.replace("Clone #1-Init-Script", "#1-clone-init-script")
|
||||
|
||||
return translated_text
|
||||
|
||||
if __name__ == "__main__":
|
||||
input_text = open("README-de.md", "r").read()
|
||||
target_lang = "en" # target language is english
|
||||
translated_text = translate_readme(input_text, target_lang)
|
||||
|
||||
with open("README-en.md", "w") as outfile:
|
||||
outfile.write(translated_text)
|
42
.github/workflows/readme.yml
vendored
42
.github/workflows/readme.yml
vendored
@@ -1,42 +0,0 @@
|
||||
name: Translate README
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 3.2.4
|
||||
paths:
|
||||
- 'README-de.md'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
translate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade googletrans==3.1.0a0
|
||||
|
||||
- name: Translate README
|
||||
run: |
|
||||
python .github/scripts/translate.py
|
||||
|
||||
- name: Commit and push translated README
|
||||
run: |
|
||||
git config --global user.email "actions@github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
git add README-en.md
|
||||
git commit -m "readme: Automatically translated README to English"
|
||||
git push
|
||||
|
84
.github/workflows/translateandtag.yml
vendored
Normal file
84
.github/workflows/translateandtag.yml
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
name: Translate README
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'README.md'
|
||||
- 'README_de.md'
|
||||
- 'init.sh'
|
||||
- 'init.functions.sh'
|
||||
- 'files/**'
|
||||
- 'local.conf.common.inc.sample'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
translate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
- name: Install translate dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade googletrans==3.1.0a0
|
||||
curl -o translate-md.py https://raw.githubusercontent.com/dbt1/translate-md/refs/heads/master/translate-md.py
|
||||
chmod 755 translate-md.py
|
||||
|
||||
- name: Prepare Git user data
|
||||
run: |
|
||||
git config --global user.email "dbt@novatux.de"
|
||||
git config --global user.name "Thilo Graf"
|
||||
|
||||
- name: Verify translate-md.py download
|
||||
run: |
|
||||
if [ ! -f translate-md.py ]; then
|
||||
echo "translate-md.py was not downloaded!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Translate README
|
||||
run: |
|
||||
cp README_de.md template.md
|
||||
python translate-md.py --template-md template.md --output-dir . --prefix README_ --main-doc README.md -c translate-md-config.json -s de
|
||||
rm template.md
|
||||
|
||||
- name: Commit and push translated README
|
||||
run: |
|
||||
git add README_de.md -f README_en.md
|
||||
git commit -m "readme: Automatically translated README"
|
||||
|
||||
- name: Install tagit dependencies
|
||||
run: |
|
||||
pip install GitPython
|
||||
curl -o tagit.py https://raw.githubusercontent.com/dbt1/tagit/master/tagit.py
|
||||
curl -o tagit-config.json https://raw.githubusercontent.com/dbt1/tagit/master/tagit-config.json
|
||||
chmod +x tagit.py
|
||||
|
||||
- name: Verify tagit.py download
|
||||
run: |
|
||||
if [ ! -f tagit.py ]; then
|
||||
echo "tagit.py was not downloaded!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Tagging
|
||||
run: |
|
||||
python tagit.py -f README_de.md -f README_en.md --scheme-file tagit-config.json
|
||||
|
||||
- name: Commit and push version and tag changes
|
||||
run: |
|
||||
git add -A
|
||||
git commit -m "Automatically updated tags [skip ci]" || echo "No changes to commit"
|
||||
git push
|
||||
git push --tags
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -18,3 +18,8 @@ local build increment
|
||||
*/poky
|
||||
poky-*
|
||||
|
||||
venv
|
||||
tagit.py
|
||||
tagit-config.json
|
||||
translate-md.py
|
||||
|
||||
|
215
README-en.md
215
README-en.md
@@ -1,215 +0,0 @@
|
||||
Note: This is an automatically translated file. Original content from [here](https://github.com/tuxbox-neutrino/buildenv/blob/3.2.4/README-de.md):
|
||||
|
||||
# Quick start image creation #
|
||||
|
||||
- [Preparation](#Preparation)
|
||||
- [Build Image](#build-image)
|
||||
- [Update](#Update)
|
||||
- [Working on Target Sources](#Working-on-Target-Sources)
|
||||
- [Overview of global configuration files](#overview-of-global-configuration-files)
|
||||
|
||||
## Preparation
|
||||
|
||||
### Install required host packages (Debian 11)
|
||||
For use with other distributions see: [Yocto Project Quick Build](https://docs.yoctoproject.org/3.2.4/ref-manual/ref-system-requirements.html#supported-linux-distributions)
|
||||
|
||||
> :memo: **NOTE:** If using the Tuxbox Builder VM (which is not mandatory), please skip to [Step 1](#1-clone-init-script). The Tuxbox Builder VM already contains required packages. Details and download of Tuxbox-Builder VM see: [Tuxbox-Builder](https://sourceforge.net/projects/n4k/files/Tuxbox-Builder)
|
||||
|
||||
```bash
|
||||
apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential \
|
||||
chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils \
|
||||
iputils-ping python3-git python3-jinja2 libegl1-mesa pylint3 xterm subversion locales-all \
|
||||
libxml2-utils ninja-build default-jre clisp libcapstone4 libsdl2-dev doxygen
|
||||
```
|
||||
> :memo: **NOTE:** On Debian 10 (buster) use libcapstone3.
|
||||
|
||||
#### Recommended additional packages for graphical support and analysis (e.g. with Kdevelop, Meld):
|
||||
```bash
|
||||
apt-get install -y gitk git-gui meld cppcheck clazy kdevelop
|
||||
```
|
||||
|
||||
### Optional: If there is no configured Git, please enter your global Git user data:
|
||||
```bash
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.user "Your name"
|
||||
```
|
||||
|
||||
## Build image
|
||||
|
||||
> :memo: **Note:** Some paths are based on defaults generated by the init script. Some entries are displayed as ```<placeholder>```, which need to be adjusted accordingly.
|
||||
|
||||
> ### 1. Clone init script.
|
||||
```bash
|
||||
git clone https://github.com/tuxbox-neutrino/buildenv.git
|
||||
cd buildenv
|
||||
```
|
||||
|
||||
> ### 2. Run init script
|
||||
```bash
|
||||
./init
|
||||
cd poky-3.2.4
|
||||
```
|
||||
|
||||
> ### 3. Show list of possible machine types
|
||||
```bash
|
||||
ls build
|
||||
```
|
||||
|
||||
> ### 4. Run environment script
|
||||
```bash
|
||||
. ./oe-init-build-env build/<enter machine type from the list from step 3 here>
|
||||
```
|
||||
|
||||
> ### 5. Build
|
||||
```bash
|
||||
bitbake neutrino image
|
||||
```
|
||||
|
||||
This could take a while. Some warning messages can be ignored. Error messages affecting the setscene tasks are not a problem, but errors during the build and package tasks terminate the process in most cases. [In this case, please report the error or send your solution to us](https://forum.tuxbox-neutrino.org/forum/viewforum.php?f=77). Help is very welcome.
|
||||
|
||||
When everything is done, you should see a message similar to this:
|
||||
```bash
|
||||
...
|
||||
NOTE: Tasks Summary: Attempted 4568 tasks of which 4198 didn't need to be rerun and all succeeded.
|
||||
...
|
||||
```
|
||||
**That's it...**
|
||||
|
||||
Created images and packages can be found at:
|
||||
```
|
||||
~/build/poky-3.2.4/build/<machine>/tmp/deploy
|
||||
```
|
||||
or in the dist directory:
|
||||
```
|
||||
~/build/dist/<image version>/<machine>/
|
||||
```
|
||||
|
||||
## Update
|
||||
> :memo: Manual updates for arbitrary target sources are not required. This is done automatically for every target accessed using Bitbake. This means that required dependencies are always updated. If you want full control over specific target sources, see [Working on Target Sources](#Working-on-Target-Sources)!
|
||||
|
||||
If [Steps 1 to 4](View #3-list-of-possible-machine-types) have already been completed, only step 5 is required:
|
||||
|
||||
### Update image
|
||||
```bash
|
||||
bitbake neutrino image
|
||||
```
|
||||
|
||||
### Update target
|
||||
```bash
|
||||
bitbake <target>
|
||||
```
|
||||
|
||||
### Update meta layer repositories
|
||||
Re-executing the init script updates the included meta layers to the status of the remote repositories.
|
||||
```bash
|
||||
cd $HOME/build
|
||||
./init
|
||||
```
|
||||
The triggered update routines of the init script should temporarily stash uncommitted changes or rebase local commits to the remote changes. However, conflicts must be resolved manually. Of course, you can manually update and modify your local meta layers for meta neutrino and machine layer repositories.
|
||||
|
||||
> :memo: **Note:** Configuration files remain untouched. New or changed configuration options are not taken into account. Please check the configuration if necessary.
|
||||
|
||||
## Working on target sources
|
||||
If you want to have full control over the target sources, the source codes should be moved to the workspace. Please refer
|
||||
[devtool](https://docs.yoctoproject.org/current/ref-manual/devtool-reference.html) and especially [devtool modify](https://docs.yoctoproject.org/current/ref-manual/devtool-reference.html#modifying-an-existing-recipe).
|
||||
|
||||
## Reset configuration
|
||||
If you want to reset your machine configurations, please rename the conf directory (deletion is not recommended) and run the init script again.
|
||||
```bash
|
||||
mv $HOME/build/poky-3.2.4/build/<machine>/conf $HOME/build/poky-3.2.4/build/<machine>/conf.01
|
||||
cd $HOME/build
|
||||
./init
|
||||
```
|
||||
|
||||
## Force rebuild of a single target
|
||||
In some cases it can happen that a target breaks off for whatever reason. You shouldn't panic and delete the tmp folder and the sstate cache. You can also do this for each target individually.
|
||||
|
||||
> :memo: In particular, broken archive URLs can lead to termination. However, these errors are always displayed and you can check the URL. Often it's just the servers and they even work again after a few minutes.
|
||||
|
||||
To make sure whether the recipe in question actually has a problem, it makes sense to completely clean up the target in question and rebuild it. To enforce this, all generated package, build and cache data must be cleaned up.
|
||||
```bash
|
||||
bitbake -c cleansstate <target>
|
||||
```
|
||||
then rebuild:
|
||||
```bash
|
||||
bitbake <target>
|
||||
```
|
||||
|
||||
## Force full image build
|
||||
If you want to force a complete image build, you can delete (or rename) the tmp directory:
|
||||
```bash
|
||||
mv tmp tmp.01
|
||||
bitbake neutrino image
|
||||
```
|
||||
If you have **not** cleared the sstate cache, the image should be built in a relatively short time. Therefore, it is recommended to keep the sstate cache. The directory where the sstate cache is located is determined via the variable ```${SSTATE_DIR}``` and can be adjusted in the configuration.
|
||||
|
||||
This directory is quite valuable and only in rare cases is it necessary to delete this directory. Please note that the build will take much longer in this case.
|
||||
> :bulb: You can tell Bitbake not to use sstate cache.
|
||||
```bash
|
||||
bitbake --no-setscene neutrino-image
|
||||
```
|
||||
or
|
||||
```bash
|
||||
bitbake --skip-setscene neutrino-image
|
||||
```
|
||||
|
||||
## Adjust if necessary
|
||||
It is recommended to build for the first time without making any changes to the configuration files to get an idea of how the build process works and to see the results.
|
||||
The setting options are very extensive and not really manageable for beginners. However, the Yoctoproject is very
|
||||
comprehensively documented and provides the best source of information.
|
||||
|
||||
**Important for developers**: "[Working on Target Sources](#Working-on-Target-Sources)"!
|
||||
|
||||
> :memo: **Please do not change the Yocto recipes! This is not recommended by the Yocto team, but you can use [.bbappend](https://docs.yoctoproject.org/3.2.4/dev-manual/dev-manual-common-tasks.html#using-bbappend-files-in-your-layer) files.**
|
||||
|
||||
### Overview of global configuration files
|
||||
For local configuration, these configuration files are required within the build directories:
|
||||
|
||||
> $HOME/build/poky-3.2.4/build/```<machine>```/conf/local.conf
|
||||
|
||||
This generated local.conf only contains a few lines, but has a line that points to a common configuration file that is valid for all images and supported machine types and can be fed with your own options.
|
||||
|
||||
> $HOME/build/local.conf.common.inc
|
||||
|
||||
This **.inc** file was created from the cloned example file when running the init script for the first time.
|
||||
|
||||
> local.conf.common.inc.sample
|
||||
|
||||
This example file should be left untouched to avoid possible conflicts when updating the build repository and to see what might have changed.
|
||||
|
||||
After an update to the build repository, some new or changed options may have been added or removed that are not reflected in the included configuration file. You should take this case into account in your own configuration and adapt it if necessary.
|
||||
Of course, you can modify ```$HOME/Build/poky-3.2.4/build/<machine>/conf/local.conf``` with your own requirements and use it as a separate configuration file for a machine type.
|
||||
|
||||
#### Sample configuration for bblayers.conf:
|
||||
> $HOME/build/poky-3.2.4/build/```<machine>```/conf/bblayers.conf
|
||||
|
||||
```bitbake
|
||||
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
|
||||
# changes incompatibly
|
||||
POKY_BBLAYERS_CONF_VERSION = "2"
|
||||
|
||||
BBPATH = "${TOPDIR}"
|
||||
BBFILES ?= ""
|
||||
|
||||
BBLAYERS ?= " \
|
||||
/home/<username>build/poky-3.2.4/meta \
|
||||
/home/<username>/build/poky-3.2.4/meta-poky \
|
||||
/home/<username>/build/poky-3.2.4/meta-yocto-bsp \
|
||||
"
|
||||
BBLAYERS += "\
|
||||
/home/<username>/build/poky-3.2.4/meta-neutrino \
|
||||
/home/<username>/build/poky-3.2.4/meta-<machine-brand-or-bsp-name> \
|
||||
/home/<username>/build/poky-3.2.4/meta-openembedded/meta-oe \
|
||||
"
|
||||
BBLAYERS += "\
|
||||
/home/<username>/build/poky-3.2.4/meta-python2 \
|
||||
"
|
||||
BBLAYERS += "\
|
||||
/home/<username>/build/poky-3.2.4/meta-qt5 \
|
||||
"
|
||||
```
|
||||
|
||||
## More information
|
||||
Further information about the Yocto build system:
|
||||
|
||||
* https://docs.yoctoproject.org/3.2.4/index.html
|
12
README.md
12
README.md
@@ -1,7 +1,9 @@
|
||||
# Documentation
|
||||
|
||||
## Localized `README.md`'s
|
||||
This document is available in the following languages:
|
||||
|
||||
| Language |
|
||||
| -------------------------- |
|
||||
| [English](README-en.md) |
|
||||
| [German](README-de.md) |
|
||||
<!-- LANGUAGE_LINKS_START -->
|
||||
[🇩🇪 German](README_de.md) | [🇬🇧 English](README_en.md)
|
||||
<!-- LANGUAGE_LINKS_END -->
|
||||
|
||||
Please choose your preferred language by clicking on the links above.
|
@@ -1,3 +1,7 @@
|
||||
<!-- LANGUAGE_LINKS_START -->
|
||||
<span style="color: grey;">🇩🇪 German</span> | [🇬🇧 English](README_en.md)
|
||||
<!-- LANGUAGE_LINKS_END -->
|
||||
|
||||
Dieses Skript dient als Werkzeug zur Vereinfachung der Erstellung einer Umgebung für Entwicklung und des Build-Prozesses für Images die mit Neutrino als Benutzeroberfläche auf unterschiedlichen Hardware-Plattformen laufen. Es automatisiert einige Schritte, die für die Einrichtung einer konsistenten und funktionalen Entwicklungs- und Build-Umgebung erforderlich sind, indem es die notwendigen Abhängigkeiten und grundlegende Konfigurationen sowie Meta-Layer voreinrichtet und benutzerdefinierte Einstellungen ermöglicht. Das Skript zielt darauf ab, eine Grundlage zu bieten, auf der man aufbauen und experimentieren kann, um eigene angepasste Versionen von Tuxbox-Neutrino Images zu erstellen, zu aktualisieren und zu pflegen.
|
||||
|
||||
- [1. Vorbereitung](#1-vorbereitung)
|
||||
@@ -30,12 +34,12 @@ Dieses Skript dient als Werkzeug zur Vereinfachung der Erstellung einer Umgebung
|
||||
|
||||
## 1. Vorbereitung
|
||||
|
||||
Empfohlen sei an dieser Stelle, den dafür vorgesehenen Docker-Container zu verwenden, da damit schon wesentliche Schritte erledigt sind, um mit möglichst wenig Anpassungen an seinem System, loslegen zu können. [siehe docker-buildenv](https://github.com/tuxbox-neutrino/docker-buildenv). In diesem Fall kann man gleich [mit der Initialisierung](#14-init-skript-ausführen) beginnen.
|
||||
|
||||
**HINWEIS:** [docker-buildenv](https://github.com/tuxbox-neutrino/docker-buildenv) löst die [Tuxbox-Builder](https://sourceforge.net/projects/n4k/files/Tuxbox-Builder)-VM komplett ab. Deren Wartung wird nicht mehr weitergeführt.
|
||||
|
||||
Hier angegebene Pfade basieren auf Vorgaben, die vom Init-Script erzeugt werden. Einige Einträge werden als ```<Platzhalter>``` dargestellt, die lokal angepasst werden müssen. [Siehe Schema](#14-init-skript-ausführen)
|
||||
|
||||
**HINWEIS:** Die Wartung der Tuxbox-Builder-VM wird nicht mehr weitergeführt. Falls die VM-Lösung trotzdem verwendet werden soll, springe bitte zu [Schritt 2](#2-image-bauen). Die Tuxbox-Builder-VM enthält normalerweise bereits erforderliche Pakete.
|
||||
|
||||
Details und Download: [Tuxbox-Builder](https://sourceforge.net/projects/n4k/files/Tuxbox-Builder)
|
||||
|
||||
### 1.1 Erforderliche Host-Pakete installieren
|
||||
|
||||
**Hinweis:** Bei Verwendung anderer Distributionen siehe: [Yocto Project Quick Build](https://docs.yoctoproject.org/3.2.4/ref-manual/ref-system-requirements.html#supported-linux-distributions)
|
||||
@@ -49,7 +53,14 @@ iputils-ping python3-git python3-jinja2 libegl1-mesa pylint3 xterm subversion lo
|
||||
libxml2-utils ninja-build default-jre clisp libcapstone4 libsdl2-dev doxygen
|
||||
```
|
||||
|
||||
**HINWEIS:** Bei Debian 10 (buster) libcapstone3 verwenden.
|
||||
Debian 12
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc-multilib build-essential \
|
||||
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping \
|
||||
python3-git python3-jinja2 libegl1-mesa pylint3 xterm subversion locales-all libxml2-utils \
|
||||
ninja-build default-jre clisp libcapstone4 libsdl2-dev doxygen
|
||||
```
|
||||
|
||||
#### 1.1.1 Empfohlene Zusatzpakete zur grafischen Unterstützung und Analyse
|
||||
|
||||
@@ -151,7 +162,6 @@ Wenn alles erledigt ist, sollte eine ähnliche Meldung wie diese erscheinen:
|
||||
|
||||
<span style="color: green;">Das war's ...</span>
|
||||
|
||||
|
||||
Ergebnisse findest Du unter:
|
||||
|
||||
```bash
|
||||
@@ -230,8 +240,8 @@ Nach einer Aktualisierung des Build-Script-Repositorys könnten neue oder geänd
|
||||
Diese Datei wird normalerweise beim erstmaligen ausführen des Init-Skripts angepasst und braucht in der Regel nur angepasst zu werden, wenn man Layer hinzufügen, entfernen oder ersetzen möchte.
|
||||
|
||||
#### 4.1.3 Konfiguration zurücksetzen
|
||||
Wenn Du deine Maschinen-Konfigurationen zurücksetzen möchtest, benenne bitte das conf-Verzeichnis um (Löschen wird nicht empfohlen) und führe das Init-Skript erneut aus.
|
||||
|
||||
Wenn Du deine Maschinen-Konfigurationen zurücksetzen möchtest, benenne bitte das conf-Verzeichnis um (Löschen wird nicht empfohlen) und führe das Init-Skript erneut aus.
|
||||
|
||||
```bash
|
||||
~/mv ~/buildenv/poky-3.2.4/build/<machine>/conf ~/buildenv/poky-3.2.4/build/<machine>/conf.01
|
||||
@@ -282,7 +292,6 @@ bitbake neutrino
|
||||
|
||||
...wird Neutrino ab sofort nur noch vom lokalen Repo im Workspace gebaut werden:
|
||||
|
||||
|
||||
```bash
|
||||
NOTE: Started PRServer with DBfile: /home/<user>/buildenv/poky-3.2.4/build/hd61/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 34211, PID: 56838
|
||||
...
|
||||
@@ -325,7 +334,8 @@ Das Init-Skript stellt dafür die Option `--reset` zur Verfügung.
|
||||
|
||||
```bash
|
||||
./init --reset
|
||||
# Anweisungen befolgen
|
||||
# Follow instructions
|
||||
|
||||
```
|
||||
|
||||
Manuell erreichst Du das ebenfalls, indem man das tmp-Verzeichnis im jeweiligem Build-Unterverzeichnis manuell umbenennt. Löschen kann man es nachträglich, wenn man Speicherplatz freigeben will oder sich sicher ist, dass man das Verzeichnis nicht mehr braucht:
|
||||
@@ -344,12 +354,14 @@ Wenn man den Cache **nicht** gelöscht hat, sollte das Image in relativ kurzer Z
|
||||
|
||||
Dieses Verzeichnis ist ziemlich wertvoll und nur in seltenen Fällen ist es notwendig, dieses Verzeichnis zu löschen. Bitte beachte, dass der Buildvorgang nach dem Löschen des Cache sehr viel mehr Zeit in Anspruch nimmt.
|
||||
|
||||
|
||||
## 7. Lizenz
|
||||
|
||||
```
|
||||
MIT License
|
||||
```
|
||||
|
||||
## 8. Weiterführende Informationen
|
||||
|
||||
Weitere Informationen zum Yocto Buildsystem:
|
||||
|
||||
* https://docs.yoctoproject.org
|
374
README_en.md
Normal file
374
README_en.md
Normal file
@@ -0,0 +1,374 @@
|
||||
<!-- LANGUAGE_LINKS_START -->
|
||||
[🇩🇪 German](README_de.md) | <span style="color: grey;">🇬🇧 English</span>
|
||||
<!-- LANGUAGE_LINKS_END -->
|
||||
|
||||
This script serves as a tool to simplify setting up a development environment and the build process for images that run with Neutrino as the user interface on various hardware platforms. It automates several steps required to establish a consistent and functional development and build environment by preconfiguring necessary dependencies, basic configurations, and meta-layers, while allowing for custom settings. The script aims to provide a foundation on which you can build and experiment to create, update, and maintain your own customized versions of Tuxbox-Neutrino images.
|
||||
|
||||
* [1. Preparation](#1-preparation)
|
||||
|
||||
* [1.1 Install Required Host Packages](#11-install-required-host-packages)
|
||||
|
||||
* [1.1.1 Recommended Additional Packages for Graphical Support and Analysis](#111-recommended-additional-packages-for-graphical-support-and-analysis)
|
||||
* [1.2 Prepare Git (if necessary)](#12-prepare-git-if-necessary)
|
||||
* [1.3 Clone Init Script](#13-clone-init-script)
|
||||
* [1.4 Run Init Script](#14-run-init-script)
|
||||
* [1.5 Build Environment Structure](#15-build-environment-structure)
|
||||
* [2. Building an Image](#2-building-an-image)
|
||||
|
||||
* [2.1 Choose a Box](#21-choose-a-box)
|
||||
* [2.2 Start the Environment Script](#22-start-the-environment-script)
|
||||
* [2.3 Create the Image](#23-create-the-image)
|
||||
* [3. Updates](#3-updates)
|
||||
|
||||
* [3.1 Update Image](#31-update-image)
|
||||
* [3.2 Update Package](#32-update-package)
|
||||
* [3.3 Update Meta-Layer Repositories](#33-update-meta-layer-repositories)
|
||||
* [4. Customizations](#4-customizations)
|
||||
|
||||
* [4.1 Configuration](#41-configuration)
|
||||
|
||||
* [4.1.1 Configuration Files](#411-configuration-files)
|
||||
* [4.1.2 bblayers.conf](#412-bblayersconf)
|
||||
* [4.1.3 Resetting Configuration](#413-resetting-configuration)
|
||||
* [4.3 Recipes](#43-recipes)
|
||||
* [4.4 Packages](#44-packages)
|
||||
|
||||
* [4.4.1 Editing Source Code in the Workspace (Example)](#441-editing-source-code-in-the-workspace-example)
|
||||
* [5. Forcing a Rebuild of a Single Package](#5-forcing-a-rebuild-of-a-single-package)
|
||||
* [6. Forcing a Full Image Rebuild](#6-forcing-a-full-image-rebuild)
|
||||
* [7. License](#7-license)
|
||||
* [8. Further Information](#8-further-information)
|
||||
|
||||
## 1. Preparation
|
||||
|
||||
At this point, it is recommended to use the provided Docker container, as it already covers essential steps needed to get started with minimal changes to your system. [See docker-buildenv](https://github.com/tuxbox-neutrino/docker-buildenv). In this case, you can jump straight to [running the initialization](#14-run-init-script).
|
||||
|
||||
**NOTE:** [docker-buildenv](https://github.com/tuxbox-neutrino/docker-buildenv) fully replaces the [Tuxbox-Builder](https://sourceforge.net/projects/n4k/files/Tuxbox-Builder) VM, which is no longer maintained.
|
||||
|
||||
The paths shown here are based on those generated by the init script. Some entries appear as `<placeholder>` and need to be adjusted locally. [See schema](#14-run-init-script).
|
||||
|
||||
### 1.1 Install Required Host Packages
|
||||
|
||||
**Note:** If you are using other distributions, see: [Yocto Project Quick Build](https://docs.yoctoproject.org/3.2.4/ref-manual/ref-system-requirements.html#supported-linux-distributions)
|
||||
|
||||
**Debian 11**
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential \
|
||||
chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils \
|
||||
iputils-ping python3-git python3-jinja2 libegl1-mesa pylint3 xterm subversion locales-all \
|
||||
libxml2-utils ninja-build default-jre clisp libcapstone4 libsdl2-dev doxygen
|
||||
```
|
||||
|
||||
**Debian 12**
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc-multilib build-essential \
|
||||
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping \
|
||||
python3-git python3-jinja2 libegl1-mesa pylint3 xterm subversion locales-all libxml2-utils \
|
||||
ninja-build default-jre clisp libcapstone4 libsdl2-dev doxygen
|
||||
```
|
||||
|
||||
#### 1.1.1 Recommended Additional Packages for Graphical Support and Analysis
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y gitk git-gui meld cppcheck clazy kdevelop
|
||||
```
|
||||
|
||||
### 1.2 Prepare Git (if necessary)
|
||||
|
||||
The init script uses Git to clone the meta-layer repositories. If you don’t have Git configured yet, please set up your global Git user data; otherwise, you’ll get unnecessary warnings while the script runs.
|
||||
|
||||
```bash
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
```
|
||||
|
||||
### 1.3 Clone Init Script
|
||||
|
||||
```bash
|
||||
git clone https://github.com/tuxbox-neutrino/buildenv.git && cd buildenv
|
||||
```
|
||||
|
||||
### 1.4 Run Init Script
|
||||
|
||||
```bash
|
||||
./init && cd poky-3.2.4
|
||||
```
|
||||
|
||||
### 1.5 Build Environment Structure
|
||||
|
||||
After [step 1.4](#14-run-init-script), you should see a structure similar to this:
|
||||
|
||||
```
|
||||
.buildenv
|
||||
├── dist <-- Shared folder for HTTP server (if set up) http://localhost, http://localhost:8080, needed for IPK feeds and images
|
||||
│ └── {DISTRO_VERSION} <-- Contains generated images and packages (symlinks to the deploy dirs inside build subdirectories)
|
||||
:
|
||||
├── init.sh <-- init script
|
||||
├── local.conf.common.inc <-- global user configuration, included in custom config
|
||||
:
|
||||
├── log <-- folder for logs, contains logs for each init script run
|
||||
:
|
||||
└── poky-{DISTRO_VERSION} <-- After step 1.4 you’ll be here. Contains the build system core and meta-layers
|
||||
│
|
||||
:
|
||||
└── build <-- Build subdirectories; after step 2.2 you’ll be inside one of these
|
||||
├── <machine x> <-- Build dir for machine type x
|
||||
│ ├── conf <-- Folder for layers and custom config
|
||||
│ │ └── bblayers.conf <-- Config for included meta-layers
|
||||
│ │ └── local.conf <-- Custom config for one machine type
|
||||
│ :
|
||||
│ ├── (tmp) <-- Work dir, auto-created during build
|
||||
│ └── (workspace) <-- Workspace, created when running devtool
|
||||
:
|
||||
└── <machine y> <-- Another build dir for machine type y
|
||||
```
|
||||
|
||||
## 2. Building an Image
|
||||
|
||||
Make sure you are in the directory shown in the [schema](#15-build-environment-structure):
|
||||
|
||||
```
|
||||
poky-{DISTRO_VERSION}
|
||||
```
|
||||
|
||||
### 2.1 Choose a Box
|
||||
|
||||
List available devices:
|
||||
|
||||
```bash
|
||||
ls build
|
||||
```
|
||||
|
||||
### 2.2 Start the Environment Script
|
||||
|
||||
Run the environment script for the desired box from the list once! You will be placed into the corresponding build subdirectory.
|
||||
|
||||
```bash
|
||||
. ./oe-init-build-env build/<machine>
|
||||
```
|
||||
|
||||
From now on, as long as you remain in the generated environment within the open shell in the chosen build subdirectory, you don’t need to re-run this script and can go straight to [step 2.3](#23-create-the-image) to build images or any packages.
|
||||
|
||||
**Note:** You can also open additional shells and thus create parallel build environments for other box types, switching to the appropriate terminal as needed and even building in parallel, provided your system can handle it.
|
||||
|
||||
### 2.3 Create the Image
|
||||
|
||||
```bash
|
||||
bitbake neutrino-image
|
||||
```
|
||||
|
||||
This can take a while. Some warnings can be ignored. Errors related to setscene tasks are usually harmless, but build and package task errors typically abort the process. [Please report the error or share your solution](https://forum.tuxbox-neutrino.org/forum/viewforum.php?f=77). Help is always welcome.
|
||||
|
||||
When done, you should see a message like this:
|
||||
|
||||
```bash
|
||||
NOTE: Tasks Summary: Attempted 4568 tasks of which 4198 didn't need to be rerun and all succeeded.
|
||||
```
|
||||
|
||||
<span style="color: green;">That’s it...</span>
|
||||
|
||||
Results can be found under:
|
||||
|
||||
```bash
|
||||
buildenv/poky-{DISTRO_VERSION}/build/<machine>/tmp/deploy
|
||||
```
|
||||
|
||||
or in the shared directory:
|
||||
|
||||
```bash
|
||||
buildenv/dist/<Image-Version>/<machine>/
|
||||
```
|
||||
|
||||
If you have a web server pointing to the shared directory:
|
||||
|
||||
```bash
|
||||
http://localhost/{DISTRO_VERSION} or with port number http://localhost:8080/{DISTRO_VERSION}
|
||||
```
|
||||
|
||||
## 3. Updates
|
||||
|
||||
Manual package updates are not required. These are handled automatically on every bitbake invocation, including dependencies. If you want full control over certain package sources, you can place them in the workspace for each package; see [4.4 Packages](#44-packages).
|
||||
|
||||
If no updates are needed, builds are skipped automatically.
|
||||
|
||||
### 3.1 Update Image
|
||||
|
||||
```bash
|
||||
bitbake neutrino-image
|
||||
```
|
||||
|
||||
### 3.2 Update Package
|
||||
|
||||
```bash
|
||||
bitbake <package>
|
||||
```
|
||||
|
||||
### 3.3 Update Meta-Layer Repositories
|
||||
|
||||
Running the init script with the `--update` parameter updates the included meta-layers to the state of their remote repositories.
|
||||
|
||||
```bash
|
||||
./init --update
|
||||
```
|
||||
|
||||
If you have made changes to the meta-layers, the init script’s update routines should temporarily stash or rebase unstashed changes on the local repositories. Of course, you can manually update your local meta-layers for meta-neutrino and machine-layer repos, but you must resolve any conflicts manually.
|
||||
|
||||
**Note:** Configuration files remain mostly untouched, but variable names may be migrated. New or changed settings are not auto-updated. Please review your configuration if necessary.
|
||||
|
||||
## 4. Customizations
|
||||
|
||||
### 4.1 Configuration
|
||||
|
||||
It is recommended to build for the first time without modified configuration files to get a feel for the build process and see results quickly. The configuration options are extensive and not easy for beginners to grasp. However, OpenEmbedded and the Yocto Project are thoroughly documented and provide the best information source.
|
||||
|
||||
#### 4.1.1 Configuration Files
|
||||
|
||||
> \~/buildenv/poky-3.2.4/build/`<machine>`/conf/local.conf
|
||||
|
||||
This file, located in the build directory for each machine type, is the actual user configuration file intended by the build system. In this environment, it contains only a few lines and includes a global configuration. This file is **only** valid for its specific machine type. You can add entries here that apply only to that machine type. [See schema](#14-run-init-script)
|
||||
|
||||
> \~/buildenv/local.conf.common.inc
|
||||
|
||||
This file holds settings that apply to all machine types and is generated from the template `~/buildenv/local.conf.common.inc.sample` on the first run of the init script.
|
||||
|
||||
Although you could use the build system’s intended `./build/<machine>/conf/local.conf` as the primary config file for each machine separately, this would increase maintenance overhead. Hence, `~/buildenv/local.conf.common.inc` is only included in `./build/<machine>/conf/local.conf`.
|
||||
|
||||
**Note on** `~/buildenv/local.conf.common.inc.sample`**:** This is a template and should remain untouched to avoid conflicts when updating the build-script repository and to see what has changed.
|
||||
|
||||
After updating the build-script repository, new or changed options may have been added or removed and not merged into your included config file. You should consider these cases and review and adjust your configuration if necessary.
|
||||
|
||||
#### 4.1.2 bblayers.conf
|
||||
|
||||
> \~/buildenv/poky-3.2.4/build/`<machine>`/conf/bblayers.conf
|
||||
|
||||
This file is usually adjusted on the first run of the init script and typically only needs changes when you want to add, remove, or replace layers.
|
||||
|
||||
#### 4.1.3 Resetting Configuration
|
||||
|
||||
If you want to reset your machine configurations, rename (rather than delete) the conf directory and rerun the init script.
|
||||
|
||||
```bash
|
||||
mv ~/buildenv/poky-3.2.4/build/<machine>/conf ~/buildenv/poky-3.2.4/build/<machine>/conf.backup
|
||||
cd ~/buildenv
|
||||
./init
|
||||
```
|
||||
|
||||
### 4.3 Recipes
|
||||
|
||||
**Unless you are directly contributing to Poky layers, do not modify the official Poky layers (meta-layers)!** The Yocto Project strongly discourages this practice, as you risk losing your work during updates and creating hard-to-maintain conflicts.
|
||||
|
||||
The usual way to extend or override existing recipes is with `.bbappend` files. [Learn more](https://docs.yoctoproject.org/3.2.4/dev-manual/dev-manual-common-tasks.html#using-bbappend-files-in-your-layer).
|
||||
|
||||
Alternatively (though also not recommended), you could copy official recipes into your own meta-layers and modify them, in which case you are responsible for keeping them up to date, increasing maintenance overhead.
|
||||
|
||||
The same principle applies to your own meta-layers like meta-neutrino or machine layers. If you want to actively work on recipes, feel free to [contribute](https://docs.yoctoproject.org/current/ref-manual/devtool-reference.html#modifying-an-existing-recipe).
|
||||
|
||||
### 4.4 Packages
|
||||
|
||||
If you want full control over a package’s source code (e.g., to fix or actively develop something), move the source you want to work on into the workspace. See the Neutrino example below.
|
||||
|
||||
See [devtool](https://docs.yoctoproject.org/current/ref-manual/devtool-reference.html) and especially [devtool modify](https://docs.yoctoproject.org/current/ref-manual/devtool-reference.html#modifying-an-existing-recipe). In the workspace, you’re guaranteed that the build system won’t touch the source. If you ignore this, you might find your changes repeatedly cleaned or overridden, losing or rendering them incompatible. In the default local config, [rm\_work](https://docs.yoctoproject.org/ref-manual/classes.html#ref-classes-rm-work) is enabled, which cleans each package’s work directory after build, leaving only logs.
|
||||
|
||||
#### 4.4.1 Editing Source Code in the Workspace (Example)
|
||||
|
||||
This example uses Neutrino, but the procedure applies to most packages.
|
||||
|
||||
```bash
|
||||
~/buildenv/poky-3.2.4/build/hd61$ devtool modify neutrino
|
||||
NOTE: Starting bitbake server...54cf81d24c147d888c"
|
||||
...
|
||||
workspace = "3.2.4:13143ea85a1ab7703825c0673128c05845b96cb5"
|
||||
|
||||
Initialising tasks: 100% |########################################################################################################| Time: 0:00:01
|
||||
Sstate summary: Wanted 0 Found 0 Missed 0 Current 10 (0% match, 100% complete)
|
||||
NOTE: Executing Tasks
|
||||
NOTE: Tasks Summary: Attempted 83 tasks of which 80 didn't need to be rerun and all succeeded.
|
||||
INFO: Adding local source files to srctree...
|
||||
INFO: Source tree extracted to /home/<user>/buildenv/poky-3.2.4/build/hd61/workspace/sources/neutrino
|
||||
INFO: Recipe neutrino-mp now set up to build from /home/<user>/buildenv/poky-3.2.4/build/hd61/workspace/sources/neutrino
|
||||
```
|
||||
|
||||
The Neutrino source code is now in `/buildenv/poky-3.2.4/build/hd61/workspace/sources/neutrino`. You can work on it there. From now on, the build system will not clone Neutrino from the remote Git repo but will use only your local workspace sources, managed by you.
|
||||
|
||||
When you run:
|
||||
|
||||
```bash
|
||||
bitbake neutrino
|
||||
```
|
||||
|
||||
... Neutrino will build from the local workspace repo:
|
||||
|
||||
```bash
|
||||
NOTE: Started PRServer with DBfile: /home/<user>/buildenv/poky-3.2.4/build/hd61/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 34211, PID: 56838
|
||||
...
|
||||
workspace = "3.2.4:13143ea85a1ab7703825c0673128c05845b96cb5"
|
||||
|
||||
Initialising tasks: 100% |########################################################################################################| Time: 0:00:01
|
||||
Sstate summary: Wanted 122 Found 116 Missed 6 Current 818 (95% match, 99% complete)
|
||||
NOTE: Executing Tasks
|
||||
NOTE: neutrino-mp: compiling from external source tree /home/<user>/buildenv/poky-3.2.4/build/hd61/workspace/sources/neutrino
|
||||
NOTE: Tasks Summary: Attempted 2756 tasks of which 2741 didn't need to be rerun and all succeeded.
|
||||
```
|
||||
|
||||
**Tip:** For Neutrino, it’s also recommended to transfer the associated `libstb-hal` to the workspace:
|
||||
|
||||
```bash
|
||||
devtool modify libstb-hal
|
||||
```
|
||||
|
||||
## 5. Forcing a Rebuild of a Single Package
|
||||
|
||||
Sometimes a target fails for unknown reasons. Avoid panicking and wiping your workspace or sstate cache. You can clean up a specific target without breaking everything else.
|
||||
|
||||
Broken archive URLs often cause failures. These errors are shown, and you can verify the URL. They often resolve after a few minutes.
|
||||
|
||||
To ensure a recipe actually has an issue, clean and rebuild the entire target’s data:
|
||||
|
||||
```bash
|
||||
bitbake -c cleansstate <target>
|
||||
```
|
||||
|
||||
Then rebuild:
|
||||
|
||||
```bash
|
||||
bitbake <target>
|
||||
```
|
||||
|
||||
## 6. Forcing a Full Image Rebuild
|
||||
|
||||
The init script provides the `--reset` option:
|
||||
|
||||
```bash
|
||||
./init --reset
|
||||
# Follow instructions
|
||||
```
|
||||
|
||||
Manually, rename the tmp directory in the respective build subdirectory. You can delete it later to free space if you’re sure you don’t need it:
|
||||
|
||||
```bash
|
||||
mv tmp tmp.backup
|
||||
```
|
||||
|
||||
Then rebuild the image:
|
||||
|
||||
```bash
|
||||
bitbake neutrino-image
|
||||
```
|
||||
|
||||
If you haven’t deleted the cache, the image should finish relatively quickly. That’s why retaining the cache is recommended. The cache directory is defined by `${SSTATE_DIR}` and can be customized in the configuration.
|
||||
|
||||
This directory is valuable, and deleting it is rarely needed. Note that builds take much longer after deleting the cache.
|
||||
|
||||
## 7. License
|
||||
|
||||
```
|
||||
MIT License
|
||||
```
|
||||
|
||||
## 8. Further Information
|
||||
|
||||
More information on the Yocto build system:
|
||||
|
||||
* [https://docs.yoctoproject.org](https://docs.yoctoproject.org)
|
@@ -7,7 +7,8 @@ function my_echo() {
|
||||
if [ "$no_term_output" == "true" ]; then
|
||||
shift
|
||||
fi
|
||||
local cleaned_output=$(echo -e "${@}" | sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g")
|
||||
local cleaned_output
|
||||
cleaned_output=$(echo -e "${@}" | sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g")
|
||||
# Write to log
|
||||
echo "[ $(date '+%Y-%m-%d %H:%M:%S') ] - ${cleaned_output}" >> "$LOGFILE"
|
||||
# Show on terminal
|
||||
@@ -16,18 +17,16 @@ function my_echo() {
|
||||
fi
|
||||
}
|
||||
|
||||
# function for checking of valid machine(s)
|
||||
function is_valid_machine ()
|
||||
{
|
||||
local ISM=$1
|
||||
for M in $MACHINES ; do
|
||||
if [ "$ISM" == "$M" ] || [ "$MACHINE" == "all" ]; then
|
||||
echo true
|
||||
return 1
|
||||
## Function to check if a machine is valid
|
||||
# Returns 0 if valid, 1 if not.
|
||||
function is_valid_machine() {
|
||||
local machine_to_check="$1"
|
||||
for m in $MACHINES; do
|
||||
if [[ "$machine_to_check" == "$m" || "$MACHINE" == "all" ]]; then
|
||||
return 0 # valid
|
||||
fi
|
||||
done
|
||||
echo false
|
||||
return 0
|
||||
return 1 # not valid
|
||||
}
|
||||
|
||||
function do_exec() {
|
||||
@@ -39,14 +38,7 @@ function do_exec() {
|
||||
|
||||
my_echo true "[EXEC] $cmd"
|
||||
|
||||
# TODO: Evaluate alternatives to 'eval' for executing complex commands
|
||||
# Using 'eval' here allows for dynamic execution of commands that may include
|
||||
# special characters, variable expansions, or other complexities that are
|
||||
# difficult to handle with direct execution methods. However, 'eval' comes with
|
||||
# significant security implications, especially when dealing with untrusted input.
|
||||
# It executes the given string as a bash command, which can lead to code injection
|
||||
# vulnerabilities if not carefully managed. This usage is a temporary solution to
|
||||
# achieve desired functionality and should be revisited to explore safer alternatives.
|
||||
# Execute the command
|
||||
if [[ "$show_output" == "show_output" ]]; then
|
||||
eval $cmd 2>> "$TMP_LOGFILE"
|
||||
else
|
||||
@@ -57,7 +49,7 @@ function do_exec() {
|
||||
|
||||
if [[ -f "$TMP_LOGFILE" ]]; then
|
||||
log_text=$(cat "$TMP_LOGFILE")
|
||||
>> "$LOGFILE" # Clear TMP_LOGFILE after reading
|
||||
: > "$TMP_LOGFILE" # Clear TMP_LOGFILE after reading
|
||||
fi
|
||||
|
||||
if [[ $cmd_exit_status -ne 0 ]]; then
|
||||
@@ -76,8 +68,8 @@ function do_exec() {
|
||||
fi
|
||||
}
|
||||
|
||||
function get_metaname () {
|
||||
local TMP_NAME=$1
|
||||
function get_metaname() {
|
||||
local TMP_NAME="$1"
|
||||
|
||||
if [ "$TMP_NAME" == "hd51" ] || [ "$TMP_NAME" == "bre2ze4k" ] || [ "$TMP_NAME" == "mutant51" ] || [ "$TMP_NAME" == "ax51" ]; then
|
||||
META_NAME="gfutures"
|
||||
@@ -90,12 +82,47 @@ function get_metaname () {
|
||||
elif [ "$TMP_NAME" == "e4hdultra" ]; then
|
||||
META_NAME="ceryon"
|
||||
else
|
||||
META_NAME=$TMP_NAME
|
||||
META_NAME="$TMP_NAME"
|
||||
fi
|
||||
echo "$META_NAME"
|
||||
}
|
||||
|
||||
# clone or update required branch for required meta-<layer>
|
||||
## Function to apply a patch using git apply with check and commit
|
||||
# Parameters:
|
||||
# $1: target_git_path (Path to the Git repository)
|
||||
# $2: patch_file (Name of the patch file located in $FILES_DIR)
|
||||
# $3: layer_name (Name of the layer, only for log output)
|
||||
function apply_patch() {
|
||||
local target_git_path="$1"
|
||||
local patch_file="$2"
|
||||
local layer_name="$3"
|
||||
|
||||
my_echo -e "Applying patch: $patch_file"
|
||||
|
||||
# Check if the patch has already been applied by testing it in reverse
|
||||
if git -C "$target_git_path" apply --reverse --check "$FILES_DIR/$patch_file" > /dev/null 2>&1; then
|
||||
my_echo -e "\033[33;1mPatch $patch_file already applied to $layer_name; skipping.\033[0m"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if the patch can be applied cleanly
|
||||
if do_exec "git -C \"$target_git_path\" apply --check \"$FILES_DIR/$patch_file\""; then
|
||||
if do_exec "git -C \"$target_git_path\" apply \"$FILES_DIR/$patch_file\""; then
|
||||
# After successfully applying the patch: add changes and commit
|
||||
do_exec "git -C \"$target_git_path\" add -A"
|
||||
do_exec "git -C \"$target_git_path\" commit -m \"Apply patch $patch_file\""
|
||||
else
|
||||
my_echo -e "\033[31;1mFailed to apply patch $patch_file to $layer_name using git apply\033[0m"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
my_echo -e "\033[33;1mSkipping patch $patch_file: cannot be applied cleanly.\033[0m"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
## Clone or update required branch for a meta-layer
|
||||
function fetch_meta() {
|
||||
local layer_name="$1"
|
||||
local branch_name="$2"
|
||||
@@ -104,16 +131,18 @@ function fetch_meta() {
|
||||
local target_git_path="$5"
|
||||
local patch_list="$6"
|
||||
|
||||
local GIT_SSH_COMMAND=""
|
||||
if [[ "$GIT_SSH_KEYFILE" != "" ]]; then
|
||||
export GIT_SSH_COMMAND="$SSH -i \"$GIT_SSH_KEYFILE\""
|
||||
fi
|
||||
|
||||
if [[ ! -d "$target_git_path/.git" ]]; then
|
||||
my_echo -e "Clone branch $branch_name from $layer_git_url into $target_git_path"
|
||||
if do_exec "git clone -b "$branch_name" "$layer_git_url" "$target_git_path""; then
|
||||
do_exec "git -C "$target_git_path" checkout "$branch_hash" -b "$IMAGE_VERSION""
|
||||
do_exec "git -C "$target_git_path" pull -r origin "$branch_name""
|
||||
if do_exec "git clone -b \"$branch_name\" \"$layer_git_url\" \"$target_git_path\""; then
|
||||
# Only perform checkout if branch_hash is not empty
|
||||
if [ -n "$branch_hash" ]; then
|
||||
do_exec "git -C \"$target_git_path\" checkout \"$branch_hash\" -b \"$IMAGE_VERSION\""
|
||||
fi
|
||||
do_exec "git -C \"$target_git_path\" pull -r origin \"$branch_name\""
|
||||
else
|
||||
my_echo -e "\033[31;1mError cloning $layer_name from $layer_git_url\033[0m"
|
||||
return 1
|
||||
@@ -121,19 +150,9 @@ function fetch_meta() {
|
||||
## Patching
|
||||
if [[ -n "$patch_list" ]]; then
|
||||
for patch_file in $patch_list; do
|
||||
# First, check if the patch can be applied cleanly
|
||||
my_echo -e "Applying patch: $patch_file"
|
||||
if do_exec "git -C "$target_git_path" apply --check "$FILES_DIR/$patch_file""; then
|
||||
# Attempt to apply the patch if 'apply --check' was successful
|
||||
if ! do_exec "git -C "$target_git_path" am < "$FILES_DIR/$patch_file""; then
|
||||
# Error message if 'git am' fails
|
||||
my_echo -e "\033[31;1mFailed to apply patch $patch_file to $layer_name\033[0m"
|
||||
if ! apply_patch "$target_git_path" "$patch_file" "$layer_name"; then
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
# Message about skipping if 'apply --check' fails
|
||||
my_echo -e "\033[33;1mSkipping patch $patch_file already applied or cannot be applied cleanly.\033[0m"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
@@ -141,13 +160,21 @@ function fetch_meta() {
|
||||
my_echo -e "Update $target_git_path on branch $branch_name"
|
||||
if [[ $(git -C "$target_git_path" stash list) ]]; then
|
||||
my_echo -e "Stashing changes in $target_git_path"
|
||||
do_exec "git -C "$target_git_path" stash push --include-untracked"
|
||||
do_exec "git -C \"$target_git_path\" stash push --include-untracked"
|
||||
local stash_applied=true
|
||||
fi
|
||||
do_exec "git -C "$target_git_path" checkout "$branch_name"" || do_exec "git -C "$target_git_path" checkout -b "$branch_name""
|
||||
do_exec "git -C "$target_git_path" pull -r origin "$branch_name""
|
||||
do_exec "git -C \"$target_git_path\" checkout \"$branch_name\"" || do_exec "git -C \"$target_git_path\" checkout -b \"$branch_name\""
|
||||
do_exec "git -C \"$target_git_path\" pull -r origin \"$branch_name\""
|
||||
## Patching
|
||||
if [[ -n "$patch_list" ]]; then
|
||||
for patch_file in $patch_list; do
|
||||
if ! apply_patch "$target_git_path" "$patch_file" "$layer_name"; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [[ "$stash_applied" == true ]]; then
|
||||
if do_exec "git -C "$target_git_path" stash pop"; then
|
||||
if do_exec "git -C \"$target_git_path\" stash pop"; then
|
||||
my_echo -e "Stash applied successfully."
|
||||
else
|
||||
my_echo -e "\033[33;1mNote: Stash could not be applied. Manual intervention required.\033[0m"
|
||||
@@ -160,172 +187,144 @@ function fetch_meta() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# clone/update required branch from tuxbox bsp layers
|
||||
function is_required_machine_layer ()
|
||||
{
|
||||
local HIM1=$1
|
||||
for M in $HIM1 ; do
|
||||
if [ "$M" == "$MACHINE" ]; then
|
||||
echo true
|
||||
return 1
|
||||
## Clone/update required branch from tuxbox bsp layers
|
||||
# Returns 0 if machine is required, 1 if not.
|
||||
function is_required_machine_layer() {
|
||||
local machine_list="$1"
|
||||
for m in $machine_list; do
|
||||
if [[ "$m" == "$MACHINE" ]]; then
|
||||
return 0 # required
|
||||
fi
|
||||
done
|
||||
echo false
|
||||
return 0
|
||||
return 1 # not required
|
||||
}
|
||||
|
||||
# get matching machine type from machine build id
|
||||
## Get matching machine type from machine build id
|
||||
function get_real_machine_type() {
|
||||
local MACHINE_TYPE=$1
|
||||
local MACHINE_TYPE="$1"
|
||||
if [ "$MACHINE_TYPE" == "mutant51" ] || [ "$MACHINE_TYPE" == "ax51" ] || [ "$MACHINE_TYPE" == "hd51" ]; then
|
||||
RMT_RES="hd51"
|
||||
echo "hd51"
|
||||
elif [ "$MACHINE_TYPE" == "hd60" ] || [ "$MACHINE_TYPE" == "ax60" ]; then
|
||||
RMT_RES="hd60"
|
||||
echo "hd60"
|
||||
elif [ "$MACHINE_TYPE" == "hd61" ] || [ "$MACHINE_TYPE" == "ax61" ]; then
|
||||
RMT_RES="hd61"
|
||||
echo "hd61"
|
||||
elif [ "$MACHINE_TYPE" == "zgemmah7" ] || [ "$MACHINE_TYPE" == "h7" ]; then
|
||||
RMT_RES="h7"
|
||||
echo "h7"
|
||||
else
|
||||
RMT_RES=$MACHINE_TYPE
|
||||
echo "$MACHINE_TYPE"
|
||||
fi
|
||||
echo $RMT_RES
|
||||
}
|
||||
|
||||
# get matching machine build id from machine type
|
||||
## Get matching machine build id from machine type
|
||||
function get_real_machine_id() {
|
||||
local MACHINEBUILD=$1
|
||||
local MACHINEBUILD="$1"
|
||||
if [ "$MACHINEBUILD" == "hd51" ]; then
|
||||
RMI_RES="ax51"
|
||||
echo "ax51"
|
||||
elif [ "$MACHINEBUILD" == "hd60" ]; then
|
||||
RMI_RES="ax60"
|
||||
echo "ax60"
|
||||
elif [ "$MACHINEBUILD" == "hd61" ]; then
|
||||
RMI_RES="ax61"
|
||||
echo "ax61"
|
||||
elif [ "$MACHINEBUILD" == "h7" ]; then
|
||||
RMI_RES="zgemmah7"
|
||||
echo "zgemmah7"
|
||||
else
|
||||
RMI_RES=$MACHINEBUILD
|
||||
echo "$MACHINEBUILD"
|
||||
fi
|
||||
echo $RMI_RES
|
||||
}
|
||||
|
||||
# function to create file entries into a file, already existing entry will be ignored
|
||||
function set_file_entry () {
|
||||
local FILE_NAME=$1
|
||||
local FILE_SEARCH_ENTRY=$2
|
||||
local FILE_NEW_ENTRY=$3
|
||||
if test ! -f $FILE_NAME; then
|
||||
echo $FILE_NEW_ENTRY > $FILE_NAME
|
||||
return 1
|
||||
else
|
||||
OLD_CONTENT=`cat $FILE_NAME`
|
||||
HAS_ENTRY=`grep -c -w $FILE_SEARCH_ENTRY $FILE_NAME`
|
||||
if [ "$HAS_ENTRY" == "0" ] ; then
|
||||
echo $FILE_NEW_ENTRY >> $FILE_NAME
|
||||
fi
|
||||
NEW_CONTENT=`cat $FILE_NAME`
|
||||
if [ "$OLD_CONTENT" == "$NEW_CONTENT" ] ; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
## Function to add an entry to a file if it doesn't already exist.
|
||||
## Returns 0 if entry was added, 1 if it already existed.
|
||||
function set_file_entry() {
|
||||
local FILE_NAME="$1"
|
||||
local FILE_SEARCH_ENTRY="$2"
|
||||
local FILE_NEW_ENTRY="$3"
|
||||
if [ ! -f "$FILE_NAME" ]; then
|
||||
echo "$FILE_NEW_ENTRY" > "$FILE_NAME"
|
||||
return 0
|
||||
else
|
||||
if grep -q -w "$FILE_SEARCH_ENTRY" "$FILE_NAME"; then
|
||||
return 1 # entry exists
|
||||
else
|
||||
echo "$FILE_NEW_ENTRY" >> "$FILE_NAME"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# function to create configuration for box types
|
||||
function create_local_config () {
|
||||
local machine=$1
|
||||
## Function to create configuration for box types
|
||||
function create_local_config() {
|
||||
local machine="$1"
|
||||
|
||||
if [ "$machine" != "all" ]; then
|
||||
|
||||
MACHINE_BUILD_DIR=$BUILD_ROOT/$machine
|
||||
do_exec "mkdir -p $BUILD_ROOT"
|
||||
MACHINE_BUILD_DIR="$BUILD_ROOT/$machine"
|
||||
do_exec "mkdir -p \"$BUILD_ROOT\""
|
||||
|
||||
BACKUP_CONFIG_DIR="$BACKUP_PATH/$machine/conf"
|
||||
do_exec "mkdir -p $BACKUP_CONFIG_DIR"
|
||||
do_exec "mkdir -p \"$BACKUP_CONFIG_DIR\""
|
||||
|
||||
LOCAL_CONFIG_FILE_PATH=$MACHINE_BUILD_DIR/conf/local.conf
|
||||
LOCAL_CONFIG_FILE_PATH="$MACHINE_BUILD_DIR/conf/local.conf"
|
||||
|
||||
if test -d $BUILD_ROOT_DIR/$machine; then
|
||||
if test ! -L $BUILD_ROOT_DIR/$machine; then
|
||||
# generate build/config symlinks for compatibility
|
||||
if [ -d "$BUILD_ROOT_DIR/$machine" ]; then
|
||||
if [ ! -L "$BUILD_ROOT_DIR/$machine" ]; then
|
||||
my_echo -e "\033[37;1m\tcreate compatible symlinks directory for $machine environment ...\033[0m"
|
||||
do_exec "mv $BUILD_ROOT_DIR/$machine $BUILD_ROOT"
|
||||
do_exec "ln -s $MACHINE_BUILD_DIR $BUILD_ROOT_DIR/$machine"
|
||||
do_exec "mv \"$BUILD_ROOT_DIR/$machine\" \"$BUILD_ROOT\""
|
||||
do_exec "ln -s \"$MACHINE_BUILD_DIR\" \"$BUILD_ROOT_DIR/$machine\""
|
||||
fi
|
||||
fi
|
||||
|
||||
# generate default config
|
||||
if test ! -d $MACHINE_BUILD_DIR/conf; then
|
||||
if [ ! -d "$MACHINE_BUILD_DIR/conf" ]; then
|
||||
my_echo -e "\033[37;1m\tcreating build directory for $machine environment ...\033[0m"
|
||||
do_exec "cd $BUILD_ROOT_DIR"
|
||||
do_exec ". ./oe-init-build-env $MACHINE_BUILD_DIR"
|
||||
# we need a clean config file
|
||||
if test -f $LOCAL_CONFIG_FILE_PATH & test ! -f $LOCAL_CONFIG_FILE_PATH.origin; then
|
||||
# so we save the origin local.conf
|
||||
do_exec "mv $LOCAL_CONFIG_FILE_PATH $LOCAL_CONFIG_FILE_PATH.origin"
|
||||
do_exec "cd \"$BUILD_ROOT_DIR\""
|
||||
do_exec ". ./oe-init-build-env \"$MACHINE_BUILD_DIR\""
|
||||
if [ -f "$LOCAL_CONFIG_FILE_PATH" ] && [ ! -f "$LOCAL_CONFIG_FILE_PATH.origin" ]; then
|
||||
do_exec "mv \"$LOCAL_CONFIG_FILE_PATH\" \"$LOCAL_CONFIG_FILE_PATH.origin\""
|
||||
fi
|
||||
do_exec "cd $BASEPATH"
|
||||
echo "[Desktop Entry]" > $BUILD_ROOT/.directory
|
||||
echo "Icon=folder-green" >> $BUILD_ROOT/.directory
|
||||
do_exec "cd \"$BASEPATH\""
|
||||
echo "[Desktop Entry]" > "$BUILD_ROOT/.directory"
|
||||
echo "Icon=folder-green" >> "$BUILD_ROOT/.directory"
|
||||
fi
|
||||
|
||||
# modify or upgrade config files inside conf directory
|
||||
if test -f $LOCAL_CONFIG_FILE_INC_PATH; then
|
||||
|
||||
if test -f $LOCAL_CONFIG_FILE_PATH; then
|
||||
HASHSTAMP=`MD5SUM $LOCAL_CONFIG_FILE_PATH`
|
||||
do_exec "cp $LOCAL_CONFIG_FILE_PATH $BACKUP_CONFIG_DIR/local.conf.$HASHSTAMP.$BACKUP_SUFFIX"
|
||||
|
||||
# migrate settings after server switch
|
||||
if [ -f "$LOCAL_CONFIG_FILE_INC_PATH" ]; then
|
||||
if [ -f "$LOCAL_CONFIG_FILE_PATH" ]; then
|
||||
HASHSTAMP=$(MD5SUM "$LOCAL_CONFIG_FILE_PATH")
|
||||
do_exec "cp \"$LOCAL_CONFIG_FILE_PATH\" \"$BACKUP_CONFIG_DIR/local.conf.$HASHSTAMP.$BACKUP_SUFFIX\""
|
||||
my_echo "migrate settings within $LOCAL_CONFIG_FILE_INC_PATH..."
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
|
||||
do_exec "sed -i -e 's|http://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|https://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
|
||||
do_exec "sed -i -e 's|archiv.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|sstate.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_INC_PATH"
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_INC_PATH\""
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_INC_PATH\""
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|g' \"$LOCAL_CONFIG_FILE_INC_PATH\""
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|g' \"$LOCAL_CONFIG_FILE_INC_PATH\""
|
||||
do_exec "sed -i -e 's|http://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_INC_PATH\""
|
||||
do_exec "sed -i -e 's|https://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_INC_PATH\""
|
||||
do_exec "sed -i -e 's|archiv.tuxbox-neutrino.org|n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_INC_PATH\""
|
||||
do_exec "sed -i -e 's|sstate.tuxbox-neutrino.org|n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_INC_PATH\""
|
||||
|
||||
my_echo "migrate settings within $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|' $LOCAL_CONFIG_FILE_PATH"
|
||||
|
||||
do_exec "sed -i -e 's|http://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|https://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
|
||||
do_exec "sed -i -e 's|archiv.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|sstate.tuxbox-neutrino.org|n4k.sourceforge.io|' $LOCAL_CONFIG_FILE_PATH"
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_PATH\""
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org|https://n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_PATH\""
|
||||
do_exec "sed -i -e 's|http://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|g' \"$LOCAL_CONFIG_FILE_PATH\""
|
||||
do_exec "sed -i -e 's|https://archiv.tuxbox-neutrino.org/sources|https://n4k.sourceforge.io/sources|g' \"$LOCAL_CONFIG_FILE_PATH\""
|
||||
do_exec "sed -i -e 's|http://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_PATH\""
|
||||
do_exec "sed -i -e 's|https://sstate.tuxbox-neutrino.org|https://n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_PATH\""
|
||||
do_exec "sed -i -e 's|archiv.tuxbox-neutrino.org|n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_PATH\""
|
||||
do_exec "sed -i -e 's|sstate.tuxbox-neutrino.org|n4k.sourceforge.io|g' \"$LOCAL_CONFIG_FILE_PATH\""
|
||||
|
||||
search_line="#UPDATE_SERVER_URL = \"http:\/\/@hostname@\""
|
||||
add_line="UPDATE_SERVER_URL = \"http://$HTTP_ADDRESS\""
|
||||
if ! grep -qF -- "$add_line" "$LOCAL_CONFIG_FILE_INC_PATH"; then
|
||||
# Wenn nicht, füge die neue Zeile nach der spezifischen Zeile ein
|
||||
sed -i -e "/$search_line/a $add_line" "$LOCAL_CONFIG_FILE_INC_PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
# add init note
|
||||
set_file_entry $LOCAL_CONFIG_FILE_PATH "generated" "# auto generated entries by init script"
|
||||
set_file_entry "$LOCAL_CONFIG_FILE_PATH" "generated" "# auto generated entries by init script"
|
||||
|
||||
# add line 1, include for local.conf.common.inc
|
||||
set_file_entry $LOCAL_CONFIG_FILE_PATH "$BASEPATH/local.conf.common.inc" "include $BASEPATH/local.conf.common.inc"
|
||||
set_file_entry "$LOCAL_CONFIG_FILE_PATH" "$BASEPATH/local.conf.common.inc" "include $BASEPATH/local.conf.common.inc"
|
||||
|
||||
# add line 2, machine type
|
||||
M_TYPE='MACHINE = "'`get_real_machine_type $machine`'"'
|
||||
if set_file_entry $LOCAL_CONFIG_FILE_PATH "MACHINE" "$M_TYPE" == 1; then
|
||||
M_TYPE='MACHINE = "'$(get_real_machine_type "$machine")'"'
|
||||
if set_file_entry "$LOCAL_CONFIG_FILE_PATH" "MACHINE" "$M_TYPE"; then
|
||||
my_echo -e "\t\033[37;1m$LOCAL_CONFIG_FILE_PATH has been upgraded with entry: $M_TYPE \033[0m"
|
||||
fi
|
||||
|
||||
# add line 3, machine build
|
||||
M_ID='MACHINEBUILD = "'`get_real_machine_id $machine`'"'
|
||||
if set_file_entry $LOCAL_CONFIG_FILE_PATH "MACHINEBUILD" "$M_ID" == 1; then
|
||||
M_ID='MACHINEBUILD = "'$(get_real_machine_id "$machine")'"'
|
||||
if set_file_entry "$LOCAL_CONFIG_FILE_PATH" "MACHINEBUILD" "$M_ID"; then
|
||||
my_echo -e "\t\033[37;1m$LOCAL_CONFIG_FILE_PATH has been upgraded with entry: $M_ID \033[0m"
|
||||
fi
|
||||
else
|
||||
@@ -335,56 +334,52 @@ function create_local_config () {
|
||||
|
||||
BBLAYER_CONF_FILE="$MACHINE_BUILD_DIR/conf/bblayers.conf"
|
||||
|
||||
# craete backup for bblayer.conf
|
||||
if test -f $BBLAYER_CONF_FILE; then
|
||||
HASHSTAMP=`MD5SUM $BBLAYER_CONF_FILE`
|
||||
do_exec "cp $BBLAYER_CONF_FILE $BACKUP_CONFIG_DIR/bblayer.conf.$HASHSTAMP.$BACKUP_SUFFIX"
|
||||
if [ -f "$BBLAYER_CONF_FILE" ]; then
|
||||
HASHSTAMP=$(MD5SUM "$BBLAYER_CONF_FILE")
|
||||
do_exec "cp \"$BBLAYER_CONF_FILE\" \"$BACKUP_CONFIG_DIR/bblayer.conf.$HASHSTAMP.$BACKUP_SUFFIX\""
|
||||
fi
|
||||
|
||||
META_MACHINE_LAYER=meta-`get_metaname $machine`
|
||||
META_MACHINE_LAYER="meta-$(get_metaname "$machine")"
|
||||
|
||||
set_file_entry "$BBLAYER_CONF_FILE" "generated" "# auto generated entries by init script"
|
||||
|
||||
# add layer entries into bblayer.conf
|
||||
set_file_entry $BBLAYER_CONF_FILE "generated" '# auto generated entries by init script'
|
||||
if [[ -z "$PYTHON2_SRCREV" ]]; then
|
||||
PYTHON2_LAYER_NAME=""
|
||||
fi
|
||||
LAYER_LIST=" $TUXBOX_LAYER_NAME $META_MACHINE_LAYER $OE_LAYER_NAME/meta-oe $OE_LAYER_NAME/meta-networking $PYTHON2_LAYER_NAME $QT5_LAYER_NAME "
|
||||
for LL in $LAYER_LIST ; do
|
||||
if set_file_entry $BBLAYER_CONF_FILE $LL 'BBLAYERS += " '$BUILD_ROOT_DIR'/'$LL' "' == 1;then
|
||||
|
||||
LAYER_LIST="$TUXBOX_LAYER_NAME $META_MACHINE_LAYER $OE_LAYER_NAME/meta-oe $OE_LAYER_NAME/meta-networking $PYTHON2_LAYER_NAME $QT5_LAYER_NAME"
|
||||
for LL in $LAYER_LIST; do
|
||||
if set_file_entry "$BBLAYER_CONF_FILE" "$LL" "BBLAYERS += \"${BUILD_ROOT_DIR}/${LL}\""; then
|
||||
my_echo -e "\t\033[37;1m$BBLAYER_CONF_FILE has been upgraded with entry: $LL... \033[0m"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# function create local dist directory to prepare for web access
|
||||
function create_dist_tree () {
|
||||
|
||||
# create dist dir
|
||||
## Function to create local dist directory to prepare for web access
|
||||
function create_dist_tree() {
|
||||
DIST_BASEDIR="$DIST_DIR/$IMAGE_VERSION"
|
||||
if test ! -d "$DIST_BASEDIR"; then
|
||||
if [ ! -d "$DIST_BASEDIR" ]; then
|
||||
my_echo -e "\033[37;1mcreate dist directory:\033[0m $DIST_BASEDIR"
|
||||
do_exec "mkdir -p $DIST_BASEDIR"
|
||||
do_exec "mkdir -p \"$DIST_BASEDIR\""
|
||||
fi
|
||||
|
||||
# create link sources
|
||||
DIST_LIST=`ls $BUILD_ROOT`
|
||||
for DL in $DIST_LIST ; do
|
||||
DIST_LIST=$(ls "$BUILD_ROOT")
|
||||
for DL in $DIST_LIST; do
|
||||
DEPLOY_DIR="$BUILD_ROOT/$DL/tmp/deploy"
|
||||
do_exec "ln -sf $DEPLOY_DIR $DIST_BASEDIR/$DL"
|
||||
if test -L "$DIST_BASEDIR/$DL/deploy"; then
|
||||
do_exec "unlink $DIST_BASEDIR/$DL/deploy"
|
||||
do_exec "ln -sf \"$DEPLOY_DIR\" \"$DIST_BASEDIR/$DL\""
|
||||
if [ -L "$DIST_BASEDIR/$DL/deploy" ]; then
|
||||
do_exec "unlink \"$DIST_BASEDIR/$DL/deploy\""
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function MD5SUM () {
|
||||
local MD5SUM_FILE=$1
|
||||
MD5STAMP=`md5sum $MD5SUM_FILE |cut -f 1 -d " "`
|
||||
echo $MD5STAMP
|
||||
function MD5SUM() {
|
||||
local MD5SUM_FILE="$1"
|
||||
md5sum "$MD5SUM_FILE" | cut -f 1 -d " "
|
||||
}
|
||||
|
||||
# Function for selecting for items included a custom entry
|
||||
## Function for selecting items with a custom entry
|
||||
function do_select() {
|
||||
local items="$1"
|
||||
SELECTION=""
|
||||
@@ -427,59 +422,42 @@ function do_select() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Remove the last space
|
||||
SELECTION=$(echo "$SELECTION" | sed 's/ $//')
|
||||
|
||||
my_echo "Selected entries: $SELECTION"
|
||||
# Return the selected machines as a string
|
||||
#"$SELECTION" has global scope
|
||||
}
|
||||
|
||||
|
||||
# Reset the build. Nothing is deleted, but rather renamed for safety.
|
||||
# Users can then decide when they want to clean up permanently.
|
||||
## Reset the build. Folders are renamed for safety.
|
||||
function do_reset() {
|
||||
# Make selection and save in a variable
|
||||
do_select "$MACHINES"
|
||||
local selected_machines=$SELECTION
|
||||
local selected_machines="$SELECTION"
|
||||
|
||||
# Check if a selection was made
|
||||
if [ -z "$selected_machines" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Set the start directory from where the search should begin
|
||||
local start_directory="$BUILD_ROOT_DIR" # Adjust to base directory
|
||||
local rename_success=0 # Tracks if a rename was performed
|
||||
local start_directory="$BUILD_ROOT_DIR"
|
||||
local rename_success=0
|
||||
|
||||
# Process the selected machines
|
||||
IFS=' ' read -r -a machines_array <<< "$selected_machines"
|
||||
for machine in "${machines_array[@]}"; do
|
||||
my_echo "Reset is being carried out for: $machine"
|
||||
|
||||
# Save results from find in an array
|
||||
readarray -t found_dirs < <(find "$start_directory" -type f -name "saved_tmpdir")
|
||||
|
||||
# Check if the array contains elements
|
||||
for dir in "${found_dirs[@]}"; do
|
||||
# Read the path from the file
|
||||
tmp_dir_path=$(cat "$dir")
|
||||
# Check if the path exists and matches the machine name
|
||||
if [[ -d "$tmp_dir_path" && "$tmp_dir_path" == *"/$machine/tmp"* ]]; then
|
||||
local timestamp=$(date '+%Y%m%d_%H%M%S')
|
||||
do_exec "mv "$tmp_dir_path" "${tmp_dir_path%/*}/tmp_${timestamp}""
|
||||
local timestamp
|
||||
timestamp=$(date '+%Y%m%d_%H%M%S')
|
||||
do_exec "mv \"$tmp_dir_path\" \"${tmp_dir_path%/*}/tmp_${timestamp}\""
|
||||
my_echo "Folder $tmp_dir_path was renamed to ${tmp_dir_path%/*}/tmp_${timestamp}."
|
||||
rename_success=1
|
||||
break # Exit the loop after the first successful rename
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Check if reset was performed
|
||||
if [ "$rename_success" -eq 0 ]; then
|
||||
my_echo "\033[33mNo reset could be performed.\033[0m"
|
||||
else
|
||||
my_echo "Reset succeeded."
|
||||
fi
|
||||
}
|
||||
|
||||
|
12
init.sh
12
init.sh
@@ -151,14 +151,14 @@ if [[ ! " $COMPATIBLE_IMAGE_VERSIONS " =~ " $IMAGE_VERSION " ]]; then
|
||||
fi
|
||||
|
||||
## Layer sources
|
||||
YOCTO_GIT_URL="https://git.yoctoproject.org/git/poky"
|
||||
POKY="poky"
|
||||
YOCTO_GIT_URL="https://github.com/yoctoproject/poky.git"
|
||||
POKY="$(basename $YOCTO_GIT_URL .git)"
|
||||
POKY_NAME="$IMAGE_VERSION" #TODO
|
||||
BUILD_ROOT_DIR="$BASEPATH/$POKY-$IMAGE_VERSION"
|
||||
BUILD_ROOT="$BUILD_ROOT_DIR/build"
|
||||
|
||||
OE_LAYER_NAME=meta-openembedded
|
||||
OE_LAYER_GIT_URL=https://git.openembedded.org/meta-openembedded
|
||||
OE_LAYER_GIT_URL=https://github.com/openembedded/meta-openembedded.git
|
||||
OE_LAYER_PATCH_LIST=""
|
||||
|
||||
OE_CORE_LAYER_NAME=openembedded-core
|
||||
@@ -181,7 +181,7 @@ case "$IMAGE_VERSION" in
|
||||
esac
|
||||
|
||||
# Check machine type
|
||||
if [ $(is_valid_machine "$MACHINE") == false ]; then
|
||||
if [ "$(is_valid_machine "$MACHINE")" = "false" ]; then
|
||||
my_echo "\033[31;1mNo valid machine defined.\033[0m"
|
||||
my_echo "$HINT_MACHINES"
|
||||
exit 1
|
||||
@@ -274,7 +274,7 @@ HISI_LAYER_NAME=meta-hisilicon #TODO: move into gfutures
|
||||
HISI_LAYER_BRANCH="master"
|
||||
HISI_LAYER_SRCREV="e85e1781704d96f5dfa0c554cf81d24c147d888c"
|
||||
HISI_LAYER_GIT_URL="$PROJECT_URL/$HISI_LAYER_NAME.git"
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_HISI '") == true; then
|
||||
if [ "$MACHINE" == "all" ] || [ $(is_required_machine_layer "' $MACHINES_HISI '") == true ]; then
|
||||
fetch_meta "" $HISI_LAYER_BRANCH $HISI_LAYER_GIT_URL "$HISI_LAYER_SRCREV" $BUILD_ROOT_DIR/$HISI_LAYER_NAME
|
||||
fi
|
||||
|
||||
@@ -340,7 +340,7 @@ my_echo ""
|
||||
my_echo "\033[37;1mUpdating build evironment and meta-layers\033[0m"
|
||||
my_echo "------------------------------------------------------------------------------------------------"
|
||||
my_echo ""
|
||||
my_echo "\033[37;1m\texecute: $USER_CALL\033[0m \033[32;1m--update\033[0m"
|
||||
my_echo "\033[37;1m\texecute: $0\033[0m \033[32;1m--update\033[0m"
|
||||
my_echo ""
|
||||
my_echo "------------------------------------------------------------------------------------------------"
|
||||
|
||||
|
10
translate-md-config.json
Normal file
10
translate-md-config.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"template_md": "template.md",
|
||||
"output_dir": ".",
|
||||
"prefix": "README_",
|
||||
"main_doc": "README.md",
|
||||
"target_languages": {
|
||||
"de": ["German", "🇩🇪"],
|
||||
"en": ["English", "🇬🇧"]
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user