Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW] - openwrt/opkg version bump and ath79 arch rename #814

Merged
merged 13 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/openwrt-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
target: ["ar71xx", "mt7622"]
target: ["ath79", "mt7622"]
container:
# Ubuntu 20.04
image: sarcasticadmin/openwrt-build@sha256:3fab43fea9e698bade514af0b84192ec447708c8f24d7c5a5e383464e9c44922
# Since user is openwrt and gets 1001 from inside container
options: --user 1001
# Ubuntu 24.04
image: sarcasticadmin/openwrt-build@sha256:25ac9d0dd4eeaad1aaaa7c82c09e9ecc103c69224fc55eb9717c4cfb018a5281
# Since user is ubuntu and gets 1000 from inside container
options: --user 1000
steps:
- uses: actions/checkout@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions nix/checks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ genAttrs

buildPhase = ''
cd tests/unit/openwrt
mkdir -p $out/tmp/ar71xx
mkdir -p $out/tmp/ath79
'';

installPhase = ''
./test.sh -t ar71xx -o $out
./test.sh -t ath79 -o $out
'';
});

Expand Down
14 changes: 6 additions & 8 deletions openwrt/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM hairyhenderson/gomplate:v3.2.0-slim AS gomplate
FROM ubuntu:20.04 as build
FROM ubuntu:24.04 AS build


ENV TZ=ETC/UTC
Expand All @@ -8,15 +8,13 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update &&\
apt-get install -y sudo time git-core subversion build-essential gcc-multilib \
libncurses5-dev zlib1g-dev gawk flex gettext wget unzip \
curl rsync python3 python3-distutils \
libncurses5-dev \
zlib1g-dev gawk flex gettext wget unzip \
curl rsync python3 file swig zstd \
python3-setuptools python3-dev pkg-config &&\
apt-get clean

COPY --from=gomplate /gomplate /bin/gomplate

RUN useradd -m openwrt &&\
echo 'openwrt ALL=NOPASSWD: ALL' > /etc/sudoers.d/openwrt

USER openwrt
WORKDIR /home/openwrt
USER ubuntu
WORKDIR /home/ubuntu
8 changes: 4 additions & 4 deletions openwrt/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Builds Openwrt images for ar71xx & ipq806x targets used at Scale
# Builds Openwrt images for targets used at Scale
# Assumes all dependency tools are already installed
#

Expand All @@ -11,7 +11,7 @@ include include/*.mk
SHELL = /usr/bin/env bash

# WNDR by default
TARGET ?= ar71xx
TARGET ?= ath79

BUILD_DIR ?= build
# Set to configure -j (defaults to nproc)
Expand All @@ -24,10 +24,10 @@ KEYPATH ?= ../facts/keys/
GOMPLATE := $(shell command -v gomplate 2> /dev/null)
CURL := $(shell command -v curl 2> /dev/null)

OPENWRT_VER ?= 9062e5faaedc03823ee419fe34de1de73f48babc
OPENWRT_VER ?= c8ea1aa970bf5a0275e3b0b7da777e804821ddcd
# If bumping opkg it needs to be a commit that exists in the fork
# https://github.com/sarcasticadmin/opkgs
OPENWRT_PKG_VERSION ?= b18cf76d0f31fa12877f7b8e83596d27d89f0020
OPENWRT_PKG_VERSION ?= 38e0f8c7d5c2f69f1603abb99e0fd3886c05f687

SHORT_VER = $(shell echo $(OPENWRT_VER) | cut -c 1-7)
IMAGEBUILDER = source-$(TARGET)-$(SHORT_VER)
Expand Down
3 changes: 1 addition & 2 deletions openwrt/configs/ar71xx-generic.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# CONFIG_PACKAGE_ucode-mod-uci is not set
CONFIG_PACKAGE_libatomic=y
CONFIG_PACKAGE_libpthread=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libuuid=y
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_netgear_wndr3700-v2=y
Expand Down
9 changes: 9 additions & 0 deletions openwrt/configs/ath79-generic.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CONFIG_PACKAGE_libpthread=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libuuid=y
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_netgear_wndr3700-v2=y
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_netgear_wndr3800=y
CONFIG_TARGET_DEVICE_ath79_generic_DEVICE_netgear_wndr3800ch=y
CONFIG_TARGET_MULTI_PROFILE=y
CONFIG_TARGET_ath79=y
CONFIG_TARGET_ath79_generic=y
13 changes: 8 additions & 5 deletions openwrt/configs/common.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CONFIG_LLDPD_WITH_FDP=y
CONFIG_LLDPD_WITH_LLDPMED=y
CONFIG_LLDPD_WITH_PRIVSEP=y
CONFIG_LLDPD_WITH_SONMP=y
CONFIG_LOGROTATE_ACL=y
# CONFIG_LUA_ECO_MBEDTLS is not set
CONFIG_LUA_ECO_OPENSSL=y
CONFIG_OPENSSH_LIBFIDO2=y
Expand All @@ -33,7 +34,7 @@ CONFIG_OPENSSL_WITH_SRP=y
CONFIG_OPENSSL_WITH_SSE2=y
CONFIG_OPENSSL_WITH_TLS13=y
CONFIG_OPENSSL_WITH_WHIRLPOOL=y
CONFIG_PACKAGE_apinger=y
CONFIG_PACKAGE_apinger-upstream=y
CONFIG_PACKAGE_bash=y
# CONFIG_PACKAGE_dnsmasq is not set
# CONFIG_PACKAGE_dropbear is not set
Expand All @@ -42,6 +43,9 @@ CONFIG_PACKAGE_iperf3=y
# CONFIG_PACKAGE_jansson is not set
CONFIG_PACKAGE_jq=y
# CONFIG_PACKAGE_kmod-nft-fib is not set
CONFIG_PACKAGE_libacl=y
CONFIG_PACKAGE_libatomic=y
CONFIG_PACKAGE_libattr=y
CONFIG_PACKAGE_libcap=y
CONFIG_PACKAGE_libcbor=y
CONFIG_PACKAGE_libestr=y
Expand All @@ -62,11 +66,10 @@ CONFIG_PACKAGE_libpcap=y
CONFIG_PACKAGE_libpopt=y
CONFIG_PACKAGE_libreadline=y
CONFIG_PACKAGE_libubus-lua=y
# CONFIG_PACKAGE_libucode is not set
CONFIG_PACKAGE_libudev-zero=y
CONFIG_PACKAGE_lldpd=y
CONFIG_PACKAGE_logger=y
# CONFIG_PACKAGE_logd is not set
CONFIG_PACKAGE_logger=y
CONFIG_PACKAGE_logrotate=y
CONFIG_PACKAGE_lua=y
CONFIG_PACKAGE_luasocket=y
Expand All @@ -83,7 +86,7 @@ CONFIG_PACKAGE_prometheus-node-exporter-lua-wifi_stations=y
CONFIG_PACKAGE_rsyslog=y
CONFIG_PACKAGE_tcpdump=y
CONFIG_PACKAGE_terminfo=y
# CONFIG_PACKAGE_ucode is not set
# CONFIG_PACKAGE_ucode-mod-ubus is not set
# CONFIG_PACKAGE_ucode-mod-uci is not set
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_uhttpd-mod-lua=y
CONFIG_PACKAGE_zlib=y
2 changes: 1 addition & 1 deletion openwrt/configs/mt7622-generic.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CONFIG_PACKAGE_ucode-mod-uci is not set
CONFIG_PACKAGE_libpthread=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libuuid=y
CONFIG_TARGET_mediatek=y
Expand Down
16 changes: 8 additions & 8 deletions openwrt/docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for all members of the tech team.
To start building:

```
# Make sure to mount the git root inside this container
# Make sure to mount the git rev-parse --show-toplevel) inside this container
docker run -v $(git rev-parse --show-toplevel):/home/openwrt/scale-network --rm -it sarcasticadmin/openwrt-build@sha256:3fab43fea9e698bade514af0b84192ec447708c8f24d7c5a5e383464e9c44922 /bin/bash
cd /home/openwrt/scale-network
```
Expand Down Expand Up @@ -255,7 +255,7 @@ rm -f *.config
If you already have a true common config (meaning no specific arch or arch packages inside) you can copy it in:

```
cp $(git root)/openwrt/configs/common.config ./.config
cp $(git rev-parse --show-toplevel)/openwrt/configs/common.config ./.config
```

Or create a new one:
Expand All @@ -270,29 +270,29 @@ Install only packages which are utilities and non arch specific things. We dont
the `common.config`

```
./scripts/diffconfig.sh | tee .diffconfig | grep -v CONFIG_TARGET > $(git root)/openwrt/configs/common.config
./scripts/diffconfig.sh | tee .diffconfig | grep -v CONFIG_TARGET > $(git rev-parse --show-toplevel)/openwrt/configs/common.config
```

```
comm -23 <(sort ./.diffconfig) <(sort $(git root)/openwrt/configs/common.config) > $(git root)/openwrt/configs/x86-generic.config
comm -23 <(sort ./.diffconfig) <(sort $(git rev-parse --show-toplevel)/openwrt/configs/common.config) > $(git rev-parse --show-toplevel)/openwrt/configs/x86-generic.config
```

Now we have the `common.config` and `x86-generic.config`. To add in a specific board:

```
cd <build source>
cat $(git root)/openwrt/configs/common.config > ./.config
cat $(git root)/openwrt/configs/x86_generic.config >> ./.config
cat $(git rev-parse --show-toplevel)/openwrt/configs/common.config > ./.config
cat $(git rev-parse --show-toplevel)/openwrt/configs/x86_generic.config >> ./.config
```

Run `make menuconfig` and change the arch from x86 to target arch:

```
./scripts/diffconfig.sh | tee .diffconfig | grep -v CONFIG_TARGET > $(git root)/openwrt/configs/common.config
./scripts/diffconfig.sh | tee .diffconfig | grep -v CONFIG_TARGET > $(git rev-parse --show-toplevel)/openwrt/configs/common.config
```

```
comm -23 <(sort ./.diffconfig) <(sort $(git root)/openwrt/configs/common.config) > $(git root)/openwrt/configs/mt7622-generic.config
comm -23 <(sort ./.diffconfig) <(sort $(git rev-parse --show-toplevel)/openwrt/configs/common.config) > $(git rev-parse --show-toplevel)/openwrt/configs/mt7622-generic.config
```

> Assuming mt7622 is our target arch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ config interface 'loopback'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

{{ if (eq (env.Getenv "TARGET") "ar71xx") }}
config globals 'globals'
option ula_prefix 'fdfa:7251:0374::/48'
{{ else }}
config globals 'globals'
option ula_prefix 'fd38:15c5:20b8::/48'
{{ end }}

{{ range (datasource "openwrt").wired.switches }}
config switch
Expand All @@ -35,7 +30,6 @@ config interface '{{.name}}'
{{ end -}}
{{ end }}

{{ if (eq (env.Getenv "TARGET") "ar71xx") }}
config switch_port
option device 'rtl8366s'
option port '1'
Expand All @@ -50,4 +44,3 @@ config switch_port
option device 'rtl8366s'
option port '5'
option led '2'
{{ end }}
2 changes: 1 addition & 1 deletion openwrt/files/etc/config/system
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ config timeserver 'ntp'
option enable_server '0'
list server '{{ (datasource "openwrt").ntp.server }}'

{{ if (eq (env.Getenv "TARGET") "ar71xx") }}
{{ if (eq (env.Getenv "TARGET") "ath79") }}
config led 'led_wan'
option name 'WAN LED (green)'
option sysfs 'netgear:green:wan'
Expand Down
4 changes: 2 additions & 2 deletions openwrt/include/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ REPO_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)

golden-test:
@cd $(REPO_ROOT)/tests/unit/openwrt && \
sh test.sh -t ar71xx
sh test.sh -t ath79

golden-update:
@cd $(REPO_ROOT)/tests/unit/openwrt && \
sh test.sh -u -t ar71xx
sh test.sh -u -t ath79

autoflash-test:
curl --request POST \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ config lldpd config
# Set class of device
option lldp_class 4
# if empty, the distribution description is sent
option lldp_description "ar71xx SCaLE OpenWrt"
option lldp_description "ath79 SCaLE OpenWrt"
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ config interface 'loopback'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'


config globals 'globals'
option ula_prefix 'fdfa:7251:0374::/48'



config switch
option blinkrate '2'
option enable_vlan '1'
Expand Down Expand Up @@ -124,7 +122,6 @@ config interface 'backdoor'
option proto 'static'



config switch_port
option device 'rtl8366s'
option port '1'
Expand All @@ -139,4 +136,3 @@ config switch_port
option device 'rtl8366s'
option port '5'
option led '2'

2 changes: 1 addition & 1 deletion tests/unit/openwrt/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ do
done
shift $((OPTIND -1))

TARGET=${TARGET:-'ar71xx'}
TARGET=${TARGET:-'ath79'}
UPDATE=${UPDATE:-0}

TMPLOC="${OUTPUT:-.}/tmp/${TARGET}"
Expand Down
Loading