Compare commits
1 Commits
v2023.08.2
...
v2023.04.1
Author | SHA1 | Date | |
---|---|---|---|
f5f12194e1 |
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@ -23,7 +23,6 @@ pipeline {
|
|||||||
|
|
||||||
stage('Update emissary release') {
|
stage('Update emissary release') {
|
||||||
when {
|
when {
|
||||||
branch 'master'
|
|
||||||
expression {
|
expression {
|
||||||
return params.emissaryRelease != 'latest'
|
return params.emissaryRelease != 'latest'
|
||||||
}
|
}
|
||||||
@ -61,7 +60,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build') {
|
stage('Build and release') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
@ -81,9 +80,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('Release') {
|
stage('Release') {
|
||||||
when {
|
|
||||||
branch 'master'
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
usernamePassword([
|
usernamePassword([
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
# Documentation
|
# 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
|
## Tutoriels
|
||||||
|
|
||||||
- [Premiers pas](./tutorials/first-steps.md)
|
- [Premiers pas](./tutorials/first-steps.md)
|
||||||
|
@ -1,85 +1,16 @@
|
|||||||
# Compiler un firmware
|
# Compiler un firmware
|
||||||
|
|
||||||
## Compiler un firmware préconfiguré
|
> TODO
|
||||||
|
|
||||||
L'ensemble des cibles de construction préconfigurés sont disponibles dans le répertoire `targets/`.
|
|
||||||
|
|
||||||
Par exemple:
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Télécharger localement les dernières archive du projet emissary
|
# Exemple: construire un firmware OpenWRT
|
||||||
make download-emissary-release
|
|
||||||
|
|
||||||
# Puis...
|
# Pour le routeur Linksys WRT1200AC
|
||||||
|
|
||||||
# ... pour le routeur Linksys WRT1200AC
|
|
||||||
make linksys-wrt1200ac
|
make linksys-wrt1200ac
|
||||||
|
|
||||||
# ... ou pour le routeur Linksys WRT1900AC
|
# Pour le routeur Linksys WRT1900AC
|
||||||
make linksys-wrt1900ac
|
make linksys-wrt1900ac
|
||||||
|
|
||||||
# ... ou pour le routeur Linksys WRT3200ACM
|
# Pourt le router Linksys WRT3200ACM
|
||||||
make 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. Lancer la compilation du firmware
|
|
||||||
|
|
||||||
```shell
|
|
||||||
make bpi-r3
|
|
||||||
```
|
|
||||||
|
|
||||||
Les fichiers du firmware seront générés dans le répertoire `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).
|
|
@ -1 +1 @@
|
|||||||
v2023.8.25-c51ac0a
|
v2023.4.14-813f837
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
install-rpi-network-config:
|
|
||||||
mkdir -p files/etc/config
|
|
||||||
cp misc/rpi/uci/network files/etc/config/network
|
|
||||||
|
|
||||||
install-rpi-uci-defaults:
|
|
||||||
mkdir -p files/etc/uci-defaults
|
|
||||||
cp misc/rpi/uci-defaults/* files/etc/uci-defaults/
|
|
@ -1,37 +0,0 @@
|
|||||||
#/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
|
|
@ -1,9 +0,0 @@
|
|||||||
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,37 +0,0 @@
|
|||||||
#/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
|
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
block info
|
FLAG_FILE=/root/.disk_resized
|
||||||
|
|
||||||
|
if [ -f "$FLAG_FILE" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
DISK=/dev/mmcblk0
|
DISK=/dev/mmcblk0
|
||||||
PARTITION="${DISK}p2"
|
PARTITION="${DISK}p2"
|
||||||
@ -16,6 +20,6 @@ LOOP_DEVICE="$(losetup -f --show -o "$FS_OFFSET" "$PARTITION")"
|
|||||||
e2fsck -y -f "$LOOP_DEVICE"
|
e2fsck -y -f "$LOOP_DEVICE"
|
||||||
resize2fs "$LOOP_DEVICE"
|
resize2fs "$LOOP_DEVICE"
|
||||||
|
|
||||||
rm -f /etc/uci-defaults/99-resize-disk.sh
|
touch "$FLAG_FILE"
|
||||||
|
|
||||||
reboot
|
# reboot
|
@ -2,7 +2,7 @@ all: rpi-4 rpi-3
|
|||||||
|
|
||||||
rpi-4:
|
rpi-4:
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
ADDITIONAL_INSTALL="install-rpi-network-config install-rpi-uci-defaults" \
|
ADDITIONAL_INSTALL="" \
|
||||||
OPENWRT_TARGET="bcm27xx/bcm2711" \
|
OPENWRT_TARGET="bcm27xx/bcm2711" \
|
||||||
EMISSARY_ARCH="arm64" \
|
EMISSARY_ARCH="arm64" \
|
||||||
OPENWRT_PROFILE="rpi-4" \
|
OPENWRT_PROFILE="rpi-4" \
|
||||||
@ -10,7 +10,7 @@ rpi-4:
|
|||||||
|
|
||||||
rpi-3:
|
rpi-3:
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
ADDITIONAL_INSTALL="install-rpi-network-config install-rpi-uci-defaults" \
|
ADDITIONAL_INSTALL="" \
|
||||||
OPENWRT_TARGET="bcm27xx/bcm2710" \
|
OPENWRT_TARGET="bcm27xx/bcm2710" \
|
||||||
EMISSARY_ARCH="arm64" \
|
EMISSARY_ARCH="arm64" \
|
||||||
OPENWRT_PROFILE="rpi-3" \
|
OPENWRT_PROFILE="rpi-3" \
|
@ -5,7 +5,7 @@ turris: omnia
|
|||||||
omnia:
|
omnia:
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
ADDITIONAL_INSTALL="install-turris-omnia-uci-defaults" \
|
ADDITIONAL_INSTALL="install-turris-omnia-uci-defaults" \
|
||||||
ADDITIONAL_OPENWRT_PACKAGES="losetup squashfs-tools-unsquashfs resize2fs e2fsprogs parted block-mount" \
|
ADDITIONAL_OPENWRT_PACKAGES="losetup squashfs-tools-unsquashfs resize2fs e2fsprogs parted" \
|
||||||
OPENWRT_TARGET="mvebu/cortexa9" \
|
OPENWRT_TARGET="mvebu/cortexa9" \
|
||||||
EMISSARY_ARCH="armv7" \
|
EMISSARY_ARCH="armv7" \
|
||||||
OPENWRT_PROFILE="cznic_turris-omnia" \
|
OPENWRT_PROFILE="cznic_turris-omnia" \
|
||||||
|
Reference in New Issue
Block a user