Compare commits
No commits in common. "3e4d53d" and "develop" have entirely different histories.
5
.gitignore
vendored
5
.gitignore
vendored
@ -5,8 +5,5 @@
|
||||
/bin
|
||||
/tools
|
||||
/gitea-dl
|
||||
/files/etc/emissary
|
||||
/files/usr/local/bin/emissary
|
||||
/files/var/lib/emissary
|
||||
/files/usr/share/emissary
|
||||
/files
|
||||
/.gitea-release
|
105
Jenkinsfile
vendored
Normal file
105
Jenkinsfile
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
pipeline {
|
||||
agent {
|
||||
dockerfile {
|
||||
filename 'Dockerfile'
|
||||
dir 'misc/jenkins'
|
||||
}
|
||||
}
|
||||
|
||||
parameters {
|
||||
persistentText(name: 'emissaryRelease', defaultValue: 'latest', description: 'Numéro de release Emissary', successfulOnly: false)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Cancel older jobs') {
|
||||
steps {
|
||||
script {
|
||||
def buildNumber = env.BUILD_NUMBER as int
|
||||
if (buildNumber > 1) milestone(buildNumber - 1)
|
||||
milestone(buildNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Update emissary release') {
|
||||
when {
|
||||
branch 'master'
|
||||
expression {
|
||||
return params.emissaryRelease != 'latest'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
currentEmissaryRelease = readFile('emissary_release.txt').trim()
|
||||
|
||||
if (currentEmissaryRelease == params.emissaryRelease) {
|
||||
currentBuild.result = 'SUCCESS'
|
||||
return
|
||||
}
|
||||
|
||||
withCredentials([
|
||||
usernamePassword([
|
||||
credentialsId: 'forge-jenkins',
|
||||
usernameVariable: 'GIT_USERNAME',
|
||||
passwordVariable: 'GIT_PASSWORD'
|
||||
])
|
||||
]) {
|
||||
sh """
|
||||
git config user.email "jenkins@cadoles.com"
|
||||
git config user.name "Jenkins"
|
||||
git config credential.https://forge.cadoles.com.username "\$GIT_USERNAME"
|
||||
git config credential.https://forge.cadoles.com.helper '!f() { test "\$1" = get && echo "password=\$GIT_PASSWORD"; }; f'
|
||||
|
||||
echo '${params.emissaryRelease}' > emissary_release.txt
|
||||
git add emissary_release.txt
|
||||
git commit -m "feat: use emissary ${params.emissaryRelease}"
|
||||
git push origin \$(git rev-parse HEAD):${env.GIT_BRANCH}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
withCredentials([
|
||||
usernamePassword([
|
||||
credentialsId: 'forge-jenkins',
|
||||
usernameVariable: 'GITEA_DOWNLOAD_USERNAME',
|
||||
passwordVariable: 'GITEA_DOWNLOAD_PASSWORD'
|
||||
])
|
||||
]) {
|
||||
sh '''
|
||||
make download-emissary-release
|
||||
make all
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Release') {
|
||||
when {
|
||||
branch 'master'
|
||||
}
|
||||
steps {
|
||||
withCredentials([
|
||||
usernamePassword([
|
||||
credentialsId: 'forge-jenkins',
|
||||
usernameVariable: 'GITEA_RELEASE_USERNAME',
|
||||
passwordVariable: 'GITEA_RELEASE_PASSWORD'
|
||||
])
|
||||
]) {
|
||||
sh 'make gitea-release'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
73
Makefile
73
Makefile
@ -2,31 +2,38 @@ OPENWRT_DEVICE ?= 192.168.1.1
|
||||
BACKUP_DATE ?=
|
||||
|
||||
GIT_VERSION := $(shell git describe --always)
|
||||
DATE_VERSION := $(shell date +%Y.%m.%d)
|
||||
FULL_VERSION := v$(DATE_VERSION)-$(GIT_VERSION)
|
||||
|
||||
OPENWRT_VERSION ?= 22.03.2
|
||||
OPENWRT_VERSION ?= 23.05.2
|
||||
OPENWRT_TARGET ?= mvebu/cortexa9
|
||||
OPENWRT_TARGET_DASHED ?= $(shell echo $(OPENWRT_TARGET) | sed 's|/|-|')
|
||||
OPENWRT_PROFILE ?= linksys_wrt1200ac
|
||||
OPENWRT_PACKAGES ?= $(shell cat packages.txt)
|
||||
EXTRA_IMAGE_NAME ?= emissary-$(GIT_VERSION)
|
||||
EXTRA_IMAGE_NAME ?= emissary-$(FULL_VERSION)
|
||||
BIN_DIR_NAME_SUFFIX ?=
|
||||
|
||||
IMAGEBUILDER_URL ?= https://downloads.openwrt.org/releases/$(OPENWRT_VERSION)/targets/$(OPENWRT_TARGET)/openwrt-imagebuilder-$(OPENWRT_VERSION)-$(OPENWRT_TARGET_DASHED).Linux-x86_64.tar.xz
|
||||
|
||||
IMAGEBUILDER_ARCHIVE_PATH := tmp/imagebuilder-$(OPENWRT_VERSION)-$(OPENWRT_TARGET_DASHED).tar.xz
|
||||
IMAGEBUILDER_DIR_PATH := $(PWD)/imagebuilder/$(OPENWRT_VERSION)/$(OPENWRT_TARGET)
|
||||
IMAGEBUILDER_ARCHIVE_PATH ?= tmp/imagebuilder-$(OPENWRT_VERSION)-$(OPENWRT_TARGET_DASHED).tar.xz
|
||||
IMAGEBUILDER_DIR_PATH ?= $(PWD)/imagebuilder/$(OPENWRT_VERSION)/$(OPENWRT_TARGET)
|
||||
IMAGEBUILDER_CUSTOM_PACKAGES_DIR_PATH := $(IMAGEBUILDER_DIR_PATH)/packages
|
||||
IMAGEBUILDER_CUSTOM_FILES_DIR_PATH := $(IMAGEBUILDER_DIR_PATH)/files
|
||||
|
||||
BIN_DIR := "$(shell readlink -f bin)/$(OPENWRT_VERSION)/$(OPENWRT_TARGET)/$(OPENWRT_PROFILE)$(BIN_DIR_NAME_SUFFIX)"
|
||||
|
||||
GITEA_DOWNLOAD_RELEASE_NAME ?= latest
|
||||
EMISSARY_RELEASE ?= $(shell cat emissary_release.txt)
|
||||
EMISSARY_ARCH ?= armv6
|
||||
|
||||
EMISSARY_RECONCILIATION_INTERVAL ?=
|
||||
EMISSARY_SERVER_URL ?=
|
||||
|
||||
BASE_INSTALL ?= install-emissary-files install-common-uci-defaults install-common-additional-agent-collectors
|
||||
ADDITIONAL_INSTALL ?=
|
||||
ADDITIONAL_OPENWRT_PACKAGES ?=
|
||||
|
||||
include targets/*.mk
|
||||
include install/*.mk
|
||||
|
||||
all:
|
||||
|
||||
@ -39,16 +46,17 @@ build: $(IMAGEBUILDER_DIR_PATH) $(IMAGEBUILDER_CUSTOM_PACKAGES_DIR_PATH) $(IMAGE
|
||||
|
||||
# Cleanup old packages signature
|
||||
rm -f $(IMAGEBUILDER_DIR_PATH)/Packages $(IMAGEBUILDER_DIR_PATH)/Packages.gz $(IMAGEBUILDER_DIR_PATH)/Packages.sig
|
||||
|
||||
|
||||
# Build firmware
|
||||
$(MAKE) \
|
||||
-C "$(IMAGEBUILDER_DIR_PATH)" \
|
||||
EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
|
||||
PROFILE="$(OPENWRT_PROFILE)" \
|
||||
PACKAGES="$(OPENWRT_PACKAGES)" \
|
||||
PACKAGES="$(OPENWRT_PACKAGES) $(ADDITIONAL_OPENWRT_PACKAGES)" \
|
||||
CONFIG_IPV6=n \
|
||||
FILES="$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)" \
|
||||
BIN_DIR="$(BIN_DIR)" \
|
||||
ROOTFS_PARTSIZE="$(ROOTFS_PARTSIZE)" \
|
||||
clean image
|
||||
|
||||
$(IMAGEBUILDER_DIR_PATH): $(IMAGEBUILDER_ARCHIVE_PATH)
|
||||
@ -70,12 +78,12 @@ $(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH):
|
||||
rm -rf "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)"
|
||||
mkdir -p "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc"
|
||||
|
||||
echo "# Firmware built with https://forge.cadoles.com/Cadoles/emissary-firmware" > "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
|
||||
echo "BUILD_DATE=$(shell date --iso-8601=seconds)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
|
||||
echo "GIT_VERSION=$(GIT_VERSION)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
|
||||
echo "# Firmware built with https://forge.cadoles.com/arcad/emissary-firmware" > "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
|
||||
echo "FIRMWARE_VERSION=$(FULL_VERSION)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
|
||||
echo "OPENWRT_PROFILE=$(OPENWRT_PROFILE)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
|
||||
|
||||
$(MAKE) copy-emissary-files
|
||||
rm -rf files/*
|
||||
$(MAKE) $(BASE_INSTALL) $(ADDITIONAL_INSTALL)
|
||||
|
||||
cp -rf files/* $(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/
|
||||
|
||||
@ -93,17 +101,18 @@ gitea-release: tools/gitea-release/bin/gitea-release.sh
|
||||
\( -name '*.img.gz' \
|
||||
-or -name '*.bin' \
|
||||
-or -name '*.img' \
|
||||
-or -name '*.itb' \
|
||||
\) -exec cp {} .gitea-release/ \;
|
||||
|
||||
GITEA_RELEASE_PROJECT="emissary-firmware" \
|
||||
GITEA_RELEASE_ORG="arcad" \
|
||||
GITEA_RELEASE_BASE_URL="https://forge.cadoles.com" \
|
||||
GITEA_RELEASE_VERSION="$(GIT_VERSION)" \
|
||||
GITEA_RELEASE_NAME="$(GIT_VERSION)" \
|
||||
GITEA_RELEASE_VERSION="$(FULL_VERSION)" \
|
||||
GITEA_RELEASE_NAME="$(FULL_VERSION)" \
|
||||
GITEA_RELEASE_COMMITISH_TARGET="$(GIT_VERSION)" \
|
||||
GITEA_RELEASE_IS_DRAFT="false" \
|
||||
GITEA_RELEASE_BODY="" \
|
||||
GITEA_RELEASE_ATTACHMENTS="$(shell find .gitea-release/* -type f)" \
|
||||
GITEA_RELEASE_BODY='Based on OpenWRT [`$(OPENWRT_VERSION)`](https://downloads.openwrt.org/releases/$(OPENWRT_VERSION)/targets/) and with Emissary [`$(EMISSARY_RELEASE)`](https://forge.cadoles.com/arcad/emissary/releases/tag/$(EMISSARY_RELEASE))' \
|
||||
GITEA_RELEASE_ATTACHMENTS="$$(find .gitea-release/* -type f)" \
|
||||
tools/gitea-release/bin/gitea-release.sh
|
||||
|
||||
.PHONY: download-emissary-release
|
||||
@ -112,36 +121,10 @@ download-emissary-release: tools/gitea-download/bin/gitea-download.sh
|
||||
GITEA_DOWNLOAD_PROJECT="emissary" \
|
||||
GITEA_DOWNLOAD_ORG="arcad" \
|
||||
GITEA_DOWNLOAD_BASE_URL="https://forge.cadoles.com" \
|
||||
GITEA_DOWNLOAD_RELEASE_NAME="$(GITEA_DOWNLOAD_RELEASE_NAME)" \
|
||||
GITEA_DOWNLOAD_RELEASE_NAME="$(EMISSARY_RELEASE)" \
|
||||
GITEA_DOWNLOAD_ATTACHMENTS_FILTER="\.tar\.gz$$" \
|
||||
tools/gitea-download/bin/gitea-download.sh
|
||||
|
||||
.PHONY: copy-emissary-files
|
||||
copy-emissary-files: download-emissary-release tools/yq/bin/yq tools/upx/bin/upx
|
||||
mkdir -p gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)
|
||||
cd gitea-dl && tar -xzf emissary-agent_*_linux_$(EMISSARY_ARCH).tar.gz -C emissary-agent_linux_$(EMISSARY_ARCH)
|
||||
|
||||
# Copy agent config
|
||||
mkdir -p files/etc/emissary
|
||||
cp gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)/misc/packaging/common/config-agent.yml files/etc/emissary/agent.yml
|
||||
|
||||
# Patch agent config
|
||||
tools/yq/bin/yq -i '.agent.controllers.spec.serverUrl = "$${EMISSARY_SERVER_URL}"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.reconciliationInterval = "$${EMISSARY_RECONCILIATION_INTERVAL}"' files/etc/emissary/agent.yml
|
||||
|
||||
# Copy emissary binary
|
||||
mkdir -p files/usr/local/bin
|
||||
cp gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)/emissary files/usr/local/bin/emissary
|
||||
chmod +x files/usr/local/bin/emissary
|
||||
|
||||
# Set defaults
|
||||
mkdir -p files/etc/emissary
|
||||
rm -rf files/etc/emissary/default.conf
|
||||
echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/etc/emissary/default.conf
|
||||
echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/etc/emissary/default.conf
|
||||
|
||||
# Compress emissary binary
|
||||
tools/upx/bin/upx -9 files/usr/local/bin/emissary
|
||||
|
||||
tools/gitea-release/bin/gitea-release.sh:
|
||||
mkdir -p tools/gitea-release/bin
|
||||
curl --output tools/gitea-release/bin/gitea-release.sh https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/gitea/gitea-release.sh
|
||||
@ -162,5 +145,5 @@ UPX_VERSION := 4.0.2
|
||||
tools/upx/bin/upx:
|
||||
mkdir -p tools/upx/bin
|
||||
curl -L --output tools/upx/upx-$(UPX_VERSION)-amd64_linux.tar.xz https://github.com/upx/upx/releases/download/v$(UPX_VERSION)/upx-$(UPX_VERSION)-amd64_linux.tar.xz
|
||||
cd tools/upx && tar -xJf upx-$(UPX_VERSION)-amd64_linux.tar.xz
|
||||
ln -s $(shell readlink -f tools/upx/upx-$(UPX_VERSION)-amd64_linux/upx) tools/upx/bin/upx
|
||||
cd tools/upx && tar -xJf upx-$(UPX_VERSION)-amd64_linux.tar.xz && wait $$!
|
||||
$(SHELL) -c 'ln -s $$(readlink -f tools/upx/upx-$(UPX_VERSION)-amd64_linux/upx) tools/upx/bin/upx'
|
@ -1,6 +1,20 @@
|
||||
# Documentation
|
||||
|
||||
## Structure du projet
|
||||
|
||||
```shell
|
||||
doc/ # Documentation technique
|
||||
install/ # Tâches Make d'installation spécifiques aux différentes cibles de construction
|
||||
misc/ # Fichiers spécifiques aux différentes cibles de construction
|
||||
targets/ # Tâches Make de définition des différentes cibles de construction
|
||||
```
|
||||
|
||||
## Tutoriels
|
||||
|
||||
- [Premiers pas](./tutorials/first-steps.md)
|
||||
- [Compiler un firmware](./tutorials/firmware-compilation.md)
|
||||
- [Flasher une borne](./tutorials/device-flashing.md)
|
||||
- [Flasher une borne](./tutorials/device-flashing.md)
|
||||
|
||||
## Fiches matériel
|
||||
|
||||
- [Banana Pi](./hardware/bananapi.md)
|
||||
|
140
doc/hardware/bananapi.md
Normal file
140
doc/hardware/bananapi.md
Normal file
@ -0,0 +1,140 @@
|
||||
# BananaPi
|
||||
|
||||

|
||||
|
||||
## Caractéristiques
|
||||
|
||||
- MediaTek MT7986(Filogic 830) Quad core ARM Cortex A53
|
||||
- Wifi 6 2.4G/5G(MT7976C)
|
||||
- 2G DDR RAM
|
||||
- 8G eMMC flash
|
||||
- 128MB Nand flash
|
||||
- 2x 2.5GbE network port
|
||||
- 1x M.2 Key B USB inerface
|
||||
- 1x M.2 KEY M PCIe inerface
|
||||
- 1x USB2.0 interface
|
||||
- 1x Wan port (gigabit)
|
||||
- 4x LAN port (gigabit)
|
||||
|
||||
## Installation
|
||||
|
||||
Par défaut, la borne est livrée sans système d'exploitation, ce qui rend impossible la procédure de flashage conventionnelle.
|
||||
|
||||
BPI fournit un logiciel qui permet de prendre un fichier .img et de le mettre en place sur une carte SD.
|
||||
|
||||
### Installation bpi-tools
|
||||
|
||||
Il est recommandé d'installer préalablement pv pour plus de commodité. (Disponible et validé sur Ubuntu et Manjaro)
|
||||
|
||||
```Shell
|
||||
apt-get install pv
|
||||
```
|
||||
|
||||
Pour installer bpi-tools sur votre machine, si vous ne pouvez pas accéder à l'URL via curl, rendez-vous sur le dépôt de bpi-tools et effectuez le processus manuellement.
|
||||
|
||||
```Shell
|
||||
curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
|
||||
```
|
||||
|
||||
### Installation firmware avec emissary
|
||||
|
||||
Dans cet exemple, nous partirons de l'image OpenWrt avec Emissary suivante : ```openwrt-22.03.2-emissary-v2023.08.02-bec8917-bcm27xx-bcm2711-rpi-4-squashfs-factory.img```
|
||||
|
||||
1. Téléchargement de l'image : Téléchargez l'image depuis la [forge cadoles](https://forge.cadoles.com/arcad/emissary-firmware/releases)
|
||||
Après le téléchargement, vous obtiendrez un fichier au format .gz.</br>
|
||||
2. Extraction : Exécutez la commande suivante pour extraire l'image (remplacez les ```**``` par les détails spécifiques du fichier) : ```gunzip openwrt-**-emissary-***-****-**-**-rpi-4-squashfs-factory.img.gz```
|
||||
3. Déplacement dans le dossier : Placez-vous dans le dossier contenant le fichier .img.
|
||||
4. Connexion de la carte SD : Branchez la carte SD sur votre machine. Pour vérifier l'identification de la carte, vous pouvez utiliser la commande ```dmesg``` et examiner les dernières lignes (généralement /dev/sda).
|
||||
5. Vérification du chemin d'accès : Confirmez le chemin d'accès à la carte SD (/dev/sd...).
|
||||
6. Copie sur la carte SD : Lancez la copie sur la carte SD en utilisant la commande bpi-copy (remplacez le nom de l'image et le chemin d'accès à la carte SD) :
|
||||
|
||||
```Shell
|
||||
sudo bpi-copy openwrt-22.03.2-emissary-v2023.08.02-bec8917-bcm27xx-bcm2711-rpi-4-squashfs-factory.img /dev/sda
|
||||
```
|
||||
|
||||
Le résultat ressemblera à ceci :
|
||||
|
||||
```Shell
|
||||
==============================================================
|
||||
jeu. 03 août 2023 10:09:12 CEST
|
||||
*** start COPY (blue led on ) .....
|
||||
umount device: /dev/sda
|
||||
umount /dev/sda1
|
||||
umount /dev/sda2
|
||||
==============================================================
|
||||
IMGFILE=openwrt-22.03.2-emissary-v2023.08.02-bec8917-bcm27xx-bcm2711-rpi-4-squashfs-factory.img
|
||||
==============================================================
|
||||
img
|
||||
8+1 enregistrements lus
|
||||
8+1 enregistrements écrits
|
||||
90475842 octets (90 MB, 86 MiB) copiés, 0,130052 s, 696 MB/s
|
||||
86,3MiO 0:00:00 [ 648MiO/s] [ <=> ]
|
||||
0+1381 enregistrements lus
|
||||
0+1381 enregistrements écrits
|
||||
*** end COPY (blue led off) .....
|
||||
jeu. 03 août 2023 10:09:18 CEST
|
||||
==============================================================
|
||||
RUNTIME 0:6
|
||||
OK!! You can remove the BOOTDISK /dev/sda now!!
|
||||
```
|
||||
|
||||
Une fois la copie terminée, retirez la carte SD. Vous pouvez maintenant l'insérer dans le boîtier de destination.
|
||||
|
||||
Après avoir flashé la carte, assurez-vous que les commutateurs sont correctement positionnés (sélection du boot), insérez la carte SD et branchez la borne.
|
||||
|
||||
Connectez-vous à un port LAN du boîtier qui distribuera une adresse IP via DHCP. Vous pourrez ensuite utiliser SSH pour y accéder.
|
||||
|
||||
### OS pour banana-bpi fournit par bpi
|
||||
|
||||
Pour installer OpenWrt sur le BPI-R3, vous devez d'abord télécharger l'image ```bananapi_bpi-r3-sdcard.img.gz``` fourni par OpenWrt. Vous pouvez le télécharger depuis leur [page de téléchargement](https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/). Si vous ne trouvez pas le fichier directement, suivez ces indications :
|
||||
|
||||
1. Accédez à la page de téléchargement OpenWrt (cf image suivante).
|
||||
2. Recherchez le dossier correspondant au modèle de votre matériel, dans ce cas bananapi_bpi-r3.
|
||||
3. Téléchargez le fichier bananapi_bpi-r3-sdcard.img.gz.
|
||||
|
||||

|
||||
|
||||
Après avoir téléchargé le fichier, vous pouvez continuer avec les étapes d'installation.
|
||||
|
||||
#### Flash du Firmware OpenWrt pour BPI
|
||||
|
||||
Suivez les étapes ci-dessous pour flasher la carte avec le firmware OpenWrt pour BPI :
|
||||
|
||||
1. Téléchargement de l'image : Si vous avez suivi les instructions précédentes, vous devriez avoir l'image de l'OS.
|
||||
2. Extraction de l'image : Exécutez la commande suivante pour extraire l'image (remplacez les **** par les détails spécifiques du fichier) : ```gunzip bananapi_****.img.gz```
|
||||
3. Placement de l'image : Placez-vous dans le dossier contenant le fichier .img.
|
||||
4. Branchement de la carte SD : Branchez la carte SD sur votre machine. Pour vérifier son identification, utilisez ```dmesg``` et observez les dernières lignes (généralement sda).
|
||||
5. Copie sur la carte SD : Lancez la copie sur la carte SD en utilisant la commande bpi-copy (remplacez les détails de l'image et le chemin d'accès à la carte SD) :
|
||||
|
||||
```Shell
|
||||
sudo bpi-copy bananapi_bpi-r3-sdcard.img /dev/sda
|
||||
```
|
||||
|
||||
Une fois la carte flashée, assurez-vous que le switch a tous ses jumpers orientés vers le haut (sélection du boot). Insérez ensuite la carte SD et branchez la borne.
|
||||
|
||||
Assurez-vous que votre carte réseau est configurée comme suit :
|
||||
|
||||
- Réseau : 192.168.1.0/24
|
||||
- Passerelle : 192.168.1.1
|
||||
|
||||
Brancher votre câble RJ45 sur le port VLAN1, et connectez vous en ssh.(temps de boot moins de 30 secondes)
|
||||
|
||||
```Shell
|
||||
ssh root@192.168.1.1
|
||||
```
|
||||
|
||||
Pour la première connexion, aucun mot de passe n'est requis.
|
||||
|
||||
## FAQ
|
||||
|
||||
### Sélection du Système de Boot
|
||||
|
||||
Pour choisir le système de boot, il suffit de manipuler un switch composé de quatre jumpers. Par défaut, ils sont tous en position haute, ce qui configure le démarrage à partir de la carte microSD.
|
||||
|
||||

|
||||
|
||||
### Noms des Périphériques Réseau
|
||||
|
||||
Par défaut, les périphériques réseau sont disposés et nommés comme suit :
|
||||
|
||||

|
BIN
doc/img/bpi-r3-case.jpg
Normal file
BIN
doc/img/bpi-r3-case.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 162 KiB |
BIN
doc/img/bpi-r3-download.png
Normal file
BIN
doc/img/bpi-r3-download.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
doc/img/bpi-r3-lan-pic.jpg
Normal file
BIN
doc/img/bpi-r3-lan-pic.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
doc/img/bpi-r3-switch.png
Normal file
BIN
doc/img/bpi-r3-switch.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -1,5 +1,7 @@
|
||||
# Flasher une borne
|
||||
|
||||
> TODO
|
||||
|
||||
```shell
|
||||
# Construire le firmware
|
||||
make <target>
|
||||
|
@ -1,16 +1,94 @@
|
||||
# Compiler un firmware
|
||||
|
||||
> TODO
|
||||
## Compiler un firmware préconfiguré
|
||||
|
||||
L'ensemble des cibles de construction préconfigurés sont disponibles dans le répertoire `targets/`.
|
||||
|
||||
Par exemple:
|
||||
|
||||
```shell
|
||||
# Exemple: construire un firmware OpenWRT
|
||||
# Télécharger localement les dernières archive du projet emissary
|
||||
make download-emissary-release
|
||||
|
||||
# Pour le routeur Linksys WRT1200AC
|
||||
# Puis...
|
||||
|
||||
# ... pour le routeur Linksys WRT1200AC
|
||||
make linksys-wrt1200ac
|
||||
|
||||
# Pour le routeur Linksys WRT1900AC
|
||||
# ... ou pour le routeur Linksys WRT1900AC
|
||||
make linksys-wrt1900ac
|
||||
|
||||
# Pourt le router Linksys WRT3200ACM
|
||||
# ... ou pour le routeur Linksys WRT3200ACM
|
||||
make linksys-wrt3200acm
|
||||
```
|
||||
```
|
||||
|
||||
## Créer une nouvelle cible de construction
|
||||
|
||||
Dans ce tutoriel, nous allons voir comment créer une nouvelle cible de construction pour un nouvel appareil, ici un [Banana Pi R3](https://wiki.banana-pi.org/Banana_Pi_BPI-R3).
|
||||
|
||||
### Créer la nouvelle tâche Make
|
||||
|
||||
1. Dans le répertoire `targets/`, créer le fichier `bananapi.mk`
|
||||
|
||||
```shell
|
||||
touch targets/bananapi.mk
|
||||
```
|
||||
|
||||
2. Éditer le fichier `targets/bananapi.mk` pour créer la nouvelle tâche Make
|
||||
|
||||
```makefile
|
||||
# On ajoute notre nouvelle tâche "bpi-r3" en dépendance de la tâche
|
||||
# principale "all"
|
||||
all: bpi-r3
|
||||
|
||||
# On créait une nouvelle tâche "bpi-r3" permettant de construire le
|
||||
# firmware pour notre BananaPi R3
|
||||
bpi-r3:
|
||||
$(MAKE) \
|
||||
OPENWRT_VERSION="snapshot" \
|
||||
IMAGEBUILDER_URL="https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-imagebuilder-mediatek-filogic.Linux-x86_64.tar.xz" \
|
||||
ADDITIONAL_INSTALL="" \
|
||||
OPENWRT_TARGET="mediatek/filogic" \
|
||||
EMISSARY_ARCH="arm64" \
|
||||
OPENWRT_PROFILE="bananapi_bpi-r3" \
|
||||
build
|
||||
```
|
||||
|
||||
**Explication des variables**
|
||||
|
||||
- `OPENWRT_VERSION`: Version d'OpenWRT à utiliser. _Normalement prédéfinie par le fichier `Makefile` principal mais ill est ici nécessaire de surcharger la variable car il n'existe à ce jour pas de version stable d'OpenWRT pour la BananaPi R3._
|
||||
- `IMAGEBUILDER_URL`: URL à utiliser pour télécharger le "builder" OpenWRT. _Normalement prédéfinie par le fichier `Makefile` principal mais ill est ici nécessaire de surcharger la variable car il n'existe à ce jour pas de version stable d'OpenWRT pour la BananaPi R3._
|
||||
- `ADDITIONAL_INSTALL`: Tâches Make d'installation supplémentaires à exécuter. Voir section suivante.
|
||||
- `OPENWRT_TARGET`: "Cible" OpenWRT associée à l'appareil
|
||||
- `EMISSARY_ARCH`: Architecture du binaire Emissary à déployer dans le firmware
|
||||
- `OPENWRT_PROFILE`: "Profil" OpenWRT associé à l'appareil
|
||||
|
||||
3. Préparation.
|
||||
|
||||
Lancer la commande suivante pour télécharger (ou mettre à jours) les fichiers tar.gz nécessaire à la construction du firmware. Si cette commande n'a pas été exécutée au moins une fois, vous ne serez pas en mesure de construire le ou les firmwares nécessaires.
|
||||
|
||||
```shell
|
||||
make download-emissary-release
|
||||
```
|
||||
|
||||
4. Lancer la compilation du firmware
|
||||
|
||||
```shell
|
||||
make bpi-r3
|
||||
```
|
||||
|
||||
Les fichiers du firmware seront générés dans le répertoire `depot/bin/snapshot/mediatek/filogic/bananapi_bpi-r3/`
|
||||
|
||||
> 🛈 **Comment trouver les valeurs des variables `OPENWRT_TARGET` et `OPENWRT_PROFILE` ?**
|
||||
>
|
||||
> Après avoir trouvé votre appareil sur la [liste de compatibilité d'OpenWRT](https://openwrt.org/toh/start), rechercher l'URL de téléchargement du fichier du firmware, qui devrait ressembler à `https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-mediatek-filogic-bananapi_bpi-r3-sdcard.img.gz`.
|
||||
>
|
||||
> La valeur de `OPENWRT_TARGET` est la chaîne comprenant les 2 répertoires juste après `targets/`, ici `mediatek/filogic`.
|
||||
>
|
||||
> La valeur de `OPENWRT_PROFILE` est la chaîne comprise entre la cible OpenWRT et le type/extension dans le nom de fichier, ici `bananapi_bpi-r3`.
|
||||
|
||||
### Personnaliser votre firmware
|
||||
|
||||
Afin de personnaliser votre firmware, vous pouvez déclarer des nouvelles tâches Make dans le répertoire `install/` et ensuite les référencer dans la variable `ADDITIONAL_INSTALL`.
|
||||
|
||||
Vous pouvez prendre exemple sur le ficher `install/raspberrypi.mk` qui par exemple déploie des fichiers de configuration UCI par défaut ainsi que des scripts [`uci-defaults`](https://openwrt.org/docs/guide-developer/uci-defaults).
|
330
doc/tutorials/first-steps.md
Normal file
330
doc/tutorials/first-steps.md
Normal file
@ -0,0 +1,330 @@
|
||||
# Premiers pas
|
||||
|
||||
## Récupérer et lancer un serveur Emissary sur sa machine
|
||||
|
||||
1. Aller sur [la page "Releases"](https://forge.cadoles.com/arcad/emissary/releases) du projet `arcad/emissary` et télécharger la dernière archive disponible `emissary-server_<version>_linux_<arch>.tar.gz` (où `<arch>` correspond à l'architecture de votre machine).
|
||||
|
||||
2. Extraire l'archive sur votre poste de travail
|
||||
|
||||
3. Dans un terminal, se positionner dans le dossier extrait puis faire:
|
||||
|
||||
```bash
|
||||
./emissary --config '' server config dump > config.yml # Générer un fichier de configuration pour votre instance
|
||||
./emissary -c config.yml server database migrate # Appliquer les migrations à la base de données SQLite
|
||||
./emissary -c config.yml server run # Lancer le serveur Emissary
|
||||
```
|
||||
|
||||
Vous devriez avoir une sortie du type:
|
||||
|
||||
```
|
||||
2023-02-22 20:54:26.876 [INFO] <server.go:100> http server listening
|
||||
2023-02-22 20:54:26.876 [INFO] <run.go:42> listening {"url": "http://127.0.0.1:3000"}
|
||||
```
|
||||
|
||||
## Récupérer et lancer une VM OpenWRT avec l'agent Emissary dans Qemu
|
||||
|
||||
1. Aller sur [la page "Releases"](https://forge.cadoles.com/arcad/emissary-firmware/releases) du projet `arcad/emissary-firmware` et télécharger la dernière archive d'image disque `openwrt-22.03.2-emissary-<gitref>-x86-generic-generic-squashfs-combined.img.gz`.
|
||||
|
||||
2. Décompresser l'image disque téléchargée
|
||||
|
||||
```bash
|
||||
gunzip openwrt-22.03.2-emissary-*-x86-generic-generic-squashfs-combined.img.gz
|
||||
```
|
||||
|
||||
3. Lancer une machine virtuelle avec Qemu en utilisant l'image disque
|
||||
|
||||
```bash
|
||||
qemu-system-x86_64 \
|
||||
-enable-kvm \
|
||||
-nographic \
|
||||
-drive file=$(ls openwrt-22.03.2-emissary-*-x86-generic-generic-squashfs-combined.img),id=d0,if=none \
|
||||
-device ide-hd,drive=d0,bus=ide.0 \
|
||||
-netdev bridge,br=virbr0,id=hn0 \
|
||||
-device e1000,netdev=hn0,id=nic1 \
|
||||
-netdev user,id=hn1 \
|
||||
-device e1000,netdev=hn1,id=nic2
|
||||
```
|
||||
|
||||
La machine virtuelle devrait démarrer. La console s'arrêtera sur une sortie proche de:
|
||||
|
||||
```
|
||||
[ 10.095596] e1000: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
|
||||
[ 10.098872] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
|
||||
[ 11.034720] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
|
||||
```
|
||||
|
||||
Appuyer sur la touche `Entrée`.
|
||||
|
||||
Vous devriez arriver sur le shell OpenWRT avec une sortie équivalente à:
|
||||
|
||||
```
|
||||
BusyBox v1.35.0 (2023-02-18 18:31:16 UTC) built-in shell (ash)
|
||||
|
||||
_______ ________ __
|
||||
| |.-----.-----.-----.| | | |.----.| |_
|
||||
| - || _ | -__| || | | || _|| _|
|
||||
|_______|| __|_____|__|__||________||__| |____|
|
||||
|__| W I R E L E S S F R E E D O M
|
||||
-----------------------------------------------------
|
||||
OpenWrt 22.03.2, r19803-9a599fee93
|
||||
-----------------------------------------------------
|
||||
=== WARNING! =====================================
|
||||
There is no root password defined on this device!
|
||||
Use the "passwd" command to set up a new password
|
||||
in order to prevent unauthorized SSH logins.
|
||||
--------------------------------------------------
|
||||
root@OpenWrt:/#
|
||||
```
|
||||
|
||||
4. Dans la console OpenWRT et via la commande `uci`, modifier l'URL de base du serveur Emissary associé à votre agent:
|
||||
|
||||
```bash
|
||||
uci set emissary.agent.server_url='http://10.0.2.2:3000'
|
||||
```
|
||||
|
||||
> L'adresse `10.0.2.2` correspond à l'IP de la passerelle de la VM et donc à votre machine sur laquelle est lancé le serveur Emissary.
|
||||
|
||||
5. Diminuer l'intervalle de réconciliation de l'agent Emissary pour accélerer le temps de convergence de la configuration pour cette démonstration:
|
||||
|
||||
```bash
|
||||
uci set emissary.agent.reconciliation_interval='10'
|
||||
```
|
||||
|
||||
6. Enregistrer la configuration et relancer le service `emissary-agent`
|
||||
|
||||
```bash
|
||||
uci commit # Enregistrer les modifications de configuration
|
||||
/etc/init.d/emissary-agent restart # Redémarrer le service emissary-agent
|
||||
logread -f # Surveiller les logs de la machine
|
||||
```
|
||||
|
||||
## Autoriser l'agent à communiquer avec le serveur
|
||||
|
||||
1. Sur votre machine, dans un nouveau terminal, interroger l'API avec la commande `curl`
|
||||
|
||||
```bash
|
||||
curl -v http://127.0.0.1:3000/api/v1/agents
|
||||
```
|
||||
|
||||
La sortie devrait ressembler à:
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"agents": [
|
||||
{
|
||||
"id": 1,
|
||||
"remoteId": "24uS35UciKh95pDtMiMXfYUPsfrCXJBvq9uhjvx6mJyx3XVo6qfXk2isHg3oTHw4qyDbPwc57oRkMWRhuBzRgSvd",
|
||||
"status": 0,
|
||||
"createdAt": "2023-02-22T21:18:47.14565137Z",
|
||||
"updatedAt": "2023-02-22T21:18:47.14565137Z"
|
||||
}
|
||||
],
|
||||
"total": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> L'attribut `status` ici égal à `0` indique que l'agent n'est pas encore autorisé à se synchroniser avec les spécifications fournies par le serveur.
|
||||
|
||||
2. Autoriser l'agent à se synchroniser avec les spécifications du serveur
|
||||
|
||||
```bash
|
||||
curl -XPUT -H 'Content-Type:application/json' -d '{"status":1}' "http://127.0.0.1:3000/api/v1/agents/${AGENT_ID}"
|
||||
```
|
||||
|
||||
Où `${AGENT_ID}` est à remplacer par l'identifiant associé à votre agent dans la sortie de l'étape précédente (attribut `id` de l'objet correspondant à votre agent).
|
||||
|
||||
La sortie de la commande devrait ressembler à:
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"agent": {
|
||||
"id": 1,
|
||||
"remoteId": "24uS35UciKh95pDtMiMXfYUPsfrCXJBvq9uhjvx6mJyx3XVo6qfXk2isHg3oTHw4qyDbPwc57oRkMWRhuBzRgSvd",
|
||||
"status": 1,
|
||||
"createdAt": "2023-02-22T21:28:57.174187323Z",
|
||||
"updatedAt": "2023-02-22T21:18:47.14565137Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Votre agent peut désormais commencer à récupérer les spécifications qui lui sont associées sur le serveur.
|
||||
|
||||
## Exemple: modifier le `hostname` de la machine
|
||||
|
||||
> On va utiliser ici la spécification `uci.emissary.cadoles.com` pour modifier la configuration [UCI](https://openwrt.org/docs/guide-user/base-system/uci) de la machine hôte de l'agent Emissary.
|
||||
|
||||
1. Sur votre machine, créer une spécification pour votre agent:
|
||||
|
||||
```bash
|
||||
cat > my-uci-spec.json <<EOF
|
||||
{
|
||||
"Name": "uci.emissary.cadoles.com",
|
||||
"Revision": 0,
|
||||
"Data": {
|
||||
"config": {
|
||||
"packages": [
|
||||
{
|
||||
"name": "system",
|
||||
"configs": [
|
||||
{
|
||||
"name": "system",
|
||||
"options": [
|
||||
{
|
||||
"type": "option",
|
||||
"name": "hostname",
|
||||
"value": "MyEmissaryAgent"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
2. Avec la commande `curl`, charger la spécification pour votre agent:
|
||||
|
||||
```bash
|
||||
curl -XPOST -d @my-uci-spec.json -H 'Content-Type:application/json' "http://127.0.0.1:3000/api/v1/agents/${AGENT_ID}/specs"
|
||||
```
|
||||
|
||||
Le réponse devrait ressembler à:
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"spec": {
|
||||
"id": 2,
|
||||
"name": "uci.emissary.cadoles.com",
|
||||
"data": {
|
||||
"config": {
|
||||
"packages": [
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "system",
|
||||
"options": [
|
||||
{
|
||||
"name": "hostname",
|
||||
"type": "option",
|
||||
"value": "MyEmissaryAgent"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "system"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"revision": 0,
|
||||
"createdAt": "2023-02-22T22:46:12.769547646Z",
|
||||
"updatedAt": "2023-02-22T22:46:12.769547646Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. Dans la console de la VM, après un cycle de réconciliation, vérifier que la configuration a bien été mise à jour:
|
||||
|
||||
```bash
|
||||
uci export system
|
||||
```
|
||||
|
||||
La sortie devrait ressembler à:
|
||||
|
||||
```
|
||||
package system
|
||||
|
||||
config system
|
||||
option hostname 'MyEmissaryAgent'
|
||||
```
|
||||
|
||||
4. Rédémarrer la VM via sa console:
|
||||
|
||||
```shell
|
||||
reboot
|
||||
```
|
||||
|
||||
Après redémarrage, la console devrait être:
|
||||
|
||||
```
|
||||
root@MyEmissaryAgent:/#
|
||||
```
|
||||
|
||||
|
||||
> **Astuce** Dans la console de la VM, vous pouvez utiliser la commande `uci export | /usr/local/bin/emissary agent openwrt uci transform` pour obtenir la représentation JSON d'une configuration UCI existante.
|
||||
|
||||
## Exemple: créer une passerelle vers un site arbitraire
|
||||
|
||||
> On va utiliser ici la spécification `gateway.emissary.cadoles.com` pour créer une passerelle inverse sur la machine vers un site web distant.
|
||||
|
||||
1. Sur votre machine, créer une spécification pour votre agent:
|
||||
|
||||
```bash
|
||||
cat > my-gateway-spec.json <<EOF
|
||||
{
|
||||
"Name": "gateway.emissary.cadoles.com",
|
||||
"Revision": 0,
|
||||
"Data": {
|
||||
"gateways": {
|
||||
"cadoles.com":{
|
||||
"address":":8080",
|
||||
"target":"http://example.com/"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
> Cette spécification déclare une "gateway" pointant vers le site `http://example.com/` et qui écoutera sur le port 8080 (sur toutes les interfaces) sur la machine hébergeant l'agent.
|
||||
|
||||
2. Avec la commande `curl`, charger la spécification pour votre agent:
|
||||
|
||||
```bash
|
||||
curl -XPOST -d @my-gateway-spec.json -H 'Content-Type:application/json' "http://127.0.0.1:3000/api/v1/agents/${AGENT_ID}/specs"
|
||||
```
|
||||
|
||||
Le réponse devrait ressembler à:
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"spec": {
|
||||
"id": 1,
|
||||
"name": "gateway.emissary.cadoles.com",
|
||||
"data": {
|
||||
"gateways": {
|
||||
"cadoles.com": {
|
||||
"address": ":8080",
|
||||
"target": "http://example.com/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"revision": 0,
|
||||
"createdAt": "2023-02-22T21:48:37.542822727Z",
|
||||
"updatedAt": "2023-02-22T21:48:37.542822727Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. Dans la console de la VM, après un cycle de réconciliation, vérifier que la passerelle est bien créée:
|
||||
|
||||
```bash
|
||||
netstat -tlnup
|
||||
```
|
||||
|
||||
La réponse devrait contenir une ligne équivalente à:
|
||||
|
||||
```bash
|
||||
tcp 0 0 :::8080 :::* LISTEN 2100/emissary
|
||||
```
|
1
emissary_release.txt
Normal file
1
emissary_release.txt
Normal file
@ -0,0 +1 @@
|
||||
2024.3.13-stable.821.cec5c78
|
@ -1,5 +0,0 @@
|
||||
package emissary
|
||||
|
||||
config main 'agent'
|
||||
option reconciliation_interval '60'
|
||||
option server_url 'https://emissary.cadol.es'
|
3
install/bananapi.mk
Normal file
3
install/bananapi.mk
Normal file
@ -0,0 +1,3 @@
|
||||
install-bpi-r3-network-config:
|
||||
mkdir -p files/etc/config
|
||||
cp misc/bpi-r3/uci/network files/etc/config/network
|
6
install/common.mk
Normal file
6
install/common.mk
Normal file
@ -0,0 +1,6 @@
|
||||
install-common-uci-defaults:
|
||||
mkdir -p files/etc/uci-defaults
|
||||
cp misc/common/uci-defaults/* files/etc/uci-defaults/
|
||||
|
||||
install-common-additional-agent-collectors: tools/yq/bin/yq
|
||||
tools/yq/bin/yq -i '.agent.collectors += load("misc/common/agent/collectors.yml")' files/etc/emissary/agent.yml
|
51
install/emissary-files.mk
Normal file
51
install/emissary-files.mk
Normal file
@ -0,0 +1,51 @@
|
||||
install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
|
||||
mkdir -p files/etc/config
|
||||
cp -r misc/emissary/config/* files/etc/config/
|
||||
|
||||
mkdir -p files/etc/init.d
|
||||
cp -r misc/emissary/init.d/* files/etc/init.d/
|
||||
|
||||
mkdir -p files/etc/uci-defaults
|
||||
cp -r misc/emissary/uci-defaults/* files/etc/uci-defaults/
|
||||
|
||||
# Copy keep.d files
|
||||
mkdir -p files/lib/upgrade/keep.d
|
||||
cp -r misc/emissary/keep.d/* files/lib/upgrade/keep.d/
|
||||
|
||||
# Copy profile.d files
|
||||
mkdir -p files/etc/profile.d
|
||||
cp -r misc/emissary/profile.d/* files/etc/profile.d/
|
||||
|
||||
mkdir -p gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)
|
||||
cd gitea-dl && tar -xzf emissary-agent_*_linux_$(EMISSARY_ARCH).tar.gz -C emissary-agent_linux_$(EMISSARY_ARCH)
|
||||
|
||||
# Copy agent config
|
||||
mkdir -p files/etc/emissary
|
||||
cp gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)/misc/packaging/common/config-agent.yml files/etc/emissary/agent.yml
|
||||
|
||||
# Patch agent config
|
||||
tools/yq/bin/yq -i '.agent.serverUrl = "$${EMISSARY_SERVER_URL}"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.reconciliationInterval = "$${EMISSARY_RECONCILIATION_INTERVAL}"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.privateKeyPath = "/data/emissary/agent-key.json"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.controllers.persistence.stateFile = "/data/emissary/agent-state.json"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.controllers.sysupgrade.firmwareVersionCommand = ["sh", "-c", "source /etc/emissary_firmware && echo \"$$FIRMWARE_VERSION\""]' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.controllers.app.dataDir = "/data/emissary/apps/data"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.controllers.app.downloadDir = "/data/emissary/apps/bundles"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.sentry.dsn = "$${EMISSARY_SENTRY_DSN}"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.sentry.environment = "$${EMISSARY_SENTRY_ENVIRONMENT}"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.controllers.status.claimURL = "$${EMISSARY_CONTROLLERS_STATUS_CLAIM_URL}"' files/etc/emissary/agent.yml
|
||||
tools/yq/bin/yq -i '.agent.controllers.status.agentURL = "$${EMISSARY_CONTROLLERS_STATUS_AGENT_URL}"' files/etc/emissary/agent.yml
|
||||
|
||||
# Copy emissary binary
|
||||
mkdir -p files/usr/local/bin
|
||||
cp gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)/emissary files/usr/local/bin/emissary
|
||||
chmod +x files/usr/local/bin/emissary
|
||||
|
||||
# Set defaults
|
||||
mkdir -p files/data/emissary
|
||||
rm -rf files/data/emissary/default.conf
|
||||
echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/data/emissary/default.conf
|
||||
echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/data/emissary/default.conf
|
||||
|
||||
# Compress emissary binary
|
||||
tools/upx/bin/upx -9 files/usr/local/bin/emissary
|
3
install/raspberrypi.mk
Normal file
3
install/raspberrypi.mk
Normal file
@ -0,0 +1,3 @@
|
||||
install-rpi-network-config:
|
||||
mkdir -p files/etc/config
|
||||
cp misc/rpi/uci/network files/etc/config/network
|
3
install/turris-omnia.mk
Normal file
3
install/turris-omnia.mk
Normal file
@ -0,0 +1,3 @@
|
||||
install-turris-omnia-uci-defaults:
|
||||
mkdir -p files/etc/uci-defaults
|
||||
cp misc/turris/omnia/uci-defaults/* files/etc/uci-defaults/
|
7
install/x86.mk
Normal file
7
install/x86.mk
Normal file
@ -0,0 +1,7 @@
|
||||
install-x86-network-config:
|
||||
mkdir -p files/etc/config
|
||||
cp misc/x86/uci/network files/etc/config/network
|
||||
|
||||
install-x86-uci-defaults:
|
||||
mkdir -p files/etc/uci-defaults
|
||||
cp misc/x86/uci-defaults/* files/etc/uci-defaults/
|
24
misc/bpi-r3/uci/network
Normal file
24
misc/bpi-r3/uci/network
Normal file
@ -0,0 +1,24 @@
|
||||
config interface 'lan'
|
||||
option type 'bridge'
|
||||
option proto 'static'
|
||||
option ipaddr '192.168.1.1'
|
||||
option netmask '255.255.255.0'
|
||||
list ports 'lan1'
|
||||
list ports 'lan2'
|
||||
list ports 'lan3'
|
||||
list ports 'lan4'
|
||||
list ports 'sfp2'
|
||||
option ip6assign '60'
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
list ports 'eth1'
|
||||
list ports 'wan'
|
||||
option proto 'dhcp'
|
||||
|
||||
config device
|
||||
config interface 'loopback'
|
||||
option device 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
9
misc/common/agent/collectors.yml
Normal file
9
misc/common/agent/collectors.yml
Normal file
@ -0,0 +1,9 @@
|
||||
- name: network-interfaces
|
||||
command: ip
|
||||
args:
|
||||
- addr
|
||||
- show
|
||||
- name: emissary-firmware
|
||||
command: cat
|
||||
args:
|
||||
- /etc/emissary_firmware
|
@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
|
||||
MIN_DISK_SPACE_MB=1000
|
||||
|
||||
list_disks() {
|
||||
lsblk -o NAME -r -d -n
|
||||
}
|
||||
|
||||
main() {
|
||||
local disks=$(list_disks)
|
||||
|
||||
local found_free_space=0
|
||||
local found_device=""
|
||||
|
||||
for device_name in ${disks}; do
|
||||
local device="/dev/${device_name}"
|
||||
echo "Checking disk '$device'..."
|
||||
|
||||
local disk_free_space="$(parted $device unit MB print free 2>/dev/null | grep 'Free Space' | tail -n1 | awk '{ print $3 }')"
|
||||
disk_free_space=${disk_free_space%MB}
|
||||
disk_free_space=$(printf '%.0f' "${disk_free_space:-0}")
|
||||
|
||||
echo "Free space on disk: ${disk_free_space}"
|
||||
|
||||
if [ ! -z "${disk_free_space}" ]; then
|
||||
if [ ${disk_free_space} -gt ${found_free_space} ]; then
|
||||
found_free_space=${disk_free_space}
|
||||
found_device=${device}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "${found_device}" ] || [ ${MIN_DISK_SPACE_MB} -gt ${found_free_space} ]; then
|
||||
echo "No device with sufficient remaining disk space, exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating new partition on '${found_device}' with remaining disk free space"
|
||||
|
||||
local last_partition_end_mb=$(parted "$found_device" unit MB print | awk '/^ [0-9]+ / {start=$3} END {print int(start)}')
|
||||
|
||||
if [ "${last_partition_end_mb}" != "0" ]; then
|
||||
parted -s "${found_device}" -f -a opt mkpart primary "${last_partition_end_mb}MB" '100%'
|
||||
else
|
||||
parted -s "${found_device}" -f -a opt mkpart primary '0%' '100%'
|
||||
fi
|
||||
|
||||
sync
|
||||
|
||||
local last_partition_number=$(parted ${found_device} print | grep -o -e '^ [0-9]*' | awk '{print $1}' | tail -n 1)
|
||||
local new_partition_device=$(lsblk -r -n -o PARTN,NAME ${found_device} | awk -v partition_number="${last_partition_number}" '$1 == partition_number {print $2}')
|
||||
|
||||
mkfs.ext4 -F /dev/${new_partition_device}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Could not initialize filesystem on new partition !"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local new_partition_uuid=$(lsblk -r -n -o PARTN,UUID ${found_device} | awk -v partition_number="${last_partition_number}" '$1 == partition_number {print $2}')
|
||||
|
||||
if [ -z "${new_partition_uuid}" ]; then
|
||||
echo "Could not find partition with number '${last_partition_number}' !"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
umount -f /data
|
||||
rm -rf /data
|
||||
mkdir -p /data
|
||||
|
||||
uci add fstab mount
|
||||
uci set fstab.@mount[-1].target='/data'
|
||||
uci set fstab.@mount[-1].uuid=${new_partition_uuid}
|
||||
uci set fstab.@mount[-1].enabled='1'
|
||||
uci commit fstab
|
||||
|
||||
reload_config
|
||||
}
|
||||
|
||||
main
|
37
misc/common/uci-defaults/99-emissary-common-uci-custom.sh
Normal file
37
misc/common/uci-defaults/99-emissary-common-uci-custom.sh
Normal file
@ -0,0 +1,37 @@
|
||||
#/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
main() {
|
||||
# Update default firewall ruleset
|
||||
uci add firewall rule
|
||||
uci set firewall.@rule[-1].name='Allow SSH on WAN'
|
||||
uci set firewall.@rule[-1].src='wan'
|
||||
uci set firewall.@rule[-1].proto='tcp'
|
||||
uci set firewall.@rule[-1].dest_port='22'
|
||||
uci set firewall.@rule[-1].target='ACCEPT'
|
||||
|
||||
uci add firewall rule
|
||||
uci set firewall.@rule[-1].name='Allow HTTP on WAN'
|
||||
uci set firewall.@rule[-1].src='wan'
|
||||
uci set firewall.@rule[-1].proto='tcp'
|
||||
uci set firewall.@rule[-1].dest_port='80'
|
||||
uci set firewall.@rule[-1].target='ACCEPT'
|
||||
|
||||
uci add firewall rule
|
||||
uci set firewall.@rule[-1].name='Allow HTTPS on WAN'
|
||||
uci set firewall.@rule[-1].src='wan'
|
||||
uci set firewall.@rule[-1].proto='tcp'
|
||||
uci set firewall.@rule[-1].dest_port='443'
|
||||
uci set firewall.@rule[-1].target='ACCEPT'
|
||||
|
||||
uci commit firewall
|
||||
|
||||
# Disable DNS-rebind protection
|
||||
uci set dhcp.@dnsmasq[0].rebind_protection='0'
|
||||
uci commit dhcp
|
||||
|
||||
reload_config
|
||||
}
|
||||
|
||||
main
|
9
misc/emissary/config/emissary
Normal file
9
misc/emissary/config/emissary
Normal file
@ -0,0 +1,9 @@
|
||||
package emissary
|
||||
|
||||
config main 'agent'
|
||||
option reconciliation_interval '60'
|
||||
option server_url 'https://emissary.cadol.es'
|
||||
option claim_url 'https://emissary.cadol.es/hq/claim/%v'
|
||||
option agent_url 'https://emissary.cadol.es/hq/agents/%v'
|
||||
option sentry_dsn ''
|
||||
option sentry_environment ''
|
@ -1,26 +1,30 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
START=50
|
||||
START=99
|
||||
STOP=50
|
||||
|
||||
start_service() {
|
||||
config_load emissary
|
||||
|
||||
mkdir -p /usr/share/emissary
|
||||
mkdir -p /var/lib/emissary
|
||||
mkdir -p /data/emissary
|
||||
|
||||
config_get emissary_reconciliation_interval agent 'reconciliation_interval' "60"
|
||||
config_get emissary_server_url agent 'server_url' "https://emissary.cadol.es"
|
||||
config_get emissary_agent_claim_url agent 'claim_url' "https://emissary.cadol.es/hq/claim/%v"
|
||||
config_get emissary_agent_url agent 'agent_url' "https://emissary.cadol.es/hq/agents/%v"
|
||||
config_get emissary_sentry_dsn agent 'sentry_dsn' ""
|
||||
config_get emissary_sentry_environment agent 'sentry_environment' ""
|
||||
|
||||
local config_file="/etc/emissary/agent.yml"
|
||||
procd_open_instance emissary-agent
|
||||
procd_set_param env EMISSARY_SERVER_URL="$emissary_server_url" EMISSARY_RECONCILIATION_INTERVAL="$emissary_reconciliation_interval"
|
||||
procd_set_param env EMISSARY_SERVER_URL="$emissary_server_url" EMISSARY_RECONCILIATION_INTERVAL="$emissary_reconciliation_interval" EMISSARY_SENTRY_DSN="$emissary_sentry_dsn" EMISSARY_SENTRY_ENVIRONMENT="$emissary_sentry_environment" EMISSARY_CONTROLLERS_STATUS_CLAIM_URL="$emissary_agent_claim_url" EMISSARY_CONTROLLERS_STATUS_AGENT_URL="$emissary_agent_url"
|
||||
procd_set_param command /usr/local/bin/emissary
|
||||
procd_append_param command --workdir /usr/share/emissary
|
||||
procd_append_param command --config "$config_file"
|
||||
procd_append_param command agent run
|
||||
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
||||
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-17280}
|
||||
procd_set_param file "$config_file"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
3
misc/emissary/keep.d/emissary
Normal file
3
misc/emissary/keep.d/emissary
Normal file
@ -0,0 +1,3 @@
|
||||
/etc/machine-id
|
||||
/data/emissary/agent-key.json
|
||||
/data/emissary/apps/data
|
3
misc/emissary/profile.d/99-emissary.sh
Normal file
3
misc/emissary/profile.d/99-emissary.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
export PATH="${PATH}:/usr/local/bin"
|
@ -3,7 +3,7 @@
|
||||
set -e
|
||||
|
||||
main() {
|
||||
local default_config="/etc/emissary/default.conf"
|
||||
local default_config="/data/emissary/default.conf"
|
||||
|
||||
if [ ! -f "${default_config}" ]; then
|
||||
exit 0
|
||||
@ -17,6 +17,12 @@ main() {
|
||||
if [ ! -z "${EMISSARY_SERVER_URL}" ]; then
|
||||
uci set "emissary.agent.server_url=${EMISSARY_SERVER_URL}"
|
||||
fi
|
||||
if [ ! -z "${EMISSARY_SENTRY_DSN}" ]; then
|
||||
uci set "emissary.agent.sentry_dsn=${EMISSARY_SENTRY_DSN}"
|
||||
fi
|
||||
if [ ! -z "${EMISSARY_SENTRY_ENVIRONMENT}" ]; then
|
||||
uci set "emissary.agent.sentry_environment=${EMISSARY_SENTRY_ENVIRONMENT}"
|
||||
fi
|
||||
|
||||
# Commit modifications
|
||||
uci commit
|
14
misc/jenkins/Dockerfile
Normal file
14
misc/jenkins/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
FROM reg.cadoles.com/proxy_cache/library/ubuntu:22.04
|
||||
|
||||
ARG HTTP_PROXY=
|
||||
ARG HTTPS_PROXY=
|
||||
ARG http_proxy=
|
||||
ARG https_proxy=
|
||||
|
||||
# Install dev environment dependencies
|
||||
RUN export DEBIAN_FRONTEND=noninteractive &&\
|
||||
apt-get update -y &&\
|
||||
apt-get install -y --no-install-recommends curl ca-certificates build-essential wget unzip tar git jq gawk python3 rsync file python3-distutils
|
||||
|
||||
# Add LetsEncrypt certificates
|
||||
RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash
|
9
misc/rpi/uci/network
Normal file
9
misc/rpi/uci/network
Normal file
@ -0,0 +1,9 @@
|
||||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'wan'
|
||||
option ifname 'eth0'
|
||||
option proto 'dhcp'
|
@ -6,24 +6,14 @@ ssh-copy-id root@${OPENWRT_DEVICE}
|
||||
|
||||
TARGET_ARCH=$(ssh root@${OPENWRT_DEVICE} source /etc/os-release \&\& echo \${OPENWRT_BOARD:-\$LEDE_BOARD})
|
||||
|
||||
FIRMWARE_FILE=bin/${OPENWRT_VERSION}/${TARGET_ARCH}/${OPENWRT_PROFILE}/openwrt-*-squashfs-factory.img
|
||||
FIRMWARE_FILENAME=${FIRMWARE_FILENAME:-openwrt-*-sysupgrade.img*}
|
||||
FIRMWARE_FILE=bin/${OPENWRT_VERSION}/${TARGET_ARCH}/${OPENWRT_PROFILE}/${FIRMWARE_FILENAME}
|
||||
FIRMWARE_FILE=${CUSTOM_FIRMWARE_FILE:-$FIRMWARE_FILE}
|
||||
|
||||
NOW=$(date +%Y-%m-%d)
|
||||
BACKUP_FILENAME="backup_${OPENWRT_DEVICE}_${NOW}.tar.gz"
|
||||
|
||||
ssh root@${OPENWRT_DEVICE} \
|
||||
rm -f "/tmp/${BACKUP_FILENAME}" \
|
||||
\&\& sysupgrade -b "/tmp/${BACKUP_FILENAME}"
|
||||
|
||||
mkdir -p tmp/backups
|
||||
|
||||
scp "root@${OPENWRT_DEVICE}:/tmp/${BACKUP_FILENAME}" ./tmp/backups/
|
||||
|
||||
ssh root@${OPENWRT_DEVICE} \
|
||||
mkdir -p /tmp/firmwares \
|
||||
\&\& rm /tmp/firmwares/* \|\| exit 0;
|
||||
|
||||
scp $FIRMWARE_FILE root@${OPENWRT_DEVICE}:/tmp/firmwares/
|
||||
|
||||
ssh root@${OPENWRT_DEVICE} sysupgrade --force -p -v -n "/tmp/firmwares/$(basename $FIRMWARE_FILE)"
|
||||
ssh root@${OPENWRT_DEVICE} sysupgrade --force -v -u "/tmp/firmwares/$(basename $FIRMWARE_FILE)"
|
@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o pipefail
|
||||
|
||||
NOW=$(date +%Y-%m-%d)
|
||||
BACKUP_DATE=${BACKUP_DATE:-${NOW}}
|
||||
BACKUP_FILENAME="backup_${OPENWRT_DEVICE}_${NOW}.tar.gz"
|
||||
|
||||
printf "%s" "Waiting for ${OPENWRT_DEVICE} ..."
|
||||
while ! ping -c 1 -n -w 1 ${OPENWRT_DEVICE} &> /dev/null
|
||||
do
|
||||
printf "%c" "."
|
||||
done
|
||||
printf "\n%s\n" "Server is back online"
|
||||
|
||||
scp "./tmp/backups/${BACKUP_FILENAME}" root@${OPENWRT_DEVICE}:/tmp/
|
||||
|
||||
ssh root@${OPENWRT_DEVICE} sysupgrade -r "/tmp/${BACKUP_FILENAME}"
|
21
misc/turris/omnia/uci-defaults/99-resize-disk.sh
Normal file
21
misc/turris/omnia/uci-defaults/99-resize-disk.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
block info
|
||||
|
||||
DISK=/dev/mmcblk0
|
||||
PARTITION="${DISK}p2"
|
||||
|
||||
parted -s -a opt "$DISK" "resizepart 2 100%"
|
||||
|
||||
FS_SIZE="$(unsquashfs -s "$PARTITION" | grep -o 'Filesystem size [0-9]* bytes' | grep -o '[0-9][0-9]*')"
|
||||
FS_OFFSET="$(expr '(' "$FS_SIZE" + 65535 ')' / 65536 '*' 65536)"
|
||||
LOOP_DEVICE="$(losetup -f --show -o "$FS_OFFSET" "$PARTITION")"
|
||||
|
||||
e2fsck -y -f "$LOOP_DEVICE"
|
||||
resize2fs "$LOOP_DEVICE"
|
||||
|
||||
rm -f /etc/uci-defaults/99-resize-disk.sh
|
||||
|
||||
reboot
|
23
misc/x86/uci-defaults/99-machine-id.sh
Executable file
23
misc/x86/uci-defaults/99-machine-id.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
main() {
|
||||
local machine_id_file="/etc/machine-id"
|
||||
|
||||
if [ -f "$machine_id_file" ]; then
|
||||
echo "Machine ID already generated. Doing nothing."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Accumulate data to create unique machine id
|
||||
local random_uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
|
||||
# Ensure destination directory
|
||||
mkdir -p "$(dirname "$machine_id_file")"
|
||||
|
||||
# Generate SHA256 hash of data and save it to $machine_id_file
|
||||
echo "$random_uuid" | sha256sum | cut -d ' ' -f1 > "$machine_id_file"
|
||||
}
|
||||
|
||||
main
|
9
misc/x86/uci/network
Normal file
9
misc/x86/uci/network
Normal file
@ -0,0 +1,9 @@
|
||||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'wan'
|
||||
option ifname 'eth0'
|
||||
option proto 'dhcp'
|
@ -1,3 +1,8 @@
|
||||
luci
|
||||
openssh-server
|
||||
openssh-sftp-server
|
||||
openssh-sftp-server
|
||||
parted
|
||||
lsblk
|
||||
e2fsprogs
|
||||
block-mount
|
||||
kmod-fs-ext4
|
10
targets/bananapi.mk
Normal file
10
targets/bananapi.mk
Normal file
@ -0,0 +1,10 @@
|
||||
all: bpi-r3
|
||||
|
||||
bpi-r3:
|
||||
$(MAKE) \
|
||||
ADDITIONAL_INSTALL="install-bpi-r3-network-config" \
|
||||
ADDITIONAL_OPENWRT_PACKAGES="block-mount kmod-fs-ext4 kmod-usb-storage kmod-usb2" \
|
||||
OPENWRT_TARGET="mediatek/filogic" \
|
||||
EMISSARY_ARCH="arm64" \
|
||||
OPENWRT_PROFILE="bananapi_bpi-r3" \
|
||||
build
|
@ -1,18 +1,22 @@
|
||||
all: x86_generic
|
||||
all: x86-generic
|
||||
|
||||
x86_generic:
|
||||
$(MAKE) OPENWRT_TARGET="x86/generic" EMISSARY_ARCH="386" OPENWRT_PROFILE="generic" build
|
||||
x86-generic:
|
||||
$(MAKE) \
|
||||
ADDITIONAL_INSTALL="install-x86-network-config" \
|
||||
ADDITIONAL_OPENWRT_PACKAGES="dmidecode" \
|
||||
OPENWRT_TARGET="x86/generic" \
|
||||
EMISSARY_ARCH="386" \
|
||||
OPENWRT_PROFILE="generic" \
|
||||
build
|
||||
|
||||
run_x86_generic: bin/$(OPENWRT_VERSION)/x86/generic/generic/openwrt-$(OPENWRT_VERSION)-emissary-*-ext4-combined.img
|
||||
run-x86-generic: bin/$(OPENWRT_VERSION)/x86/generic/generic/openwrt-$(OPENWRT_VERSION)-emissary-*-ext4-combined.img
|
||||
qemu-system-x86_64 \
|
||||
-enable-kvm \
|
||||
-nographic \
|
||||
-drive file=$(shell ls bin/$(OPENWRT_VERSION)/x86/generic/generic/openwrt-$(OPENWRT_VERSION)-emissary-*-ext4-combined.img),id=d0,if=none \
|
||||
-device ide-hd,drive=d0,bus=ide.0 \
|
||||
-netdev bridge,br=virbr0,id=hn0 \
|
||||
-device e1000,netdev=hn0,id=nic1 \
|
||||
-netdev user,id=hn1 \
|
||||
-device e1000,netdev=hn1,id=nic2
|
||||
-device e1000,netdev=hn1,id=nic1
|
||||
|
||||
bin/$(OPENWRT_VERSION)/x86/generic/generic/openwrt-$(OPENWRT_VERSION)-emissary-*-ext4-combined.img:
|
||||
gunzip bin/$(OPENWRT_VERSION)/x86/generic/generic/openwrt-$(OPENWRT_VERSION)-emissary-*-ext4-combined.img.gz || exit 0
|
||||
gunzip bin/$(OPENWRT_VERSION)/x86/generic/generic/openwrt-$(OPENWRT_VERSION)-emissary-*-ext4-combined.img.gz
|
24
targets/linksys-wrt.mk
Normal file
24
targets/linksys-wrt.mk
Normal file
@ -0,0 +1,24 @@
|
||||
all: linksys-wrtXXXXac
|
||||
|
||||
linksys-wrtXXXXac: linksys-wrt1200ac linksys-wrt1900ac linksys-wrt3200acm
|
||||
|
||||
linksys-wrt1200ac:
|
||||
$(MAKE) \
|
||||
OPENWRT_TARGET="mvebu/cortexa9" \
|
||||
EMISSARY_ARCH="armv6" \
|
||||
OPENWRT_PROFILE="linksys_wrt1200ac" \
|
||||
build
|
||||
|
||||
linksys-wrt1900ac:
|
||||
$(MAKE) \
|
||||
OPENWRT_TARGET="mvebu/cortexa9" \
|
||||
EMISSARY_ARCH="armv7" \
|
||||
OPENWRT_PROFILE="linksys_wrt1900ac-v2" \
|
||||
build
|
||||
|
||||
linksys-wrt3200acm:
|
||||
$(MAKE) \
|
||||
OPENWRT_TARGET="mvebu/cortexa9" \
|
||||
EMISSARY_ARCH="armv7" \
|
||||
OPENWRT_PROFILE="linksys_wrt3200acm" \
|
||||
build
|
@ -1,12 +0,0 @@
|
||||
all: linksys-wrtXXXXac
|
||||
|
||||
linksys-wrtXXXXac: linksys-wrt1200ac linksys-wrt1900ac linksys-wrt3200acm
|
||||
|
||||
linksys-wrt1200ac:
|
||||
$(MAKE) OPENWRT_TARGET="mvebu/cortexa9" EMISSARY_ARCH="armv6" OPENWRT_PROFILE="linksys_wrt1200ac" build
|
||||
|
||||
linksys-wrt1900ac:
|
||||
$(MAKE) OPENWRT_TARGET="mvebu/cortexa9" EMISSARY_ARCH="armv6" OPENWRT_PROFILE="linksys_wrt1900ac-v2" build
|
||||
|
||||
linksys-wrt3200acm:
|
||||
$(MAKE) OPENWRT_TARGET="mvebu/cortexa9" EMISSARY_ARCH="armv6" OPENWRT_PROFILE="linksys_wrt3200acm" build
|
17
targets/raspberrypi.mk
Normal file
17
targets/raspberrypi.mk
Normal file
@ -0,0 +1,17 @@
|
||||
all: rpi-4 rpi-3
|
||||
|
||||
rpi-4:
|
||||
$(MAKE) \
|
||||
ADDITIONAL_INSTALL="install-rpi-network-config" \
|
||||
OPENWRT_TARGET="bcm27xx/bcm2711" \
|
||||
EMISSARY_ARCH="arm64" \
|
||||
OPENWRT_PROFILE="rpi-4" \
|
||||
build
|
||||
|
||||
rpi-3:
|
||||
$(MAKE) \
|
||||
ADDITIONAL_INSTALL="install-rpi-network-config" \
|
||||
OPENWRT_TARGET="bcm27xx/bcm2710" \
|
||||
EMISSARY_ARCH="arm64" \
|
||||
OPENWRT_PROFILE="rpi-3" \
|
||||
build
|
12
targets/turris.mk
Normal file
12
targets/turris.mk
Normal file
@ -0,0 +1,12 @@
|
||||
all: turris
|
||||
|
||||
turris: omnia
|
||||
|
||||
omnia:
|
||||
$(MAKE) \
|
||||
ADDITIONAL_INSTALL="install-turris-omnia-uci-defaults" \
|
||||
ADDITIONAL_OPENWRT_PACKAGES="losetup squashfs-tools-unsquashfs resize2fs e2fsprogs parted block-mount" \
|
||||
OPENWRT_TARGET="mvebu/cortexa9" \
|
||||
EMISSARY_ARCH="armv7" \
|
||||
OPENWRT_PROFILE="cznic_turris-omnia" \
|
||||
build
|
Loading…
x
Reference in New Issue
Block a user